var varversion = 2;

//clear input box
function clearInputBox(item,dvalue){
	if(item.value == dvalue) {
		item.value = ""
	}
}

function JumpTo(placeToGo)
{
	var offWeGo;
	
	if (placeToGo == "executive")
		offWeGo = ("http://executive." + vardomain + "/if.asp?loc=alliance&comefrom=" + varcomefrom);
	else if (placeToGo == "it")
		offWeGo = ("http://it." + vardomain + "/if.asp?loc=alliance&comefrom=" + varcomefrom);
	else if (placeToGo == "uk")
		offWeGo = ("http://" + vardomain + "/uk/index.ascx" + "?comefrom=" + varcomefrom);
	else if (placeToGo == "healthcare")
		offWeGo = ("http://" + vardomain + "/healthcare/index.ascx" + "?comefrom=" + varcomefrom);
	else 
		offWeGo = ("http://" + vardomain + "/" + placeToGo + "?comefrom=" + varcomefrom);
	
	window.location = offWeGo;
}

// JScript source code
function AddItemToDropDownAt(dropdown, text, value, index) {
	var opt = new Option(text, value, true, true);
	AddOptionAt(dropdown, opt, index);
}
function AddOptionAt(ctl, opt, index) {
	for (j=ctl.options.length; j >= index; j--) {
		if (j > 0) {
			var movedOpt = new Option(ctl.options[j-1].text, ctl.options[j-1].value)
			ctl.options[j] = movedOpt;
		}
	}
	ctl.options[index] = opt
}
					  
function GetObjectByPartName(name)
{
var obj; // string which is return referencing object by element id
var elementnumber; 
var elementname;

		//Go through the forms collection
		for (var i= 0; i < document.layout.length; i++)
		{
			elementname = document.layout.elements[i].name.toString();
		
			// if the object name passed equals the object name in the form collection - return it's number
			if (elementname.indexOf(name) != -1)
				{
				elementnumber = i;
				obj = document.layout.elements[i]
				break;
				}
		}
			
			// create the string which can be used to reference this object and return it could be used for Net 4.7
			//obj = "document.layout.elements[" + elementnumber + "]";
	
	return obj;
}

var aCatSelected = new Array(0);
var aDefaultOverrides = new Array(0);



//Gets the query string
function GetQueryString()
{
	var formItems = new Array();
	var formKeys = new Array();
	var myURL = document.URL;
	// Get the query string
	var startQs = myURL.indexOf('?',0);	
	if (startQs >=0)
	{
		var qs = myURL.substring(startQs+1);
		var items = qs.split('&');
		var keyIdx = 0;
		for(var idx=0; idx < items.length; idx++)
		{
			var tmpItem = items[idx].split('=');
			if(formItems[tmpItem[0]] == null)
			{
				formKeys[keyIdx++] = tmpItem[0];
				formItems[tmpItem[0]] = tmpItem[1];
			}
			else
			{
				formItems[tmpItem[0]] =  formItems[tmpItem[0]] + ',' + tmpItem[1];
			}
		}
	}
	return new Array(formKeys,formItems);
}
// Gets the Form element with the name speciifed
function GetFormElementByName(fName)
{
	var formItems = GetQueryString();
	var formValue = formItems[1][fName];
	if(formValue != null)
		return  SafeDecodeURL(formItems[1][fName]);
	else
		return null;
}

