
/******************************** query variables ********************************************/

var arrayname='industry';

var querystring = window.location.search.substring(1); 
var url = new String(window.location);
var index = url.indexOf(".html");
var url = url.substring(0, index);
var index1 = url.lastIndexOf("_");

var industryid = url.substring(index1 + 1);
if(isNaN(industryid))
	industryid = "";

var supersectorid = getQueryVariable("supersector", querystring);
var sectorid = getQueryVariable("sector", querystring);
var subsectorid = getQueryVariable("subsector", querystring);

if(industryid == null)
	industryid = "";
if(supersectorid == null)
	supersectorid = "";
if(sectorid == null)
	sectorid = "";
if(subsectorid == null)
	subsectorid = "";




/****************************************************************************/


// Code to create the select boxes
document.write('<form name="industryForm">');
document.write('<table width="600" border="0" cellspacing="0" cellpadding="0"><tr><td>');
document.write('Industry: ');
document.write('</td><td>&nbsp;');		
document.write('Supersector: ');
document.write('</td><td>&nbsp;');		
document.write('Sector: ');
document.write('</td><td>&nbsp;');		
document.write('Subsector: ');
document.write('</td><td>&nbsp;</td></tr><tr><td nowrap>');
document.write('<SELECT style="width:137" NAME="industrySelect" VERYSILLY="NO" SIZE="1" onChange="changeDropdown(industrySelectIndex, this, marketcode)"></SELECT>');
document.write('</td><td nowrap>&nbsp;');		
document.write('<SELECT style="width:139" NAME="supersectorSelect" VERYSILLY="NO" onChange="changeDropdown(supersectorSelectIndex, this, marketcode)" SIZE="1"></SELECT>');
document.write('</td><td nowrap>&nbsp;');		
document.write('<SELECT style="width:139" NAME="sectorSelect" VERYSILLY="NO" onChange="changeDropdown(sectorSelectIndex, this, marketcode)" SIZE="1"></SELECT>');
document.write('</td><td nowrap>&nbsp;');		
document.write('<SELECT style="width:139" NAME="subsectorSelect" VERYSILLY="NO" SIZE="1" onChange="changeDropdown(subsectorSelectIndex, this, marketcode)"></SELECT>');

document.write('</td><td nowrap style="width:46">&nbsp;&nbsp;<a href="javascript:industryHandler(marketcode)"><img src="/images/about/listed/btn_go.gif" border="0"></a></td></tr></table>');
document.write('</form>');



/******************************** javascript functions ********************************************/


function industrysort(a, b){

	var aname = a[1].toLowerCase();
	var bname = b[1].toLowerCase();

	if(aname.indexOf("the") == 0) {
	    aname = aname.substring(3);
		aname = fnTrim(aname);
	}
    if(bname.indexOf("the") == 0) {
		bname = bname.substring(3);
		bname = fnTrim(bname);
	}

	if(aname < bname)
		return -1;
	else if(aname > bname)
		return 1;
	else
		return 0;	
		
}

/*
 * Function to populate the initial values in the industry, supersector, sector and subsector drop downs.
 */
