//######################
//## GLOBAL COMMANDS: ##
//######################

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Random display of short candidate testimonials underneath the page logo. +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function Testimonial(){
	var quotes=new Array();
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	quotes[0]='In 20 years of working with recruiters this is<br>the first one who\'s team has really impressed me!';
	quotes[1]='Why can\'t other recruiters be more like this?<br>If you need a superb recruiter - look no further...';
	quotes[2]='Most professional, one of the better agencies to deal with...';
	quotes[3]='Efficient and professional...';
	quotes[4]='The best in market coverage, insight,<br>communications and candidate support...';
	quotes[5]='I would have no hesitation in recommending RSA...';
	quotes[6]='Kind, respectful, trustworthy...';
	quotes[7]='I would recommend them, they are professional<br>and keep you well updated throughout the process...';
	quotes[8]='Positive, helpful and willing to chase things up...';
	quotes[9]='If you want a job in the Pharma industry,<br>RSA is the company to contact...';
	quotes[10]='A friendly and professional recruitment service...';
	quotes[11]='The RSA consultant did a super job<br>in managing a difficult client process...';
	quotes[12]='I have been delighted with the service that I have received...';
	quotes[13]='If I am ever looking for a job again I will return to RSA...';
	quotes[14]='Thank you all very much for your efforts<br>in securing this role for me...';
	quotes[15]='Highly focused, professional and personable...';
	quotes[16]='The service you provided was excellent all-round...';
	quotes[17]='I am extremely grateful to RSA<br>for having worked so hard on my behalf...';
	quotes[18]='A sincere interest to understand the candidate requirements...';
	quotes[19]='I would strongly recommend RSA...';
	quotes[20]='It is a great comfort to know you are<br>on-the-ground to smooth things along...';
	quotes[21]='RSA personnel greatly impressed me<br>with their professionalism...';
	quotes[22]='RSA has a great reputation in the market place<br>and a fantastic depth of industry knowledge...';
	quotes[23]='There are few Search companies so courteous<br>and I chalk it up as a first...';
	quotes[24]='I received excellent support<br>throughout the acceptance process...';
	quotes[25]='The RSA consultant was an absolute pleasure to work with...';
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	var defaultquote='Great companies have one thing in common, great people...';
	var whichquote=Math.floor(Math.random()*(quotes.length));
	if(window.location=='http://www.rsajobs.com/'){document.write(defaultquote);setTimeout("QUOTESIGNATURE.innerHTML='Nick Stephens, CEO RSA'",125);}

//	else if(window.location=='http://www.rsajobs.com/upgrade/'){document.write(defaultquote);setTimeout("QUOTESIGNATURE.innerHTML='Nick Stephens, CEO RSA'",125);}
//	else if(window.location=='http://www.rsajobs.com/upgrade/index.html'){document.write(defaultquote);setTimeout("QUOTESIGNATURE.innerHTML='Nick Stephens, CEO RSA'",125);}

	else if(window.location=='http://www.rsajobs.com/candidate-testimonials.shtml'){document.write(defaultquote);setTimeout("QUOTESIGNATURE.innerHTML='Nick Stephens, CEO RSA'",125);}
	else document.write(quotes[whichquote]);
}

//++++++++++++++++++++++++++++
// Standard email addresses. +
//++++++++++++++++++++++++++++
function Hatfield(){
	document.write('<a href=\"mailto:enquiries@thersagroup.com\">enquiries@thersagroup.com</a>');
}
function London(){
	document.write('<a href=\"mailto:london@thersagroup.com\">london@thersagroup.com</a>');
}
function France(){
	document.write('<a href=\"mailto:france@thersagroup.com\">france@thersagroup.com</a>');
}
function Germany(){
	document.write('<a href=\"mailto:germany@thersagroup.com\">germany@thersagroup.com</a>');
}
function Switzerland(){
	document.write('<a href=\"mailto:switzerland@thersagroup.com\">switzerland@thersagroup.com</a>');
}
function Singapore(){
	document.write('<a href=\"mailto:singapore@thersagroup.com\">singapore@thersagroup.com</a>');
}
function China(){
	document.write('<a href=\"mailto:vache@fprsa.com\">vache@fprsa.com</a>');
}
function Americas(){
	document.write('<a href=\"mailto:americas@thersagroup.com\">americas@thersagroup.com</a>');
}

