// JavaScript Document

function swaptab(id)
{
	//alert(id)
	
}

var sell_ajax= new sack();
var buy_ajax= new sack();
function displaydesc(v)
{	
	// when the first level category is selected
	var Level=0;
	if(v=='fcat')
	{
		var index=document.getElementById(v).selectedIndex;
		var text=document.getElementById(v)[index].text;
		document.getElementById('categorydesc').style.display='';
		
		document.getElementById('selectedcat').innerHTML='<strong>You have selected '+text+' Category</strong';		
		Level=1;
		//alert(text)		 
		
	}
	// when the second level category is selected
	if(v=='fcat2')
	{
		var index=document.getElementById(v).selectedIndex;
		var text=document.getElementById(v)[index].text;
		document.getElementById('categorydesc').style.display='';
		
		document.getElementById('selectedcat').innerHTML='<strong>You have selected '+text+' Category</strong';
		Level=2;
		//alert(text)
	}
	
	// when the third level category is selected
	if(v=='fcat3')
	{
		var index=document.getElementById(v).selectedIndex;
		var text=document.getElementById(v)[index].text;
		document.getElementById('categorydesc').style.display='';
		
		document.getElementById('selectedcat').innerHTML='<strong>You have selected '+text+' Category</strong';
		Level=3;
		//alert(text)
	}
	
	document.getElementById('hid_category_id').value=document.getElementById(v).value;
	document.getElementById('hid_category_level').value=Level;
	//document.getElementById('tr_continue').style.display='';
	
	document.getElementById('div_loading').style.display='';
	var cat_id = document.getElementById(v).value;
	sell_ajax.requestFile='sell/call_ajax_sell.php?category_id='+cat_id+'&Level='+Level;
	sell_ajax.onCompletion = createFactor
	sell_ajax.runAJAX();
}

function createFactor()
{
		//alert(sell_ajax.response);
		eval(sell_ajax.response);
}

function step1Validatation()
{
	if(document.getElementById('fcat'))
	{
		if(document.getElementById('fcat').selectedIndex==-1)
		{
			alert("Please select the first category.");
			return false;
		}
	}
	if(document.getElementById('td_cat2').style.display=='')
	{
		if(document.getElementById('fcat2').selectedIndex==-1)
		{
			alert("Please select the second category.");
			return false;
		}
	}
	if(document.getElementById('td_cat3').style.display=='')
	{
		if(document.getElementById('fcat3').selectedIndex==-1)
		{
			alert("Please select the third category.");
			return false;
		}
	}
}

