<!--

var akamaiImgs = 'http://akamai.globalsources.com.edgesuite.net/f/593/3445/5d/static.globalsources.com';	
var akamaiTNW = 'http://akamai.globalsources.com.edgesuite.net/f/593/3445/5d/static.globalsources.com/SITE/I/S';
var akamaiBlank = 'http://akamai.globalsources.com.edgesuite.net/f/593/3445/5d/static.globalsources.com/SITE/I/0.GIF';	

// get data from jsp
function buildList(xml, tag, field) {
   if (xml.getElementsByTagName(tag)) {
      list = xml.getElementsByTagName(tag)[0].getElementsByTagName('option');
      for (i = 0; i < list.length; i++) {
         option = new Option(list[i].getAttribute('description'), list[i].getAttribute('code'));
         field.options[field.options.length] = option;
      }
   }
}

function buildPickList(xml, form) {
 /*  buildList(xml, 'countryList', form.country); 
   buildList(xml, 'industryList', form.industry); 
   buildList(xml, 'monthList', form.month); */
   
   buildList(xml, 'countryList', form.event_country); 
   buildList(xml, 'industryList', form.event_industry); 
   buildList(xml, 'monthList', form.event_month);   
   
}

function handler() {
 if(client.readyState == 4 && client.status == 200) {
  // so far so good
  if(client.responseXML != null && client.responseXML.getElementsByTagName('tsfindbox'))
   // success!
   //buildPickList(client.responseXML, document.theForm);
   buildPickList(client.responseXML, document.findashow);
   
  else
   buildPickList(null);
 } else if (client.readyState == 4 && client.status != 200) {
  // fetched the wrong page or network error...
  buildPickList(null);
 }
}

var client = null;

function getURL2(url) {
   if (window.XMLHttpRequest) {
      client = new XMLHttpRequest();
   } else if (window.ActiveXObject) {
     client = new ActiveXObject("Microsoft.XMLHTTP");
   }
   client.onreadystatechange = handler;
   client.open("GET", url, true);
   client.send(null);
}
// end get data from jsp

// picklist filter

function doSearch(form) {
	//reset the sorting, paging
	/*form['page'].value=1;
	form['doSort'].value="";
	form['reverse_sort'].value="";
	form['sorter'].value="";
	
	form.submit();
	*/
	if(form['inputkey'].value != "(Enter Keyword Optional)")
	{	form['keyword'].value = form['inputkey'].value;
	}
	form.submit();	
} 


 function doFilter(form, field) {
 var slectVal=field.options[field.selectedIndex].value;
	var sindex=field.selectedIndex;
	//alert(slectVal +"i="+sindex);
	blankSelected=false;
	if (sindex!=0 && slectVal=='') {    //items hardcoded into the page, or from xml if it uses < option CODE="" description=""  /> 
	//if (sindex!=0 && slectVal=='null') {    //get data from xml if it uses < option VALUE="" description=""  /> 
		field.options[0].selected=true;
		blankSelected=true;
	} 
	/*if (!blankSelected) {
		form.submit();
	} */
	
	if (!blankSelected) 
	{	if(form['inputkey'].value != "(Enter Keyword Optional)")
		{ form['keyword'].value = form['inputkey'].value; }
		form.submit()
	}	
 } 
// end picklist filter


var MacBrws = (navigator.appVersion.indexOf("Mac") != -1);
var brwSafari = (navigator.appVersion.indexOf("Safari") != -1);	
var brwsNets = (navigator.appName.indexOf("Netscape") != -1);
var brwFirefox = (navigator.userAgent.indexOf("Firefox") != -1);


function initializeThis() {
	getURL2('/trdshw/gsol/pex/en/bondat/jsp/common/tsfindboxXML.jsp');
}

//do a browser check here ----------------------------------
//window.onload=initializeThis;

if ((!brwsNets) && (!brwFirefox)) {
	window.onload=initializeThis;
}	
	

//do a browser check here ----------------------------------
// display the picklist

