// TARGETS BLANK IN XHTML STRICT
   
function relTags() {

	if (document.getElementsByTagName) {
	
		var anchors = document.getElementsByTagName( "a" );
		
		for (var loop = 0; loop < anchors.length; loop++) {
			
			var anchor = anchors[loop];
			if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
				anchor.target = "_blank";
			}
		}
	}
}


// INCREASE AND DECREASE THE FONT

var min=8;
var max=18;

function increaseFontSize() {
  
   
   var tag = new Array('content','menu','linksCopyright','submenu');
   
   for(j=0;j<tag.length;j++) {
	   
	   var p = document.getElementById(tag[j]);
		  if(p.style.fontSize) {
			 var s = parseInt(p.style.fontSize.replace("px",""));
		  } else {
			 var s = 12;
		  }
		  if(s!=max) {
			 s += 1;
		  }
		  p.style.fontSize = s+"px"
	   
   }
   
}

function decreaseFontSize() {
	
   var tag = new Array('content','menu','linksCopyright','submenu');
   
   for(j=0;j<tag.length;j++) {

	   var p = document.getElementById(tag[j]);
		  if(p.style.fontSize) {
			 var s = parseInt(p.style.fontSize.replace("px",""));
		  } else {
			 var s = 12;
		  }
		  if(s!=min) {
			 s -= 1;
		  }
		  p.style.fontSize = s+"px"
	   
   }
   
}


// Email.js version 5
var tld_ 	= new Array()
tld_[0]  	= "com";
tld_[1] 	= "org";
tld_[2]  	= "net";
tld_[3]  	= "info";
tld_[4] 	= "co.uk";
tld_[5] 	= "fr";
tld_[6] 	= "org.uk";
tld_[7] 	= "gov.uk";
tld_[8] 	= "uk.com";
tld_[9] 	= "gb.com";
var topDom_ = 13;
var m_ 		= "mailto:";
var a_ 		= "@";
var d_ 		= ".";

function mail(name, dom, tl, accesskey, display) {
	var s = e(name,dom,tl);
	
	if (display != "") { document.write('<a href="'+m_+e(name,dom,tl)+'" accesskey="'+accesskey+'">'+display+'</a>'); }
	else { document.write('<a href="'+m_+s+'" accesskey="'+accesskey+'">'+s+'</a>'); }
		
}

function e(name, dom, tl) {
	var s = name+a_;
	if (tl!=-2) {
		s+= dom;
		if (tl>=0)
			s+= d_+tld_[tl];
	}
	else
		s+= swapper(dom);
	return s;
}

function swapper(d) {
	var s = "";
	for (var i=0; i<d.length; i+=2)
		if (i+1==d.length)
			s+= d.charAt(i)
		else
			s+= d.charAt(i+1)+d.charAt(i);
	return s.replace(/\?/g,'.');
}