function poplateDropDowns(menuname,arrayname,rows, market, selectedid)
{
	var obj = document.forms["industryForm"].elements[menuname];
//	alert(arrayname)
	var eventArray = eval(arrayname);
	menuSelect=obj.form.elements[menuname];
	var nOptions;
	//alert(menuname);
	//alert(menuSelect);

	menuSelect.length=0;

	if(rows<eventArray.length)
	{
	nOptions = rows;
	}
	
	if(rows>eventArray.length)
	{
	nOptions = eventArray.length;
	}

	if ((rows==0) || (rows == eventArray.length))
	{
	nOptions = eventArray.length;
	}
	
	var optionName = "";	
	if(menuname == "industrySelect")
		optionName = "Select an Industry";
	if(menuname == "supersectorSelect")
		optionName = "Select a Supersector";
	if(menuname == "sectorSelect")
		optionName = "Select a Sector";
	if(menuname == "subsectorSelect")
		optionName = "Select a Subsector";
	document.forms["industryForm"].elements[menuname][0]=new Option(optionName,"-1");

	for(i=1;i<=nOptions;i++)
	{
		if(eventArray[i-1][0].length>40)	
		{
			document.forms["industryForm"].elements[menuname][i]=new Option(eventArray[i-1][0].substring(0,40), eventArray[i-1][1]);
			if(eval("lc_" + market + "_industry_" + eventArray[i-1][1] + "_count") == 0)
				document.forms["industryForm"].elements[menuname].options[i].style.cssText = "color:cfcfcf";
			if(menuname == "industrySelect" && selectedid == eventArray[i-1][1])
				document.forms["industryForm"].elements[menuname].options[i].selected = true;
		}
		else
		{
			document.forms["industryForm"].elements[menuname][i]=new Option(eventArray[i-1][0], eventArray[i-1][1]);
			if(eval("lc_" + market + "_industry_" + eventArray[i-1][1] + "_count") == 0)
				document.forms["industryForm"].elements[menuname].options[i].style.cssText = "color:cfcfcf";
			if(menuname == "industrySelect" && selectedid == eventArray[i-1][1])
				document.forms["industryForm"].elements[menuname].options[i].selected = true;
		}
		
	}


}

/*
 * Generate the drop down options according to the selected industry / supersector / sector / subsector
 */