function GetPageURLNoQuery()
{
	var pIdx = document.URL.indexOf('?');
	
	if(pIdx >= 0)
	{
		return  document.URL.substring(0, pIdx);
	}
	else
	{
		return document.URL;
	}
}	
	


	function getItemValue(catId, catIdx)
	{
		switch(catId)
		{
		case 'location':
		{
			return document.layout.catlocation.options[catIdx].value;
		}
		case 'area':
		{
			return document.layout.catarea.options[catIdx].value;
		}
		case 'worktype':
		{
			return document.layout.catworktype.options[catIdx].value;
		}
		case 'industry':
		{
			return document.layout.catindustry.options[catIdx].value;
		}
		case 'occupation':
		{
			return document.layout.catoccupation.options[catIdx].value;
		}
		case 'specialisation':
		{
			return document.layout.catspecialisation.options[catIdx].value;
		}
		}
   }

	var submitCounter = 0;

	var aCategories = new Array(6);

	var childBehaviours = new Array();

	var categoryNames = new Array();

	var defaultIndexes = new Array();

	var isSorted = new Array();

	var categorySelections = new Array();

	var parentChildRelationships = new Array();

	parentChildRelationships["state"] = "location";

	var aLocationItems = new Array(16);
	aLocationItems[0] = new Array("Any", 0 );
	aLocationItems[1] = new Array("Sydney", 1000 );
	aLocationItems[2] = new Array("NSW - Other", 1001 );
	aLocationItems[3] = new Array("Melbourne", 1002 );
	aLocationItems[4] = new Array("VIC - Other", 1003 );
	aLocationItems[5] = new Array("Brisbane", 1004 );
	aLocationItems[6] = new Array("Gold Coast", 1005 );
	aLocationItems[7] = new Array("QLD - Other", 1006 );
	aLocationItems[8] = new Array("Perth", 1009 );
	aLocationItems[9] = new Array("WA - Other", 1010 );
	aLocationItems[10] = new Array("Adelaide", 1007 );
	aLocationItems[11] = new Array("SA - Other", 1008 );
	aLocationItems[12] = new Array("Hobart", 1011 );
	aLocationItems[13] = new Array("TAS - Other", 1012 );
	aLocationItems[14] = new Array("ACT", 1015 );
	aLocationItems[15] = new Array("Darwin", 1013 );
	aLocationItems[16] = new Array("Northern Territory", 1014 );
	//aLocationItems[17] = new Array("Auckland", 1018 );
	//aLocationItems[18] = new Array("Wellington", 1019 );
	//aLocationItems[19] = new Array("Nth Island - Other", 1020 );
	//aLocationItems[20] = new Array("Christchurch", 1021 );
	//aLocationItems[21] = new Array("Sth Island - Other", 1022 );
	//aLocationItems[22] = new Array("UK - London", 1023 );
	//aLocationItems[23] = new Array("UK - Other", 1024 );
	//aLocationItems[24] = new Array("Ireland", 1025 );
	//aLocationItems[25] = new Array("Overseas - Other", 1016 );

	// nz has different location order to aus - determined by country 
	//if (varcountry == "nz")
	//{
		//var aLocationItems = new Array(26);
		//aLocationItems[0] = new Array("Any", 0 );
		//aLocationItems[1] = new Array("Any NZ Location", 1017 );
		//aLocationItems[2] = new Array("Auckland", 1018 );
		//aLocationItems[3] = new Array("Wellington", 1019 );
		//aLocationItems[4] = new Array("Nth Island - Other", 1020 );
		//aLocationItems[5] = new Array("Christchurch", 1021 );
		//aLocationItems[6] = new Array("Sth Island - Other", 1022 );
		//aLocationItems[7] = new Array("Sydney", 1000 );
		//aLocationItems[8] = new Array("NSW - Other", 1001 );
		//aLocationItems[9] = new Array("Melbourne", 1002 );
		//aLocationItems[10] = new Array("VIC - Other", 1003 );
		//aLocationItems[11] = new Array("Brisbane", 1004 );
		//aLocationItems[12] = new Array("Gold Coast", 1005 );
		//aLocationItems[13] = new Array("QLD - Other", 1006 );
		//aLocationItems[14] = new Array("Perth", 1009 );
		//aLocationItems[15] = new Array("WA - Other", 1010 );
		//aLocationItems[16] = new Array("Adelaide", 1007 );
		//aLocationItems[17] = new Array("SA - Other", 1008 );
		//aLocationItems[18] = new Array("Hobart", 1011 );
		//aLocationItems[19] = new Array("TAS - Other", 1012 );
		//aLocationItems[20] = new Array("ACT", 1015 );
		//aLocationItems[21] = new Array("Darwin", 1013 );
		//aLocationItems[22] = new Array("Northern Territory", 1014 );
		//aLocationItems[23] = new Array("UK - London", 1023 );
		//aLocationItems[24] = new Array("UK - Other", 1024 );
		//aLocationItems[25] = new Array("Ireland", 1025 );
		//aLocationItems[26] = new Array("Overseas - Other", 1016 );
	//}

	aCategories["location"] = aLocationItems;

	categoryNames[categoryNames.length] = "location";
	defaultIndexes["location"] = 0;
	isSorted["location"] = false;
	categorySelections["location"] = new Array();
	childBehaviours["location"] = new Array("ShowDirectChildren","DisableChild","DisableChild");

	parentChildRelationships["location"] = "area";

	var aAreaItems = new Array(84);
	aAreaItems[0] = new Array("Any", 0 );
	aAreaItems[1] = new Array("Albany", 2750 );
	aAreaItems[2] = new Array("Albury - Wodonga", 2751 );
	aAreaItems[3] = new Array("Alice Springs", 2752 );
	aAreaItems[4] = new Array("Auckland - Inner", 2753 );
	aAreaItems[5] = new Array("Auckland - North", 2754 );
	aAreaItems[6] = new Array("Auckland - South", 2755 );
	aAreaItems[7] = new Array("Auckland - West", 2756 );
	aAreaItems[8] = new Array("Ballarat", 2757 );
	aAreaItems[9] = new Array("Bathurst", 2758 );
	aAreaItems[10] = new Array("Bendigo", 2759 );
	aAreaItems[11] = new Array("Blenheim", 2760 );
	aAreaItems[12] = new Array("Bunbury", 2761 );
	aAreaItems[13] = new Array("Bundaberg", 2762 );
	aAreaItems[14] = new Array("Burnie", 2763 );
	aAreaItems[15] = new Array("Cairns", 2764 );
	aAreaItems[16] = new Array("Coffs Harbour", 2765 );
	aAreaItems[17] = new Array("Devonport", 2766 );
	aAreaItems[18] = new Array("Dubbo", 2767 );
	aAreaItems[19] = new Array("Dunedin", 2768 );
	aAreaItems[20] = new Array("Geelong", 2769 );
	aAreaItems[21] = new Array("Geraldton", 2770 );
	aAreaItems[22] = new Array("Gisborne", 2771 );
	aAreaItems[23] = new Array("Gladstone", 2772 );
	aAreaItems[24] = new Array("Gosford - Central Coast", 2773 );
	aAreaItems[25] = new Array("Hamilton", 2774 );
	aAreaItems[26] = new Array("Invercargill", 2775 );
	aAreaItems[27] = new Array("Kalgoorlie - Boulder", 2776 );
	aAreaItems[28] = new Array("Launceston", 2777 );
	aAreaItems[29] = new Array("Lismore", 2778 );
	aAreaItems[30] = new Array("Mackay", 2779 );
	aAreaItems[31] = new Array("Maitland", 2780 );
	aAreaItems[32] = new Array("Mandurah", 2781 );
	aAreaItems[33] = new Array("Maryborough - Hervey Bay", 2783 );
	aAreaItems[34] = new Array("Melbourne - East", 2784 );
	aAreaItems[35] = new Array("Melbourne - Inner", 2785 );
	aAreaItems[36] = new Array("Melbourne - North", 2786 );
	aAreaItems[37] = new Array("Melbourne - South", 2787 );
	aAreaItems[38] = new Array("Melbourne - West", 2788 );
	aAreaItems[39] = new Array("Mildura", 2789 );
	aAreaItems[40] = new Array("Mt Gambier", 2790 );
	aAreaItems[41] = new Array("Mt Isa", 2791 );
	aAreaItems[42] = new Array("Napier - Hastings", 2792 );
	aAreaItems[43] = new Array("Nelson", 2793 );
	aAreaItems[44] = new Array("New Plymouth", 2794 );
	aAreaItems[45] = new Array("Newcastle", 2795 );
	aAreaItems[46] = new Array("Orange", 2796 );
	aAreaItems[47] = new Array("Palmerston", 2797 );
	aAreaItems[48] = new Array("Palmerston North", 2798 );
	aAreaItems[49] = new Array("Perth - Inner", 2799 );
	aAreaItems[50] = new Array("Perth - North", 2800 );
	aAreaItems[51] = new Array("Perth - South", 2801 );
	aAreaItems[52] = new Array("Porirua - Hutt Valley", 2802 );
	aAreaItems[53] = new Array("Port Macquarie", 2803 );
	aAreaItems[54] = new Array("Richmond", 2813 );
	aAreaItems[55] = new Array("Rockhampton", 2814 );
	aAreaItems[56] = new Array("Rockingham", 2815 );
	aAreaItems[57] = new Array("Rotorua", 2816 );
	aAreaItems[58] = new Array("Shepparton", 2817 );
	aAreaItems[59] = new Array("Sunshine Coast", 2818 );
	aAreaItems[60] = new Array("Sydney - Inner", 2819 );
	aAreaItems[61] = new Array("Sydney - North", 2820 );
	aAreaItems[62] = new Array("Sydney - South", 2821 );
	aAreaItems[63] = new Array("Sydney - West", 2822 );
	aAreaItems[64] = new Array("Tamworth", 2823 );
	aAreaItems[65] = new Array("Tauranga", 2824 );
	aAreaItems[66] = new Array("Timaru", 2825 );
	aAreaItems[67] = new Array("Toowoomba", 2826 );
	aAreaItems[68] = new Array("Townsville", 2827 );
	aAreaItems[69] = new Array("Wagga Wagga", 2828 );
	aAreaItems[70] = new Array("Wanganui", 2829 );
	aAreaItems[71] = new Array("Warrnambool", 2830 );
	aAreaItems[72] = new Array("Wellington Central", 2831 );
	aAreaItems[73] = new Array("Whangarei", 2832 );
	aAreaItems[74] = new Array("Whyalla", 2833 );
	aAreaItems[75] = new Array("Wollongong", 2834 );
	aAreaItems[76] = new Array("Rest of NSW", 2804 );
	aAreaItems[77] = new Array("Rest of NT", 2805 );
	aAreaItems[78] = new Array("Rest of Nth Island", 2806 );
	aAreaItems[79] = new Array("Rest of QLD", 2807 );
	aAreaItems[80] = new Array("Rest of SA", 2808 );
	aAreaItems[81] = new Array("Rest of Sth Island", 2809 );
	aAreaItems[82] = new Array("Rest of TAS", 2810 );
	aAreaItems[83] = new Array("Rest of VIC", 2811 );
	aAreaItems[84] = new Array("Rest of WA", 2812 );

	aCategories["area"] = aAreaItems;

	categoryNames[categoryNames.length] = "area";
	defaultIndexes["area"] = 0;
	isSorted["area"] = true;
	categorySelections["area"] = new Array();
	childBehaviours["area"] = new Array("ShowDirectChildren","DisableChild","DisableChild");

	var aWorktypeItems = new Array(4);
	aWorktypeItems[0] = new Array("Any", 0 );
	aWorktypeItems[1] = new Array("Full Time", 242 );
	aWorktypeItems[2] = new Array("Part Time", 243 );
	aWorktypeItems[3] = new Array("Contract/Temp", 244 );
	aWorktypeItems[4] = new Array("Casual/Vacation", 245 );

	aCategories["worktype"] = aWorktypeItems;

	categoryNames[categoryNames.length] = "worktype";
	defaultIndexes["worktype"] = 0;
	isSorted["worktype"] = false;
	categorySelections["worktype"] = new Array();
	childBehaviours["worktype"] = new Array("ShowDirectChildren","ShowDirectChildren","ShowDirectChildren");

	var aIndustryItems = new Array(1);
	aIndustryItems[0] = new Array("Any", 0 );
	aIndustryItems[1] = new Array("I.T. & T", 1215 );

	aCategories["industry"] = aIndustryItems;

	categoryNames[categoryNames.length] = "suppress";
	defaultIndexes["industry"] = 0;
	isSorted["industry"] = true;
	categorySelections["industry"] = new Array();
	childBehaviours["industry"] = new Array("ShowDirectChildren","ShowDirectChildren","AggregateChild");

	parentChildRelationships["industry"] = "occupation";

	var aOccupationItems = new Array(24);
	aOccupationItems[0] = new Array("Any", 0 );
	aOccupationItems[1] = new Array("Analyst/Programmer", 1319 );
	aOccupationItems[2] = new Array("Architect", 1320 );
	aOccupationItems[3] = new Array("Business Analyst", 1339 );
	aOccupationItems[4] = new Array("Computer Operators", 1358 );
	aOccupationItems[5] = new Array("Consultant/Functional Consultant", 1360 );
	aOccupationItems[6] = new Array("Database Dev. & Admin", 1370 );
	aOccupationItems[7] = new Array("Engineer: Hardware", 1380 );
	aOccupationItems[8] = new Array("Engineer: Network", 1381 );
	aOccupationItems[9] = new Array("Engineer: Software", 1382 );
	aOccupationItems[10] = new Array("Help Desk/Support", 1413 );
	aOccupationItems[11] = new Array("Internet/Multimedia Design", 1422 );
	aOccupationItems[12] = new Array("Internet/Multimedia Dev.", 1423 );
	aOccupationItems[13] = new Array("Management ", 1437 );
	aOccupationItems[14] = new Array("Networks & Systems", 1452 );
	aOccupationItems[15] = new Array("Product Management", 1482 );
	aOccupationItems[16] = new Array("Project Management", 1554 );
	aOccupationItems[17] = new Array("QA/Testers", 1491 );
	aOccupationItems[18] = new Array("Sales: Pre & Post", 1506 );
	aOccupationItems[19] = new Array("Security", 1555 );
	aOccupationItems[20] = new Array("Team Leaders", 1529 );
	aOccupationItems[21] = new Array("Technical Writers", 1531 );
	aOccupationItems[22] = new Array("Telecommunications", 1533 );
	aOccupationItems[23] = new Array("Trainers", 1539 );
	aOccupationItems[24] = new Array("Other", 1463 );

	aCategories["occupation"] = aOccupationItems;

	categoryNames[categoryNames.length] = "occupation";
	defaultIndexes["occupation"] = 0;
	isSorted["occupation"] = false;
	categorySelections["occupation"] = new Array();
	childBehaviours["occupation"] = new Array("ShowDirectChildren","DisableChild","DisableChild");

	parentChildRelationships["occupation"] = "specialisation";

	var aSpecialisationItems = new Array(207);
	aSpecialisationItems[0] = new Array("Any", 0 );
	aSpecialisationItems[1] = new Array(".NET", 2260 );
	aSpecialisationItems[2] = new Array("ABAP", 2261 );
	aSpecialisationItems[3] = new Array("Acceptance", 2000 );
	aSpecialisationItems[4] = new Array("Account Management", 2001 );
	aSpecialisationItems[5] = new Array("Active Directory", 2002 );
	aSpecialisationItems[6] = new Array("ActiveX", 2003 );
	aSpecialisationItems[7] = new Array("Agile", 2006 );
	aSpecialisationItems[8] = new Array("AIX", 2007 );
	aSpecialisationItems[9] = new Array("Anti-Spam", 2008 );
	aSpecialisationItems[10] = new Array("Anti-Virus Software", 2009 );
	aSpecialisationItems[11] = new Array("Apache", 2010 );
	aSpecialisationItems[12] = new Array("Application", 2011 );
	aSpecialisationItems[13] = new Array("Application Development", 2012 );
	aSpecialisationItems[14] = new Array("Applications", 2013 );
	aSpecialisationItems[15] = new Array("Application Servers", 2262 );
	aSpecialisationItems[16] = new Array("AS/400", 2014 );
	aSpecialisationItems[17] = new Array("ASP", 2015 );
	aSpecialisationItems[18] = new Array("Automated", 2019 );
	aSpecialisationItems[19] = new Array("BEA WebLogic", 2020 );
	aSpecialisationItems[20] = new Array("Broadband", 2021 );
	aSpecialisationItems[21] = new Array("Business Cont. Planning", 2022 );
	aSpecialisationItems[22] = new Array("Business Development", 2023 );
	aSpecialisationItems[23] = new Array("Business Intelligence", 2267 );
	aSpecialisationItems[24] = new Array("C", 2024 );
	aSpecialisationItems[25] = new Array("C#", 2025 );
	aSpecialisationItems[26] = new Array("C++", 2026 );
	aSpecialisationItems[27] = new Array("Change Management", 2027 );
	aSpecialisationItems[28] = new Array("Cisco", 2030 );
	aSpecialisationItems[29] = new Array("Cisco Certified", 2031 );
	aSpecialisationItems[30] = new Array("CISSP", 2032 );
	aSpecialisationItems[31] = new Array("Citrix Metaframe", 2033 );
	aSpecialisationItems[32] = new Array("Clear Case", 2034 );
	aSpecialisationItems[33] = new Array("ClearQuest", 2035 );
	aSpecialisationItems[34] = new Array("Client Server", 2036 );
	aSpecialisationItems[35] = new Array("CMM", 2037 );
	aSpecialisationItems[36] = new Array("Cold Calling", 2038 );
	aSpecialisationItems[37] = new Array("ColdFusion", 2039 );
	aSpecialisationItems[38] = new Array("COM", 2040 );
	aSpecialisationItems[39] = new Array("Communications", 2041 );
	aSpecialisationItems[40] = new Array("Content Management", 2043 );
	aSpecialisationItems[41] = new Array("CRM", 2046 );
	aSpecialisationItems[42] = new Array("Crystal Reports", 2047 );
	aSpecialisationItems[43] = new Array("Data", 2048 );
	aSpecialisationItems[44] = new Array("Data Warehousing", 2049 );
	aSpecialisationItems[45] = new Array("Delphi", 2050 );
	aSpecialisationItems[46] = new Array("Deployment", 2051 );
	aSpecialisationItems[47] = new Array("Development", 2052 );
	aSpecialisationItems[48] = new Array("Digital Certificates", 2054 );
	aSpecialisationItems[49] = new Array("Digital Communications", 2055 );
	aSpecialisationItems[50] = new Array("Dir. Enabled Network", 2056 );
	aSpecialisationItems[51] = new Array("Disaster Recovery Plan.", 2057 );
	aSpecialisationItems[52] = new Array("Distributed Network", 2058 );
	aSpecialisationItems[53] = new Array("DNS", 2059 );
	aSpecialisationItems[54] = new Array("Domino Server", 2060 );
	aSpecialisationItems[55] = new Array("EAI", 2061 );
	aSpecialisationItems[56] = new Array("Encryption", 2064 );
	aSpecialisationItems[57] = new Array("Enterprise Software", 2079 );
	aSpecialisationItems[58] = new Array("ERP", 2080 );
	aSpecialisationItems[59] = new Array("Execution", 2081 );
	aSpecialisationItems[60] = new Array("Extreme Programming (XP)", 2082 );
	aSpecialisationItems[61] = new Array("Firewalls", 2085 );
	aSpecialisationItems[62] = new Array("Frame Relay", 2086 );
	aSpecialisationItems[63] = new Array("FTP", 2087 );
	aSpecialisationItems[64] = new Array("Functional", 2088 );
	aSpecialisationItems[65] = new Array("GPRS", 2089 );
	aSpecialisationItems[66] = new Array("Hardware", 2090 );
	aSpecialisationItems[67] = new Array("Hewlett Packard", 2091 );
	aSpecialisationItems[68] = new Array("HTML", 2092 );
	aSpecialisationItems[69] = new Array("IBM", 2272 );
	aSpecialisationItems[70] = new Array("IBM/DB2", 2093 );
	aSpecialisationItems[71] = new Array("IIS", 2094 );
	aSpecialisationItems[72] = new Array("Informatica", 2095 );
	aSpecialisationItems[73] = new Array("Informix Dynamic Server", 2096 );
	aSpecialisationItems[74] = new Array("Infrastructure", 2097 );
	aSpecialisationItems[75] = new Array("Ingres", 2098 );
	aSpecialisationItems[76] = new Array("Installation", 2100 );
	aSpecialisationItems[77] = new Array("Instant Messaging", 2101 );
	aSpecialisationItems[78] = new Array("Integration", 2102 );
	aSpecialisationItems[79] = new Array("Interfacing", 2103 );
	aSpecialisationItems[80] = new Array("Internet", 2104 );
	aSpecialisationItems[81] = new Array("Intrusion Detection Sys.", 2105 );
	aSpecialisationItems[82] = new Array("ISO 9000", 2106 );
	aSpecialisationItems[83] = new Array("ITIL", 2107 );
	aSpecialisationItems[84] = new Array("J2EE", 2108 );
	aSpecialisationItems[85] = new Array("Java", 2109 );
	aSpecialisationItems[86] = new Array("Java Server Pages", 2110 );
	aSpecialisationItems[87] = new Array("Javascript", 2111 );
	aSpecialisationItems[88] = new Array("LAN", 2113 );
	aSpecialisationItems[89] = new Array("LAN/WAN", 2114 );
	aSpecialisationItems[90] = new Array("Linux", 2116 );
	aSpecialisationItems[91] = new Array("Lotus Notes", 2117 );
	aSpecialisationItems[92] = new Array("MCP", 2122 );
	aSpecialisationItems[93] = new Array("MCSE", 2123 );
	aSpecialisationItems[94] = new Array("Mercury Tools", 2126 );
	aSpecialisationItems[95] = new Array("Messaging", 2127 );
	aSpecialisationItems[96] = new Array("Middleware", 2128 );
	aSpecialisationItems[97] = new Array("Mobiles", 2130 );
	aSpecialisationItems[98] = new Array("MS Access", 2131 );
	aSpecialisationItems[99] = new Array("MS Exchange Server", 2132 );
	aSpecialisationItems[100] = new Array("MS Project", 2133 );
	aSpecialisationItems[101] = new Array("MS Windows 2000", 2134 );
	aSpecialisationItems[102] = new Array("MS Windows 2003", 2135 );
	aSpecialisationItems[103] = new Array("MS Windows CE", 2136 );
	aSpecialisationItems[104] = new Array("MS Windows NT", 2137 );
	aSpecialisationItems[105] = new Array("MS Windows XP", 2138 );
	aSpecialisationItems[106] = new Array("Multimedia", 2140 );
	aSpecialisationItems[107] = new Array("MVS", 2141 );
	aSpecialisationItems[108] = new Array("MYSQL", 2142 );
	aSpecialisationItems[109] = new Array("NAS/SAN", 2143 );
	aSpecialisationItems[110] = new Array("Network", 2145 );
	aSpecialisationItems[111] = new Array("Network Security", 2146 );
	aSpecialisationItems[112] = new Array("Networking", 2147 );
	aSpecialisationItems[113] = new Array("Netware", 2149 );
	aSpecialisationItems[114] = new Array("NUnit/JUnit", 2150 );
	aSpecialisationItems[115] = new Array("Object Oriented", 2151 );
	aSpecialisationItems[116] = new Array("Open Source", 2152 );
	aSpecialisationItems[117] = new Array("Optical", 2153 );
	aSpecialisationItems[118] = new Array("Oracle", 2154 );
	aSpecialisationItems[119] = new Array("OS390", 2155 );
	aSpecialisationItems[120] = new Array("Outsourcing", 2160 );
	aSpecialisationItems[121] = new Array("PABX", 2161 );
	aSpecialisationItems[122] = new Array("PC", 2163 );
	aSpecialisationItems[123] = new Array("PeopleCode", 2264 );
	aSpecialisationItems[124] = new Array("PeopleSoft", 2164 );
	aSpecialisationItems[125] = new Array("Perl", 2166 );
	aSpecialisationItems[126] = new Array("PHP", 2167 );
	aSpecialisationItems[127] = new Array("PKI", 2169 );
	aSpecialisationItems[128] = new Array("PMBOK", 2170 );
	aSpecialisationItems[129] = new Array("PMI/PMP", 2171 );
	aSpecialisationItems[130] = new Array("Point of Sale Systems", 2172 );
	aSpecialisationItems[131] = new Array("Post Sales", 2268 );
	aSpecialisationItems[132] = new Array("PowerBuilder", 2173 );
	aSpecialisationItems[133] = new Array("Pre-Sales", 2269 );
	aSpecialisationItems[134] = new Array("Prince", 2175 );
	aSpecialisationItems[135] = new Array("Progress", 2178 );
	aSpecialisationItems[136] = new Array("Project Office", 2179 );
	aSpecialisationItems[137] = new Array("Prospecting", 2180 );
	aSpecialisationItems[138] = new Array("Prototyping", 2181 );
	aSpecialisationItems[139] = new Array("QA", 2183 );
	aSpecialisationItems[140] = new Array("RACF", 2184 );
	aSpecialisationItems[141] = new Array("Rational Tools", 2185 );
	aSpecialisationItems[142] = new Array("RDBMS", 2186 );
	aSpecialisationItems[143] = new Array("Regression", 2188 );
	aSpecialisationItems[144] = new Array("Remote Access Network", 2189 );
	aSpecialisationItems[145] = new Array("Replication", 2190 );
	aSpecialisationItems[146] = new Array("Reporting", 2191 );
	aSpecialisationItems[147] = new Array("RFID", 2193 );
	aSpecialisationItems[148] = new Array("RFP", 2194 );
	aSpecialisationItems[149] = new Array("Risk", 2195 );
	aSpecialisationItems[150] = new Array("Routers", 2196 );
	aSpecialisationItems[151] = new Array("SAP", 2197 );
	aSpecialisationItems[152] = new Array("SAS", 2198 );
	aSpecialisationItems[153] = new Array("Scripting", 2199 );
	aSpecialisationItems[154] = new Array("Scripts", 2200 );
	aSpecialisationItems[155] = new Array("SDLC", 2201 );
	aSpecialisationItems[156] = new Array("Security", 2203 );
	aSpecialisationItems[157] = new Array("Security Clearance", 2204 );
	aSpecialisationItems[158] = new Array("Server", 2265 );
	aSpecialisationItems[159] = new Array("SharePoint Portal Server", 2205 );
	aSpecialisationItems[160] = new Array("Simulator", 2206 );
	aSpecialisationItems[161] = new Array("Six Sigma", 2207 );
	aSpecialisationItems[162] = new Array("Smart Card", 2208 );
	aSpecialisationItems[163] = new Array("Software Lic. Agreements", 2210 );
	aSpecialisationItems[164] = new Array("Solution Selling", 2211 );
	aSpecialisationItems[165] = new Array("SQL", 2213 );
	aSpecialisationItems[166] = new Array("SQL Server", 2214 );
	aSpecialisationItems[167] = new Array("Stakeholder Management", 2215 );
	aSpecialisationItems[168] = new Array("Storage", 2216 );
	aSpecialisationItems[169] = new Array("Stress & Volume", 2270 );
	aSpecialisationItems[170] = new Array("Strategy", 2217 );
	aSpecialisationItems[171] = new Array("Sun", 2218 );
	aSpecialisationItems[172] = new Array("Support", 2219 );
	aSpecialisationItems[173] = new Array("Switches", 2221 );
	aSpecialisationItems[174] = new Array("Sybase", 2222 );
	aSpecialisationItems[175] = new Array("System", 2271 );
	aSpecialisationItems[176] = new Array("System Recovery", 2223 );
	aSpecialisationItems[177] = new Array("Systems Development", 2224 );
	aSpecialisationItems[178] = new Array("TCP/IP", 2226 );
	aSpecialisationItems[179] = new Array("Tenders", 2229 );
	aSpecialisationItems[180] = new Array("Test Cases", 2230 );
	aSpecialisationItems[181] = new Array("Test Director", 2231 );
	aSpecialisationItems[182] = new Array("Test Plans", 2232 );
	aSpecialisationItems[183] = new Array("Training", 2233 );
	aSpecialisationItems[184] = new Array("Transact SQL", 2234 );
	aSpecialisationItems[185] = new Array("Trouble Shooting", 2235 );
	aSpecialisationItems[186] = new Array("Tuxedo", 2266 );
	aSpecialisationItems[187] = new Array("UAT", 2237 );
	aSpecialisationItems[188] = new Array("UML", 2238 );
	aSpecialisationItems[189] = new Array("Unit", 2239 );
	aSpecialisationItems[190] = new Array("Unix", 2240 );
	aSpecialisationItems[191] = new Array("Unix Scripts", 2241 );
	aSpecialisationItems[192] = new Array("VB.NET", 2242 );
	aSpecialisationItems[193] = new Array("VBScript", 2243 );
	aSpecialisationItems[194] = new Array("Vendor", 2244 );
	aSpecialisationItems[195] = new Array("Vertical Markets", 2245 );
	aSpecialisationItems[196] = new Array("Visual Basic", 2246 );
	aSpecialisationItems[197] = new Array("Voice", 2247 );
	aSpecialisationItems[198] = new Array("Voice Data", 2248 );
	aSpecialisationItems[199] = new Array("VPN", 2249 );
	aSpecialisationItems[200] = new Array("Vulnerability", 2250 );
	aSpecialisationItems[201] = new Array("WAP", 2251 );
	aSpecialisationItems[202] = new Array("Web Services/SOAP", 2253 );
	aSpecialisationItems[203] = new Array("WebSphere", 2254 );
	aSpecialisationItems[204] = new Array("Wireless", 2255 );
	aSpecialisationItems[205] = new Array("WLAN", 2256 );
	aSpecialisationItems[206] = new Array("XML", 2258 );
	aSpecialisationItems[207] = new Array("Other", 2157 );

	aCategories["specialisation"] = aSpecialisationItems;

	categoryNames[categoryNames.length] = "specialisation";
	defaultIndexes["specialisation"] = 0;
	isSorted["specialisation"] = false;
	categorySelections["specialisation"] = new Array();
	childBehaviours["specialisation"] = new Array("ShowDirectChildren","ShowDirectChildren","ShowDirectChildren");

	var aRelationShips  = new Array(2);

	var aOccupationChildItems = new Array(6);
	aOccupationChildItems[1319] = new Array(1,2,6,7,11,13,17,19,24,25,26,34,37,38,42,44,45,46,60,68,70,72,73,75,84,85,86,87,90,91,96,98,108,114,115,118,125,126,132,135,142,151,152,153,165,172,174,177,183,184,185,188,192,193,196,202,206,207);
	aOccupationChildItems[1506] = new Array(4,22,23,36,39,41,57,58,62,66,76,88,97,106,110,120,121,122,130,131,133,137,148,156,163,164,168,179,195,198,199,204,207);
	aOccupationChildItems[1491] = new Array(3,12,18,32,33,59,64,78,79,82,94,138,141,143,145,154,156,160,169,170,175,180,181,182,187,189,207);
	aOccupationChildItems[1555] = new Array(9,10,21,30,48,51,56,61,81,111,127,140,147,157,162,170,176,200,207);
	aOccupationChildItems[1554] = new Array(7,14,27,35,41,43,47,55,58,74,83,100,112,118,128,129,134,136,139,146,149,151,155,156,161,167,194,197,207);
	aOccupationChildItems[1452] = new Array(5,8,15,16,19,20,28,29,31,39,40,41,49,50,52,53,54,58,63,65,67,69,71,77,80,89,90,92,93,95,97,99,101,102,103,104,105,107,109,110,113,116,117,119,121,123,124,144,147,150,158,159,166,171,173,178,186,190,191,197,199,201,202,203,204,205,207);

	aRelationShips["occupation"] = 	aOccupationChildItems;

	var aLocationChildItems = new Array(14);
	aLocationChildItems[1010] = new Array(32,56,84,27,21,12,1);
	aLocationChildItems[1009] = new Array(51,50,49);
	aLocationChildItems[1008] = new Array(74,80,40);
	aLocationChildItems[1006] = new Array(33,68,67,59,55,79,41,30,23,15,13);
	aLocationChildItems[1003] = new Array(71,58,83,39,20,10,8);
	aLocationChildItems[1002] = new Array(38,37,36,35,34);
	aLocationChildItems[1001] = new Array(75,69,64,54,76,53,46,45,31,29,24,18,16,9,2);
	aLocationChildItems[1000] = new Array(63,62,61,60);
	aLocationChildItems[1022] = new Array(66,81,43,26,19,11);
	aLocationChildItems[1020] = new Array(73,70,65,57,78,48,44,42,25,22);
	aLocationChildItems[1019] = new Array(72,52);
	aLocationChildItems[1018] = new Array(7,6,5,4);
	aLocationChildItems[1014] = new Array(77,47,3);
	aLocationChildItems[1012] = new Array(82,28,17,14);

	aRelationShips["location"] = 	aLocationChildItems;
					
		function ValidateCategoryList(categoryId, maxItems, childCategoryId,populateChildren)
		{
			var defIdx = defaultIndexes[categoryId];
			var ddl = document.getElementById('cat' + categoryId);
			var chk = GetObjectByPartName('chkUnspecified' + categoryId);

			// Now validate that Any is not selected with other values
			var anyOption = ddl.options[0];

			getItemValue(categoryId,0);

			if(getItemValue(categoryId,0) == 0 &&  anyOption.selected)
			{
				for(var idx = 1; idx < ddl.options.length; idx++)
				{
					if(ddl.options[idx].selected)
					{
						anyOption.selected = false;						
						break;
					}
				}
			}

			// If the 'Any' option was selected, disabled the respective 
			// 'Include' checkbox.
			if(chk != null)
			{
				if(!anyOption.selected)
				{
					if(chk.disabled)
						chk.checked = true;
				}
				else
					chk.checked = false;
				
				chk.disabled = anyOption.selected;				
			}

			// Validate Max Items if required
			if(maxItems > 0)
			{
				var selectedIdx  = ddl.selectedIndex;

				if(ddl != null)
				{
					var removeIdx = 0;
					var removeOptions = new Array();
				
					var selected = 0;
					for(idx = 0; idx < ddl.options.length; idx++)
					{
						if(ddl.options[idx].selected)
						{
							if(selected > maxItems)
							{
								removeOptions[removeIdx++] = idx;
							}
							selected++;
						}
					}
					if(selected > maxItems)
					{
						alert('Only ' + maxItems + ' items may be selected for category ' + categoryId );
						
						for(rIdx = 0; rIdx < removeOptions.length; rIdx++)
						{
							ddl.options[removeOptions[rIdx]].selected = false;
						}
						populateChildren = false; // Don't continue populating
					}
				}
			}		

			if(populateChildren) // If we are cascading population events ...
			{
				aCatSelected['cat' + childCategoryId] = new Array(); //Clear out the old values
				ProcessChildList(categoryId,childCategoryId);
			}

			var cat = GetObjectByPartName('cat' + categoryId)
			cat.focus();
			
		}

	function populateClassiferList(ddListId, catID)
	{
		var ddl = document.getElementById(ddListId);
		var classifers = aCategories[catID];
		var defIdx = defaultIndexes[catID];
		var forceDefaultZero = (aDefaultOverrides[catID] != null);
		var defaults = new Array(); // defaults always at top
		var nonDefSelected = false;
		var ItemIndex = 0;
		var sorted = isSorted[catID];
		var selections = new Array();
		var defSelections = new Array();

		if(forceDefaultZero)
			defIdx = 0;
		
		if(ddl != null)
		{
			var sortArray = new Array();
			var sortIndex = 0;

			for(idx =0; idx < classifers.length; idx++)
			{	
				var isSelected = false;
				var classifier = classifers[idx];
				var opt = new Option(classifier[0],classifier[1]);

				if(opt.value == 0) // deal with std default
				{	if(defIdx == 0){
						//opt.selected=true;
						defSelections['OPT_' + opt.value ] = true;
					}
					else
					{	
						defSelections['OPT_' + opt.value ] = false;
					}
					defaults[0] = opt; 
				}	
				else
				{
					var selectedItems = aCatSelected['cat' + catID];

					if(selectedItems != null && selectedItems.length > 0)
					{
						for(sIdx =0; sIdx < selectedItems.length; sIdx++)
						{
							if(selectedItems[sIdx] == classifier[1])
							{
								//opt.selected = true;
								isSelected = true;
								if(idx != defIdx)
								{
									nonDefSelected=true;
								}
								break;
							}
						}
					}
					else
					{
						if(idx == defIdx)
						{
							//opt.selected = true;
							selections['OPT_'+ opt.value] = true;
							isSelected = true;
						}
					}
					if(idx != defIdx){
						sortArray[ItemIndex++] = opt;
						selections['OPT_'+ opt.value] = isSelected;
					}
					else
					{
						var def = defaults.length;
						defaults[def] = opt; 
						defSelections['OPT_'+ opt.value] = isSelected; 
					}	
				}
			}
			
			if(sorted) //only sort those that need it
				sortArray.sort(sortCategory);

			var finalList = new Array();

			// Add defaults
			for(var d = 0; d < defaults.length; d++)
			{
				if(nonDefSelected && defaults[d].value == '0')
				{			
					selections['OPT_'+ defaults[d].value] = false;
				}
				else
				{
					selections['OPT_'+ defaults[d].value] = defSelections['OPT_'+ defaults[d].value];
				}
				finalList[finalList.length] = defaults[d];
			}

			for(var i =0; i < sortArray.length; i++)
			{
				finalList[finalList.length] = sortArray[i];
			}

			finalList = removeDuplicates(finalList);

			for(var f =0; f < finalList.length; f++)
			{
				var selIdx = ddl.options.length;
				ddl.options[selIdx] = finalList[f];
				SelectItem(catID,selIdx,selections['OPT_'+ finalList[f].value]);
			}
			
			categorySelections[catID] = selections;			
		}
	}

	function removeDuplicates(arr)
	{
		var optText = '';
		for(var i =0; i<arr.length; i++)
		{
			optText = arr[i].text;
			
			if (i < (arr.length - 1))
			{
				if (optText == arr[i+1].text)
				{
					arr[i].value += ',' + arr[i+1].value;

					for(var j=i+1; j<arr.length; j++)
					{
						if (j < (arr.length - 1))
							arr[j] = arr[j+1]
					}

					arr.length = arr.length - 1;
				}
			}	
		}			
		return arr;
	}

	function isNS62()
	{
		var browserType = navigator.appName;
		var browserVer = navigator.appVersion;

		if(browserType == 'Netscape' && browserVer.indexOf('5.0') >= 0)
		{
			return true;
		}
		return false;
	}



	// Works out the current mode of operation - Multi, Single or any Select
	function ProcessChildList(parentCategoryId, childCategoryId)
	{
		var ddl = document.getElementById('cat' + parentCategoryId);
		var mode = 0; // Default. 0 = Single, 1= Multi, 2 = Any
		var anyOption = false;
		var classifers = aCategories[parentCategoryId];
	
		ddl.blur();

		if(classifers.length <= 2) // Including the any option
		{
			anyOption = true;
		}
		else{
			// Now validate that Any is not selected with other values
			anyOption = ddl.options[0].selected;
		}

		if(anyOption) // Can only be selected in isolation (Not with other items)
		{
			mode = 2;
		}
		else
		{
			var selCount = 0;
			mode = 0;
			for(var idx = 1; idx < ddl.options.length; idx++)
			{
				if(ddl.options[idx].selected)
				{
					selCount++;
					if(selCount > 1)
					{
						mode = 1;
						break;
					}
				}
			}
		}
		//window.alert('something ' + mode);
		//Process the correct Mode
	
		processListSelect(childBehaviours[parentCategoryId][mode],parentCategoryId,childCategoryId);

		if(parentChildRelationships[childCategoryId] != null)
		{
			ProcessChildList(childCategoryId,parentChildRelationships[childCategoryId]);
		}
	}

	// Processes the selection using the prescribed behaviour
	function processListSelect(action, parentListId, childListId)
	{
		//window.status = action + ' ' + parentListId;
		
		switch(action)
		{
			case 'AggregateChild':
				aggregateChildList(parentListId , childListId);
				break;
			case 'DisableChild':
				clearCategoryList(parentListId, childListId,true,'No Selection Required')
				break;
			case 'EmptyChild':
				break;
			case 'ShowDirectChildren':
			case 'Default':
			default:
				populateChildList(parentListId, childListId);
				break;
		}
	}
	// used to create dummy timeouts
	function nsFix()
	{
		window.status = '';
	}

	// Clears a Category List and then fires an 'any' event for the child list if one exists
	function clearCategoryList(parentListId, childListId, showAny, anyCopy)
	{
		var pList = document.getElementById('cat' + parentListId);
		var cList = document.getElementById('cat' + childListId);
		var defIdx = defaultIndexes[childListId];

		// Now validate that Any is not selected with other values
		var anyOption = pList.options[0];

		//pseudo: If ANY behaviour is CLEAR
		//Clear out the Child List Box
		for(var cIdx = cList.options.length -1; cIdx >= 0 ; cIdx--)
		{	
			cList.remove(cIdx);
		}

		if(showAny)
		{
			// if occupation is set to 'Any', display 'Select a Sub-Classification' 
			// in the specialisation list box.
			if(anyOption.selected && childListId == 'specialisation')
				cList.options[0] = new Option('Select a Skill',0,true,true);
			else
				cList.options[0] = new Option(anyCopy,0,true,true);
		}

		populateCheckBox(null, childListId);
	}


