function highlighttab(id) {
 document.getElementById(id).style.backgroundImage="url(/images/left_coloumn_navigation/navigation_container_bg.jpg)";
}
	
function unhighlighttab(id2) {
 document.getElementById(id2).style.backgroundImage="url(/images/transparentClicker.gif)";
}

// JavaScript Document
	var myRotatingImage= new Array();
	myRotatingImage[0] = "/images/homepage_banners/derby_new.jpg";
	myRotatingImage[1] = "/images/homepage_banners/derby_old.jpg";
	myRotatingImage[2] = "/images/homepage_banners/lincoln_new.jpg";
	myRotatingImage[3] = "/images/homepage_banners/lincoln_old.jpg";
	myRotatingImage[4] = "/images/homepage_banners/mansfield_new.jpg";
	myRotatingImage[5] = "/images/homepage_banners/mansfield_old.jpg";
	myRotatingImage[6] = "/images/homepage_banners/newark_new.jpg";
	myRotatingImage[7] = "/images/homepage_banners/newark_old.jpg";
	myRotatingImage[8] = "/images/homepage_banners/nottingham_new.jpg";
	myRotatingImage[9] = "/images/homepage_banners/nottingham_old.jpg";
	myRotatingImage[10] = "/images/homepage_banners/derby_new.jpg";

	var	myLocation= new Array();
	myLocation[0] = "DERBY";
	myLocation[1] = "DERBY";
	myLocation[2] = "LINCOLN";
	myLocation[3] = "LINCOLN";
	myLocation[4] = "MANSFIELD";
	myLocation[5] = "MANSFIELD";
	myLocation[6] = "NEWARK";
	myLocation[7] = "NEWARK";
	myLocation[8] = "NOTTINGHAM";
	myLocation[9] = "NEWARK";
	myLocation[10] = "DERBY";

var currentImage = 0
var currentLocation = 0
var randomnumber 
var randomnumber2 

function displayrandomImages() {
	setInterval("changeImage()",3000);
	setInterval("imagerandomiser()",3000);
	setTimeout("triggerImage2()", 3000);
}

function imagerandomiser() {
	randomnumber=Math.floor(Math.random()*9);
	randomnumber2=randomnumber+1;
}

function triggerImage2() {
	setInterval("changeImage2()",3000)
}

function changeImage() {
	var checkToFadeInOurOut = '';
	if (checkToFadeInOurOut == '') {
	  $("#rotatingimageholder").fadeOut(3000, function() {   
      document.getElementById('rotatingimageholder').style.backgroundImage="url(" + myRotatingImage[randomnumber] + ")";
    	$("#locationImage").fadeOut(0);
	    $("#locationImage").fadeIn(3000);
      document.getElementById('locationImage').innerHTML =  myLocation[randomnumber];
    });
	  checkToFadeInOurOut = 0;
	}
	
	if (checkToFadeInOurOut == 0) {		
	  $("#rotatingimageholder").fadeIn(3000);
	  checkToFadeInOurOut = '';
	}	
}

// The below images will radomly appear after an timeout of five seconds with an interval of three seconds
function changeImage2() {
	var checkToFadeInOurOut = '';
	if (checkToFadeInOurOut == '') {
	  $("#rotatingimageholder2").fadeOut(3000, function() {   
      document.getElementById('rotatingimageholder2').style.backgroundImage="url(" + myRotatingImage[randomnumber2] + ")";
	    $("#locationImage").fadeOut(0);
	    $("#locationImage").fadeIn(3000);
	    document.getElementById('locationImage').innerHTML =  myLocation[randomnumber2];
    });
	  checkToFadeInOurOut = 0;
	}

	if (checkToFadeInOurOut == 0) {	
	  $("#rotatingimageholder2").fadeIn(3000);
	  checkToFadeInOurOut = '';
	}
}
		
	//Effect.Appear('rotatingimageholder', { duration: 2.0 });
	//document.write(mycars[i] + "<br />");
	//document.getElementById('rotatingimageholder').style.backgroundImage="url(" + myRotatingImage[i] + ")"
	//setInterval(document.getElementById('rotatingimageholder').style.backgroundImage="url(" + myRotatingImage[i] + ")", 5000)
	
	/*if (i == myRotatingImage.length)
	{
	i = 0
		}*/

 //Effect.Fade('hdrNavList', {duration:9999, from:1.0, to:0.0})

