
 //----add by wilson for sector-subsector mapping
 var Individual_Site_Location = '';
 
 var BF_Text ='(All Jobs)';
 var BF_Value ='-1';
 
 var BF_Account_Text = '(All Jobs)|Compliance / Risk Management|Credit|Financial Accounting|Regulatory Reporting|Management Accounting / Reporting|Financial / Business Analysis|Internal Audit|Fund Accounting|Consulting|Acquisition Finance|Others';
 var BF_Account_Value = 'bf1|1|2|3|4|5|6|7|8|9|10|11';
 
 var BF_Insurance_Text ='(All Jobs)|Sales & Distribution (Agency, Bancassurance, Telemarketing)|Agency Administration & Support|Actuarial|Business Development|Supports - Underwriting & Claims|Corporate Marketing|Corporate/Agency Training|Others';
 var BF_Insurance_Value ='bf2|12|13|14|15|16|17|18|19';
 
 var BF_Operations_Text ='(All Jobs)|Associate - Private/Retail Banking|Operation Management/Change Management/ Process Re-engineering|Dealing - FX/MM/Fix Income/Equities|Settlement - Global/Local Settlement - FX, Futures, Equities, Securities|Middle Office / Treasury Operation|Investor Relations|Investment Counsel|Product Development|Others';
 var BF_Operations_Value ='bf3|20|21|22|23|24|25|26|27|28';
 
 var BF_PrivateEquity_Text ='(All Jobs)|Private Equity / Venture Capital';
 var BF_PrivateEquity_Value ='bf4|29';
 
 var BF_IBanking_Text ='(All Jobs)|M & A / Corporate Finance|Origination';
 var BF_IBanking_Value ='bf5|30|31';
 
 var BF_PBanking_Text ='(All Jobs)|Client Relations|Financial Planning|Infrastructure|Portfolio Management|Private Client|Product Specialisation|Others';
 var BF_PBanking_Value ='bf6|32|33|34|35|36|37|38';
 
 var BF_AssetManagement_Text ='(All Jobs)|Analyst|CIO|Dealer|Investment Writer|Portfolio Manager|Product Manager|Sales & Client Services|Strategist / Economist|Others';
 var BF_AssetManagement_Value ='bf7|39|40|41|42|43|44|45|46|47';
 
 var BF_Equities_Text ='(All Jobs)|Research|Sales|Sales-Trading|Trading|Others';
 var BF_Equities_Value ='bf8|48|49|50|51|52';
 
 var BF_BankingOthers_Text ='(All Jobs)|Retail Banking|Corporate Banking|IT - Project Management|IT - Business Analyst|IT - System Analyst|IT - Analyst Programmer |IT - Others|HR - Recruitment & Selection|HR - Training & Development|HR - Compensation & Benefits|HR - Employee Relations|HR - Others';
 var BF_BankingOthers_Value ='bf9|53|54|55|56|57|58|59|60|61|62|63|64';
 
 var GI_Text ='(All Jobs)';
 var GI_Value ='-1';
 
 var GI_Sales_Text ='(All Jobs)|Brand / Product Management|Direct Marketing|General / Support|Market Research|Retail|Telesales / Call Center|Business Development|Others';
 var GI_Sales_Value ='gi1|1|2|3|4|5|6|7|8';
 
 var GI_Logistic_Text ='(All Jobs)|Logistic/ Supply Chain|Fulfillment|Inventory / Warehousing|FMCG|Manufacturing/ Trading|Merchandizing/ Procurement|Others';
 var GI_Logistic_Value ='gi2|9|10|11|12|13|14|15';
 
 var GI_Media_Text ='(All Jobs)|Media|Public Relations/ Communication|Event Management|General / Support|Others';
 var GI_Media_Value ='gi3|16|17|18|19|20';

 var GI_Property_Text ='(All Jobs)|Property / Real Estate|Construction Management|Contract Administration|Building Services|Facilities & Property Management|Leasing & Valuations|Project Management|Others';
 var GI_Property_Value ='gi4|21|22|23|24|25|26|27|28';
 
 var GI_HR_Text ='(All Jobs)|Recruitment & Selection|Training & Development|Compensation & Benefits|Employee Relations|Others';
 var GI_HR_Value ='gi5|29|30|31|32|33';
 
 var GI_Secretary_Text ='(All Jobs)|Customer Services/ Order Processing/ Operation|Office Manager|Administration Assistant / Officer|Receptionist|Secretary|Others';
 var GI_Secretary_Value ='gi6|34|35|36|37|38|39';
 
 var GI_IT_Text ='(All Jobs)|Business Development|Sales Management|Technical Sales / Sales Engineer|Programming|System & Network Specialist|Technical Support|Software Testing|Product Management|Project Management|Technical / Functional Consulting|Others';
 var GI_IT_Value ='gi7|40|41|42|43|44|45|46|47|48|49|50';
 
 var GI_Engineering_Text ='(All Jobs)|Electrical / Electronics|Engineering Project Management|Manufacturing & Production|Others';
 var GI_Engineering_Value ='gi8|51|52|53|54';
 
 var LE_Text ='(All Jobs)|General Corporate/Commercial|Pharmaceutical/Biotechnology|Funds/Financial Services|Insolvency/Corporate Recovery/Restructuring|Insurance/Reinsurance|IP/IT/Telecoms|Litigation|Arbitration|Projects/Project Finance/Energy|Real Estate/Property/Construction|Tax/Trusts|Transport/Shipping/Aviation|Banking & Finance|Capital Markets|Mergers & Acquisitions|International Trade|Policy|Media/Entertainment|Hospitality Management/Hotels|Secretaries/Paralegals';
 var LE_Value ='-1|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|17|18|19|20|21';
 
 var HO_Text ='(All Jobs)|Human Resources|Financial Control / Accounting|Secretary / Administration / Personal Assistant|Customer Services|Sales / Business Development|Marketing / Communication / Public Relationship|Restaurant Management|Event Management|Beverage Management|Catering Sales Management|Reservation|Front Office|Back Office|Housekeeping|Spa & Beauty|Business Center|Engineering|IT|Hotels & Resorts|Travel & Leisure|Entertainment|Others';
 var HO_Value ='-1|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22';
 
 var KA_Text ='(All Jobs)|Banking & Finance|General & Hospitality';
 var KA_Value ='-1|ka1|ka6';
 
 var CH_Text ='(All Jobs)|Accounting / Finance / Internal Audit|Back-Office / Operation / Settlement|Human Resources / Administration & Secretariat / Receptionist|Investment Banking - Corporate Finance / M&A / ECM / DCM / Structured Finance|Investor Relations / Marketing / Public Relations|Middle Office / Risk Management / Product Control / Trade Support|Private Equity / Venture Capital|Research / Analysis|Trading / Dealing / Sales / Fund Management / Client Services|Trust|Banking - Others|Accounting / Finance / Internal Audit|Corporate Finance / Direct Investments / Corporate Strategy|Finance (Commerce & Industry) - Others|Call Centre / Customer Service / Telesales|Design - Product / Graphic / Interior / Fashion|Energy / Chemical / Paper / Material|General Management / Strategic Consultancy|Hotels & Hospitality|Human Resources / Personnel / Recruitment|IT / Telecoms / Media / Internet|Logistics|Manufacturing / Supply Chain / Engineering|Marketing / Marketing Research & Business Development|Merchandising / Sourcing / Procurement / Project Management|Real Estate / Property / Construction|Research & Development|Sales|Secretariat / Clerical / Administration|Taxation / Treasury|Food & Beverages (F&B)|General & IT - Others';
 var CH_Value ='-1|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32';
 
 function ddlSector_change(ddlSector)
 {
	if (ddlSector.selectedIndex >= 0) 
	{
	    var ddlSubSector = document.getElementById('ddlSubSector');
	
	    var text_array=window[ddlSector.options[ddlSector.selectedIndex].value.toString() + "_Text"].split("|");
	    var value_array=window[ddlSector.options[ddlSector.selectedIndex].value.toString() + "_Value"].split("|");
	    
	    removeAllSubSector()
        
	    for (i=0; i<=text_array.length - 1; i++) 
	    {
	        addOption(ddlSubSector,text_array[i],value_array[i])
	    }
	 
	}
 }
 
 function addOption(ddlSubSector, text, value)
 {
	var y=document.createElement('option');
	y.text=text;
	y.value=value;
	try
	{
		ddlSubSector.add(y,null); // standards compliant
	}
	catch(ex)
	{
		ddlSubSector.add(y); // IE only
	}	

 }
 
 function removeAllSubSector()
 {
	var ddlSubSector = document.getElementById('ddlSubSector');
	var i;
	for (i = ddlSubSector.length - 1; i>=0; i--) 
	{
		ddlSubSector.remove(i);		
	}	
 }
 