function CheckContactForm() {
	var errorMsg = "";

	// Check name
	if (document.Form.name.value == ""){
		errorMsg += "\n\tName \t- Enter your Full Name";	
	}
	
	// Check Company name
	if (document.Form.company.value == ""){
		errorMsg += "\n\tCompany \t- Enter your Full Company Name";	
	}
	
	// Check address
	if (document.Form.address.value == ""){
		errorMsg += "\n\tAddress \t- Enter your Address";	
	}
	
	// Check postcode
	if (document.Form.postcode.value == ""){
		errorMsg += "\n\tPostcode \t- Enter your Postcode";	
	}
	
	// Check phone
	if (document.Form.phone.value == ""){
		errorMsg += "\n\tPhone \t- Enter your Phone Number";	
	}
	
	//Check for an e-mail address and that it is valid
	if ((document.Form.email.value == "") || (document.Form.email.value.length > 0 && (document.Form.email.value.indexOf("@",0) == - 1 || document.Form.email.value.indexOf(".",0) == - 1))) { 
		errorMsg += "\n\tE-mail Address \t- Enter a valid E-mail Address";
	}
	

	//If there is aproblem with the form then display an error
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "Your enquiry has not been sent because there are problem(s) with the form.\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "______________________________________________________________\n\n";
		msg += "The following field(s) need to be corrected: \n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}




function CheckConstructionReviewForm() {
	var errorMsg = "";

	// Check name
	if (document.Form.name.value == ""){
		errorMsg += "\n\tName \t- Enter your Full Name";	
	}
	
	// Check Job Title
	if (document.Form.job.value == ""){
		errorMsg += "\n\tJob Title \t- Enter your Full Job Title";	
	}
	
	// Check Company name
	if (document.Form.company.value == ""){
		errorMsg += "\n\tCompany \t- Enter your Full Company Name";	
	}
	
	// Check address
	if (document.Form.address.value == ""){
		errorMsg += "\n\tAddress \t- Enter your Address";	
	}
	
	// Check postcode
	if (document.Form.postcode.value == ""){
		errorMsg += "\n\tPostcode \t- Enter your Postcode";	
	}
	
	// Check phone
	if (document.Form.phone.value == ""){
		errorMsg += "\n\tPhone \t- Enter your Phone Number";	
	}
	
	//Check for an e-mail address and that it is valid
	if ((document.Form.email.value == "") || (document.Form.email.value.length > 0 && (document.Form.email.value.indexOf("@",0) == - 1 || document.Form.email.value.indexOf(".",0) == - 1))) { 
		errorMsg += "\n\tE-mail Address \t- Enter a valid E-mail Address";
	}
	

	//If there is aproblem with the form then display an error
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "Your enquiry has not been sent because there are problem(s) with the form.\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "______________________________________________________________\n\n";
		msg += "The following field(s) need to be corrected: \n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}





function CheckFreeSampleForm() {
	var errorMsg = "";

	// Check name
	if (document.Form.name.value == ""){
		errorMsg += "\n\tName \t- Enter your Full Name";	
	}
	

	// Check Company name
	if (document.Form.company.value == ""){
		errorMsg += "\n\tCompany \t- Enter your Full Company Name";	
	}
	
	// Check address
	if (document.Form.address.value == ""){
		errorMsg += "\n\tAddress \t- Enter your Address";	
	}
	
	// Check postcode
	if (document.Form.postcode.value == ""){
		errorMsg += "\n\tPostcode \t- Enter your Postcode";	
	}
	
	// Check phone
	if (document.Form.phone.value == ""){
		errorMsg += "\n\tPhone \t- Enter your Phone Number";	
	}
	
	//Check for an e-mail address and that it is valid
	if ((document.Form.email.value == "") || (document.Form.email.value.length > 0 && (document.Form.email.value.indexOf("@",0) == - 1 || document.Form.email.value.		    indexOf(".",0) == - 1))) { 
		errorMsg += "\n\tE-mail Address \t- Enter a valid E-mail Address";
	}
	
	// Check Dropdown Selection
	if (document.Form.comMB.value == ""){
		errorMsg += "\n\tDrop-down Selection \t- Please select one option from the list";	
	}
	
	// Check Dropdown Selection
	if (document.Form.comMBtwo.value == ""){
		errorMsg += "\n\tDrop-down Selection \t- Please select one option from the list";	
	}

	//If there is aproblem with the form then display an error
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "Your enquiry has not been sent because there are problem(s) with the form.\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "______________________________________________________________\n\n";
		msg += "The following field(s) need to be corrected: \n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}




function CheckEnquiryForm() {
	var errorMsg = "";

	// Check name
	if (document.Form.name.value == ""){
		errorMsg += "\n\tName \t- Enter your Full Name";	
	}
	

	// Check Company name
	if (document.Form.company.value == ""){
		errorMsg += "\n\tCompany \t- Enter your Full Company Name";	
	}
	
	// Check address
	if (document.Form.address.value == ""){
		errorMsg += "\n\tAddress \t- Enter your Address";	
	}
	
	// Check postcode
	if (document.Form.postcode.value == ""){
		errorMsg += "\n\tPostcode \t- Enter your Postcode";	
	}
	
	// Check phone
	if (document.Form.phone.value == ""){
		errorMsg += "\n\tPhone \t- Enter your Phone Number";	
	}
	
	//Check for an e-mail address and that it is valid
	if ((document.Form.email.value == "") || (document.Form.email.value.length > 0 && (document.Form.email.value.indexOf("@",0) == - 1 || document.Form.email.value.		    indexOf(".",0) == - 1))) { 
		errorMsg += "\n\tE-mail Address \t- Enter a valid E-mail Address";
	}
	
	// Check Dropdown Selection
	if (document.Form.comMB.value == ""){
		errorMsg += "\n\tDrop-down Selection \t- Please select one option from the list";	
	}
	
	// Check Dropdown Selection2
	if (document.Form.comMBtwo.value == ""){
		errorMsg += "\n\tDrop-down Selection \t- Please select one option from the list";	
	}

	//If there is aproblem with the form then display an error
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "Your enquiry has not been sent because there are problem(s) with the form.\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "______________________________________________________________\n\n";
		msg += "The following field(s) need to be corrected: \n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}


function CheckReportForm() {
	var errorMsg = "";

	// Check name
	if (document.Form.CustomerFirstName.value == ""){
		errorMsg += "\n\tFirstName \t- Enter your First Name";	
	}
	

	// Check Company name
	if (document.Form.CustomerLastName.value == ""){
		errorMsg += "\n\tLastName \t- Enter your Last Name";	
	}
	
	// Check address1
	if (document.Form.CustomerAddress1.value == ""){
		errorMsg += "\n\tAddress1 \t- Enter your Address Line1";	
	}
	
	// Check address2
	if (document.Form.CustomerAddress2.value == ""){
		errorMsg += "\n\tAddress2 \t- Enter your Address Line2";	
	}
	
	// Check town
	if (document.Form.CustomerCity.value == ""){
		errorMsg += "\n\tTown \t- Enter your Town";	
	}
	
	// Check postcode
	if (document.Form.CustomerPostalCode.value == ""){
		errorMsg += "\n\tFull Postcode \t- Enter your Postcode";	
	}
	
	// Check county
	if (document.Form.CustomerCounty.value == ""){
		errorMsg += "\n\tDrop-down Selection \t- Enter your County";	
	}
	
	// Check Dropdown Selection Country
	if (document.Form.CustomerCountry.value == ""){
		errorMsg += "\n\tDrop-down Selection \t- Select one option from the list";	
	}
	
	//Check for an e-mail address and that it is valid
	if ((document.Form.CustomerEmailAddress.value == "") || (document.Form.email.value.length > 0 && (document.Form.email.value.indexOf("@",0) == - 1 || document.Form.email.value.		    indexOf(".",0) == - 1))) { 
		errorMsg += "\n\tE-mail Address \t- Enter a valid E-mail Address";
	}


	//If there is aproblem with the form then display an error
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "Your enquiry has not been sent because there are problem(s) with the form.\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "______________________________________________________________\n\n";
		msg += "The following field(s) need to be corrected: \n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}



function CheckUploadForm() {
	var errorMsg = "";
	
    // Check Title
	if (document.Form.title.value == ""){
		errorMsg += "\n\tTitle \t- Select a Title";	
	}

	// Check name
	if (document.Form.firstname.value == ""){
		errorMsg += "\n\tFirst Name \t- Enter your First Name";	
	}
	

	// Check Surname name
	if (document.Form.surname.value == ""){
		errorMsg += "\n\tSurname \t- Enter your Surname";	
	}
	
	// Check Address
	if (document.Form.address.value == ""){
		errorMsg += "\n\tAddress \t- Enter your Address";	
	}
	
	// Check Postcode
	if (document.Form.postcode.value == ""){
		errorMsg += "\n\tPostcode \t- Enter your Postcode";	
	}
	
	// Check Phone
    if (document.Form.phone.value == ""){
        errorMsg += "\n\tPhone \t- Enter your Phone Number"; 
    }
	
	//Check for an e-mail address and that it is valid
	if ((document.Form.email.value == "") || (document.Form.email.value.length > 0 && (document.Form.email.value.indexOf("@",0) == - 1 || document.Form.email.value.		    indexOf(".",0) == - 1))) { 
		errorMsg += "\n\tE-mail Address \t- Enter a valid E-mail Address";
	}
	
	// Check Found Vacnacy
	if (document.Form.vacancy.value == ""){
		errorMsg += "\n\tVacancy drop-down selection \t- Please select one option from the list";	
	}
	
	// Check Describe
	if (document.Form.description.value == ""){
		errorMsg += "\n\tDescription \t- Enter why you are suitable for this role";	
	}
	
	// Check Upload
	if (document.Form.myfilename.value == ""){
		errorMsg += "\n\tUplaod your CV\t- Please upload a Word Document";	
    }
	
	

	//If there is aproblem with the form then display an error
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "Your enquiry has not been sent because there are problem(s) with the form.\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "______________________________________________________________\n\n";
		msg += "The following field(s) need to be corrected: \n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}


// Highlight CELL TAB
function changeTdBackgroundColor (id,colorOff,colorOn) {
	var selector = document.getElementById(id);
	
	var anchors = selector.getElementsByTagName("td");
	for (var i = 0; i < anchors.length; i++) {
		anchors[i].onmouseover = function() {
			this.style.backgroundColor = colorOn;
		}
		anchors[i].onmouseout = function() {
			this.style.backgroundColor  = colorOff;
		}
	}
	
}


function changeTdByClass (id,classOn) {
	
	var selector = document.getElementById(id);
	
	var tag = selector.getElementsByTagName("tr");
	
	for (var i = 1; i < tag.length; i++) {
		
		tag[i].onmouseout = function() {
			alert(oldClass[i] +' '+ i);
			this.className  = oldClass[i];
		}
		
		tag[i].onmouseover = function() {
			this.className = classOn;
		}
	
	}
	
}


// POP UP NOTES

function hideObject(id) {

   document.getElementById(id).style.display = "none";

}


function showObject(id) {

     document.getElementById(id).style.display = "block";

}

// ON LOAD

window.onload = function() {
	relTags();
}

// Interactive login validation
function chk(){

	if(document.login.userName.value==""){

		alert("Please enter your Username");
		document.login.userName.focus();
		return false;

	}	

	if(document.login.password.value==""){

		alert("Please enter your Password");

		document.login.password.focus();

		return false;
	}	

}

var redirectionURLOnLoad = new Array();
redirectionURLOnLoad[0] = "http://www.barbour-abi.com/onlineservices/Login.do";
redirectionURLOnLoad[1] = "http://evolution.barbour-abi.com/onlineservices/Login.do"; //"http://192.9.200.123/onlineservices/Login.do";

var redirectionCriteriaOnLoad = new Array();
redirectionCriteriaOnLoad[0] = "";
redirectionCriteriaOnLoad[1] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";


// Added by Basker on 12/02/2008
//This method used to redirect the page as per the user select
function isValidUser() {
	var serviceId = document.login.service.value; 

	if (serviceId == 2) { 
		//http://10.0.2.222/abirel2/abi_index.html
		//document.login.action = "http://www.barbour-abi.com/abirel2/abivalidate.jsp"
		//document.login.action = "http://213.152.239.211/abirel3/abivalidate.jsp"
		document.login.action = "http://www.barbour-abi.com/abirel3/abivalidate.jsp"
	} else {
		//http://www.barbour-abi.com/onlineservices/Login.do
		// http://localhost:8080/ABI-Dynamo-P3/login.htm
		//document.login.action = "http://www.barbour-abi.com/onlineservices/Login.do?LBAL=R0"
		var url = getURLToBalanceLoad();
		document.login.action = url;
	}
	if(document.login.userName.value==""){

		alert("Please enter your Username");
		document.login.userName.focus();
		return false;

	}	

	if(document.login.password.value==""){

		alert("Please enter your Password");

		document.login.password.focus();

		return false;
	}	

}


function getURLToBalanceLoad() {
	var redirectionCode = -1;
	
	var userNameEntered = document.login.userName.value;
	userNameEntered = userNameEntered.toUpperCase();
	//alert("The username formatted for comparision is : "+userNameEntered);

	var firstCharacterOfUserName = userNameEntered.charAt(0);
	//alert("The first character of username is : "+firstCharacterOfUserName);

	var sizeOfRedirectionCriteria = redirectionCriteriaOnLoad.length;
	var index = 0;
	for (; index < sizeOfRedirectionCriteria;  ++index)
	{
		var redirectionCriteria = redirectionCriteriaOnLoad[index];
		var lengthOfString = redirectionCriteria.length;
		var breakThisLoop = false;

		for (i = 0; i < lengthOfString; ++i)
		{
			var tempChar = redirectionCriteria.charAt(i);
			if (firstCharacterOfUserName == tempChar)
			{
				redirectionCode = index;
				breakThisLoop = true;
				
				//alert("The first character was found in [ "+redirectionCriteria+" ]");				
				break;
			}
		}

		if (breakThisLoop)
		{
			break;
		}
		
	}

	if (redirectionCode != -1)
	{
		//alert("redirecting the login request to this URL: - "+redirectionURLOnLoad[redirectionCode]);
		var redirectURL = redirectionURLOnLoad[redirectionCode];
		redirectURL = redirectURL + "?LBAL=R"+redirectionCode;
		return redirectURL;
		
	} else {
		//alert("Oops!!! Sorry the redirection criteria Failed ... hence redirecting to the original site "+redirectionURLOnLoad[0]);
		var redirectURL = redirectionURLOnLoad[0];
		redirectURL = redirectURL + "?LBAL=R0";
		return redirectURL;
		
	}

}
<!--Drop down dynamic text links-->

function doIt(objval)
{
document.getElementById("notification").innerHTML=myarr[objval]
}
function changeIt() {
 var dd = document.getElementById("service");
 var index = dd.selectedIndex;
 var value = dd.options[index].value;
 doIt(value);
}


myarr=new Array()
myarr[2]="<div style=\"margin-right:20px; display:inline;\"><a href=\"client_management.htm\">Forgot your details ?</a></div> <div style=\"display:inline;\"><a href=\"sales.htm\">How to subscribe ?</a></div>"
myarr[1]="<div><a href=\"http://www.barbour-abi.com/onlineservices/ForgotLoginCredentials.do?portalId=1&dp=1\">Recover Username / Password </a></div>"

// Start of Changes for CR155
function changeVisibilityOfCheckBox(objVal) {

	doIt(objVal);
	var serviceIdIndex = document.login.service.options.selectedIndex;
	var serviceOptionId = document.login.service.options[serviceIdIndex];
	var child  = document.getElementById('keepMeLoggedInChkBox');

	//alert(serviceOptionId.value);

	if (serviceOptionId.value == '2') {
		hideCheckBox();
	} else {
		// alert(child);
		if (child == null)
		{
			unhideCheckBox();
		}
		
	}
}

function hideCheckBox() {
	var parent = document.getElementById('loginBox');
	var child  = document.getElementById('keepMeLoggedInChkBox');
	parent.removeChild(child);
}

function unhideCheckBox() {
	var rememberMeCheckBoxElement = document.createElement('dd');
	rememberMeCheckBoxElement.setAttribute('id','keepMeLoggedInChkBox');
	rememberMeCheckBoxElement.setAttribute('class','checkBox');
	rememberMeCheckBoxElement.innerHTML = '<label for="rememberUser">Log me in for the day</label> <input type="checkbox" name="rememberUser" id="rememberUser"/>';
	var submitBtn = document.getElementById('submitBtn');
	var parent = document.getElementById('loginBox');
	parent.insertBefore(rememberMeCheckBoxElement, submitBtn);

}
// End of Changes for CR155
  
  