function changeDropdownValues(fieldname, market, eventtype)
{
	if(eval("eventtype") == undefined)
		eventtype = "";

	var obj = document.forms["industryForm"].elements[0];
	var arrayname='industry';
	var menuname="";

	if(fieldname=='industrySelect')
	{
		
		menuname='supersectorSelect';	
		if(obj.form.elements['industrySelect'].value==-1) {
			for(;document.forms["industryForm"].elements[menuname].length;)
			{
				document.forms["industryForm"].elements[menuname][0]=null;
			}
			delNul(document.forms["industryForm"].elements[menuname]);
			document.forms["industryForm"].elements[menuname][0]=new Option("Select a Supersector","-1");
			return;
		} else {
			for(;document.forms["industryForm"].elements[menuname].length;)
			{
				document.forms["industryForm"].elements[menuname][0]=null;
			}
			delNul(document.forms["industryForm"].elements[menuname]);
		}
		arrayname=arrayname+"_"+obj.form.elements['industrySelect'].value;
	}
	else if(fieldname=='supersectorSelect')
	{
		menuname='sectorSelect';
		//alert(obj.form.elements['supersectorSelect'].value)
		if(obj.form.elements['supersectorSelect'].value==-1)
		{
			var length=document.forms["industryForm"].elements[menuname].length;
			for(;document.forms["industryForm"].elements[menuname].length;)
			{
				document.forms["industryForm"].elements[menuname][0]=null;
			}
			delNul(document.forms["industryForm"].elements[menuname]);
			document.forms["industryForm"].elements[menuname][0]=new Option("Select a Sector","-1");
			return;
		}else {
			var length=document.forms["industryForm"].elements[menuname].length;
			for(;document.forms["industryForm"].elements[menuname].length;)
			{
				document.forms["industryForm"].elements[menuname][0]=null;
			}
			delNul(document.forms["industryForm"].elements[menuname]);	

		}
		arrayname=arrayname+'_'+obj.form.elements['supersectorSelect'].value;
	}
	else if(fieldname=='sectorSelect')
	{
		menuname='subsectorSelect';
		//alert(obj.form.elements['sectorSelect'].value)
		if(obj.form.elements['sectorSelect'].value==-1)
		{
			var length=document.forms["industryForm"].elements[menuname].length;
			for(;document.forms["industryForm"].elements[menuname].length;)
			{
				document.forms["industryForm"].elements[menuname][0]=null;
			}
			delNul(document.forms["industryForm"].elements[menuname]);
			document.forms["industryForm"].elements[menuname][0]=new Option("Select a Subsector","-1");
			return;
		}else {
			var length=document.forms["industryForm"].elements[menuname].length;
			for(;document.forms["industryForm"].elements[menuname].length;)
			{
				document.forms["industryForm"].elements[menuname][0]=null;
			}
			delNul(document.forms["industryForm"].elements[menuname]);	
		}		
		arrayname=arrayname+'_'+obj.form.elements['sectorSelect'].value;
	}
	else if(fieldname=='subsectorSelect')
	{
		return;
	}

	//alert(fieldname + "," + arrayname)
	var eventArray = eval(arrayname);
	var nOptions = eventArray.length;
	var k=0;
	if(fieldname=='industrySelect')
		document.forms["industryForm"].elements[menuname][k++]=new Option("Select a Supersector","-1");	
	else if(fieldname=='supersectorSelect')
		document.forms["industryForm"].elements[menuname][k++]=new Option("Select a Sector","-1");		
	else if(fieldname=='sectorSelect')
		document.forms["industryForm"].elements[menuname][k++]=new Option("Select a Subsector","-1");
		
	for(i=0;i<nOptions;i++)
	{
		document.forms["industryForm"].elements[menuname][k++]=new Option(eventArray[i][0], eventArray[i][1]);
		if(eval("lc_" + market + "_industry_" + eventArray[i][1] + "_count") == 0)
			document.forms["industryForm"].elements[menuname].options[k-1].style.cssText = "color:cfcfcf";
	}

	if(fieldname=='industrySelect') {
		var selobj = document.forms["industryForm"].elements["supersectorSelect"];
		var selindex = 0;
		for(i = 0; i < selobj.length;i++) {
			if(selobj.options[i].value == supersectorid) {
				selindex = i;
				break;
			}
		}
		if(eventtype == "pageload") {
			document.forms["industryForm"].elements["supersectorSelect"].options[selindex].selected = true;
			changeDropdownValues('supersectorSelect', market, eventtype);
			changeDropdownValues('sectorSelect', market, eventtype);
		} else {
			changeDropdownValues('supersectorSelect', market);
			changeDropdownValues('sectorSelect', market);
		}
	} else if(fieldname=='supersectorSelect') {
		var selobj = document.forms["industryForm"].elements["sectorSelect"];
		var selindex = 0;
		for(i = 0; i < selobj.length;i++) {
			if(selobj.options[i].value == sectorid) {
				selindex = i;
				break;
			}
		}
		if(eventtype == "pageload") {
			document.forms["industryForm"].elements["sectorSelect"].options[selindex].selected = true;
			changeDropdownValues('sectorSelect', market, eventtype);
		} else {
			changeDropdownValues('sectorSelect', market);
		}
	} else if(fieldname=='sectorSelect') {
		var selobj = document.forms["industryForm"].elements["subsectorSelect"];
		var selindex = 0;
		for(i = 0; i < selobj.length;i++) {
			if(selobj.options[i].value == subsectorid) {
				selindex = i;
				break;
			}
		} 
		if(eventtype == "pageload") {
			document.forms["industryForm"].elements["subsectorSelect"].options[selindex].selected = true;
			changeDropdownValues('subsectorSelect', market, eventtype);
		} else {
			changeDropdownValues('subsectorSelect', market);
		}
	}

}

//This function is to remove the null values in the select box
function delNul(lst){
    i = 0;
    while (i<lst.options.length) {
        if (lst.options[i].value==-1)
            lst.options[i]=null
        else
            i = i + 1;
    }
}

/*
 * On changing the option of the drop down, call the necessary function to generate the remaining drop downs.
 */