function setCurrent_location(inCurrent_location)
{
	Individual_Site_Location = inCurrent_location;
}

function searchJob()
{
	var ddlSector = document.getElementById('ddlSector');
	var ddlSubSector = document.getElementById('ddlSubSector');
	var location_array = ddlSector.options[ddlSector.selectedIndex].value.split("_");
	var sLocation = location_array[0];
	var sSpeciality = ddlSubSector.options[ddlSubSector.selectedIndex].value;
	var sPath = "";
	
	// if Individual_Site_Location = '', mean it is from index.aspx
	if (Individual_Site_Location == '')
	{
		if (sLocation == "CH")
		{
			sPath = "http://www.searchasia.com.cn/job_search.aspx";
		}
		else if (sLocation == "LE")
		{
			sPath = "http://recruit-legal.com.hk/job_search.aspx";
		}
		else
		{
			sPath = "job_search_index.aspx";
		}		
	}
	else // from  BF, GI, HO, KA Job Seach Bar
	{
		if (sLocation == "CH" || sLocation == "LE")
		{
			sPath = "job_search_other_sites.aspx";
		}		
		else
		{
			sPath = "job_search_special.aspx";	
		}
	}

	
	//This parameter is used for BF, GI, HO, KA Job Seach Bar, to retreive the database records from this location. 
	sPath = sPath + "?SearchLocation=" + sLocation;	
	
	//Set Location
	//Assume Individual_Site_Location is not empty if come from BF, GI, HO, KA Job Seach Bar
	if (Individual_Site_Location != '')
		sPath = sPath + "&Location=" + Individual_Site_Location ;
	else
		sPath = sPath + "&Location=" + sLocation;
				
	if (location_array.length == 1 && sSpeciality == -1)
	{
		sPath = sPath + "&NewSearch=1";		
	}
	else
	{
		if (isNaN(sSpeciality) == true)
		{
			sPath = sPath + "&NewSearch=1&srchSubSpeciality=" + sSpeciality ;		
		}
		else
		{
			sPath = sPath + "&NewSearch=1&srchspeciality=" + sSpeciality ;
		}
	}
	
	// if Individual_Site_Location = '', mean it is from index.aspx
	if (Individual_Site_Location == '')
		document.getElementById('inner_main').src = sPath;				
	else
		window.top.mainFrame.location.href= sPath;	
}