function populateCheckBox(selectedItems, childListId)
	{
		var chkBox = GetObjectByPartName('chkUnspecified' + childListId);

		if (selectedItems != null)
		{
			if(selectedItems.length > 0)
			{		
				if (chkBox != null)
				{
					var chkBoxValues = chkBox.value.split(',');
					for(idx=0; idx<selectedItems.length; idx++)
					{
						for(var j=0; j<chkBoxValues.length; j++)
						{
							if(selectedItems[idx] == chkBoxValues[j].value)
							{
								chkBox.disabled = false;
								chkBox.checked = true;
								break;
							}
							else
								chkBox.disabled = false;
						}
					}
				}
			}
			else
				disableCheckBox(chkBox);
		}
		else
			disableCheckBox(chkBox);
	}

	function disableCheckBox(chkBox)
	{
		if (chkBox != null)
		{
			chkBox.checked = false;
			chkBox.disabled = true;
		}
	}


	// Populates the Child With a Full (Aggregated) List of it's applicable values
	function aggregateChildList(parentListId, childListId)
	{	
		clearCategoryList(parentListId, childListId,false,'Any');
		
		
		var cList = document.getElementById('cat' + childListId);
		var defIdx = defaultIndexes[childListId];
		var classifers = aCategories[childListId];
		var anyOption = new Option('Any',0,false,false);
		var nonDefaults = 0;	
		var sortIdx = 0;
		var selectedItems = aCatSelected['cat' + childListId];
		var sortedArray = new Array();
		var defaults = new Array();
		var selections = new Array();
	
		// Check each option
		for(var classIdx =1; classIdx < classifers.length; classIdx++)
		{ 
			var cItem = classifers[classIdx];
			var newOpt = new Option(cItem[0],cItem[1]);
			var isSelected = false;

			if(selectedItems != null)
			{
				for(sIdx = 0; sIdx < selectedItems.length; sIdx++)
				{
					if(cItem[1] == selectedItems[sIdx])
					{
						newOpt.selected = true;
						isSelected = true;
						nonDefaults++;
						break;
					}
				}
			}

			selections['OPT_' + newOpt.value] = isSelected;
	
			if(newOpt.value == defIdx)
			{
				defaults[defaults.length] = newOpt;
			}
			else
			{
				sortedArray[sortIdx++] = newOpt;
			}
		}

		sortedArray.sort(sortCategory);
		// Create a new Array (NS62 workaround)
		var finalArray = new Array();

		finalArray[0] = anyOption;
		selections['OPT_' + anyOption.value] = (nonDefaults == 0 && defIdx == 0);

		for(var dIdx =0; dIdx < defaults.length; dIdx++)
		{	
			var defOpt = defaults[dIdx];
			selections['OPT_'+ defOpt.value] = (nonDefaults == 0);
			finalArray[	finalArray.length ] = defOpt;
		}

		for(var s=0; s < sortedArray.length; s++)
		{
			finalArray[	finalArray.length ] = sortedArray[s];
		}

		finalArray = removeDuplicates(finalArray);

		cList.blur();
		
		var insertAt = 0;
		for(var i =0; i < finalArray.length; i++)
		{
			insertAt = cList.options.length;
			cList.options[insertAt] = finalArray[i];

			var sel = false;
			var arrIds = finalArray[i].value.split(',');

			for(var j=0; j<arrIds.length; j++)
			{
				sel = selections['OPT_'+ arrIds[j]];
				if (sel)
					break;
			}

			SelectItem(childListId,insertAt, sel);
		}

		aCatSelected['cat' + childListId] = new Array(); // Clear out the selections

		populateCheckBox(selectedItems, childListId);
	}


