
//For mainPage.jhtml
function swp() {
	if(document.images){document.images['indicator'].src = "/common/images/Symbols/toc10on.gif";}
}
function addBookmark(url,pageName) {
	if (window.external) {window.external.AddFavorite(url,pageName)}
	else{alert(noBroswerSupportMsg);}
}
function openWin(url,w,h,center,toolbar,location,status,menuBar,resizable,scrollbars) {
	var args;
	if(center) {
		var xRes = screen.width, yRes = screen.height;
		var xWin = w, yWin = h;
		var xWinPos = Math.floor((xRes/2) - (xWin/2));
		var yWinPos = Math.floor((yRes/2) - (yWin/2));
		args = "screenX=" +xWinPos+ ",screenY=" +yWinPos+ ",top=" +yWinPos+ ",left=" +xWinPos+ ",";
	}
	args = "height=" +h+ ",width=" +w;
	if(location){args+=",location=yes";}
	if(menuBar){args+=",menubar=yes";}
	if(status){args+=",status=yes";}
	if(resizable){args+=",resizable=1";}
	if(scrollbars){args+=",scrollbars=1";}
	popup=window.open(url,"",args);		
}
//End main

//For topFragment.jhtml
function confirmLogout(msg,url) {
	if(window.confirm(msg)) {
		window.location.href = url;
	}
}
function openWebHelp(sURL) {
	var xRes = screen.width, yRes = screen.height;
	var xWin = 630, yWin = 390;
	var xWinPos = Math.floor( (xRes/2) - (xWin/2) );
	var yWinPos = Math.floor( (yRes/2) - (yWin/2) );
	win = window.open(sURL,
			'','screenX=' + xWinPos + ',screenY=' + yWinPos + ',top=' + yWinPos + ',left=' + xWinPos + ',toolbar=no,directories=no,menubar=no,location=no,status=no,scrollbars=0,resizable=0,width=' + xWin + ',height=' + yWin + '');	
}
//End top

//For Escenic pages
function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i< a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//End for Escenic pages

 function submitMailForm(){
			var mandatoryChar="*";
			var formEmail=true;
			var formMandatory=true;
			var errorText="";
			if (document.getElementById("Customername") != null) {
				if (document.mailform.CustomernameText.value.length> 0  && document.mailform.CustomernameText.value.charAt(document.mailform.CustomernameText.value.length-1)==mandatoryChar && document.mailform.Customername.value.length<1){
					document.mailform.Customername.select();
					formMandatory=false;
				}
			}
			if (document.getElementById("Email") != null) {
				if (document.mailform.EmailText.value.length> 0  && document.mailform.EmailText.value.charAt(document.mailform.EmailText.value.length-1)==mandatoryChar && document.mailform.Email.value.length<1){
					document.mailform.Email.select();
					formMandatory=false;
				} else if (document.mailform.Email.value.length >0 && (document.mailform.Email.value.indexOf(" ") >= 0 || document.mailform.Email.value.indexOf("@") < 1 || document.mailform.Email.value.length < 5)) {
					formEmail=false;
					document.mailform.Email.select();
				}
			}
			if (document.getElementById("Company") != null) {
				if (document.mailform.CompanyText.value.length> 0  && document.mailform.CompanyText.value.charAt(document.mailform.CompanyText.value.length-1)==mandatoryChar && document.mailform.Company.value.length<1  ){
				document.mailform.Company.select();
				formMandatory=false;
				}
			}
			if (document.getElementById("Address") != null) {
				if (document.mailform.AddressText.value.length> 0  && document.mailform.AddressText.value.charAt(document.mailform.AddressText.value.length-1)==mandatoryChar && document.mailform.Address.value.length<1  ){
				document.mailform.Address.select();
				formMandatory=false;
				}
			}
			if (document.getElementById("Postcode") != null) {
				if (document.mailform.PostcodeText.value.length> 0  && document.mailform.PostcodeText.value.charAt(document.mailform.PostcodeText.value.length-1)==mandatoryChar && document.mailform.Postcode.value.length<1  ){
				document.mailform.Postcode.select();	
				formMandatory=false;
				}
			}
			if (document.getElementById("City") != null) {
				if (document.mailform.CityText.value.length> 0  && document.mailform.CityText.value.charAt(document.mailform.CityText.value.length-1)==mandatoryChar && document.mailform.City.value.length<1  ){
				document.mailform.City.select();	
				formMandatory=false;
				}
			}
			if (document.getElementById("Telephone") != null) {
				if (document.mailform.TelephoneText.value.length> 0  && document.mailform.TelephoneText.value.charAt(document.mailform.TelephoneText.value.length-1)==mandatoryChar && document.mailform.Telephone.value.length<1  ){
				document.mailform.Telephone.select();	
				formMandatory=false;
				}
			}
			if (document.getElementById("Fax") != null) {
				if (document.mailform.FaxText.value.length> 0  && document.mailform.FaxText.value.charAt(document.mailform.FaxText.value.length-1)==mandatoryChar && document.mailform.Fax.value.length<1  ){
				document.mailform.Fax.select();
				formMandatory=false;
				}
			}
			if (document.getElementById("Field1") != null) {
				if (document.mailform.Field1Text.value.length> 0  && document.mailform.Field1Text.value.charAt(document.mailform.Field1Text.value.length-1)==mandatoryChar && document.mailform.Field1.value.length<1  ){
				document.mailform.Field1.select();
				formMandatory=false;
				}
			}
			if (document.getElementById("Field2") != null) {
				if (document.mailform.Field2Text.value.length> 0  && document.mailform.Field2Text.value.charAt(document.mailform.Field2Text.value.length-1)==mandatoryChar && document.mailform.Field2.value.length<1  ){
				document.mailform.Field2.select();
				formMandatory=false;
				}
			}
			if (document.getElementById("Field3") != null) {
				if (document.mailform.Field3Text.value.length> 0  && document.mailform.Field3Text.value.charAt(document.mailform.Field3Text.value.length-1)==mandatoryChar && document.mailform.Field3.value.length<1  ){
				document.mailform.Field3.select();
				formMandatory=false;
				}
			}
			if (document.getElementById("Field4") != null) {
				if (document.mailform.Field4Text.value.length> 0  && document.mailform.Field4Text.value.charAt(document.mailform.Field4Text.value.length-1)==mandatoryChar && document.mailform.Field4.value.length<1  ){
				document.mailform.Field4.select();
				formMandatory=false;
				}
			}
			if (document.getElementById("Field5") != null) {
				if (document.mailform.Field5Text.value.length> 0  && document.mailform.Field5Text.value.charAt(document.mailform.Field5Text.value.length-1)==mandatoryChar && document.mailform.Field5.value.length<1  ){
				document.mailform.Field5.select();
				formMandatory=false;
				}
			}
			if (document.getElementById("Field6") != null) {
				if (document.mailform.Field6Text.value.length> 0  && document.mailform.Field6Text.value.charAt(document.mailform.Field6Text.value.length-1)==mandatoryChar && document.mailform.Field6.value.length<1  ){
				document.mailform.Field6.select();
				formMandatory=false;
				}
			}
			
			if (formEmail==false) {
				errorText=document.mailform.wrongEmailMessage.value;
			}
			if (formMandatory==false) {
				if(errorText=="") {
					errorText=document.mailform.mandatoryEmailMessage.value;
				}else{
					errorText+="\n" + document.mailform.mandatoryEmailMessage.value;
				}
			}
			if (errorText!=""){
				alert(errorText);
			}else{document.mailform.submit();}
		}
