// JavaScript Document
// Copyright 2006-2007 javascript-array.com

var timeout	= 200;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose;

//div display function start here
function toggleDiv(divid)
{
 
  if(divid == 'eVidya')
  {
  document.getElementById('eVidya').style.display = 'block';
  document.getElementById('eSports').style.display = 'none';
  
  }
  else if(divid == 'eSports')
  {     
  document.getElementById('eVidya').style.display = 'none';
  document.getElementById('eSports').style.display = 'block';
 
  }
  
}
//div display function end here

function HeightOfDiv()
{
var box1 = document.getElementById('left-div');
var box2 = document.getElementById('right-div');
var height = box1.offsetHeight;
if(box1.offsetHeight < box2.offsetHeight) height = box2.offsetHeight;
box1.style.height = box2.style.height = String(height) + 'px';
}


function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1)
		{
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
		{
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
		{
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1)
		 {
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
		 {
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1)
		 {
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1)
		 {
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.contact_form.txtEmail
	
	if ( document.contact_form.FirstName.value == "" )
    {
    	alert ( "Please fill in the 'Name' box." ); 
		document.contact_form.FirstName.focus();
        return false
    }	
	
	if ((emailID.value==null)||(emailID.value==""))
	{
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}	
	if (echeck(emailID.value)==false)
	{
		emailID.value=""
		emailID.focus()
		return false
	}
	
	if ( document.contact_form.Phone.value == "" )
    {
        alert ( "Please fill in the 'Phone' box." );
		document.contact_form.Phone.focus();
        return false
    }
	
	if ( document.contact_form.City.value == "" )
    {
        alert ( "Please fill in the 'City' box." );
		document.contact_form.City.focus();
        return false
    }	
	
	if ( document.contact_form.Nature.value == "" )
    {
        alert ( "Please fill in the 'Nature of Business' box." );
		document.contact_form.Nature.focus();
        return false
    }	
															
	{
		alert("Thank you for your interest in Trizile POS." + '\n' + "A link has been emailed to you. Click on the link to download the 30-day FREE Trizile POS Trial version. Please contact us if you have any questions.")
	}
	return true
	
 }
 
//form field to contain only numeric input function
function numbersonly(e){
var unicode=e.charCode? e.charCode : e.keyCode
if (unicode!=8){ //if the key isn't the backspace key (which we should allow)
if (unicode<48||unicode>57) //if not a number
return false //disable key press
}
}