function changeDropdown(selectIndex, element, market) {
//alert("hi")
	var ind = document.forms["industryForm"].elements[element.name].selectedIndex;
	var val = document.forms["industryForm"].elements[element.name].options[ind].value;

	if(val == -1 && element.name == "industrySelect") {
		poplateDropDowns("supersectorSelect", "supersector","0", market);
		poplateDropDowns("sectorSelect", "sector","0", market);
		poplateDropDowns("subsectorSelect", "subsector","0", market);
//changeDropdownValues("industrySelect", market);
//changeDropdownValues("supersectorSelect", market);
//changeDropdownValues("sectorSelect", market);

		industrySelectIndex = document.forms["industryForm"].elements["industrySelect"].selectedIndex;
		supersectorSelectIndex = document.forms["industryForm"].elements["supersectorSelect"].selectedIndex;
		sectorSelectIndex = document.forms["industryForm"].elements["sectorSelect"].selectedIndex;
		subsectorSelectIndex = document.forms["industryForm"].elements["subsectorSelect"].selectedIndex;

		return;
	} 
	if(val == -1 && element.name == "supersectorSelect") {
//		poplateDropDowns("sectorSelect", "sector","0", market);
//		poplateDropDowns("subsectorSelect", "subsector","0", market);
changeDropdownValues("supersectorSelect", market);
changeDropdownValues("sectorSelect", market);
		industrySelectIndex = document.forms["industryForm"].elements["industrySelect"].selectedIndex;
		supersectorSelectIndex = document.forms["industryForm"].elements["supersectorSelect"].selectedIndex;
		sectorSelectIndex = document.forms["industryForm"].elements["sectorSelect"].selectedIndex;
		subsectorSelectIndex = document.forms["industryForm"].elements["subsectorSelect"].selectedIndex;

		return;
	}
	if(val == -1 && element.name == "sectorSelect") {
		//poplateDropDowns("subsectorSelect", "subsector","0", market);
changeDropdownValues("sectorSelect", market);
		industrySelectIndex = document.forms["industryForm"].elements["industrySelect"].selectedIndex;
		supersectorSelectIndex = document.forms["industryForm"].elements["supersectorSelect"].selectedIndex;
		sectorSelectIndex = document.forms["industryForm"].elements["sectorSelect"].selectedIndex;
		subsectorSelectIndex = document.forms["industryForm"].elements["subsectorSelect"].selectedIndex;

		return;
	}
	if(val == -1 && element.name == "subsectorSelect") {

		industrySelectIndex = document.forms["industryForm"].elements["industrySelect"].selectedIndex;
		supersectorSelectIndex = document.forms["industryForm"].elements["supersectorSelect"].selectedIndex;
		sectorSelectIndex = document.forms["industryForm"].elements["sectorSelect"].selectedIndex;

		return;
	}

	if(document.forms["industryForm"].elements[element.name].options[ind].style.cssText == "") {
		if(element.name != "subsectorSelect")
			changeDropdownValues(element.name, market);
		industrySelectIndex = document.forms["industryForm"].elements["industrySelect"].selectedIndex;
		supersectorSelectIndex = document.forms["industryForm"].elements["supersectorSelect"].selectedIndex;
		sectorSelectIndex = document.forms["industryForm"].elements["sectorSelect"].selectedIndex;
		subsectorSelectIndex = document.forms["industryForm"].elements["subsectorSelect"].selectedIndex;

	}
	else {
		document.forms["industryForm"].elements[element.name].options[selectIndex].selected = true;
	}

}

/*
 * On click on the go button load the page with respect to the selected Industry, Supersector, Sector and Subsector.
 */