document.write("<SCRIPT LANGUAGE='JavaScript' SRC='/TRADESHOW/JS/picklistStatic.js' TYPE='text/javascript'><\/SCRIPT>");	

function displayPicklist()
{
	if ((!brwsNets) && (!brwFirefox)) //if not Nets / Firefox
	{	
		displayPicklistXML();
	}	
	else 
	{  displayPicklistStatic();
	}
	
}



// function displayPicklistXML()
function displayPicklistXML(){


	document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
	document.write('<tr><td background="'+akamaiTNW+'L.GIF"><img src="'+akamaiBlank+'" height="1" width="4"></td>');
	document.write('<td width="100%" height="40" background="'+akamaiTNW+'B.GIF" class="sidebarhdr" align=center>');
	
	// start fields
	
	document.write('		<table border="0" cellpadding="0" cellspacing="0">');
	document.write('		<form name="findashow" method="post" action="http://tradeshowcalendar.globalsources.com/tscal/gsol/pex/en/tscal/jsp/search.jsp" onsubmit="doSearch(document.findashow) ">');
	document.write('		<input type="hidden" name="onTSBoxFilter" value="true">');
	document.write('		<input type="hidden" name="page" value="1"> ');
	document.write('        <input type="hidden" name="doSort" value="">');
	document.write('        <input type="hidden" name="reverse_sort" value="">');
	document.write('		<tr> ');
	document.write('		  <td valign="top"><strong><span class="ver">Find a Show&nbsp;</span></strong>&nbsp;</td>');
	document.write('				<td> <font face="verdana,arial,helvetica" size="1">');
	document.write('						<select name="event_country" size="1" class="footer"  onchange="doFilter(this.form, this)">');
	document.write('						<option value="" selected="selected">All Regions&nbsp;&nbsp;&nbsp;&nbsp;</option>');
	document.write('						</select>	');
	document.write('					</font><td>');
						
	document.write('					<td><img src="'+akamaiBlank+'" border="0"  width="5"  height="1" ></td>');
	document.write('					<td><font face="verdana,arial,helvetica" size="1">');
	document.write('						<select name="event_industry" size="1" class="footer" onchange="doFilter(this.form, this)">');
	document.write('						<option value="" selected="selected">All Industries&nbsp;&nbsp;&nbsp;&nbsp;</option>');
	document.write('						</select>	');
	document.write('				</font></td>');
	document.write('				<td><img src="'+akamaiBlank+'" border="0"  width="5"  height="1" ></td>');
	document.write('				<td><font face="verdana,arial,helvetica" size="1"> ');
	document.write('						<select name="event_month" size="1" class="footer" onchange="doFilter(this.form, this)">');
	document.write('						<option value="" selected="selected">All Months</option>');
	document.write('						</select>');
	document.write('					</font>');
	document.write('					</td>');
	document.write('					<td><img src="'+akamaiBlank+'" border="0"  width="5"  height="1" ></td>');
	document.write('		  			<td nowrap="nowrap" valign="middle">');
	document.write('			  		<input type="hidden" name="keyword">');
	//document.write('			 		<input name="inputkey" type="text" class="ver" value="(Enter Keyword Optional)" size="30"> ');
	document.write('					<input name="inputkey" type="text" class="ver" value="(Enter Keyword Optional)" size="30" onfocus="this.value=\'\'"> ');
	document.write('		  			</td>');
	document.write('		 			<td><input  onclick="doSearch(this.form)" src="'+akamaiImgs+'/TRADESHOW/IMAGES/SEARCHTRNSP.GIF" alt="Search" align="top" border="0" type="image"></td>');
	document.write('		</tr>	');
	document.write('	  </form>');
	document.write('	</table>');

	// end fields	

	document.write('</td>');
	document.write('<td align="right" background="'+akamaiTNW+'R.GIF"><img src="'+akamaiBlank+'" width="4" height="40"></td>');
	document.write('</tr></table>');		
	
}
//end function displayPicklistXML()	

/*
function displayPicklistStatic()
{
	document.write('static picklist');
}*/
	
//-->