var ADVANCED_SEARCHED = "<form name='advanceSearch' id='advanceSearch' \/><table cellpadding='0' cellspacing='0'>  <tr><td>Category: <\/td><td class='rightBorder'><select name='searchcatalogid' id='advancedSearchCatalogId' class='txt230'><option value='all'>LinkChina.com<\/option><option value='24'> Holiday and Seasonal <\/option><option value='02'>Apparel & Accessories<\/option><option value='01'>Arts<\/option><option value='15'>Baby & Kids<\/option><option value='20'>Books<\/option><option value='05'>Cameras & Photo<\/option><option value='04'>Cell Phones & PDAs<\/option><option value='22'>Collectibles<\/option><option value='06'>Computers & Networking<\/option><option value='03'>Consumer Electronics<\/option><option value='17'>DVDs & Movies<\/option><option value='19'>Health & Beauty <\/option><option value='16'>Home & Garden<\/option><option value='08'>Jewelry <\/option><option value='14'>Motor Parts & Accessories<\/option><option value='12'>Music<\/option><option value='13'>Musical & Instruments<\/option><option value='21'>Office Suppliers<\/option><option value='10'>Sporting Goods<\/option><option value='18'>Stamps<\/option><option value='11'>Toys & Hobbies<\/option><option value='23'>Travel<\/option><option value='07'>Video Games<\/option><option value='09'>Watches<\/option>  <\/select><\/td><td>Unit Price:<\/td><td class='rightBorder'><input type='text' onKeyUp='checkInputPrice(this)' class='txt60' id='searchPricestart' value='' name='searchPricestart' onkeypress='submitAdvanceForm(event,\"advanceSearch\",\"\/advanceSearchAction.do\");' \/>  &nbsp;&nbsp;to&nbsp;&nbsp;  <input type='text' onKeyUp='checkInputPrice(this)' class='txt60' id='searchPriceend' value='' name='searchPriceend' onkeypress='submitAdvanceForm(event,\"advanceSearch\",\"\/advanceSearchAction.do\");' \/><\/td><td>Item Code:<\/td><td><input type='text' class='txt150' id='searchItemcode' onkeypress='submitAdvanceForm(event,\"advanceSearch\",\"\/advanceSearchAction.do\");' value='' name='searchItemcode'\/><\/td>  <\/tr>  <tr><td>Keyword (s):<\/td><td class='rightBorder'><input type='text' class='txt216' id='advanceSearchproductname' value='' maxlength='70' name='searchproductname' onkeypress='submitAdvanceForm(event,\"advanceSearch\",\"\/advanceSearchAction.do\");' \/>  <label for='searchFreeship'>  <input type='checkbox' value='free' id='searchFreeship' name='searchFreeship'\/>Free Shipment <\/label><\/td><td>Seller Name:<\/td><td class='rightBorder'><input type='text' class='txt150' id='searchSellerid' value='' name='searchSellerid' onkeypress='submitAdvanceForm(event,\"advanceSearch\",\"\/advanceSearchAction.do\");' \/><\/td><td colspan='2'><img src='http:\/\/image.linkchina.com\/buyer\/btn_orange_darkbg.gif' onClick='submitAdvanceFormSelf(\"advanceSearch\",\"\/advanceSearchAction.do\");' alt='Search' \/><\/td>  <\/tr><\/table><div class='clear'><img src='http:\/\/image.linkchina.com\/buyer\/head\/icon_category_close.gif' onclick='searchToggle()' alt='Close advanced search' \/><\/div>";

function searchToggle(){
	var btnObj = document.getElementById("advanceSearchTit");
	var formObj = document.getElementById("advanceSearchPanel");
	
	formObj.innerHTML = ADVANCED_SEARCHED;
	
	if(formObj.style.display != "block" || btnObj.className != "on"){
		btnObj.className = "on";
		formObj.style.display = "block";
	}else{
		btnObj.className = "";
		formObj.style.display = "none";
	}
}

function submitAdvanceForm(e,formName,actionName){
	if(!e) var e = window.event;
	if(e.keyCode == 13) submitAdvanceFormSelf(formName,actionName);
}

function submitAdvanceFormSelf(formName,actionName){
	//null check
	if((document.getElementById('advancedSearchCatalogId').value != null && document.getElementById('advancedSearchCatalogId').value != 'all' && document.getElementById('advanceSearchproductname').value != '') 
	|| (document.getElementById('advanceSearchproductname').value != null && document.getElementById('advanceSearchproductname').value != '')
	|| document.getElementById('searchFreeship').checked 
	|| (document.getElementById('searchPricestart').value != null && document.getElementById('searchPricestart').value != '')
	|| (document.getElementById('searchPriceend').value != null && document.getElementById('searchPriceend').value != '') 
	|| (document.getElementById('searchSellerid').value != null && document.getElementById('searchSellerid').value != '')
	|| (document.getElementById('searchItemcode').value != null && document.getElementById('searchItemcode').value != '') 
	){
		
	}else{
		return;
	}
	
	document.getElementById(formName).method = 'post';
	document.getElementById(formName).action = actionName;
	document.getElementById(formName).submit();
}