function displayCVUploader(hideLink) {
  document.getElementById('attachmentBrowse').style.display= "";
  document.getElementById(hideLink).style.display= "none";
}

var obj = '';
var obj2 ='';
function closerelevantbox(objpassed, obj2passed) {
	obj = document.getElementById(objpassed);
	obj2 = document.getElementById(obj2passed);
}

document.onclick=check; 
function check(e){ 
	if (obj != '') {
	  var target = (e && e.target) || (event && event.srcElement); 
	  checkParent(target)?obj.style.display='none':null; 
	  target==obj2?obj.style.display='block':null;
	}
} 

function checkParent(t){ 
	while(t.parentNode){ 
	  if(t==document.getElementById(obj)){ 
	    return false 
	  } 
	  t=t.parentNode 
	} 
	return true 
}
	
function hideSelfPicker(hidecloseclicker) {
	document.getElementById(hidecloseclicker).style.display='none';	
}
	
function displaycandidatedropdown(nameOfMenu, hidemenu1) {
	document.getElementById(nameOfMenu).style.display='';
	document.getElementById(hidemenu1).style.display='none';
}	

function candidatestypeSelector(selectJobType, Numbers) {
	document.candidateSearch.searchContractActualValue.value = selectJobType;
	if (selectJobType == 'Both') {		
	  document.candidateSearch.contract.value = '';
	} else {
	  document.candidateSearch.contract.value = Numbers;
	}
	document.getElementById('candidatestypeDropDown').style.display='none';
}
		
function candidatesfullpartSelector(selectFullOrPart) {
	document.candidateSearch.candidateshours.value = selectFullOrPart;
	if (selectFullOrPart == 'Both') {		
	  document.candidateSearch.candidateshours.value = '';
	} else {
	  document.candidateSearch.candidateshours.value = selectFullOrPart;
	}
	document.getElementById('candidatesfulltimeparttimeeDropDown').style.display='none';
}

function displaydropdown(nameOfMenu, hidemenu1, hidemenu2, hidemenu3, displaycloseclicker) {	
  $( "#" + nameOfMenu).fadeIn(300);
	//document.getElementById(nameOfMenu).style.display='';
	document.getElementById(hidemenu1).style.display='none';
	document.getElementById(hidemenu2).style.display='none';
	document.getElementById(hidemenu3).style.display='none';
	document.getElementById(displaycloseclicker).style.display='';
}

function titleSelector(selecttitle, selectvalue) {
	document.SearchBox.searchActualTitle.value = selecttitle;
	if (selecttitle == 'All Jobs') {		
	  document.SearchBox.keywords.value = '';
	} else {
	  document.SearchBox.keywords.value = selectvalue;
	}
	document.getElementById('titleDropDown').style.display='none';
}

function locationSelector(selectlocation, locationID) {
	document.SearchBox.regions.value = '';
	document.SearchBox.searchLocationActualValue.value = selectlocation;
	if (selectlocation == 'All regions') {		
	  document.SearchBox.location.value = '';
	} else {
	  document.SearchBox.location.value = locationID;
	}
	document.getElementById('locationDropDown').style.display='none';
}

function regionSelector(selectRegion, idofRegion) {
	document.SearchBox.location.value = '';
	document.SearchBox.searchLocationActualValue.value = selectRegion;
	if (selectRegion == 'All regions') {		
	  document.SearchBox.regions.value = '';
	} else {
	  document.SearchBox.regions.value = idofRegion;
	}
	document.getElementById('locationDropDown').style.display='none';
}

