// JavaScript Document
window.onload=montre;
function montre(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}
//-->



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 Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
		{
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
		{
		    alert("Invalid E-mail Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1)
		 {
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
		 {
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1)
		 {
		    alert("Invalid E-mail Address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1)
		 {
		    alert("Invalid E-mail Address")
		    return false
		 }

 		 return true					
}
	
function ValidateForm()
{
	var firstname=document.contact_form.firstname;
	var email=document.contact_form.email;
	
	if ((firstname.value==null)||(firstname.value==""))
	{
		alert("Please Enter your First Name");
		firstname.focus();
		return false;
	}
	
	if (echeck(email.value)==false)
	{
		email.value="";
		email.focus();
		return false;
	}
	
	if ((email.value==null)||(email.value=="")){
		alert("Please Enter your Email");
		email.focus();
		return false;
	}

	return true;
}








/* PopUp Window */


function newWindowOpen(Url, wWidth, wHeight, isStatus, isToolbar, isMenubar, isLocation, isResizable, isScroll) {
  var wSpec = '';
  var myWidth = getWidth();
  var myHeight = getHeight();

  if (wWidth == 0 && wHeight == 0) {
	  wWidth = myWidth;
	  wHeight = myHeight;
	  wSpec = wSpec + 'left=10, top=10, width=' + wWidth + ', height=' + wHeight + ', ';
  }
  else {
	  wSpec = wSpec + 'width=' + wWidth + ', height=' + wHeight + ', ';
  }
	    

  if (isStatus == true)
   wSpec = wSpec + 'status=yes,';
  else
   wSpec = wSpec + 'status=no,';
  
  if (isToolbar == true)
   wSpec = wSpec + 'toolbar=yes,';
  else
   wSpec = wSpec + 'toolbar=no,';

  if (isMenubar == true)
   wSpec = wSpec + 'menubar=yes,';
  else
   wSpec = wSpec + 'menubar=no,';
	
  if (isLocation == true)
   wSpec = wSpec + 'location=yes,';
  else
   wSpec = wSpec + 'location=no,';

  if (isResizable == true)
   wSpec = wSpec + 'resizable=yes,';
  else
   wSpec = wSpec + 'resizable=no,';

  if (isScroll == true)
   wSpec = wSpec + 'scrollbars=yes,';
  else
   wSpec = wSpec + 'scrollbars=no,';

  var newWindow = window.open(Url,'myWindow',wSpec);
  newWindow.focus();
 }



function getWidth() {

 var myWidth = 0;

  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }

  return(myWidth);
}

function getHeight() {

 var myHeight = 0;

  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }

  return(myHeight);
}