function step2Validation()
{
	
	
	if(document.getElementById('auctioncat').selectedIndex==-1)
	{
		alert('Select the Suitable option to which this auction belongs and is accessible to.');
		document.getElementById('auctioncat').focus();
		return false;
	}
	else if(document.getElementById('auctioncat').selectedIndex > 1)
	{
		var index = document.getElementById('auctioncat').selectedIndex;
		
		var select_name = "auctioncat_"+index;		
		if(document.getElementById(select_name).selectedIndex==-1)
		{			
			alert('Select the Suitable option to which this auction belongs and is accessible to.');
			document.getElementById(select_name).focus();
			return false;
		}
		
	}
	else if(document.getElementById('txtTitle').value=="")
	{
			alert('Help buyers find your item with a great title');
			document.getElementById('txtTitle').focus();
			return false;
	}
	else if(document.getElementById('txtSubTitle').value=="")
	{
			alert('Help buyers find your item with a Subtitle');
			document.getElementById('txtSubTitle').focus();
			return false;
	}
	else if(document.getElementById('selectCondition').selectedIndex==-1)
	{			
		alert('Help buyers find your item with product condition (New/Used)');
		document.getElementById('selectCondition').focus();
		return false;
	}
	else if(document.getElementById('SNO').checked==false && document.getElementById('VIN').checked==false)
	{
	alert('Please select any one of the two options VIN or Serial number');
		document.getElementById('SNO').focus();
		return false;
	}
	else if(document.getElementById('vin_sno_value').value=='')
	{
		if(document.getElementById('SNO').checked==true)
		{
	    alert('Please enter serial number or part number of the product');
		}
		else if(document.getElementById('VIN').checked==true)
		{
		alert('Please enter vehicle identification number(VIN)');
		}
		document.getElementById('vin_sno_value').focus();
		return false;
	}
	if(document.getElementById('auction_tab').style.display=='')
	{
		document.getElementById('hid_bid_type').value='Auction';
		if(document.getElementById('txtStartingPrice').value=="")
		{
			alert("Please enter Auction Starting Price.");
			document.getElementById('txtStartingPrice').focus();
			return false;
		}
		else if(isNaN(document.getElementById('txtStartingPrice').value))
		{
			alert("Please enter Auction Starting Price in numeric format [0-9].");
			document.getElementById('txtStartingPrice').focus();
			return false;
		}
		else if(document.getElementById('txtReservePrice').value!='')
		{
			
			if(isNaN(document.getElementById('txtReservePrice').value))
			{	
			alert("Please enter Auction Reserve Price in numeric format [0-9].");
			document.getElementById('txtReservePrice').focus();
			return false;
			}
			
			if(parseInt(document.getElementById('txtReservePrice').value) <=parseInt(document.getElementById('txtStartingPrice').value))
			{
				alert("Auction reserve price should be greater than Auction starting price.");
				document.getElementById('txtReservePrice').focus();
				return false;
			}
		}
		
		 if(document.getElementById('txtBuyNowPrice').value=="")
		{
			alert("Please enter Auction Buy it Now Price.");
			document.getElementById('txtBuyNowPrice').focus();
			return false;
		}
		else if(isNaN(document.getElementById('txtBuyNowPrice').value))
		{
			alert("Please enter Auction Buy it Now Price in numeric format [0-9].");
			document.getElementById('txtBuyNowPrice').focus();
			return false;
		}
		else if(parseInt(document.getElementById('txtStartingPrice').value)==parseInt(document.getElementById('txtBuyNowPrice').value))
		{
			alert("Auction starting price and buy it now price should not be equal.");
			document.getElementById('txtBuyNowPrice').focus();
			return false;
		}
		else if(parseInt(document.getElementById('txtStartingPrice').value) > parseInt(document.getElementById('txtBuyNowPrice').value))
		{
			alert("Buy it now price should be greater than auction starting price.");
			document.getElementById('txtBuyNowPrice').focus();
			return false;
		}
		
		else if(document.getElementById('txtQuantiy').value=="")
		{
			alert("Please enter Auction Quantity.");
			document.getElementById('txtQuantiy').focus();
			return false;
		}
		else if(isNaN(document.getElementById('txtQuantiy').value))
		{
			alert("Please enter Auction Quantity in numeric format [0-9].");
			document.getElementById('txtQuantiy').focus();
			return false;
		}
		else if(document.getElementById('selectDuration').selectedIndex==-1)
		{
			alert("Please select the Auction Duration.");
			document.getElementById('selectDuration').focus();
			return false;
		}
		else if(document.getElementById('radioSchedule1').checked==false && document.getElementById('radioSchedule2').checked==false )
		{
			alert("Please select the Auction Schedule.");
			document.getElementById('radioSchedule1').focus();
			return false;
		}
		else if(document.getElementById('radioSchedule2').checked==true)
		{
			if(document.getElementById('startDate').value==0)
			{
				alert("Please select the Auction Schedule Start time.");
				document.getElementById('startDate').focus();
				return false;
			}		
		}
		
	}
	
	if(document.getElementById('fixed_tab').style.display=='')
	{
		document.getElementById('hid_bid_type').value='Fixed';
		if(document.getElementById('txtFixedBuyItNow').value=="")
		{
			alert("Please enter Buy it Now Price.");
			document.getElementById('txtFixedBuyItNow').focus();
			return false;
		}
		else if(isNaN(document.getElementById('txtFixedBuyItNow').value))
		{
			alert("Please enter Buy it Now Price in numeric format [0-9].");
			document.getElementById('txtFixedBuyItNow').focus();
			return false;
		}
		else if(document.getElementById('txtFixedQuantity').value=="")
		{
			alert("Please enter the quantity.");
			document.getElementById('txtFixedQuantity').focus();
			return false;
		}
		else if(isNaN(document.getElementById('txtFixedQuantity').value))
		{
			alert("Please enter Quantity in numeric format [0-9].");
			document.getElementById('txtFixedQuantity').focus();
			return false;
		}		
		else if(document.getElementById('selectFixedDuration').selectedIndex==-1)
		{
			alert("Please select the Duration in days.");
			document.getElementById('selectFixedDuration').focus();
			return false;
		}
		else if(document.getElementById('radioFixedSchedule1').checked==false && document.getElementById('radioFixedSchedule2').checked==false )
		{
			alert("Please select the Schedule.");
			document.getElementById('radioFixedSchedule1').focus();
			return false;
		}
		else if(document.getElementById('radioFixedSchedule2').checked==true)
		{
			if(document.getElementById('Fixed_startDate').value==0)
			{
				alert("Please select the Schedule Start time.");
				document.getElementById('Fixed_startDate').focus();
				return false;
			}		
		}
		
	}
	
	if(document.getElementById('txtPaypalId').value=="")
	{
		alert("Enter Paypal id");		
		document.getElementById('txtPaypalId').focus();
		return false;
	}
	if(document.getElementById('txtPaypalId').value!="")
	{
		if(EmailValidation(document.getElementById('txtPaypalId'))==0)
		{			
			return false;
		}
	}
	
	if(document.getElementById('txtAddress').value=="")
		{
			alert("Please enter the address.");
			document.getElementById('txtAddress').focus();
			return false;
		}
		if(document.getElementById('Country').value=="0")
		{
			alert("Please select the Country.");
			document.getElementById('Country').focus();
			return false;
		}
		if(document.getElementById('tr_state').style.display=='')
		{
			if(document.getElementById('txtState').value=="0")
			{
				alert("Please select the state.");
				document.getElementById('txtState').focus();
				return false;
			}
		}
		if(document.getElementById('txtCity').value=="")
		{
			alert("Please enter the city.");
			document.getElementById('txtCity').focus();
			return false;
		}
		if(document.getElementById('txtZip').value=="")
		{
			alert("Please enter the zip.");
			document.getElementById('txtZip').focus();
			return false;
		}
		if(isNaN(document.getElementById('txtZip').value))
		{
			alert("Please enter the zip in numeric format [0-9].");
			document.getElementById('txtZip').focus();
			return false;
		}
		
	if(document.getElementById('shiptype').value=='Flat')
	{
		
		if(document.getElementById('Flat1').value==0)
		{
		alert("Please select the shipping services.");
		document.getElementById('Flat1').focus();
		return false;
		} 
		if(document.getElementById('tr_flat_1').style.display=='')
		{
		   if(document.getElementById('Flat2').value==0)
			{
			alert("Please select the shipping services.");
			document.getElementById('Flat2').focus();
			return false;
			}
			
			if(document.getElementById('Flat1').value==document.getElementById('Flat2').value)
			{
				alert('You have choosen same service more than once.')
				document.getElementById('Flat2').focus();
				return false;

			}
		} 
		if(document.getElementById('tr_flat_2').style.display=='')
		{
		   if(document.getElementById('Flat3').value==0)
			{
			alert("Please select the shipping services.");
			document.getElementById('Flat3').focus();
			return false;
			}
			if(document.getElementById('Flat3').value==document.getElementById('Flat1').value || document.getElementById('Flat3').value==document.getElementById('Flat2').value )
			{
				alert('You have choosen same service more than once.')
				document.getElementById('Flat3').focus();
				return false;

			}
		}
		
		
	
	}
	
	if(document.getElementById('shiptype').value=='Calculated')
	{
		if(document.getElementById('weight_lb').value=='')
		{
			alert('Please enter weight of the item.')
			document.getElementById('weight_lb').focus();
			return false;
		}
		if(isNaN(document.getElementById('weight_lb').value))
		{
			alert("Please enter the weight in numeric format [0-9].");
			document.getElementById('weight_lb').focus();
			return false;
		}
		if(document.getElementById('weight_oz').value!='')
		{
			if(isNaN(document.getElementById('weight_oz').value))
			{
				alert("Please enter the weight in numeric format [0-9].");
				document.getElementById('weight_oz').focus();
				return false;
			}
		}
		if(document.getElementById('length').value=='')
		{
			alert('Please enter length of the item.')
			document.getElementById('length').focus();
			return false;
		}
		if(isNaN(document.getElementById('length').value))
		{
			alert("Please enter the length in numeric format [0-9].");
			document.getElementById('length').focus();
			return false;
		}
		if(document.getElementById('width').value=='')
		{
			alert('Please enter width of the item.')
			document.getElementById('width').focus();
			return false;
		}
		if(isNaN(document.getElementById('width').value))
		{
			alert("Please enter the width in numeric format [0-9].");
			document.getElementById('width').focus();
			return false;
		}
		if(document.getElementById('height').value=='')
		{
			alert('Please enter height of the item.')
			document.getElementById('height').focus();
			return false;
		}
		if(isNaN(document.getElementById('height').value))
		{
			alert("Please enter the height in numeric format [0-9].");
			document.getElementById('height').focus();
			return false;
		}
		
	}
	
	if(document.getElementById('shipsto').value=='custom')
	{
		
		if(document.getElementById('selectedlist[]').length==0)
		{
			alert("Please at least one country where you can ship this item.");
			document.getElementById('countrylist[]').focus();
			return false;
		}
		
			for(var i = 0; i < document.getElementById('selectedlist[]').length; i++)
			{
			 document.getElementById('selectedlist[]').options[i].selected=true;
			}
		
	}
		
}