function industryHandler(market) { 
	var iIndustryIndex = document.industryForm.industrySelect.selectedIndex;  
	var selectedIndustry = document.industryForm.industrySelect.options[iIndustryIndex].value; 	
	var iSuperSectorIndex = document.industryForm.supersectorSelect.selectedIndex;  
	var selectedSuperSector = document.industryForm.supersectorSelect.options[iSuperSectorIndex].value; 	
	var iSectorIndex = document.industryForm.sectorSelect.selectedIndex;  
	var selectedSector = document.industryForm.sectorSelect.options[iSectorIndex].value; 	
	var iSubSectorIndex = document.industryForm.subsectorSelect.selectedIndex;  
	var selectedSubSector = document.industryForm.subsectorSelect.options[iSubSectorIndex].value; 	

	var url = window.location.search.substring(1); 
	var sLstComp = getQueryVariable("ListedComp", url);
	if (sLstComp == null) {
	  sLstComp = "All";
	}
	
	var industryid = "";
	var supersectorid = "";
	var sectorid = "";
	var subsectorid = "";

	if (iSubSectorIndex != 0) { 
		for(i = 0; i < subsector.length; i++) {
			if(subsector[i][1] == selectedSubSector) {
				industryid = subsector[i][2];
				break;
			}
		}

		var temparr = eval("industry_" + industryid)
		if(temparr.length == 1)
			supersectorid = temparr[0][1];
		else {
			for(i = 0; i < temparr.length; i++) {
				supersectorid += temparr[i][1] + ",";
			}
			supersectorid = supersectorid.substring(0, supersectorid.length - 1);
		}
		//alert(supersectorid);

		var temparr = supersectorid.split(",");
		outer:
		for(i = 0; i < temparr.length; i++) {
			var temparr1 = eval("industry_" + temparr[i]);
			//alert(temparr1)
			for(j = 0; j < temparr1.length; j++) {
				var temparr2 = eval("industry_" + temparr1[j][1]);
				//alert(temparr2)
				for(k = 0; k < temparr2.length; k++) {
					//alert(temparr2[k][1])
					if(temparr2[k][1] == selectedSubSector) {
						sectorid = temparr1[j][1];
						supersectorid = temparr[i];
						break outer;
					}
				}
			}
		}
		//alert(sectorid);

		//alert( "/about/listed/lc_" + market + "_industry_" + industryid + ".html?supersector=" + supersectorid +"&sector=" + sectorid + "&subsector="+selectedSubSector+"&ListedComp="+sLstComp);
		window.location.href = "/about/listed/lc_" + market + "_industry_" + industryid + ".html?supersector=" + supersectorid +"&sector=" + sectorid + "&subsector="+selectedSubSector+"&ListedComp="+sLstComp; 
	} else if(iSectorIndex != 0 && iSubSectorIndex == 0) { 
		for(i = 0; i < sector.length; i++) {
			if(sector[i][1] == selectedSector) {
				industryid = sector[i][2];
				break;
			}
		}
		
		var temparr = eval("industry_" + industryid)
		if(temparr.length == 1)
			supersectorid = temparr[0][1];
		else {
			for(i = 0; i < temparr.length; i++) {
				supersectorid += temparr[i][1] + ",";
			}
			supersectorid = supersectorid.substring(0, supersectorid.length - 1);
		}

		var temparr = supersectorid.split(",");
		outer:
		for(i = 0; i < temparr.length; i++) {
			var temparr1 = eval("industry_" + temparr[i]);
			for(j = 0; j < temparr1.length; j++) {
				if(temparr1[j][1] == selectedSector) {
					supersectorid = temparr[i];
					break outer;
				}
			}
		}
		//alert(supersectorid);

		//alert( "/about/listed/lc_" + market + "_industry_" + industryid + ".html?&supersector=" + supersectorid + "&sector="+selectedSector+"&ListedComp="+sLstComp);
		window.location.href = "/about/listed/lc_" + market + "_industry_" + industryid + ".html?supersector=" + supersectorid + "&sector="+selectedSector+"&ListedComp="+sLstComp; 
	} else if(iSuperSectorIndex != 0 && iSectorIndex == 0) { 
		for(i = 0; i < supersector.length; i++) {
			if(supersector[i][1] == selectedSuperSector) {
				industryid = supersector[i][2];
				break;
			}
		}

		//alert( "/about/listed/lc_" + market + "_industry_" + industryid + ".html?supersector="+selectedSuperSector+"&ListedComp="+sLstComp);
		window.location.href = "/about/listed/lc_" + market + "_industry_" + industryid + ".html?supersector="+selectedSuperSector+"&ListedComp="+sLstComp; 
	} else if(iIndustryIndex != 0 && iSuperSectorIndex == 0) { 
		for(i = 0; i < industry.length; i++) {
			if(industry[i][1] == selectedIndustry) {
				industryid = industry[i][2];
				break;
			}
		}

		//alert( "/about/listed/lc_" + market + "_industry_" + industryid + ".html?ListedComp="+sLstComp);
		window.location.href = "/about/listed/lc_" + market + "_industry_" + industryid + ".html?ListedComp="+sLstComp; 
	} else {
		alert ('Please select Industry/Supersector/Sector/Subsector');
	}
}