function SelectItem(catId, catIdx, selected)
	{
		switch(catId)
		{
		case 'location':
		{
			document.layout.catlocation.options[catIdx].selected = selected;
			break;
		}
		case 'area':
		{
			document.layout.catarea.options[catIdx].selected = selected;
			break;
		}
		case 'worktype':
		{
			document.layout.catworktype.options[catIdx].selected = selected;
			break;
		}
		case 'industry':
		{
			document.layout.catindustry.options[catIdx].selected = selected;
			break;
		}
		case 'occupation':
		{
			document.layout.catoccupation.options[catIdx].selected = selected;
			break;
		}
		case 'specialisation':
		{
			document.layout.catspecialisation.options[catIdx].selected = selected;
			break;
		}
		}
   }

	function getItemValue(catId, catIdx)
	{
		switch(catId)
		{
		case 'location':
		{
			return document.layout.catlocation.options[catIdx].value;
		}
		case 'area':
		{
			return document.layout.catarea.options[catIdx].value;
		}
		case 'worktype':
		{
			return document.layout.catworktype.options[catIdx].value;
		}
		case 'industry':
		{
			return document.layout.catindustry.options[catIdx].value;
		}
		case 'occupation':
		{
			return document.layout.catoccupation.options[catIdx].value;
		}
		case 'specialisation':
		{
			return document.layout.catspecialisation.options[catIdx].value;
		}
		}
   }


	// Populates the child list of the currently selected list (if applicable)
	// Only populates direct descendants
	function populateChildList(parentListId, childListId)
	{
		// must cater for duplicates when multi-parent items exist

		var cList = document.getElementById('cat' + childListId);
		var pList = document.getElementById('cat' + parentListId);
		var defIdx = defaultIndexes[childListId];
		var parentSelections  = new Array();
		var parentClassifications = aCategories[parentListId].length;
		// Save the currenlty selected Parent Options if applicable
		// Save the currently selected child options
		var currentSelections = new Array();

		var selections = new Array();

		var cSelIdx = 0;
		for(var cIdx =0; cIdx < cList.options.length; cIdx++)
		{
			if(cList.options[cIdx].selected)
			{
				var arrIds = cList.options[cIdx].value.split(',');

				for(var i=0; i<arrIds.length; i++)
					currentSelections[cSelIdx++] = arrIds[i];
			}
		}

		// Clear the list and show message if the item selected is a duplicate
		if (pList.options.selectedIndex >= 0)	
		{
			if (pList.options[pList.options.selectedIndex].value.split(',').length > 1)
			{
				clearCategoryList(parentListId,childListId,true,'No Selection is Required');
				return;	
			}
		}			

		// Now clear the list 
		clearCategoryList(parentListId,childListId,false,'Any');

		var aRels = aRelationShips[parentListId];
		var classifers = aCategories[childListId];
		var selectedItems = aCatSelected['cat' + childListId];
		
		var optIdx = 0;
		var selectedAll = false;
	    var anyOption = new Option('Any',0,false,false);

		if(defIdx == 0){
			anyOption.selected = true;	
			selections['OPT_'+ anyOption.value] = true;
		}

		if(aRels != null && aRels.length > 0)
		{
			var sortedArray = new Array();
			for(pIdx =1; pIdx < pList.options.length; pIdx++)
			{
				if(selectedAll)
				{
					selectedAll = false;
					break;	
				}
				var pOpt = pList.options[pIdx];
				
				if(pOpt.selected == true)
				{
					if(pOpt.value != 0) // If not ANY
					{		
						var itemRels = aRels[pOpt.value]; //PW CHange

						//window.status = pIdx;
						if(itemRels != null)
						{
							for(idx =0; idx < itemRels.length ; idx++)
							{
								var rIdx = itemRels[idx];
								var cat = classifers[rIdx];
								var opt = new Option(cat[0],cat[1]);

								if(selectedItems != null){
									for(sIdx = 0; sIdx < selectedItems.length; sIdx++)
									{
										if(opt.value == selectedItems[sIdx])
										{
											opt.selected = true;
											anyOption.selected = false;
											selections['OPT_'+ opt.value] = true;
											selections['OPT_'+ anyOption.value] = false;
										}
									}
								}
								for(var oldSelIdx = 0; oldSelIdx < currentSelections.length; oldSelIdx++)
								{
									if(opt.value == currentSelections[oldSelIdx])
									{
										opt.selected = true;
										anyOption.selected = false;

										selections['OPT_'+ opt.value] = true;
										selections['OPT_'+ anyOption.value] = false;
								
									}
								}

								var add = true; // Check for duplicates
								var optValue = 0;
								var optIndex = 0;
								for(var dupIdx=0; dupIdx < sortedArray.length; dupIdx++)
								{
									if(opt.text == sortedArray[dupIdx].text)
									{
										add = false;

										if(opt.value != sortedArray[dupIdx].value)
										{
											optValue = opt.value;
											optIndex = dupIdx;
										}
										
										break;
									}
								}

								// If the item has the same text but different ids, concatenate
								// the ids into one.
								if (optValue != 0)
								{
									sortedArray[optIndex].value += ',' + opt.value;
								}
								else
								{
									if(add)
										sortedArray[optIdx++] = opt;
								}								
							}	
						}
					}
					else // IS ANY
					{
						//Clear out the search box
						clearCategoryList(parentListId,childListId,false,'Any');
						selectedAll = true;
					}
				}
			}

			var sorted = isSorted[childListId];
			if (sorted == null || sorted)
				sortedArray.sort(sortCategory);

			var finalArray = new Array();
			finalArray[0] = anyOption;

			for(var s=0 ; s < sortedArray.length; s++)
			{
				finalArray[finalArray.length] = sortedArray[s];
			}

			finalArray = removeDuplicates(finalArray);
			
			for(var i =0; i < finalArray.length; i++)
			{
				cList.options[cList.options.length] = finalArray[i];

				var sel = false;
				var arrIds = finalArray[i].value.split(',');

				for(var j=0; j<arrIds.length; j++)
				{
					sel = selections['OPT_'+ arrIds[j]];
					if (sel)
						break;
				}

				SelectItem(childListId,i,sel);
			}
		}

		populateCheckBox(selectedItems, childListId);
	}


	// Custom case insensitive Sorter for option arrays
	function sortCategory(opt1, opt2)
	{
		// Expects 2 option objects
		
		if ( opt1.text.toLowerCase() == opt2.text.toLowerCase() )
			return 0;
		else if( opt1.text.toLowerCase() > opt2.text.toLowerCase())
			return 1;
		else
			return -1;
		
	}
			

	function  ValidateBeforePost()
	{
		submitCounter++;
	var listArray = new Array(6);
	var forceDefault = new Array(6);
	var minSelection = 2;
	var selectedCount = 0;
	var ctrlIdx = 0;
	var kw = '';
	var refineKw = '';
	var selectedJobs = '';
	var qString = '?';
	

	var kwTextBox = document.forms['layout'].elements['Keywords'];
	var selectedItemsList = document.forms['layout'].elements['chkJob'];
	var refineTextBox = document.forms['layout'].elements['refine'];

	if (submitCounter > 1)
	{
		alert('Your request is being processed - please wait.');
		submitCounter--;
		return false; 
	}

	//empty out the Keyword box if it contains crap text
	if(kwTextBox != null && kwTextBox.value.indexOf ('optional') != -1)
	{
		kwTextBox.value = '';
	}

	if(kwTextBox != null && kwTextBox.value != '')
	{
		kw = kwTextBox.value;
	}

	if(refineTextBox != null && refineTextBox.value != '')
	{
		refineKw = refineTextBox.value;
	}

	if(selectedItemsList != null && selectedItemsList.value != '')
	{
		for (var i=0; i < selectedItemsList.length; i++)
		{
		if (selectedItemsList[i].checked)
			{
				selectedJobs += selectedItemsList[i].value;
				selectedJobs += ',';
			}
		}
	}

	var dateRangeList = document.getElementById('DateRange');
	if(dateRangeList != null){
		forceDefault[ctrlIdx]  = 0;
		listArray[ctrlIdx++] = dateRangeList;
		
	}
listArray[0] = dateRangeList;
	forceDefault[ctrlIdx]  = '0';
	listArray[ctrlIdx++] = document.getElementById('catlocation');
	forceDefault[ctrlIdx]  = '0';
	listArray[ctrlIdx++] = document.getElementById('catarea');
	forceDefault[ctrlIdx]  = '0';
	listArray[ctrlIdx++] = document.getElementById('catworktype');
	forceDefault[ctrlIdx]  = '0';
	listArray[ctrlIdx++] = document.getElementById('catindustry');
	forceDefault[ctrlIdx]  = '0';
	listArray[ctrlIdx++] = document.getElementById('catoccupation');
	forceDefault[ctrlIdx]  = '0';
	listArray[ctrlIdx++] = document.getElementById('catspecialisation');
	var blnlocationChecked = false;
	var chkBoxlocation = GetObjectByPartName('chkUnspecifiedlocation');
	if (chkBoxlocation != null) 
		if (!chkBoxlocation.disabled)
			blnlocationChecked = chkBoxlocation.checked;
	var blnareaChecked = false;
	var chkBoxarea = GetObjectByPartName('chkUnspecifiedarea');
	if (chkBoxarea != null) 
		if (!chkBoxarea.disabled)
			blnareaChecked = chkBoxarea.checked;
	var blnworktypeChecked = false;
	var chkBoxworktype = GetObjectByPartName('chkUnspecifiedworktype');
	if (chkBoxworktype != null) 
		if (!chkBoxworktype.disabled)
			blnworktypeChecked = chkBoxworktype.checked;
	var blnindustryChecked = false;
	var chkBoxindustry = GetObjectByPartName('chkUnspecifiedindustry');
	if (chkBoxindustry != null) 
		if (!chkBoxindustry.disabled)
			blnindustryChecked = chkBoxindustry.checked;
	var blnoccupationChecked = false;
	var chkBoxoccupation = GetObjectByPartName('chkUnspecifiedoccupation');
	if (chkBoxoccupation != null) 
		if (!chkBoxoccupation.disabled)
			blnoccupationChecked = chkBoxoccupation.checked;
	var blnspecialisationChecked = false;
	var chkBoxspecialisation = GetObjectByPartName('chkUnspecifiedspecialisation');
	if (chkBoxspecialisation != null) 
		if (!chkBoxspecialisation.disabled)
			blnspecialisationChecked = chkBoxspecialisation.checked;


		for(var idx=0;idx < listArray.length; idx++)
		{	
			var searchableItems = '';
			var ddList = listArray[idx];
			var doForceDefault = false;
			var countedCategory = false;
			
			if(ddList == null) //suppressed categories will be null so bypass them
				continue;

			// If Category control doesnt appear (eg. Area not shown for 30 days), but
			// exists in model, then must test that control exists first.
			if (ddList != null)
			{
				for(var k=0; k < ddList.options.length; k++)
				{ 
					var sItems = 0;
					var opt = ddList.options[k];
				
					if(opt.selected && opt.value != '0' && opt.value != '999')
					{
						searchableItems += '&' + ddList.name + '=' + opt.value;
						sItems++;
					
						// for non-zero defaults ensure that any is actually reset
						if(opt.selected && forceDefault[idx] != 0 && opt.value == '0')
						{
							doForceDefault = true;
						}

						if(listArray[idx].name == 'catlocation')
							searchableItems += '&stateselected=true';
					}
					else
					{
						if(opt.selected && ddList.name == 'DateRange' && opt.value == '999')
						{
							qString += '&DateRange=999'; // add it but dont count it
						}
					
					}

					if(sItems > 0 && !countedCategory)
					{
						selectedCount++;
						countedCategory = true;
					}
				}
			}

			if(doForceDefault)
			{
				//qString += '&def' + ddList.name + '=1';
			}
			if(selectedCount > 0)
			{
				qString += searchableItems;
			}
		}
	if(blnlocationChecked)
 { 
	var chkBoxValues = chkBoxlocation.value.split(',')
	for(var j=0; j<chkBoxValues.length; j++)
		qString += '&catlocation=' + chkBoxValues[j];
 } 

	if(blnareaChecked)
 { 
	var chkBoxValues = chkBoxarea.value.split(',')
	for(var j=0; j<chkBoxValues.length; j++)
		qString += '&catarea=' + chkBoxValues[j];
 } 

	if(blnworktypeChecked)
 { 
	var chkBoxValues = chkBoxworktype.value.split(',')
	for(var j=0; j<chkBoxValues.length; j++)
		qString += '&catworktype=' + chkBoxValues[j];
 } 

	if(blnoccupationChecked)
 { 
	var chkBoxValues = chkBoxoccupation.value.split(',')
	for(var j=0; j<chkBoxValues.length; j++)
		qString += '&catoccupation=' + chkBoxValues[j];
 } 

	if(blnspecialisationChecked)
 { 
	var chkBoxValues = chkBoxspecialisation.value.split(',')
	for(var j=0; j<chkBoxValues.length; j++)
		qString += '&catspecialisation=' + chkBoxValues[j];
 } 

qString += '&catindustry=1215';

		if(selectedCount < minSelection)
		{
			if (minSelection == 3)
				alert('Please select a minimum of three categories before proceeding with your search.');
			else if (minSelection == 2)
				alert('Please select a minimum of two categories before proceeding with your search.');
			else
				alert('Please select at least one category before proceeding with your search.');
			submitCounter--;
			return false;
		}
		else
		{
			
				var page;
				var pIdx = document.URL.indexOf('?');

				
				
				page =  ('http://jobs.seek.com.au/jobsearch/index.ascx');
				
				
				if(kw != '')
				{
					qString += '&Keywords=' + doUriEncode(kw);
				}
				if(refineKw != '')
				{
					qString += '&refine=' + doUriEncode(refineKw);
				}
				if(varversion != '')
				{
					qString += '&catversion=' + doUriEncode(varversion);
				}
				
				qString += '&advertiserID=21057345';
					
					

				if (submitCounter > 1)
				{
					alert('Your request is being processed - please wait.');
					return false; 
				}
				submitCounter++;
				
				document.location = page +  qString + '';
				return false;
		}
	}

	function doUriEncode(uri)
	{
		var isOld = false;

		var bBrowser= navigator.appName;
		var bVersion = navigator.appVersion;
		var encoded = uri;

		if(bBrowser == 'Microsoft Internet Explorer')
		{
			isOld = (bVersion.indexOf('MSIE 5.0') != -1);
		}

		if(isOld)
			encoded = escape(uri);
		else
			encoded = encodeURIComponent(uri);	

		while (encoded.search('\'') != -1)
		{
			encoded = encoded.replace('\'','%27'); //encode single quotes
		}

		while (encoded.search('[\+]') != -1)
		{
			encoded = encoded.replace('+','%2B'); //encode single quotes
		}
		
		return encoded;
	}

	function HideExecLink()
	{
		document.all['execnav1'].style.display = "none";
		document.all['execnav2'].style.display = "inline"
	}

	function ChangeToNZImages()
	{
		document.all['auslogo'].style.display = "none";
		document.all['nzlogo'].style.display = "inline"
	}

	function ChangeToNZWords()
	{
		document.all['auswords'].style.display = "none";
		document.all['nzwords'].style.display = "inline"
	}
	
	populateClassiferList("catlocation","location");
	populateClassiferList("catworktype","worktype");
	populateClassiferList("catoccupation","occupation");
	ProcessChildList("occupation","specialisation");
	
	AddItemToDropDownAt(document.layout.catlocation,'Location', 0, 0)
	AddItemToDropDownAt(document.layout.catworktype,'WorkType', 0, 0)
	AddItemToDropDownAt(document.layout.catoccupation,'Position', 0, 0)
//	AddItemToDropDownAt(document.layout.catarea,'Regional', 0, 0)

	if (varcountry == "nz")
	{
		HideExecLink();
		ChangeToNZImages();
		ChangeToNZWords();
	}