function showMore(tab,id)
{	
   	document.getElementById('td_'+tab+'_add').innerHTML='';
	document.getElementById('tr_'+tab+'_'+id).style.display='';
	if(id==2)
	{
		
	document.getElementById('td_'+tab+'_add1').innerHTML='<input name="Add" type="button" onclick="hideService(\''+tab+'\',2)" value="Remove" class="submit" />';
	}
}

function hideService(tab,id)
{
	document.getElementById('tr_'+tab+'_'+id).style.display='none';
	
	if(id==1)
	document.getElementById('Flat2').selectedIndex=0;
	document.getElementById('txtServiceCost2').value=0;
	document.getElementById('td_'+tab+'_add').innerHTML='<input name="Add" type="button" onclick="showMore(\''+tab+'\',1)" value="Add more" class="submit" />';
	if(id==2)
	{
		document.getElementById('Flat3').selectedIndex=0;
		document.getElementById('txtServiceCost3').value=0;
		document.getElementById('td_'+tab+'_add1').innerHTML='<input name="Add" type="button" onclick="hideService(\''+tab+'\',1)" value="Remove" class="submit" />&nbsp;&nbsp; <input name="Add" type="button" onclick="showMore(\''+tab+'\',2)" value="Add more" class="submit" />';
	}
}

