if(parent.frames.length>0){parent.location.href=location.href;}status_waiting=new Image();status_waiting.src="Images/Icons/icon_status_waiting.gif";status_uploading=new Image();status_uploading.src="Images/Icons/icon_status_uploading.gif";var DoShortcut=false;function CheckShortcuts(e){if(window.event){e=window.event.keyCode;}else{e=e.charCode;}if(e==49&& DoShortcut==true){location.href=ajaxPath+"admin";}if(e==50&& DoShortcut==true){location.href=ajaxPath+"candidate";}if(e==51&& DoShortcut==true){location.href=ajaxPath+"recruiter";}if((e==67||e==99)&& DoShortcut==true){location.href=ajaxPath+"admin_clients.aspx";}if((e==74||e==106)&& DoShortcut==true){location.href=ajaxPath+"admin_jobs.aspx";}if((e==65||e==97)&& DoShortcut==true){location.href=ajaxPath+"admin_candidates.aspx";}DoShortcut=false;if(e==96){DoShortcut=true;}}function CreateCookie(name,subkey,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}else{var expires="";}document.cookie=name+"="+ReadCookie(name).replace("&"+subkey+"="+value,"")+"&"+subkey+"="+value+expires+"; path=/";}function ReadCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' '){c=c.substring(1,c.length);}if(c.indexOf(nameEQ)==0){return c.substring(nameEQ.length,c.length);}}return "";}function EraseCookie(name){CreateCookie(name,"",-1);}function ConvertToNumber(num){num=num.toString().replace('k','000');num=num.toString().replace(/\£|\,/g,'');if(isNaN(num)||num.length==0){num=0;}else{num=parseFloat(num);}return num;}function FormatAsCurrency(num){var showPencevar pencenum=ConvertToNumber(num);if(num==0){return "";}if(num<100||(num%1)>0){showPence=true;}else{showPence=false;}num=Math.floor(num*100+0.50000000001);pence=num%100;num=Math.floor(num/ 100).toString();if(pence<10){pence="0"+pence;}for(var i=0;i<Math.floor((num.length-(1+i))/3);i++){num=num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));}if(showPence==true){return(num+'.'+pence);}else{return num;}}function Pad(n,totalDigits){n=n.toString();var pd='';if(totalDigits>n.length){for(i=0;i<(totalDigits-n.length);i++){pd+='0';}}return pd+n.toString();}function IsValidEmail(str){return(str.indexOf(".")>2)&&(str.indexOf("@")>0);}function SendToAFriend(Button){var JobID;var FromEmailAddress;var ToEmailAddress;var Message;JobID=Button.id.substring(Button.id.indexOf("aSend_")+6);FromEmailAddress=document.getElementById("usrJobDetails_txtFromEmailAddress_"+JobID).value;ToEmailAddress=document.getElementById("usrJobDetails_txtToEmailAddress_"+JobID).value;Message=document.getElementById("usrJobDetails_txtMessage_"+JobID).value;if(IsValidEmail(FromEmailAddress)==false){alert("Please enter a valid 'From' Email Address");document.getElementById("usrJobDetails_txtFromEmailAddress_"+JobID).focus();return false;}if(IsValidEmail(ToEmailAddress)==false){alert("Please enter a valid 'To' Email Address");document.getElementById("usrJobDetails_txtToEmailAddress_"+JobID).focus();return false;}if(Message=="Message"){alert("Please enter a Message");document.getElementById("usrJobDetails_txtMessage_"+JobID).focus();return false;}var xmlHttp;try{xmlHttp=new XMLHttpRequest();}catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){alert("Your browser does not support AJAX!");}}}xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){var ReturnValue=xmlHttp.responseText;if(ReturnValue=="True"){alert("The job has been successfully sent to "+ToEmailAddress+".");}else{alert("There was a problem sending the job - please check your email addresses and try again.");}}}xmlHttp.open("GET",ajaxPath+"send_to_a_friend_ajax.aspx?JobID="+JobID+"&FromEmailAddress="+FromEmailAddress+"&ToEmailAddress="+ToEmailAddress+"&Message="+Message,true);xmlHttp.send(null);}function AutoSendSiteToAFriend(){if(ReadCookie("send_site_to_a_friend").indexOf("first_view")>0){if(ReadCookie("send_site_to_a_friend").indexOf("viewed")>0){}else{OpenSendSiteToAFriend('center');}CreateCookie("send_site_to_a_friend","state","viewed",14)}if(ReadCookie("send_site_to_a_friend")==""){CreateCookie("send_site_to_a_friend","state","first_view",14)}}function OpenSendSiteToAFriend(position){CloseFollowOnTwitter();CloseGetWidget();if(emailAddress.length>0){document.getElementById("txtSendSiteToAFriendFromEmailAddress").value=emailAddress;}switch(position){case"center":document.getElementById("tblSendSiteToAFriend").style.left="335px";document.getElementById("tblSendSiteToAFriend").style.top="220px";break;case"header":document.getElementById("tblSendSiteToAFriend").style.left=(parseInt(GetElementX(document.getElementById("imgSendSiteToAFriendHeader")))-99)+"px";document.getElementById("tblSendSiteToAFriend").style.top=(parseInt(GetElementY(document.getElementById("imgSendSiteToAFriendHeader")))+205)+"px";break;case"footer":document.getElementById("tblSendSiteToAFriend").style.left=(parseInt(GetElementX(document.getElementById("imgSendSiteToAFriendFooter")))+96)+"px";document.getElementById("tblSendSiteToAFriend").style.top=(parseInt(GetElementY(document.getElementById("imgSendSiteToAFriendFooter")))-169)+"px";break;}document.getElementById("tblSendSiteToAFriend").style.display="";}function CloseSendSiteToAFriend(){document.getElementById("tblSendSiteToAFriend").style.display="none";CreateCookie("send_site_to_a_friend","state","viewed",14)}function SendSiteToAFriend(){var FromEmailAddress;var ToEmailAddress;var Message;FromEmailAddress=document.getElementById("txtSendSiteToAFriendFromEmailAddress").value;ToEmailAddress=document.getElementById("txtSendSiteToAFriendToEmailAddress").value;Message=document.getElementById("txtSendSiteToAFriendMessage").value;if(IsValidEmail(FromEmailAddress)==false){alert("Please enter a valid 'From' Email Address");document.getElementById("txtSendSiteToAFriendFromEmailAddress").focus();return false;}if(IsValidEmail(ToEmailAddress)==false){alert("Please enter a valid 'To' Email Address");document.getElementById("txtSendSiteToAFriendToEmailAddress").focus();return false;}if(Message=="Message"){alert("Please enter a Message");document.getElementById("txtSendSiteToAFriendMessage").focus();return false;}var xmlHttp;try{xmlHttp=new XMLHttpRequest();}catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){alert("Your browser does not support AJAX!");}}}xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){var ReturnValue=xmlHttp.responseText;if(ReturnValue=="True"){alert("Your message has been successfully sent to "+ToEmailAddress+".");CloseSendSiteToAFriend();}else{alert("There was a problem sending your message - please check your email addresses and try again.");}}}xmlHttp.open("GET",ajaxPath+"send_site_to_a_friend_ajax.aspx?FromEmailAddress="+FromEmailAddress+"&ToEmailAddress="+ToEmailAddress+"&Message="+Message,true);xmlHttp.send(null);}function OpenFollowOnTwitter(){CloseSendSiteToAFriend();CloseGetWidget();document.getElementById("tblFollowOnTwitter").style.left=(parseInt(GetElementX(document.getElementById("imgFollowOnTwitterHeader")))-104)+"px";document.getElementById("tblFollowOnTwitter").style.top=(parseInt(GetElementY(document.getElementById("imgFollowOnTwitterHeader")))+205)+"px";document.getElementById("tblFollowOnTwitter").style.display="";}function CloseFollowOnTwitter(){document.getElementById("tblFollowOnTwitter").style.display="none";}function OpenGetWidget(){}function CloseGetWidget(){}function GetElementX(oElement){var iReturnValue=0;while(oElement!=null){iReturnValue+=oElement.offsetLeft;oElement=oElement.offsetParent;}return iReturnValue;}function GetElementY(oElement){var iReturnValue=0;while(oElement!=null){iReturnValue+=oElement.offsetTop;oElement=oElement.offsetParent;}return iReturnValue;}function SetTipPosition(Tip,OffsetX,OffsetY){document.getElementById("tblTip"+Tip).style.left=(parseInt(GetElementX(document.getElementById("imgTip"+Tip)))+OffsetX)+"px";document.getElementById("tblTip"+Tip).style.top=(parseInt(GetElementY(document.getElementById("imgTip"+Tip)))+OffsetY)+"px";document.getElementById("tblTip"+Tip).style.display="";}function CloseTip(Tip){document.getElementById("tblTip"+Tip).style.display="none";var xmlHttp;try{xmlHttp=new XMLHttpRequest();}catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){alert("Your browser does not support AJAX!");}}}xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){}}xmlHttp.open("GET",ajaxPath+"/close_tip_ajax.aspx?Tip="+Tip,true);xmlHttp.send(null);}function ReformatDate(sender,args){var strDatevar regexvar matchesvar dateToday=new Date();var MonthNames=new Array();MonthNames["jan"]="01";MonthNames["feb"]="02";MonthNames["mar"]="03";MonthNames["apr"]="04";MonthNames["may"]="05";MonthNames["jun"]="06";MonthNames["jul"]="07";MonthNames["aug"]="08";MonthNames["sep"]="09";MonthNames["oct"]="10";MonthNames["nov"]="11";MonthNames["dec"]="12";MonthNames["january"]="01";MonthNames["february"]="02";MonthNames["march"]="03";MonthNames["april"]="04";MonthNames["may"]="05";MonthNames["june"]="06";MonthNames["july"]="07";MonthNames["augu"]="08";MonthNames["september"]="09";MonthNames["october"]="10";MonthNames["november"]="11";MonthNames["december"]="12";args.IsValid=true;strDate=args.Value.toLowerCase();strDate=strDate.replace(/st/g,"");strDate=strDate.replace(/nd/g,"");strDate=strDate.replace(/rd/g,"");strDate=strDate.replace(/th/g,"");regex=/(.*)(\/|-)(.*)(\/|-)(.*)/;matches=strDate.match(regex);if(matches!=null){strDate=Pad(RegExp.$1,2)+"/"+Pad(RegExp.$3,2)+"/"+Pad(RegExp.$5,2);document.getElementById(sender.controltovalidate).value=strDate;return;}regex=/(.*)(\/|-)(.*)/;matches=strDate.match(regex);if(matches!=null){strDate=Pad(RegExp.$1,2)+"/"+Pad(RegExp.$3,2)+"/"+dateToday.getYear();document.getElementById(sender.controltovalidate).value=strDate;return;}regex=/(\d+)( ?,? ?)([a-z]+)( ?,? ?)(\d+)?/i;matches=strDate.match(regex);if(matches!=null){if(RegExp.$5.length==0){strDate=Pad(RegExp.$1,2)+"/"+MonthNames[RegExp.$3]+"/"+dateToday.getYear();}else{strDate=Pad(RegExp.$1,2)+"/"+MonthNames[RegExp.$3]+"/"+Pad(RegExp.$5,2);}document.getElementById(sender.controltovalidate).value=strDate;return;}regex=/([a-z]+)( ?,? ?)(\d+)( ?,? ?)(\d+)?/i;matches=strDate.match(regex);if(matches!=null){if(RegExp.$5.length==0){strDate=Pad(RegExp.$3,2)+"/"+MonthNames[RegExp.$1]+"/"+dateToday.getYear();}else{strDate=Pad(RegExp.$3,2)+"/"+MonthNames[RegExp.$1]+"/"+Pad(RegExp.$5,2);}document.getElementById(sender.controltovalidate).value=strDate;return;}}function DocumentNameChanged(DocumentName){var names=new Array;names[0]="Application Form";names[1]="Additional Information";names[2]="Brochure";names[3]="Equal Opportunities Form";names[4]="Guidance Notes";names[5]="Job Description";names[6]="Person Specification";names[7]="Project Profile";names[9]="Role Profile";names[8]="Recruitment Pack";names[10]="Terms and Conditions";var found=false;for(var i=0;i<names.length;i++){if(names[i].toUpperCase().indexOf(DocumentName.value.toUpperCase())==0){found=true;break;}}if(document.getElementById("txtNewDocumentName").createTextRange){if(false&&!found){document.getElementById("txtNewDocumentName").value=document.getElementById("txtNewDocumentName").value.substring(0,document.getElementById("txtNewDocumentName").value.length-1);return;}var cursorKeys="8;46;37;38;39;40;33;34;35;36;45;";if(cursorKeys.indexOf(event.keyCode+";")==-1){var r1=document.getElementById("txtNewDocumentName").createTextRange();var oldValue=r1.text;var newValue=found?names[i]:oldValue;if(newValue!=document.getElementById("txtNewDocumentName").value){document.getElementById("txtNewDocumentName").value=newValue;var rNew=document.getElementById("txtNewDocumentName").createTextRange();rNew.moveStart('character',oldValue.length);rNew.select();}}}}