//++++++++++++++++++++++++++++++++++
// Retrieve session cookie values. +
//++++++++++++++++++++++++++++++++++
function getSessionCookieValue(cookieName){
	var exp=new RegExp(escape(cookieName)+"=([^;]+)");
	if(exp.test(document.cookie+";")){exp.exec(document.cookie+";");return unescape(RegExp.$1);}
	else return false;
}

//+++++++++++++++++++++++++++++++++++++++++++++++++
// Keep all page copyright dates to current year. +
//+++++++++++++++++++++++++++++++++++++++++++++++++
function Copyright(){
	today=new Date();
	document.write(today.getFullYear());
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Check a form field for leading and trailing whitespace and remove it. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function RemoveWhitespace(Form,Field){
	document.forms[Form].elements[Field].value=document.forms[Form].elements[Field].value.replace(/ +/g,' ');  
	document.forms[Form].elements[Field].value=document.forms[Form].elements[Field].value.replace(/^\s/g,'');
	document.forms[Form].elements[Field].value=document.forms[Form].elements[Field].value.replace(/\s$/g,'');
}

//----------------------------------------------------------------------------------------------------

//###############################################
//## TOP PANEL APPLICATION-SPECIFIC FUNCTIONS: ##
//###############################################

//################
//## JOB SEARCH ##
//################+++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Keywords() controls the default value in the KEYWORDS input element. +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function Keywords(){
	var Keywords=document.forms['searchstring'].KEYWORDS;
	if(Keywords.value==='Keyword(s) or job reference')Keywords.value='';
	else if(Keywords.value==='')Keywords.value='Keyword(s) or job reference';
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// SaveSearch() controls the actions surrounding the search session cookies. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function SaveSearch(){
	document.cookie=escape('keywords')+"="+escape(document.forms['searchstring'].KEYWORDS.value)+";path=/";
	document.cookie=escape('jobtype')+"="+escape(document.forms['searchstring'].JOBTYPE.value)+";path=/";
	document.cookie=escape('grade')+"="+escape(document.forms['searchstring'].GRADE.value)+";path=/";
	document.cookie=escape('function')+"="+escape(document.forms['searchstring'].FUNCTION.value)+";path=/";
	document.cookie=escape('location')+"="+escape(document.forms['searchstring'].LOCATION.value)+";path=/";
}
function readSearchCookie(){
	if(getSessionCookieValue('keywords'))document.forms['searchstring'].KEYWORDS.value=getSessionCookieValue('keywords');
	if(getSessionCookieValue('jobtype'))document.forms['searchstring'].JOBTYPE.value=getSessionCookieValue('jobtype');
	if(getSessionCookieValue('grade'))document.forms['searchstring'].GRADE.value=getSessionCookieValue('grade');
	if(getSessionCookieValue('function'))document.forms['searchstring'].FUNCTION.value=getSessionCookieValue('function');
	if(getSessionCookieValue('location'))document.forms['searchstring'].LOCATION.value=getSessionCookieValue('location');
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Search() accumulates all the values in the search string and writes them into the SEARCH input element. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function Search(){
	var Searchstring=document.forms['searchstring'];
	var Keywords='';
	SaveSearch();
	if(Searchstring.KEYWORDS.value==='Keyword(s) or job reference')Keywords='';
	else if(Searchstring.KEYWORDS.value==='')Keywords='';
	else Keywords=Searchstring.KEYWORDS.value;
	document.forms['jobsearch'].search.value=Keywords+' '+Searchstring.JOBTYPE.value+' '+Searchstring.GRADE.value+' '+Searchstring.FUNCTION.value+' '+Searchstring.LOCATION.value+'';
	document.forms['jobsearch'].submit();
}

//#################
//## BREADCRUMBS ##
//#################++++++++++++++++++++++++++++++++++++++
// RootBreadcrumb() writes in the permanent index link. +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++
function RootBreadcrumb(){
	document.write('You&nbsp;are&nbsp;currently&nbsp;here:&nbsp;<a href="http://www.rsajobs.com">RSAjobs.com</a>');
	readSearchCookie();
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// TrunkBreadcrumb() controls the actions surrounding the breadcrumb session cookie & TRUNKBREADCRUMB element. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function TrunkBreadcrumb(Title){
	document.forms['jobalert'].reset();
	var cookieValue='';
	var Title=Title;
	cookieValue='&nbsp;>&nbsp;<a href="'+document.location+'" id="trunkroad">'+Title+'</a>';
	document.cookie=escape('trunkbreadcrumb')+"="+escape(cookieValue)+";path=/";
	if(getSessionCookieValue('trunkbreadcrumb'))TRUNKBREADCRUMB.innerHTML=''+getSessionCookieValue('trunkbreadcrumb')+'';
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Set the referrer cookie in case the visitor decides to pass the page page on. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	document.cookie=escape('referrer')+"="+escape(Title)+";path=/";
}
function readTrunkCookie(){
	if(getSessionCookieValue('trunkbreadcrumb'))TRUNKBREADCRUMB.innerHTML=''+getSessionCookieValue('trunkbreadcrumb')+'';
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// JoblistBreadcrumb() controls the actions surrounding the breadcrumb session cookie & TRUNKBREADCRUMB element. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function JoblistBreadcrumb(Title){
	document.forms['jobalert'].reset();
	cookieValue='&nbsp;>&nbsp;<a href="'+document.location+'" id="trunkroad">'+Title+'</a>';
	document.cookie=escape('joblistbreadcrumb')+"="+escape(cookieValue)+";path=/";
	if(getSessionCookieValue('joblistbreadcrumb'))TRUNKBREADCRUMB.innerHTML=''+getSessionCookieValue('joblistbreadcrumb')+'';
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Set the referrer cookie in case the visitor decides to pass the page page on. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	document.cookie=escape('referrer')+"="+escape(Title)+";path=/";
}
function readJoblistCookie(){
	if(getSessionCookieValue('joblistbreadcrumb'))TRUNKBREADCRUMB.innerHTML=''+getSessionCookieValue('joblistbreadcrumb')+'';
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// BranchBreadcrumb() controls the actions surrounding the BRANCHBREADCRUMB element. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function BranchBreadcrumb(Text){
	document.forms['jobalert'].reset();
	readJoblistCookie();
	BRANCHBREADCRUMB.innerHTML='&nbsp;>&nbsp;'+Text;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Set the referrer cookie in case the visitor decides to pass the job page page on. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	document.cookie=escape('referrer')+"="+escape(Text)+";path=/";
}

//----------------------------------------------------------------------------------------------------

//################################################
//## LEFT PANEL APPLICATION-SPECIFIC FUNCTIONS: ##
//################################################

//+++++++++++++++++++++++++++++++++++++++++++++
// Take the user to the CV subscription form. +
//+++++++++++++++++++++++++++++++++++++++++++++
function ToolbarCV(){
	top.location.href='http://www.rsajobs.com/send-us-your-cv.shtml';
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Send the user to the top of the page and highlight the mailing list subscription panel. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ToolbarAlerts(){
	document.location.replace('#TOP');
	document.getElementById('JOBALERTPANEL').style.backgroundColor='#00FF00';
	document.forms['jobalert'].TITLE.focus();
}
//++++++++++++++++++++++++++++++++++++++++++++++
// Take the user to the RSS subscription page. +
//++++++++++++++++++++++++++++++++++++++++++++++
function ToolbarRSS(){
	top.location.href='http://www.rsajobs.com/rss/jobs.xml';
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Open the bookmark dialogue panel and preset for the open page. +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	var title=document.title;
	var url=window.location;
function ToolbarBookmark(title,url){
	if(window.sidebar)window.sidebar.addPanel(title,url,'');
	else if(window.opera && window.print){var elem=document.createElement('a');elem.setAttribute('href',url);elem.setAttribute('title',title);elem.setAttribute('rel','sidebar');elem.click();}
	else window.external.AddFavorite(url,title);
}
//++++++++++++++++++++++++++++++++++++++
// Print a text-only copy of the page. +
//++++++++++++++++++++++++++++++++++++++
function ToolbarPrint(){
	window.print();
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Catch the page location then take the user to the page recommendation form. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ToolbarFriend(){
	var Error='ERROR: NO LOGIC TO RECOMMENDING THIS PAGE SO ACTION CANCELLED';
	if(window.location=='http://www.rsajobs.com/recommendation.shtml')alert(Error);
	else if(window.location=='http://www.rsajobs.com/recommendation-thanks.shtml')alert(Error);
	else{document.cookie=escape('referrerurl')+"="+escape(document.location)+";path=/";
	top.location.href='http://www.rsajobs.com/recommendation.shtml';}
}

//----------------------------------------------------------------------------------------------------

//###################################################
//## CENTRAL PANEL APPLICATION-SPECIFIC FUNCTIONS: ##
//###################################################

function SaveForename(formname){
	document.cookie=escape('forename')+"="+escape(document.forms[formname].FORENAME.value)+";path=/";
}
function WriteForename(){
	if(getSessionCookieValue('forename'))FORENAME.innerHTML='&nbsp;'+getSessionCookieValue('forename');
}

//#####################
//## JOB APPLICATION ##
//#####################+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// JobApplication() controls the actions surrounding the job application form. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function JobApplication(){
	var Application=document.forms['jobapplication'];
	var Candidate=document.forms['candidate'];
	var Error='ERROR: You have not entered your ';
	var Target='website.administration';
//+++++++++++++++++++++++++++++++++++++++++++++
// Check that all fields have been completed. +
//+++++++++++++++++++++++++++++++++++++++++++++
	if(Candidate.FORENAME.value===''){alert(''+Error+'Forename');Candidate.FORENAME.focus();}
	else if(Candidate.SURNAME.value===''){alert(''+Error+'Surname');Candidate.SURNAME.focus();}
	else if(Candidate.DAYTIMEPHONE.value===''){alert(''+Error+'Daytime Telephone Number');Candidate.DAYTIMEPHONE.focus();}
	else if(Candidate.EVENINGPHONE.value===''){alert(''+Error+'Evening Telephone Number');Candidate.EVENINGPHONE.focus();}
	else if(Candidate.EMAIL.value===''){alert(''+Error+'Email Address');Candidate.EMAIL.focus();}
	else if(Candidate.LETTER.value===''){alert(''+Error+'Covering Letter');Candidate.LETTER.focus();}
	else if(Application.file_attached.value==='')alert('ERROR: You have not attached your CV');
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// If all is well then format the data in the application form and send it. +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	else{
	Application.email_recipient.value=Candidate.LOCALPART.value+'@thersagroup.com';
	Application.bcc.value=Target+'@rsajobs.com';
	Application.name_sender.value=Candidate.TITLE.value+' '+Candidate.FORENAME.value+' '+Candidate.SURNAME.value;
	Application.email_sender.value=Candidate.EMAIL.value;
	Application.main_message.value='FORWARD TO: '+Candidate.LOCALPART.value+'@thersagroup.com\n\n\n'+Application.subject.value+'\n\nThe candidate\'s email address for your reply is '+Candidate.EMAIL.value+'\n\n---------------------------------------------------------------------------\n\n'+Candidate.TITLE.value+' '+Candidate.FORENAME.value+' '+Candidate.SURNAME.value+'\n\nDaytime phone: '+Candidate.DAYTIMEPHONE.value+'\nEvening phone: '+Candidate.EVENINGPHONE.value+'\nE-mail address: '+Candidate.EMAIL.value+'\n\n'+Candidate.LETTER.value+'\n\nEND OF MESSAGE';
	SaveForename('candidate');
	Application.submit();
	Application.SUBMIT.value='PROCESSING';
	Application.SUBMIT.disabled=true;}
}

//###################
//## CV SUBMISSION ##
//###################++++++++++++++++++++++++++++++++++++++++++++++
// CV() controls the actions surrounding the cv application form. +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function CV(){
	var Target='website.administration';
	var CV=document.forms['cv'];
	var Candidate=document.forms['candidate'];
	var Error='ERROR: You have not entered your ';
//+++++++++++++++++++++++++++++++++++++++++++++
// Check that all fields have been completed. +
//+++++++++++++++++++++++++++++++++++++++++++++
	if(Candidate.FORENAME.value===''){alert(''+Error+'forename(s)');Candidate.FORENAME.focus();}
	else if(Candidate.SURNAME.value===''){alert(''+Error+'surname');Candidate.SURNAME.focus();}
	else if(Candidate.DAYTIMEPHONE.value===''){alert(''+Error+'daytime telephone number');Candidate.DAYTIMEPHONE.focus();}
	else if(Candidate.EVENINGPHONE.value===''){alert(''+Error+'evening telephone number');Candidate.EVENINGPHONE.focus();}
	else if(Candidate.EMAIL.value===''){alert(''+Error+'email address');Candidate.EMAIL.focus();}
	else if(Candidate.NOTES.value===''){alert(''+Error+'candidate notes');Candidate.NOTES.focus();}
	else if(CV.file_attached.value==='')alert('ERROR: You have not attached your CV');
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// If all is well then format the data in the cv form and send it. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	else{
	CV.email_recipient.value=Target+'@rsajobs.com';
	CV.name_sender.value=Candidate.TITLE.value+' '+Candidate.FORENAME.value+' '+Candidate.SURNAME.value;
	CV.email_sender.value=Candidate.EMAIL.value;
	CV.main_message.value='This CV has been forwarded to you from the RSAjobs.com website.\nTo reply please use the information below or refer to the candidate\'s CV.\n\n---------------------------------------------------------------------------\n\n'+Candidate.TITLE.value+' '+Candidate.FORENAME.value+' '+Candidate.SURNAME.value+'\n\nDaytime phone: '+Candidate.DAYTIMEPHONE.value+'\nEvening phone: '+Candidate.EVENINGPHONE.value+'\nE-mail address: '+Candidate.EMAIL.value+'\n\nCandidate notes:\n'+Candidate.NOTES.value+'\n';
	SaveForename('candidate');
	CV.submit();
	CV.SUBMIT.value='PROCESSING';
	CV.SUBMIT.disabled=true;}
}