function validateUploadImage(id)
{
	var element = "fileImage"+id;
	
	if(document.getElementById(element).value=="")
	{
		alert("You need to browse the image first.");
		document.getElementById(element).focus();
		return false;
	}
	if(isImage(element)==false)
	{
		alert("Please upload only images of type (gif, jpg, jpeg, png, bmp)");
		document.getElementById(element).focus();
		return false;
	}
	document.getElementById('hid_counter').value=id;
	
}
function isImage(element_id)
{
	var index_dot = document.getElementById(element_id).value.indexOf(".");
		var length_image = document.getElementById(element_id).value.length;
		//alert(length_image);
		//alert(index_dot);
		var str_ext ='';
		for(var i = index_dot+1; i<length_image; i++)		
		{
			str_ext += document.getElementById(element_id).value.charAt(i);
		}
		//alert(str_ext);
		str_ext=str_ext.toLowerCase()
		//alert(str_ext);
		if(str_ext=="gif" || str_ext=="GIF"  || str_ext=="jpg" || str_ext=="JPG" || str_ext=="jpeg" || str_ext=="JPEG" || str_ext=="png" || str_ext=="PNG" || str_ext=="bmp" || str_ext=="BMP")
		return true;
		else
		return false
}

function checkItemLocation()
{
	if(document.getElementById('chkItemLocation').checked == true)
	{
			document.getElementById('txtAddress').value="";
		document.getElementById('txtAddress').readOnly=true;
				
		document.getElementById('Country').disabled=true;
		document.getElementById('txtState').disabled=true;
		
		document.getElementById('txtCity').value="";
		document.getElementById('txtCity').readOnly=true;
		
		document.getElementById('txtZip').value="";
		document.getElementById('txtZip').readOnly=true;
	}
	else
	{
		
		document.getElementById('txtAddress').value="";
		document.getElementById('txtAddress').readOnly=false;
				
		document.getElementById('Country').disabled=false;
		document.getElementById('txtState').disabled=false;
		
		document.getElementById('txtCity').value="";
		document.getElementById('txtCity').readOnly=false;
		
		document.getElementById('txtZip').value="";
		document.getElementById('txtZip').readOnly=false;
	}
}

