
function home_roll(inputObj){

		var menuItem = inputObj;
		if('home_on' == document.getElementById(menuItem).className){
			
			document.getElementById(menuItem).className = 'homeOff';
			
			
		}else{
			
			document.getElementById(menuItem).className = 'home_on';
			
			
		}
		
		
}

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 to clear text from a form text input*/
function clearText(formElement) {
	if (formElement.value == 'Search') formElement.value = '';
}


//**function to show subnavigation*/
function showMenu(id) {
	var subNavigation = document.getElementById(id);
	if (subNavigation != null) {
		hideMenus();
		subNavigation.className = 'subNavigationShow';
	}
}

/**function to hide all navigation menus*/
function hideMenus() {
	document.getElementById('productNavigation').className = 'subNavigation';
	document.getElementById('applicationsNavigation').className = 'subNavigation';
	document.getElementById('supportNavigation').className = 'subNavigation';
	document.getElementById('technologyNavigation').className = 'subNavigation';
}


/** function to swap classNames*/

function swapClass(element, classname) {
	
	document.getElementById(element).className = classname;
	
}

/** function to return a flash movie object */
function getFlashMovieObject(movieName)
    {
        if (window.document[movieName])
        {
            return window.document[movieName];
        }
        if (navigator.appName.indexOf("Microsoft Internet") == -1)
        {
            if (document.embeds && document.embeds[movieName])
                return document.embeds[movieName];
        }
        else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
        {
            return document.getElementById(movieName);
        }
    }
  
 
function handleTabClick(tab, color, url) {
// get mainTabBar and set color
var tabBar = document.getElementById('mainTabBar');
tabBar.className = 'mainTabBar_' + color;

// change selected tab to color
var selectedTab = document.getElementById('tab' + tab);
selectedTab.className= color + '_tab';

var strapLineImage = document.getElementById('straplineImage');
strapLineImage.src = '/wwlf2-web-1-0-SNAPSHOT/images/strapline_' + color + '.gif';

// change other tabs to off
for (var i=1; i <=3; i++) {
if ( i != tab) {
	var  t = document.getElementById('tab' + i);
	t.className = 'tab_off';
}
}
}

function handleTabMouseOver(tab ) {
// get mainTabBar and set color
var t = document.getElementById('tab' + tab );
if (t.className == 'tab_off') {
t.className = 'tab_on';
} 
}

function handleTabMouseOut(tab ) {
// get mainTabBar and set color
var t = document.getElementById('tab' + tab);
if (t.className == 'tab_on') {
t.className = 'tab_off';
} 
}

function popup(url, name, features) {
window.open(url, name, features);
}

