function blockError(){return true;}
window.onerror = blockError;

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_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_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];}
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

// JavaScript Document
var fontVariation=2;
var minFontSize=12;
var maxFontSize=16;

function enlargeFont(bigger)
{
	var elements=document.getElementById("Text2Enlarge");
	var tds=elements.getElementsByTagName("TD");
	var newFontSize="";
		newFontSize=elements.style.fontSize;
		if(newFontSize=="")
			newFontSize=minFontSize;
			newFontSize=parseInt(newFontSize);
		if(bigger){
			newFontSize=(newFontSize<maxFontSize)?(newFontSize+fontVariation):(maxFontSize);}
		else
			{newFontSize=(newFontSize>minFontSize)?(newFontSize-fontVariation):(newFontSize);}
		
	elements.style.fontSize=newFontSize+'px';
	
	for(var i=0;i<tds.length; i++){
		tds[i].style.fontSize=newFontSize+'px';
	}
}


function print_function()
{ 
	var disp_setting="toolbar=no,location=no,directories=no,menubar=no,";
		disp_setting+="scrollbars=yes,width=460, height=550, left=150, top=150";
	var content_vlue = document.getElementById("PrintText").innerHTML;

	var docprint=window.open("","",disp_setting);

	docprint.document.open();
	docprint.document.write('<html><head><title> Spinneys</title>');
	docprint.document.write('</head><link href="../css/styles.css" rel="stylesheet" type="text/css"><body onLoad="self.print(); self.close();" style="background:none; padding-left:20px;" >');
	docprint.document.write('<img src="../images/globalLogo.gif"');
	docprint.document.write('<br><br><br><br><div style="color:#626262;font-family:arial;font-size:11px; width:400px;">'+content_vlue+'</div>');
	docprint.document.write('</body></html>');
	docprint.document.close(); 
 	docprint.focus();
}
function print_function_subCountry()
{ 
	var disp_setting="toolbar=no,location=no,directories=no,menubar=no,";
		disp_setting+="scrollbars=yes,width=700, height=550, left=150, top=150";
	var content_vlue = document.getElementById("PrintText").innerHTML;

	var docprint=window.open("","",disp_setting);

	docprint.document.open();
	docprint.document.write('<html><head><title> Spinneys </title>');
	docprint.document.write('</head><link href="../css/styles.css" rel="stylesheet" type="text/css"><body onLoad="self.print(); self.close();" style="background:none; padding-left:20px;" >');
	docprint.document.write('<img src="../images/globalLogo.gif"');
	docprint.document.write('<br><br><br><br><div style="color:#626262;font-family:arial;font-size:11px;">'+content_vlue+'</div>');
	docprint.document.write('</body></html>');
	docprint.document.close(); 
 	docprint.focus();
}

/*------------------------------------------------------------------------------------------*/

//TRIM Functions
function Trim(TRIM_VALUE){
if(TRIM_VALUE.length < 1){
return"";
}
TRIM_VALUE = RTrim(TRIM_VALUE);
TRIM_VALUE = LTrim(TRIM_VALUE);
if(TRIM_VALUE==""){
return "";
}
else{
return TRIM_VALUE;
}
} //End Function

function RTrim(VALUE){
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;

while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;

} //End While
return strTemp;

} //End Function

function LTrim(VALUE){
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function

function ValidateRecruitmentForm() {
	var msg = "";
	var msg1 = "";


	if (document.getElementById('txtFullName').value == "") {
		msg += " - Full Name \n";
	}
	
		if (Trim(document.getElementById('txtEmail').value) == "") {
		msg += " - Email\n";
	} else {
		var strvalmail = IsValidEmail(document.getElementById('txtEmail'));
		if (strvalmail.length>0) {
			msg1 += strvalmail;
		}
	}
	
	if (document.getElementById('txtPhone').value == "") {
		msg += " - Telephone \n";
	}
		if (document.getElementById('txtRegion').value == "") {
		msg += " - Region \n";
	}
		if (document.getElementById('txtSalary').value == "") {
		msg += " - Salary \n";
	}
	if (document.getElementById('FileUpload1').value == "") {
		msg += " - CV Attachment \n";
	}

	if (msg == "") {
		if (msg1 == "") {
			return true;
		} else {
			alert(msg1);
			return false;
		}
	} else {
		alert("Please check the following and submit again:\n"+msg);
		return false;
	}
}
function IsValidEmail(txt){
    var stremail="";
	if(txt.value !=""){ 
		var goodEmail = txt.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (goodEmail){
		    return true;
		} else {
			stremail=" - The Email address is not valid\n";
			return stremail;
		}
	}
}
function ValidateRecruitmentForm2() {
	var msg = "";
	var msg1 = "";


	if (document.getElementById('txtFullName').value == "") {
		msg += " - Full Name \n";
	}
	
		if (Trim(document.getElementById('txtEmail').value) == "") {
		msg += " - Email\n";
	} else {
		var strvalmail = IsValidEmail(document.getElementById('txtEmail'));
		if (strvalmail.length>0) {
			msg1 += strvalmail;
		}
	}

	if (msg == "") {
		if (msg1 == "") {
			return true;
		} else {
			alert(msg1);
			return false;
		}
	} else {
		alert("Please check the following and submit again:\n"+msg);
		return false;
	}
}

function ValidateAddToNewsLetter() {
	var msg = "";
	var msg1 = "";

		if (Trim(document.getElementById('ucHeader1_txtEmail').value) == "Your email here") {
		msg += " - Email\n";
	} else {
		var strvalmail = IsValidEmail(document.getElementById('ucHeader1_txtEmail'));
		if (strvalmail.length>0) {
			msg1 += strvalmail;
		}
	}
	if (msg == "") {
		if (msg1 == "") {
			return true;
		} else {
			alert(msg1);
			return false;
		}
	} else {
		alert("Please check the following and submit again:\n"+msg);
		return false;
	}
}
/**********************************************************************************************/
function OpenEmail(URL){
     OpenWnd('Forward.aspx?URL='+URL, 'Email',500,500, 'no');
}
function OpenCountryEmail(URL){
     OpenWnd('../Global/Forward.aspx?URL='+URL, 'Email', 500,500, 'no');
}
function OpenWnd(mypage, myname, w, h, scroll)

{
      var winl = (screen.width - w) / 2;
      var wint = (screen.height - h) / 2;
      winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=No'
      win = window.open(mypage, myname, winprops)
      if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }

}
function ResetForm(){
form1.reset()
}
/**********************************************************************************************/