function markFeatured(listing_price,feature_price)
{
	if(document.getElementById('chkFeature').checked==true)
	{ 
	  if(document.getElementById('totavailabelbids').value<11 && document.getElementById('LP').checked==true)
	  { 
	    alert('you have no sufficent lists in your list pack account, you can buy enough lists or you can choose other payment option!');
		document.getElementById('LP').checked=false;
		document.getElementById('LP').disabled=true;
		document.getElementById('moreoptions').style.display='';
		document.getElementById('LP_Details').style.display='none'; 
		return false;
	  }
	  else
	  {
		  document.getElementById('LP_Feature').style.display='';
		  document.getElementById('lbl_total_lists').value='11';
	  }
	  if(document.getElementById('PP').checked==true || document.getElementById('GOC').checked==true)
	  {
	    document.getElementById('ALL_Feature').style.display='';
		document.getElementById('lbl_total_charges').value='10.89';	
	  }
	}
	else
	{
	 if(document.getElementById('totavailabelbids').value>0 && document.getElementById('LP').checked==false)
		 {
		 document.getElementById('LP').checked=true;
		 document.getElementById('LP').disabled=false;
		 document.getElementById('moreoptions').style.display='none';
		 document.getElementById('LP_Details').style.display='';
		 document.getElementById('ALL_Details').style.display='none';
		  }
		  else
		  {
			  document.getElementById('LP_Feature').style.display='none';
			  document.getElementById('lbl_total_lists').value='1';
		  }
		document.getElementById('ALL_Feature').style.display='none';
		document.getElementById('lbl_total_charges').value='0.99';	
	}
	}
	
	
function showdetails(id)
{
 if(id=='LP')
 { //LP--List Pack 
 document.getElementById('LP_Details').style.display='';
 document.getElementById('ALL_Details').style.display='none';
 
 }	
 else if(id=='PP')
 { //PP--Paypal
 
 document.getElementById('ALL_label').innerHTML='Paypal';
 document.getElementById('ALL_Details').style.display=''; 
 document.getElementById('LP_Details').style.display='none';
	 if(document.getElementById('chkFeature').checked==true)
	 {
	 document.getElementById('ALL_Feature').style.display='';
	 document.getElementById('lbl_total_charges').value='10.89';
	 }
	 else 
	 {
	 document.getElementById('ALL_Feature').style.display='none';
	 document.getElementById('lbl_total_charges').value='0.99';
	 }
 }
 else if(id=='GOC')
 { //GOC--Google checkout
 
 document.getElementById('ALL_label').innerHTML='Google Checkout';
 document.getElementById('ALL_Details').style.display='';	 
 document.getElementById('LP_Details').style.display='none';
	if(document.getElementById('chkFeature').checked==true)
	 {
	 document.getElementById('ALL_Feature').style.display='';
	 document.getElementById('lbl_total_charges').value='10.89';
	 }
	 else 
	 {
	 document.getElementById('ALL_Feature').style.display='none';
	 document.getElementById('lbl_total_charges').value='0.99';
	 }
 }
 
}
function showdetails_bid(id)
{
 if(id=='LP')
 { //LP--List Pack 
 document.getElementById('LP_Details').style.display='';
 document.getElementById('ALL_Details').style.display='none';
 
 }	
 else if(id=='PP')
 { //PP--Paypal
 
 document.getElementById('ALL_label').innerHTML='Paypal';
 document.getElementById('ALL_Details').style.display=''; 
 document.getElementById('LP_Details').style.display='none';
 document.getElementById('ALL_Feature').style.display='none';
 document.getElementById('lbl_total_charges').value='0.99';

 }
 else if(id=='GOC')
 { //GOC--Google checkout
 
 document.getElementById('ALL_label').innerHTML='Google Checkout';
 document.getElementById('ALL_Details').style.display='';	 
 document.getElementById('LP_Details').style.display='none';
 document.getElementById('ALL_Feature').style.display='none';
 document.getElementById('lbl_total_charges').value='0.99';

 }
 
}
function getState(country_id)
{
	document.getElementById('div_loading').style.display='';	
	sell_ajax.requestFile='sell/call_ajax_sell.php?country_id='+country_id;
	sell_ajax.onCompletion = createFactor
	sell_ajax.runAJAX();	
}

