
/* Merged Plone Javascript file
 * This file is dynamically assembled from separate parts.
 * Some of these parts have 3rd party licenses or copyright information attached
 * Such information is valid for that section,
 * not for the entire composite file
 * originating files are separated by - filename.js -
 */

/* - fixHover.js - */
// http://abpi-careers.org.uk/portal_javascripts/fixHover.js?original=1
fixHover=function(){var fixLi=document.getElementById("mainNavArea").getElementsByTagName("LI");for(var i=0;i<fixLi.length;i++){fixLi[i].onmouseover=function(){this.style.backgroundColor="#486e12"}
fixLi[i].onmouseout=function(){this.style.backgroundColor="#80b03d"}}}
if(window.attachEvent) window.attachEvent("onload",fixHover);

/* - clearForm.js - */
// http://abpi-careers.org.uk/portal_javascripts/clearForm.js?original=1
function clearMe(what){if(what.value==what.title){what.value=""}}
function writeToMe(what){if(what.value==""){what.value=what.title}}


/* - printScript.js - */
// http://abpi-careers.org.uk/portal_javascripts/printScript.js?original=1
function printpage(){window.print()}
writePrintButton=function(){document.write("<ul class=\"globalTools\"><li><a class=\"email\" href=\"javascript:newPopWin('mailFriend-template.htm', 600, 500)\" accesskey=\"7\" tabindex=\"7\">Email this Page</a></li><li><a class=\"print\" href=\"#\" onclick=\"printpage()\" accesskey=\"6\" tabindex=\"6\">Print this Page</a></li></ul>")}

/* - openSendLink.js - */
// http://abpi-careers.org.uk/portal_javascripts/openSendLink.js?original=1
var infowin=null;
function newPopWin(url,w,h){infowin=window.open("","","toolbar=yes,location=yes,scrollbars=yes,resizable=yes,top=20,left=20,width="+w+",height="+h);if(infowin!=null){infowin.location.href=url;if(window.focus){infowin.focus()}}}
function closePopWin(){if(infowin!=null&&infowin.open) infowin.close()}


/* - sendlink.js - */
// http://abpi-careers.org.uk/portal_javascripts/sendlink.js?original=1
function getPageUrl(){if(getQueryVariable("url"))
return getQueryVariable("url");else if(window.opener)
return window.opener.document.location.href;else
return("Error: This page must be opened in a popup window or must be passed a 'url' querystring value.")}
function getQueryVariable(variable){var query=window.location.search.substring(1);var vars=query.split("&");for(var i=0;i<vars.length;i++){var pair=vars[i].split("=");if(pair[0]==variable)
return pair[1]}
return false}
function validate(theForm){var strError="";if(theForm.sender_name.value=="")
strError+="Your name\n";if(!isValidEmail(theForm.sender_email.value))
strError+="Your email\n";if(!isValidEmail(theForm.recipient.value))
strError+="Friend's email\n";if(strError!=""){alert("The following fields had errors:\n\n"+strError+"\nPlease try again.");return false}
else{return true}}
function isValidEmail(strInput){var regex=/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;return regex.test(strInput)}
