function bigimage(image,title,wid,hgt)
{
	sw=(screen.width-wid)/2;
	sh=(screen.height-hgt)/2;
	newwin=window.open('','newwin','width='+wid+',height='+hgt+',scrollbars=0,menubars=0,toolbars=0,statusbar=false,loca tion=0,directories=0,status=0,top='+sh+',left='+sw+'');
	newwin.document.open();
	newwin.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n');
	newwin.document.write('"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
	newwin.document.write('\n<html>\n<head>\n<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />\n');
	newwin.document.write('<meta http-equiv="Imagetoolbar" content="no" />\n');
	newwin.document.write('<title>'+title+'</title>\n');
	newwin.document.write('</head>');
	newwin.document.write('<body style="margin:0;padding:0">\n<img src="'+image+'" width="'+wid+'" height="'+hgt+'" />');
	newwin.document.write('\n</body></html>');
	newwin.document.close();
	newwin.focus();
}

function changeCh(x) 
{
	document.getElementById("ch"+x+"_1").src="innerData/images/subMenuLTo.gif";
	document.getElementById("ch"+x+"_2").src="innerData/images/subMenuRTo.gif";
	document.getElementById("ch"+x+"_3").src="innerData/images/subMenuLBo.gif";
	document.getElementById("ch"+x+"_4").src="innerData/images/subMenuRBo.gif";
	document.getElementById("ch"+x).className="subMenuDivOver";
}

function changeBackCh(y) 
{
	document.getElementById("ch"+y+"_1").src="innerData/images/subMenuLT.gif";
	document.getElementById("ch"+y+"_2").src="innerData/images/subMenuRT.gif";
	document.getElementById("ch"+y+"_3").src="innerData/images/subMenuLB.gif";
	document.getElementById("ch"+y+"_4").src="innerData/images/subMenuRB.gif";
	document.getElementById("ch"+y).className="subMenuDiv";
}

function activateSearchButtonOnEnter()
{
	var key = event.keyCode;
	if(key == 13)
	{
		window.location='hsearch_' + document.getElementById('searchInput').value+ '.html';
	}
}

function activateSearchButtonOnEnter_English()
{
	var key = event.keyCode;
	if(key == 13)
	{
		window.location='search_' + document.getElementById('searchInput').value+ '.html';
	}
}

function activateSearchButtonOnEnter_Spanish()
{
	var key = event.keyCode;
	if(key == 13)
	{
		window.location='search_' + document.getElementById('searchInput').value+ '.html';
	}
}



/* Validation Functions */


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 ValidateAskUsHebForm()
{
	var name=document.askUsForm.name;
	var email=document.askUsForm.email;
	var phone=document.askUsForm.phone;
	var country=document.askUsForm.country;
	var question=document.askUsForm.question;

	if ((name.value==null)||(name.value=="")){
		alert("Please Enter your Name")
		name.focus()
		return false
	}
	if (echeck(email.value)==false){
		email.focus()
		return false
	}
	if ((email.value==null)||(email.value=="")){
		alert("Please Enter your Email")
		email.focus()
		return false
	}
	if ((phone.value==null)||(phone.value=="")){
		alert("Please Enter your Phone")
		phone.focus()
		return false
	}
	if ((country.value==null)||(country.value=="")){
		alert("Please Enter your Country")
		country.focus()
		return false
	}
	if ((question.value==null)||(question.value=="")){
		alert("Please Enter your Question")
		question.focus()
		return false
	}
	document.askUsForm.submit();
}

function ValidateContactUsHebForm()
{
    
    document.ContactUsHebForm.submit();
}

function ValidateGetExamHebForm()
{
    
    document.GetExamHebForm.submit();
}

function ValidateNewsletterHebForm()
{

    document.NewsletterHebForm.submit();
}






/* AskUs Functions */

var flagForMouseOverTheAskUsDiv = false;

function SetFlagForMouseOverTheAskUsDiv()
{
    flagForMouseOverTheAskUsDiv = true;
}

function ClearFlagForMouseOverTheAskUsDiv()
{
    flagForMouseOverTheAskUsDiv = false;
    setTimeout("HideAskUsHiddenFormRunFinction();", 2000);
}

function ShowAskUsHiddenForm()
{
    flagForMouseOverTheAskUsDiv = true;
    var hiddenDiv = document.getElementById('askUsHiddenDiv');
    var askUsImage = document.getElementById('askUsImage');
	var divTop = getPos (askUsImage,"Top");
	var divLeft = getPos (askUsImage,"Left");
    
    hiddenDiv.style.top = divTop - 60;
    hiddenDiv.style.left = divLeft - 220;
    hiddenDiv.style.display='';
}

function HideAskUsHiddenForm()
{
    flagForMouseOverTheAskUsDiv = false;
    setTimeout("HideAskUsHiddenFormRunFinction();", 1000);
}

function HideAskUsHiddenFormRunFinction()
{
    if (flagForMouseOverTheAskUsDiv == false)
    {
        document.getElementById('askUsHiddenDiv').style.display='none';
    }
}

function getPos(el,sProp) {
	var iPos = 0;
	while (el!=null) {
		iPos+=el["offset" + sProp]
		el = el.offsetParent
	}
	return iPos
}

/* End of AskUs Functions*/



function setIframeHeight(height)
{
    alert(height);
    document.getElementById("IFrameWantedExternalSite").style.height = height + 10 + "px";
}

function onLoadIFrameFunction()
{
	var height = document.getElementById("ViewContentTable").offsetHeight;
	parent.setIframeHeight(height);
}

