// Dropdown function overrides

function RecruitR() { }

// Close (conditionally)
RecruitR.ddCvx = function(strIdn) {
	strId = 'dm_' + strIdn;
	$(strId).dmEnable = 0;
	setTimeout('RecruitR.cVis(\'dm_'+strIdn+'\',$(\''+strId+'\').dmEnable)',100);
}

RecruitR.cVis = function(strId, dmx) {
	if (dmx != 1) { 
		var objTgt = $(strId);
		if (objTgt._hasIframe == 1) objTgt._iframe.style.display='none';
		objTgt.style.display='none';
	}
}
// Open DD
RecruitR.ddOvx = function(strIdn) {
	strId = 'dm_'+strIdn;
	strTopId = 'ml_'+strIdn;
	var objTgt = $(strId);
	objTgt.dmEnable = 1;
	objTgt.style.top=(findPosY($(strTopId)) + $(strTopId).offsetHeight + 1) + "px";
	objTgt.style.left=findPosX($(strTopId)) + "px";
	objTgt.style.display='block';
	if (document.selection) {
		// IE IFRAME underlay trick
		if (objTgt._hasIframe != 1) {
			var iFrame = document.createElement('IFRAME');
			iFrame.className = 'dd_iframe_underlay';
			iFrame.frameBorder = 'no';
			iFrame.style.display = 'none';
			iFrame.style.top = objTgt.style.top;
			iFrame.style.left = objTgt.style.left;
			iFrame.style.width = objTgt.offsetWidth + 'px';
			iFrame.style.height = objTgt.offsetHeight + 'px';
			objTgt._iframe = iFrame;
			objTgt.parentNode.appendChild(iFrame);
			objTgt._hasIframe = 1;
		}
		objTgt._iframe.style.display='block';
	}
}
// Sustain DD
RecruitR.ddSvx = function(strIdn) {
	strId = 'dm_'+strIdn;
	$(strId).dmEnable = 1;
}


RecruitR.subIndustriesArray = new Array(
	new Array(
		new Array("276","Architecture"),
		new Array("548","Architecture &amp; Interior Design"),
		new Array("545","Building and Construction"),
		new Array("277","CAD/Drafting"),
		new Array("546","Civil Construction"),
		new Array("547","Consulting Engineers"),
		new Array("278","Contracts Administration"),
		new Array("279","Demolishing/Excavating"),
		new Array("280","Estimating"),
		new Array("281","Foreperson/Supervisor"),
		new Array("282","Inspectors"),
		new Array("283","Interior Design"),
		new Array("284","Landscape Architecture"),
		new Array("285","OH &amp; S"),
		new Array("290","Other"),
		new Array("286","Planning"),
		new Array("287","Project Management"),
		new Array("288","Site Management"),
		new Array("289","Surveying")),
	new Array(
		new Array("303","CAD/Drafting"),
		new Array("304","Engineer"),
		new Array("305","Maintenance"),
		new Array("306","Management"),
		new Array("310","Other"),
		new Array("307","Project Manager"),
		new Array("308","Safety Coordinator Officer"),
		new Array("309","Supervisor")),
	new Array(
		new Array("355","Change Management"),
		new Array("356","General HR"),
		new Array("357","Industrial Relations"),
		new Array("358","Management"),
		new Array("359","OH &amp; S"),
		new Array("362","Other"),
		new Array("360","Recruitment Consultant"),
		new Array("361","Training &amp; Development")),
	new Array(
		new Array("419","Drilling"),
		new Array("420","Environ./Health &amp; Safety"),
		new Array("421","Geoscience"),
		new Array("422","Management"),
		new Array("423","Mining: Eng. &amp; Maintenance"),
		new Array("424","Mining: Mineral Processing"),
		new Array("425","Mining: Production"),
		new Array("426","Oil &amp; Gas: Eng. &amp; Maintenance"),
		new Array("427","Oil &amp; Gas: Exploration"),
		new Array("428","Oil &amp; Gas: Maintenance"),
		new Array("429","Oil &amp; Gas: Production"),
		new Array("430","Other")),
	new Array(
		new Array("468","Chemist"),
		new Array("469","Environmental Science"),
		new Array("470","Laboratory"),
		new Array("475","Other"),
		new Array("471","QA"),
		new Array("472","Research"),
		new Array("473","Scientist"),
		new Array("474","Technical")),
	new Array(
		new Array("482","Air Con./Refrigeration"),
		new Array("483","Automotive Trades"),
		new Array("484","Baker/Butcher/Grocer"),
		new Array("485","Beauty Therapy"),
		new Array("486","Boilermaking/Welding"),
		new Array("487","Bricklaying"),
		new Array("488","Carpentry/Cabinet Making"),
		new Array("489","Cleaning"),
		new Array("490","Electrician"),
		new Array("491","Florist"),
		new Array("492","Gardening/Landscaping"),
		new Array("493","Hairdressing"),
		new Array("494","Labourer"),
		new Array("495","Maintenance/Handyperson"),
		new Array("496","Nanny/Babysitting"),
		new Array("502","Other"),
		new Array("497","Painting"),
		new Array("498","Plumbing"),
		new Array("499","Printing"),
		new Array("500","Security"),
		new Array("501","Technician")));

RecruitR.al_changeIndustry = function() {
	$('al_subindustry').options.length = 1;
	var industryIndex = $('al_industry').selectedIndex - 1
	$('al_subindustry').options.length = RecruitR.subIndustriesArray[industryIndex].length + 1;
	for(i = 0; i< RecruitR.subIndustriesArray[industryIndex].length; i++) {
		$('al_subindustry').options[i + 1].value = RecruitR.subIndustriesArray[industryIndex][i][0];
		$('al_subindustry').options[i + 1].text = RecruitR.subIndustriesArray[industryIndex][i][1];
	}
}

RecruitR.al_createIFrame = function(frameURL) {

	var frameURLParameters = encodeURI("?newSearch=true&applySearchCriteria=true&job_type_id=ANY&time_interval_id=ALL&recruiterId=828&storeId=1&regionId=ANY");

	urlElements = String(document.location).split('?');
	
	if(urlElements.length > 0) {
	
		urlVariables = urlElements[1].split('&');
	
		for(i = 0; i <= urlVariables.length - 1; i++) {
			urlVariablePair = urlVariables[i].split('=');
			if(urlVariablePair.length > 0) {
				switch(urlVariablePair[0])
				{
					case "al_keywords":
						frameURLParameters += encodeURI("&keyword=" + urlVariablePair[1]);
						break;    
					case "al_industry":
						frameURLParameters += encodeURI("&industryId=" + urlVariablePair[1]);
						break;
					case "al_subindustry":
						frameURLParameters += encodeURI("&subIndustryId=" + urlVariablePair[1]);
						break;    
					case "al_region":
						frameURLParameters += encodeURI("&subRegionId=" + urlVariablePair[1]);
						break;
				}
			}	
			
		}
		
	}
	document.write('<iframe src="' + frameURL + frameURLParameters + '" id=' + '"frame_01' + '" />');
}