

	// function to position the footer content
	function funcBeginJavaScript ()
	{
		if ((typeof positionScriptLoaded == 'number') && (typeof highlightScriptLoaded  == 'number'))
		{ 
//			funcPositionFooter ();
			funcHighlightText ();		
		}
		else setTimeout("funcBeginJavaScript()",500);
	}


	// function to position the footer
	var positionFooterCount = 0;
	function funcPositionFooter ()
	{
		var contentDiv = document.getElementById("content");
		var footerDiv = document.getElementById("footer");
		var windowHeight = (window.innerHeight)? window.innerHeight : document.body.clientHeight;
		var tmp = contentDiv.offsetTop+contentDiv.offsetHeight+20;
		if (tmp+footerDiv.offsetHeight > windowHeight) footerDiv.style.top = tmp;
		else footerDiv.style.top = windowHeight - footerDiv.offsetHeight;

		// fix to reposition after every second for first 30 seconds
		positionFooterCount++;
		if (positionFooterCount < 30) { setTimeout("funcPositionFooter ()", 1000) }
	}



	function submitOptionForm() { if (document.applicationForm.action.value != "") return true; else return false; }
	function optionFormAction(action) 
	{
		if (action == "printer") { printerVersion (); return; }
		else if ((action == "shortlist") && (previousShortlist))
		{
			if (!confirm ("You have already shortlisted this job!\nShortlisting this job again will move it to the top of your shortlist.\nAre your sure you want to shortlist this job again?")) { return true; }
		}
		else if (action == "apply")
		{
			if (previousApplication) { if (!confirm ("You have already applied for this job!\nAre your sure you want to apply again?")) { return false; } }
			if (eecRequired) { if (!confirm ("Only applications from candidates that are authorised to work in the EEC will be accepted.\nPress cancel if you are not authorised to work in the EEC")) { return false; } }
		}
		var appForm = document.getElementById('applicationForm');
		var appFormAction = document.getElementById('applicationFormAction');
		appFormAction.value = action;
		return true;
	}

	function externalApplication(id)
	{
		window.open("/affiliates/job-redirect.html?id="+id);
		return false;
	}

	function printerVersion ()
	{
		// if check the url for variables
		var qs = location.search.substring(1);
		var nv = qs.split('&');
		var url = new Object();
		for(i = 0; i < nv.length; i++)
		{
			eq = nv[i].indexOf('=');
			url[nv[i].substring(0,eq).toLowerCase()] = unescape(nv[i].substring(eq + 1));
		}
		 
		if (typeof(url.printable) != "undefined"){ alert ("This is the printable page");}
		else
		{
			if (location.search.substring(0)) vURL = window.location + "&printable=true";
			else vURL = window.location + "?printable=true";
			window.open (vURL);
		}	
	}	

	// function to control the search forms
	function directorySearchForm (thisButton)
	{
		if (thisButton.value == "product") { document.searchForm.location_list.disabled = true; }
		else { document.searchForm.location_list.disabled = false; }
	}

	// recruiter option form actions
	function optionFormActionRec(action, candidateID, highlightKeywords) 
	{
		if (action == "shortlist")
		{
			document.shortlistForm.candidate.value = candidateID; 
			document.shortlistForm.submit(); 
		}
		else if (action == "email")
		{
			document.emailForm.candidate.value = candidateID; 
			document.emailForm.submit(); 
		}
		else if (action == "preview")
		{

			// create the preview url
			var url = "/recruiters/preview-cv.html?id="+candidateID+"&highlight="+highlightKeywords;
			
			// set the new window to the centre of the screen
			var size = new Object();
			size.x = screen.width;
			size.y = screen.height;
			var width = 590;
			var height = size.y - 200;
			var xpos = ((size.x / 2) - (width / 2));
			var ypos = ((size.y / 2) - (height / 2));

			// fix for low resolutions
			if (xpos < 0){ xpos = 0; }
			if (ypos < 0){ ypos = 0; }

			var win_options = ("left="+xpos+",top="+ypos+",width="+width+",height="+height+",resizable=yes,menubar=no,scrollbars=yes");
			newWindow = window.open(url, "preview_cv", win_options);
			newWindow.focus();
			return;

		}
		else if (action == "download")
		{
			document.downloadForm.candidate.value = candidateID; 
			document.downloadForm.submit(); 
		}
		else if (action == "notes")
		{

			// create the preview url
			var url = "/recruiters/notes.html?id="+candidateID;
			
			// set the new window to the centre of the screen
			var size = new Object();
			size.x = screen.width;
			size.y = screen.height;
			var width = 590;
			var height = 360;
			var xpos = ((size.x / 2) - (width / 2));
			var ypos = ((size.y / 2) - (height / 2));

			// fix for low resolutions
			if (xpos < 0){ xpos = 0; }
			if (ypos < 0){ ypos = 0; }

			var win_options = ("left="+xpos+",top="+ypos+",width="+width+",height="+height+",resizable=yes,menubar=no,scrollbars=yes");
			newWindow = window.open(url, "notes", win_options);
			newWindow.focus();
			return;
		}
		else if (action == "getEmail") {
			
			// create the preview url
			var url = "/recruiters/email-address.html?id="+candidateID;
			
			// set the new window to the centre of the screen
			var size = new Object();
			size.x = screen.width;
			size.y = screen.height;
			var width = 590;
			var height = 400;
			var xpos = ((size.x / 2) - (width / 2));
			var ypos = ((size.y / 2) - (height / 2));

			// fix for low resolutions
			if (xpos < 0){ xpos = 0; }
			if (ypos < 0){ ypos = 0; }

			var win_options = ("left="+xpos+",top="+ypos+",width="+width+",height="+height+",resizable=yes,menubar=no,scrollbars=yes");
			newWindow = window.open(url, "notes", win_options);
			newWindow.focus();
			return;
		}
	}


	function jumpTo()
	{ 
		var newIndex = document.jumpForm.jumpToSelect.selectedIndex; 
		if ( newIndex > 0 )
		{ 
			cururl = document.jumpForm.jumpToSelect.options[ newIndex ].value; 
			window.location.assign( cururl );
		}
		return false;
	} 

	function funcCFC(checksum) {
		formChkDiv = document.getElementById('formChk');
		formChkDiv.innerHTML = '<input '+'type="hidden" '+'value="'+checksum+'" name="'+'cfc'+'" />';
	}

	function funcDeleteJobs() {
		if (confirm("Are you sure you want to delete the selected jobs?")) { document.deleteForm.submit(); }
		else return false;
	}

	function funcHomeFlash() {
		document.write(
			"<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"900\" height=\"225\" id=\"menu\" align=\"middle\">"+
			"<param name=\"allowScriptAccess\" value=\"sameDomain\" />"+
			"<param name=\"movie\" value=\"/images/flash/menu.swf\" />"+
			"<param name=\"quality\" value=\"high\" />"+
			"<param name=\"bgcolor\" value=\"#ffffff\" />"+
			"<param name=\"wmode\" value=\"transparent\" />"+
			"<embed src=\"/images/flash/menu.swf\" quality=\"high\" bgcolor=\"#ffffff\" wmode=\"transparent\" width=\"900\" height=\"225\" name=\"menu\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />"+
			"</object>"		
			);
	}
	
	function funcSearchBoxKeywords() {
		var searchBoxKeywords = document.getElementById('srcBoxKeywords');
		if (searchBoxKeywords.value == 'Job Title (ie. engineer)') { searchBoxKeywords.value = ''; }
	}

	function funcHomeRes(n) {
		var homeResBlock = document.getElementById('homeResBlock');
		var homeTitlesBlock = document.getElementById('homeTitlesBlock');
		if (n == 1) {
			homeResBlock.style.display = 'block';
			homeTitlesBlock.style.display = 'none';
		} else {
			homeResBlock.style.display = 'none';
			homeTitlesBlock.style.display = 'block';			
		}
	}

	// variable so we know this has loaded
	// this should always be the last line of this script
	var positionScriptLoaded = 1;

	// make sure we are not in a frameset
	if (window.parent.location != window.location) window.parent.location = window.location;