//#########################
//## RECOMMENDATION PAGE ##
//#########################++++++++++++++++++++
// Get the referrer cookie value as required. +
//+++++++++++++++++++++++++++++++++++++++++++++ 
function getReferrerCookieValue(cookieName){
	var exp=new RegExp(escape(cookieName)+"=([^;]+)");
	if(exp.test(document.cookie+";")){exp.exec(document.cookie+";");return unescape(RegExp.$1);}
	else return false;
}
//++++++++++++++++++++++++++++++++
// Load the recommendation page. +
//++++++++++++++++++++++++++++++++
function RecommendationPage(){
	readTrunkCookie();
	BRANCHBREADCRUMB.innerHTML='&nbsp;>&nbsp;<a href="'+getReferrerCookieValue('referrerurl')+'">Recommend "'+getReferrerCookieValue('referrer')+'"</a>';
	document.forms['referrer'].PAGEDETAILS.value=getReferrerCookieValue('referrer')+'\n'+getReferrerCookieValue('referrerurl');
	REFERRERBLOCK.innerHTML=getReferrerCookieValue('referrer')+'<br>'+getReferrerCookieValue('referrerurl');
	REFERRERTEXT.innerHTML=getReferrerCookieValue('referrer');
	REFERRERURLTEXT.innerHTML=getReferrerCookieValue('referrerurl');
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Write the visitors name into the page text as they enter it. +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function FromName(){
	if(document.forms['referrer'].FROMNAME.value==='')REFERRERNAME.innerHTML='[Your name]';
	else REFERRERNAME.innerHTML=document.forms['referrer'].FROMNAME.value;
}
//+++++++++++++++++++++++++++++++++++
// Process the recommendation form. +
//+++++++++++++++++++++++++++++++++++
function Recommend(){
	var Error='ERROR: You have not entered your ';
	var Recommendation=document.forms['recommendation'];
	var Referrer=document.forms['referrer'];
//+++++++++++++++++++++++++++++++++++++++++++++
// Check that all fields have been completed. +
//+++++++++++++++++++++++++++++++++++++++++++++
	if(Referrer.FROMNAME.value===''){alert(''+Error+'name');Referrer.FROMNAME.focus();}
	else if(Referrer.FROMMAIL.value===''){alert(''+Error+'email address');Referrer.FROMMAIL.focus();}
	else if(Referrer.TONAME.value===''){alert(''+Error+'friends\' name');Referrer.TONAME.focus();}
	else if(Referrer.TOMAIL.value===''){alert(''+Error+'friends\' email address');Referrer.TOMAIL.focus();}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// If all is well then format the data in the recommendation form and send it. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	else{
	Referrer.RECOMMEND.value='PROCESSING';
	Referrer.RESET.disabled=true;
	Referrer.RECOMMEND.disabled=true;
	Recommendation.name_sender.value=Referrer.FROMNAME.value;
	Recommendation.email_sender.value=Referrer.FROMMAIL.value;
	Recommendation.name_recipient.value=Referrer.TONAME.value;
	Recommendation.email_recipient.value=Referrer.TOMAIL.value;
	Recommendation.subject.value='A web page recommendation from '+Referrer.FROMNAME.value;
	Recommendation.main_message.value=Referrer.PAGEDETAILS.value+'\n\n'+Referrer.COMMENTS.value+'\n\nEND OF MESSAGE';
	Recommendation.submit();}
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Things to do when the confirmation page has loaded. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++
function RecommendationHousekeeping(){
	REFERRER.innerHTML=getReferrerCookieValue('referrer')+'" with the web page address '+getReferrerCookieValue('referrerurl');
	RETURNLINK.innerHTML='<a href=# onClick=location.replace(\''+getReferrerCookieValue('referrerurl')+'\')>click here</a>';
	BranchBreadcrumb('Recommendation sent');
	TRUNKBREADCRUMB.innerHTML=''+getTrunkCookieValue('trunkbreadcrumb')+'';
}

//----------------------------------------------------------------------------------------------------

//#################################################
//## RIGHT PANEL APPLICATION-SPECIFIC FUNCTIONS: ##
//#################################################

//################
//## JOB ALERTS ##
//################++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Check for initials, capitalization and all lower case then adjust formatting. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function AlertText(Field,Fieldtitle){
	var Subscriber=document.forms['jobalert'];
	if(Subscriber.elements[Field].value!==''){
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Check that not just an initial has been entered (alert). +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	if(Subscriber.elements[Field].value.length===1){
	alert('You have only given the single character \''+Subscriber.elements[Field].value+'\ as your '+Fieldtitle+'.\nThe form requires your full '+Fieldtitle+' and not just an initial.');
	Subscriber.elements[Field].focus();}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Check for excessive use of capital letters (alert + amend). +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	else{
	var Val=Subscriber.elements[Field].value;
	var newVal='';
	Val=Val.toLowerCase();
	Val=Val.split(' ');
	for(var c=0;c<Val.length;c++){newVal+=Val[c].substring(0,1).toUpperCase()+Val[c].substring(1,Val[c].length)+' ';}
	Val=newVal;
	var Cap=false;
	var Text=Subscriber.elements[Field].value.length;
	if(Text>2){for(var i=0;i<Text;i++){var char=Subscriber.elements[Field].value.charAt(i);
	if(char>='A'&&char<='Z'){if(Cap){if(i==Text-1){alert('You seem to have entered your '+Fieldtitle+' using a large proportion of CAPITAL LETTERS.\nTo comply with internationally accepted correct presentation it has been amended.\nFor the purposes of this form your '+Fieldtitle+' will now read as \''+Val+'\'.');Subscriber.elements[Field].value=Val;Subscriber.elements[Field].focus();return;}}Cap=true;}else Cap=false;}}

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Check for excessive use of lower case letters (alert + amend). +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//	Subscriber.elements[Field].value=Val;

	}}
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Run the formatting loop onMouseover of the submit button. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function AlertFormatting(){
	AlertText('FORENAME','forename');
	AlertText('SURNAME','surname');
	RemoveWhitespace('jobalert','FORENAME');
	RemoveWhitespace('jobalert','SURNAME');
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Format the email address: remove any whitespace and capitals then present as all lower case. +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	document.forms['jobalert'].ADDRESS.value=document.forms['jobalert'].ADDRESS.value.replace(/ /g,'');
	document.forms['jobalert'].ADDRESS.value=document.forms['jobalert'].ADDRESS.value.toLowerCase();
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// AlertSubscribe() controls the actions surrounding the email alert sign-up form. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function AlertSubscribe(){
	var Subscriber=document.forms['jobalert'];
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Check that the minimum amount of required data has been entered. +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	var warning='There appears to be missing data:\nYou do not seem to have entered your ';
	if(Subscriber.TITLE.value==='NULL'){alert(warning+'title');Subscriber.TITLE.focus();}
	else if(Subscriber.FORENAME.value===''){alert(warning+'forename');Subscriber.FORENAME.focus();}
	else if(Subscriber.SURNAME.value===''){alert(warning+'surname');Subscriber.SURNAME.focus();}
	else if(Subscriber.ADDRESS.value===''){alert(warning+'email address');Subscriber.ADDRESS.focus();}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Run a loop to value each list checked checkbox using forms['jobalert'].DATABLOCK as a temp. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// NOTE: IF THE NUMBER OF CHECKBOXES IS CHANGED THEN AMEND THE CURRENT 14 TO THE NEW NUMBER.   +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	else if(Subscriber.DATABLOCK.value===''){
	ck=1;
	while(ck<=14){if(Subscriber.elements['CHECKBOX'+ck+''].checked==true)Subscriber.DATABLOCK.value='YES';ck++;}
	if(Subscriber.DATABLOCK.value==='')alert('There appears to be missing data:\nYou do not seem to have selected any function categories.');
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// If validation is clear then create the subscriber datablock and process the subscriber. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	else{
	Subscriber.DATABLOCK.value==='';
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Create a unique key as a security code for this subscriber request. +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	var Keylist='ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
	var Key='';
	for(i=0;i<25;i++)Key+=Keylist.charAt(Math.floor(Math.random()*Keylist.length));
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Identify the formatting style for subscriber messages. +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	var Formatting='';
	if(Subscriber.elements['RADIO1'].checked==true)Formatting='HTML';
	if(Subscriber.elements['RADIO2'].checked==true)Formatting='TEXT';
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Write the initial subscriber information into forms['jobalert'].DATABLOCK +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	Subscriber.DATABLOCK.value=''+Key+'|'+Subscriber.TITLE.value+' '+Subscriber.FORENAME.value+' '+Subscriber.SURNAME.value+'|'+Subscriber.ADDRESS.value+'|'+Formatting+'|'+Key+'|'+Subscriber.TITLE.value+' '+Subscriber.FORENAME.value+' '+Subscriber.SURNAME.value+'|'+Subscriber.TITLE.value+' '+Subscriber.SURNAME.value+'|'+Subscriber.FORENAME.value+'|'+Subscriber.ADDRESS.value+'|'+Subscriber.JOBTYPE.value+'|||||';
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Run a loop to value each list checkbox then add that value to the existing information in forms['jobalert'].DATABLOCK +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// LOOP WARNING: IF THE NUMBER OF CHECKBOXES IS CHANGED YOU MUST AMEND THE CURRENT 14 TO THE NEW TOTAL NUMBER AND	 +
// THE DUMMY LIST NO| SO THAT THE TOTAL IS 30 (IF A CHECKBOX IS ADDED THEN A NO| MUST BE REMOVED AND VICE VERSA).	 +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	i=1;
	while(i<=14){
	if(Subscriber.elements['CHECKBOX'+i+''].checked==true)Subscriber.DATABLOCK.value=Subscriber.DATABLOCK.value+'YES|';
	if(Subscriber.elements['CHECKBOX'+i+''].checked==false)Subscriber.DATABLOCK.value=Subscriber.DATABLOCK.value+'NO|';
	i++;}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Add the dummy list NO| values to the end of the existing information in forms['jobalert'].DATABLOCK +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ADMIN NOTE: REFER TO THE CHECKBOX LOOP WARNING FOR ALTERATIONS IN THE LENGTH OF THE NO| SEQUENCE.   +
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	Subscriber.DATABLOCK.value=Subscriber.DATABLOCK.value+'NO|NO|NO|NO|NO|NO|NO|NO|NO|NO|NO|NO|NO|NO|NO|NO|';
//++++++++++++++++++++++++++++++++
// Submit the subscription data. +
//++++++++++++++++++++++++++++++++
	SaveForename('jobalert');
	document.forms['jobalert'].submit();}}
}