/****************************************************************************/

// Used to include the subsector js files according to the selected industry / supersector / sector values for the given market

var include_subsectorid = "";
if(subsectorid != "") {
	var idexists = false;
	for(i = 0; i < subsector_id.length; i++) {
		if(subsector_id[i] == subsectorid) {
			idexists = true;
			break;
		}
	}

	if(idexists)
		include_subsectorid = subsectorid + ",";
} else if(sectorid != "") {

	var idexists = false;
	for(i = 0; i < sector_id.length; i++) {
		if(sector_id[i] == sectorid) {
			idexists = true;
			break;
		}
	}
	
	if(idexists) {
		var include_sectorid = sectorid;
		var sector_array = eval("industry_" + include_sectorid);
		for(j = 0; j < sector_array.length; j++) {
			include_subsectorid += sector_array[j][1] + ",";
		}
	}
} else if(supersectorid != "") {

	var idexists = false;
	for(i = 0; i < supersector_id.length; i++) {
		if(supersector_id[i] == supersectorid) {
			idexists = true;
			break;
		}
	}
	
	if(idexists) {
		var include_sectorid = "";
		var sector_array = eval("industry_" + supersectorid);

		for(j = 0; j < sector_array.length; j++) {
			include_sectorid += sector_array[j][1] + ",";
		}

		if(include_sectorid.length > 0)
			include_sectorid = include_sectorid.substring(0, include_sectorid.length - 1);

		var include_sectorid = include_sectorid.split(",");

		var sector_count = include_sectorid.length;
		for(i = 0; i < sector_count; i++) {
			var sector_array = eval("industry_" + include_sectorid[i]);
			for(j = 0; j < sector_array.length; j++) {
				include_subsectorid += sector_array[j][1] + ",";
			}
		}
	}
} else if(industryid != "") {

	var idexists = false;
	for(i = 0; i < industry_id.length; i++) {
		if(industry_id[i] == industryid) {
			idexists = true;
			break;
		}
	}
	
	if(idexists) {
		var include_sectorid = [101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139];

		var sector_count = include_sectorid.length;
		for(i = 0; i < sector_count; i++) {
			var sector_array = eval("industry_" + include_sectorid[i]);
			for(j = 0; j < sector_array.length; j++) {
				if(sector_array[j][2] == industryid)
					include_subsectorid += sector_array[j][1] + ",";
				else
					break;
			}
		}
	}
}

if(include_subsectorid.length > 0)
	include_subsectorid = include_subsectorid.substring(0, include_subsectorid.length - 1);
//alert(include_subsectorid)

var strsubsector = include_subsectorid.split(",");
for(i = 0; i < strsubsector.length; i++) {
	//alert("<scr" + "ipt src='/about/listed/lc_" + marketcode + "_industry_" + strsubsector[i] + ".js' language='JavaScript' type='text/javascript'>" + "</scr" + "ipt>")
	document.write("<scr" + "ipt src='/about/listed/lc_" + marketcode + "_industry_" + strsubsector[i] + ".js' language='JavaScript' type='text/javascript'>" + "</scr" + "ipt>");	
}