/*CurrentPhoto=3;
MaxPhoto=3;*/
TextArray=new Array();
HeadArray=new Array();
LinkArray=new Array();

var news_timeout;
function slideNews(more) {
    NextPhoto(more);
   news_timeout=setTimeout('slideNews(\''+more+'\')',4000);
}
function NextPhoto(more,langs){
	document.getElementById('small'+(CurrentPhoto)).className="careernav";
	if(CurrentPhoto==MaxPhoto)
		CurrentPhoto=1;
	else
		CurrentPhoto++;
	var imgs='';
	document.getElementById('ShowText').innerHTML=TextArray[CurrentPhoto]+" <a href="+LinkArray[CurrentPhoto]+">&raquo; more</a>";
	document.getElementById('Headline').innerHTML=HeadArray[CurrentPhoto];
	document.getElementById('small'+(CurrentPhoto)).className="careernavon";
	opacity('divtrans', 0, 100, 700);
}
function News(id,more){
	 for (i = 0; i < MaxPhoto; i++) {
		document.getElementById('small'+(i+1)).className="careernav";
}

CurrentPhoto=id;
var imgs='';
		document.getElementById('ShowText').innerHTML=TextArray[id]+" <a href="+LinkArray[CurrentPhoto]+">&raquo; more</a>";
		document.getElementById('Headline').innerHTML=HeadArray[id];
		document.getElementById('small'+id).className="careernavon";
		//clearTimeout(news_timeout);news_timeout=setTimeout('slideNews(\''+more+'\')',100000000000000);
		
}

function opacity(id, opacStart, opacEnd, millisec) {
    var speed = Math.round(millisec / 100);
    var timer = 0;
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}
/**********************************************************************************************/
//CurrentPhotoPromo=3;
//MaxPhotoPromo=3;
//TextArrayPromo=new Array();
//HeadArrayPromo=new Array();
//LinkArrayPromo=new Array();

//var Promo_timeout;
//function slidePromo(more){
//	NextPhotoPromo(more);
//	Promo_timeout=setTimeout('slidePromo(\''+more+'\')',4000);
//}
//function NextPhotoPromo(more,langs){
//	document.getElementById('smallPromo'+(CurrentPhotoPromo)).className="careernav";
//	if(CurrentPhotoPromo==MaxPhotoPromo)
//		CurrentPhotoPromo=1;
//	else
//		CurrentPhotoPromo++;
//	var imgs='';
//	document.getElementById('ShowTextPromo').innerHTML=TextArrayPromo[CurrentPhotoPromo]+" <a href="+LinkArrayPromo[CurrentPhotoPromo]+">&raquo; more</a>";
//	document.getElementById('HeadlinePromo').innerHTML=HeadArrayPromo[CurrentPhotoPromo];
//	document.getElementById('smallPromo'+(CurrentPhotoPromo)).className="careernavon";
//	opacity('divtransPromo', 0, 100, 700);
//}
//function Promo(id,more){
//	for(i=1;i<4;i++){
//		document.getElementById('smallPromo'+i).className="careernav";
//}
//CurrentPhotoPromo=id;
//var imgs='';
//		document.getElementById('ShowTextPromo').innerHTML=TextArrayPromo[id]+" <a href="+LinkArrayPromo[CurrentPhotoPromo]+">&raquo; more</a>";
//		document.getElementById('HeadlinePromo').innerHTML=HeadArrayPromo[id];
//		document.getElementById('smallPromo'+id).className="careernavon";
//		clearTimeout(Promo_timeout);Promo_timeout=setTimeout('slidePromo(\''+more+'\')',100000000000000);
//		
//}