function validateTitle()
{
	title = document.getElementById('txtTitle').value;
	document.getElementById('div_loading_title').style.display='';	
	sell_ajax.requestFile='sell/call_ajax_sell.php?title='+title;
	sell_ajax.onCompletion = createFactor
	sell_ajax.runAJAX();
}
function validateFeatured(pid)
{
 if(document.getElementById('LP').checked==false && document.getElementById('PP').checked==false && document.getElementById('GOC').checked==false)
 {
	 alert('Please select any one of the payment options to pay the listing fee!');
	 return false;
 }
	if(document.getElementById('chkFeature').checked==true)
	{		
		sell_ajax.requestFile='sell/call_ajax_sell.php?featured=1&prod_id='+pid;
		sell_ajax.onCompletion = createFactor
		sell_ajax.runAJAX();
	}
	else
		return true;
}
function changetab(id)
{
	
if(id=='auction')
	{   
	      document.getElementById('auction').className="activetab";
		  document.getElementById('auction_tab').style.display="";
	      document.getElementById('fixed').className="inactivetab";
		  document.getElementById('fixed_tab').style.display="none";
			    
	}
if(id=='fixed')
	{ 
	   document.getElementById('fixed').className="activetab";
	   document.getElementById('fixed_tab').style.display="";
	   document.getElementById('auction').className="inactivetab";
	   document.getElementById('auction_tab').style.display="none";
	   
	}	
}
function showbidders(id)
{
	//alert(id)
	if(document.getElementById('bidderstab_'+id).style.display=='none')
	{
		document.getElementById('bidderstab_'+id).style.display=''
		document.getElementById(id).innerHTML='Hide all Bidders';
	}
	else
	{
		document.getElementById('bidderstab_'+id).style.display='none';
		document.getElementById(id).innerHTML='Show all Bidders';
	}
}

function showauctioncat(id)
{
	var index=document.getElementById(id).selectedIndex;
	
	for(var i=2; i<=5; i++)
	{
	
		
		document.getElementById('auctioncat_'+i).style.display='none';
		
	}
	if(index>1 )
	{
	
	document.getElementById('auctioncat_'+index).style.display='';
	
	}
}

function emailToFriend(pid)
{
	if(EmailValidation(document.getElementById('txtFEmailID'))==0)
		{			
			return false;
		}
		else
		{
			document.getElementById('div_loading').style.display='';
			email=document.getElementById('txtFEmailID').value;
	sell_ajax.requestFile='innerphp/call_ajax.php?emailFriend='+email+'&Product_ID='+pid;
	sell_ajax.onCompletion = createFactor
	sell_ajax.runAJAX();	
		}
}
function showFriends(id)
{
	if(document.getElementById(id).style.display=='')
		document.getElementById(id).style.display='none';
	else
		document.getElementById(id).style.display='';
}

function addToFav(seller_id,pid)
{
	document.getElementById('div_loading').style.display='';
	sell_ajax.requestFile='innerphp/call_ajax.php?addFavID='+seller_id+'&pr_id='+pid;
	sell_ajax.onCompletion = createFactor
	sell_ajax.runAJAX();
}
<!-- Praveen code starts here-->
<!--Startl: Flitering criteria for refining search in product lisitngs page -->
function fetchlevel2cat(value)
{
var level1catid=value;
if(value==0)
{
document.getElementById('slt_categoryL2_row').style.display='none';
document.getElementById('slt_categoryL3_row').style.display='none';
}
else
{
	
document.getElementById('slt_categoryL3_row').style.display='none';
buy_ajax.requestFile='buy/call_ajax_buy.php?level1_id='+level1catid;
buy_ajax.onCompletion = createFactorbuy
buy_ajax.runAJAX();
}

}

function fetchlevel3cat(value)
{
var level2catid=value;
if(value==0)
{
document.getElementById('slt_categoryL3_row').style.display='none';
}
else
{
buy_ajax.requestFile='buy/call_ajax_buy.php?level2_id='+level2catid;
buy_ajax.onCompletion = createFactorbuy
buy_ajax.runAJAX();
}

}
function preselect(L1CATID,L2CATID,L3CATID)
{
	buy_ajax.requestFile='buy/call_ajax_buy.php?preselectL1='+L1CATID+'&preselectL2='+L2CATID+'&preselectL3='+L3CATID;
	buy_ajax.onCompletion = createFactorbuy
	buy_ajax.runAJAX();
}
function createFactorbuy()
{
		//alert(buy_ajax.response);
		
		eval(buy_ajax.response);
}
<!--End: Flitering criteria for refining search in product lisitngs page 	-->


<!-- Praveen code ends here-->