function typeSelector(selectJobType, Numbers) {
	document.SearchBox.searchContractActualValue.value = selectJobType;
	if (selectJobType == 'Both') {		
	  document.SearchBox.contract.value = '3';
	} else {
	  document.SearchBox.contract.value = Numbers;
	}
	document.getElementById('typeDropDown').style.display='none';
}
		
function fullpartSelector(selectFullOrPart, selectFullOrPartID) {
	document.SearchBox.searchPermanentorTempActualValue.value = selectFullOrPart;
	if (selectFullOrPart == 'Both') {		
	  document.SearchBox.permanentOrTemp.value = '5';
	} else {
	  document.SearchBox.permanentOrTemp.value = selectFullOrPartID;
	}
	document.getElementById('fulltimeparttimeeDropDown').style.display='none';
}

function panelHighlight(idofPanel) {
	document.getElementById(idofPanel).style.backgroundColor ='#ADACAC';
	document.getElementById(idofPanel).style.borderColor ='#FFFFFF';
	//document.getElementById(idofPanel + 'Bottom').style.color ='#4E4E4E';
}
	
function panelUnhighlight(idofPanel) {
	document.getElementById(idofPanel).style.backgroundColor ='';
	document.getElementById(idofPanel).style.borderColor ='#6DC069';
	//document.getElementById(idofPanel + 'Bottom').style.color ='#6DC069';
}
	
function panelHighlight2(idofPanel) {
	document.getElementById(idofPanel).style.backgroundColor ='#ADACAC';
	document.getElementById(idofPanel).style.borderColor ='#FFFFFF';
	document.getElementById(idofPanel + 'Bottom').style.color ='#4E4E4E';
}
	
function panelUnhighlight2(idofPanel) {
	document.getElementById(idofPanel).style.backgroundColor ='';
	document.getElementById(idofPanel).style.borderColor ='#6DC069';
	document.getElementById(idofPanel + 'Bottom').style.color ='#6DC069';
}

function changeContainerToShowBg(idOfContainer) {
	document.getElementById(idOfContainer).style.backgroundImage ="url(/images/left_coloumn_navigation/navigation_container_bg.jpg)";
}
	
function changeContainerToHideBg(idOfContainer) {
	document.getElementById(idOfContainer).style.backgroundImage ="";
}

function Displayonlythismenu(menu1, menu2, menu3) {
	document.getElementById(menu1).style.display ='none';
	document.getElementById(menu2).style.display ='none';
	document.getElementById(menu3).style.display ='none';
}

function closeAlldropoutmenus(menu1, menu2, menu3, menu4) {
	document.getElementById(menu1).style.display ='none';
	document.getElementById(menu2).style.display ='none';
	document.getElementById(menu3).style.display ='none';
	document.getElementById(menu4).style.display ='none';
}

function shownDropOutMenu(nameofMenu, triggerfade) {
	//document.getElementById(nameofMenu).style.display ='';
	if (triggerfade == 'Yes') {
	  $( "#" + nameofMenu).fadeIn(150);
	}
	//var idcollector = "#" + nameofMenu
}

function hideDropOutMenu(nameofMenu, positionfromTopOfMenu) {
	document.getElementById(nameofMenu).style.display ='none';
}
	
function submitOfficelocationForm(nameOfLocation) {
	//document.SearchBox.action = '/jobs/office_locations.asp?location='+ nameOfLocation +'';
	document.SearchBox.action = '/jobs/job_search_results.asp';
	document.SearchBox.submit();
}	

function submitSearchForm() {
	document.SearchBox.action = '/jobs/job_search_results.asp';
	document.SearchBox.submit();
}
	
function highlightOffice(HighlightAppropriateOffice) {
	document.getElementById(HighlightAppropriateOffice).style.backgroundColor='#6dc069';
}	
	
function unhighlightOffice(HighlightAppropriateOffice) {
	document.getElementById(HighlightAppropriateOffice).style.backgroundColor='';
}	