//lc_ar_industry_3_companies = lc_ar_industry_1120128534136_companies;
//alert(eval("lc_" + marketcode + "_industry_" + industryid + "_companies"));



/****************************************************************************/

// if industry id is empty then the four drop downs will be populated with the initial values, else populated with the respective industry / supersector / sector / subsector selection
if(industryid != "") {
	poplateDropDowns("industrySelect", "industry","0", marketcode, industryid);
	changeDropdownValues("industrySelect", marketcode, "pageload");
} else {
	poplateDropDowns("industrySelect", "industry","0", marketcode, industryid);
	poplateDropDowns("supersectorSelect", "supersector","0", marketcode, supersectorid);
	poplateDropDowns("sectorSelect", "sector","0", marketcode, sectorid);
	poplateDropDowns("subsectorSelect", "subsector","0", marketcode, subsectorid);
}

/****************************************************************************/

//Below values are used to set back the option to older one if the selected option does not have any company in it
var industrySelectIndex = document.forms["industryForm"].elements["industrySelect"].selectedIndex;
var supersectorSelectIndex = document.forms["industryForm"].elements["supersectorSelect"].selectedIndex;
var sectorSelectIndex = document.forms["industryForm"].elements["sectorSelect"].selectedIndex;
var subsectorSelectIndex = document.forms["industryForm"].elements["subsectorSelect"].selectedIndex;

var industry_text = "";
var industry_desc = "";
if(industryid != "") {
	var selobj = document.forms["industryForm"].elements["industrySelect"];
	var selindex = 0;
	for(i = 0; i < selobj.length;i++) {
		if(selobj.options[i].value == industryid) {
			selindex = i;
			break;
		}
	}
	industry_text += document.forms["industryForm"].elements["industrySelect"].options[selindex].text + ",";
}
if(supersectorid != "") {
	var selobj = document.forms["industryForm"].elements["supersectorSelect"];
	var selindex = 0;
	for(i = 0; i < selobj.length;i++) {
		if(selobj.options[i].value == supersectorid) {
			selindex = i;
			break;
		}
	}
	industry_text += document.forms["industryForm"].elements["supersectorSelect"].options[selindex].text + ",";
}
if(sectorid != "") {
	var selobj = document.forms["industryForm"].elements["sectorSelect"];
	var selindex = 0;
	for(i = 0; i < selobj.length;i++) {
		if(selobj.options[i].value == sectorid) {
			selindex = i;
			break;
		}
	}
	industry_text += document.forms["industryForm"].elements["sectorSelect"].options[selindex].text + ",";
}
if(subsectorid != "") {
	var selobj = document.forms["industryForm"].elements["subsectorSelect"];
	var selindex = 0;
	var temp_text = "";
	for(i = 0; i < selobj.length;i++) {
		if(selobj.options[i].value == subsectorid) {
			selindex = i;
			break;
		}
	}
	temp_text = document.forms["industryForm"].elements["subsectorSelect"].options[selindex].text;
	industry_text += temp_text + ",";

	for(i = 0; i < subsector.length;i++) {
		if(subsector[i][0] == temp_text) {
			industry_desc = subsector[i][3];
			break;
		}
	}

}

if(industry_text.length > 0) {
	industry_text = industry_text.substring(0, industry_text.length - 1);
	document.write ("<table width='600' border='0' cellspacing='0' cellpadding='0'><tr><td><span class='fontbold'>");
	var industry_text = industry_text.split(",");
/*	for(i = 0; i < industry_text.length; i++) {
		if(i == 0)
			document.write(industry_text[i]);
		else
			document.write(" > " + industry_text[i]);
	}*/
	document.write(industry_text[industry_text.length - 1]);
	document.write("</span></td></tr>");
	if(industry_desc != "")	{
		document.write("<tr><td>");
		document.write(industry_desc);
		document.write("</td></tr>");
	}
	document.write("</table>");
}