function submitVacancyApply() {
	document.getElementById('vacancyApply').submit()
}
function validateFormOnSubmit(theForm) {
				
		var reason = "";
				
			reason += validatefirstname(theForm.firstname);
			reason += validatelastname(theForm.lastname);
			reason += validateorganisation(theForm.organisation);
			reason += validateaddress1(theForm.address1);
			reason += validatecity(theForm.city);
			reason += validatecountystate(theForm.countystate);
			reason += validatepostcode(theForm.postcode);
			reason += validatetelephone(theForm.telephone);
			reason += validatefax(theForm.fax);

			if (reason != "") {
				 
				alert("Some fields need correction:\n" + reason);

				    return false;
					
				}else{
				
				    return true;
				
			}
				
}

			function validatefirstname(fld) {
				    var error = "";
				
				    if (fld.value.length == 0) {
				        fld.style.background = '#FDD6B2';
				        error = "First name has not been completed.\n"
				    } else {
				        fld.style.background = 'White';
				    }
				    return error;
				}
								

			function validatelastname(fld) {
				    var error = "";
				
				    if (fld.value.length == 0) {
				        fld.style.background = '#FDD6B2';
				        error = "Last name has not been completed.\n"
				    } else {
				        fld.style.background = 'White';
				    }
				    return error;
				}

			function validateorganisation(fld) {
				    var error = "";
				
				    if (fld.value.length == 0) {
				        fld.style.background = '#FDD6B2';
				        error = "Organisation/company has not been completed.\n"
				    } else {
				        fld.style.background = 'White';
				    }
				    return error;
				}
								
			function validateaddress1(fld) {
				    var error = "";
				
				    if (fld.value.length == 0) {
				        fld.style.background = '#FDD6B2';
				        error = "Address 1 has not been completed.\n"
				    } else {
				        fld.style.background = 'White';
				    }
				    return error;
				}

			function validatecity(fld) {
				    var error = "";
				
				    if (fld.value.length == 0) {
				        fld.style.background = '#FDD6B2';
				        error = "City has not been completed.\n"
				    } else {
				        fld.style.background = 'White';
				    }
				    return error;
				}
				
			function validatecountystate(fld) {
				    var error = "";
				
				    if (fld.value.length == 0) {
				        fld.style.background = '#FDD6B2';
				        error = "County/State has not been completed.\n"
				    } else {
				        fld.style.background = 'White';
				    }
				    return error;
				}
				
			function validatepostcode(fld) {
				    var error = "";
				
				    if (fld.value.length == 0) {
				        fld.style.background = '#FDD6B2';
				        error = "Postcode has not been completed.\n"
				    } else {
				        fld.style.background = 'White';
				    }
				    return error;
				}
				

				
			function validatetelephone(fld) {
				    var error = "";
				
				    if (fld.value.length == 0) {
				        fld.style.background = '#FDD6B2';
				        error = "Telephone has not been completed.\n"
				    } else {
				        fld.style.background = 'White';
				    }
				    return error;
				}
				
			function validatefax(fld) {
				    var error = "";
				
				    if (fld.value.length == 0) {
				        fld.style.background = '#FDD6B2';
				        error = "Fax has not been completed.\n"
				    } else {
				        fld.style.background = 'White';
				    }
				    return error;
				}



			function submitParametricSearchForm() {
				  	var hidden = document.getElementById('parametricsearch_searchSubmitted');
					if (hidden != null) {
						hidden.value = false;
					}
				 	document.getElementById('parametricsearch').submit();
			}
				

			function submitCategoryParametricSearchForm() {
					
					document.getElementById('category').selectedIndex= -1;
					submitParametricSearchForm();
					

			}				
				
				
			function populateSubCategories(id) {
				window.location="/prepareParametricSearch.action?categoryId="+id;
			}					
				
			function populateBringFormUpOnScreen(id,subCategoryId) {
				window.location="/prepareParametricSearch.action?categoryId="+id+"&subCategoryId="+subCategoryId;
			}					
				
				
				
				

			function submitParametricSearchForm() {
			var hidden = document.getElementById('parametricsearch_searchSubmitted');
			if (hidden != null) {
			hidden.value = false;
			}
			 document.getElementById('parametricsearch').submit();
			}
			
			function validateEmail(theForm) {
				var reason = "";
				reason += validateEmail(document.getElementById(theForm).email);
				if (reason != "") {
					alert("Please check your details.\n" + reason);
				} else {
					document.getElementById(theForm).submit();
				}
			}
			function trim(s) {
				return s.replace(/^\s+|\s+$/, "");
			}
			function validateEmail(fld) {
				alert = "email = " + fld;
				var error = "";
				var tfld = trim(fld.value);                        // value of field with whitespace trimmed off
				var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/;
				var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/;
				if (fld.value == "") {
					fld.style.background = "RED";
					error = "You didn't enter an email address.\n";
				} else {
					if (!emailFilter.test(tfld)) {              //test email for illegal characters
						fld.style.background = "RED";
						error = "Please enter a valid email address.\n";
					} else {
						if (fld.value.match(illegalChars)) {
							fld.style.background = "RED";
							error = "The email address contains illegal characters.\n";
						} else {
							fld.style.background = "White";
						}
					}
				}
				return error;
}


function submitParametricSearchForm() {
	var hidden = document.getElementById("parametricsearch_searchSubmitted");
	if (hidden != null) {
		hidden.value = false;
	}
	document.getElementById("parametricsearch").submit();
}
function submitResourceCentreForm() {
	var hidden = document.getElementById("resourceCentre_performSearch");
	if (hidden != null) {
		hidden.value = true;
	}
	document.getElementById("resourceCentre").submit();
}
function handleResourceChange() {
	var resource = document.getElementById("resCentre_selectedResources");
	var button = document.getElementById("submitButton");
	var index = resource.selectedIndex;
	if (index != -1) {
		button.src = "/images/resourcecenter/resource_find.gif";
		button.disabled = false;
	} else {
		button.src = "/images/resourcecenter/resource_find_off.gif";
		button.disabled = true;
	}
}
function handleInvestorResourceChange() {
	var resource = document.getElementById("investorResourceCentre_selectedResources");
	var button = document.getElementById("submitButton");
	var index = resource.selectedIndex;
	if (index != -1) {
		button.src = "/images/resourcecenter/resource_find.gif";
		button.disabled = false;
		if (isPressSelected(resource)) {
			var newsInfo = document.getElementById("newsInfo");
			if (newsInfo != null) {
				newsInfo.style.display = "block";
			}
		} else {
			var newsInfo = document.getElementById("newsInfo");
			if (newsInfo != null) {
				newsInfo.style.display = "none";
			}
		}
	} else {
		button.src = "/images/resourcecenter/resource_find_off.gif";
		button.disabled = true;
	}
}
function isPressSelected(opt) {
	var selected = new Array();
	var index = 0;
	var isSelected = false;
	for (var intLoop = 0; intLoop < opt.length; intLoop++) {
		if (opt[intLoop].selected && opt[intLoop].value == "News") {
			isSelected = true;
		}
	}
	return isSelected;
}

function centeredpopup(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}

function changeHighlights() {

	var dropDown = document.getElementById('sheet');
	//alert("1" + dropDown.value);
	if (dropDown != null) {
		//var selectedOption = dropdown.value;
		//alert("2" + selectedOption.value);
		//alert("3" + dropDown.value);
		window.location = dropDown.value;
	}

}