function setSearch()
{
	getStyleObject('o1').backgroundColor='#D2E4FC';
	updateSearch('Parts');
}

function updateSearch(what)
{
	var action;
	var dropdownSubCategs='';
	string = 'theTarget = document.getElementById("lySearchBox");';
	eval(string);
	
	getStyleObject('o1').backgroundColor='';
	getStyleObject('o2').backgroundColor='';
	getStyleObject('o3').backgroundColor='';
	getStyleObject('o4').backgroundColor='';
	getStyleObject('o5').backgroundColor='';
	getStyleObject('o6').backgroundColor='';
	getStyleObject('o7').backgroundColor='';
	getStyleObject('o8').backgroundColor='';
	getStyleObject('o9').backgroundColor='';
	getStyleObject('o10').backgroundColor='';
	getStyleObject('o11').backgroundColor='';
	
	if (what=='Parts')
	{
		getStyleObject('lySearchBox').backgroundColor='#D2E4FC';
		getStyleObject('lySearchBox').borderColor='#9DCBFD';
		getStyleObject('o1').backgroundColor='#D2E4FC';		//parts
		dropdownSubCategs='<select name="szSubCateg">';
		dropdownSubCategs+='<option value=0>[All categories]</option>';
		dropdownSubCategs+='<option value="airfuel">Air and fuel</option>';
		dropdownSubCategs+='<option value="books">Books</option>';
		dropdownSubCategs+='<option value="camsvalvetrain">Cams / Valvetrain</option>';
		dropdownSubCategs+='<option value="chassis">Chassis</option>';
		dropdownSubCategs+='<option value="cooling">Cooling</option>';
		dropdownSubCategs+='<option value="dataacq">Data acquisition</option>';
		dropdownSubCategs+='<option value="dressup">Dress up and car care</option>';
		dropdownSubCategs+='<option value="engine">Engine and components</option>';
		dropdownSubCategs+='<option value="exhaust">Exhaust</option>';
		dropdownSubCategs+='<option value="gaskets">Gaskets</option>';
		dropdownSubCategs+='<option value="gauges">Gauges</option>';
		dropdownSubCategs+='<option value="hardware">Hardware</option>';
		dropdownSubCategs+='<option value="ignitions">Ignitions / Electronics</option>';
		dropdownSubCategs+='<option value="jacks">Jacks / Hoists</option>';
		dropdownSubCategs+='<option value="lighting">Lighting</option>';
		dropdownSubCategs+='<option value="mobelectr">Mobile electronics</option>';
		dropdownSubCategs+='<option value="mopar">Mopar</option>';
		dropdownSubCategs+='<option value="mustang">Mustang</option>';
		dropdownSubCategs+='<option value="pluming">Pluming</option>';
		dropdownSubCategs+='<option value="reax">Rear axle</option>';
		dropdownSubCategs+='<option value="sport">Sport Compact</option>';
		dropdownSubCategs+='<option value="safety">Safety</option>';
		dropdownSubCategs+='<option value="tools">Tools</option>';
		dropdownSubCategs+='<option value="tplslt">TPl / LS1 / LT1</option>';
		dropdownSubCategs+='<option value="transmissions">Transmissions</option>';
		dropdownSubCategs+='<option value="wheels">Wheels and Tires	</option>';
		dropdownSubCategs+='</select>';
	}
	else if (what=='Cars')
	{
		getStyleObject('lySearchBox').backgroundColor='#D9F4E3';
		getStyleObject('lySearchBox').borderColor='#96E0B1';
		getStyleObject('o2').backgroundColor='#D9F4E3';		//cars
		dropdownSubCategs='<select name="dIDSubCateg">';
		dropdownSubCategs+='<option value=0>[All categories]</option>';
		dropdownSubCategs+='<option value="1">Drag</option>';
		dropdownSubCategs+='<option value="2">Junior</option>';
		dropdownSubCategs+='<option value="3">Round</option>';
		dropdownSubCategs+='<option value="4">Street</option>';
		dropdownSubCategs+='<option value="5">Muscle</option>';
		dropdownSubCategs+='<option value="6">Restored</option>';
		dropdownSubCategs+='<option value="7">Stock</option>';
		dropdownSubCategs+='</select>';
	}
	else if (what=='Trucks')
	{
		getStyleObject('lySearchBox').backgroundColor='#C5E0FE';
		getStyleObject('lySearchBox').borderColor='#9DCBFD';
		getStyleObject('o3').backgroundColor='#C5E0FE';		//trucks
		dropdownSubCategs='<select name="dIDSubCateg">';
		dropdownSubCategs+='<option value=0>[All categories]</option>';
		dropdownSubCategs+='<option value="8">Stock</option>';
		dropdownSubCategs+='<option value="9">Street</option>';
		dropdownSubCategs+='<option value="10">Lifted</option>';
		dropdownSubCategs+='<option value="11">Circle</option>';
		dropdownSubCategs+='<option value="12">Drag</option>';
		dropdownSubCategs+='<option value="13">Monster</option>';
		dropdownSubCategs+='</select>';
	}
	else if (what=='Bikes')
	{
		getStyleObject('lySearchBox').backgroundColor='#F4D7EB';
		getStyleObject('lySearchBox').borderColor='#E6A2D1';
		getStyleObject('o4').backgroundColor='#F4D7EB';		//bikes
		dropdownSubCategs='<select name="dIDSubCateg">';
		dropdownSubCategs+='<option value=0>[All categories]</option>';
		dropdownSubCategs+='<option value="14">Racing</option>';
		dropdownSubCategs+='<option value="15">Street</option>';
		dropdownSubCategs+='<option value="16">Custom</option>';
		dropdownSubCategs+='<option value="17">Choppers</option>';
		dropdownSubCategs+='<option value="18">Kids</option>';
		dropdownSubCategs+='<option value="19">Dirt</option>';
		dropdownSubCategs+='<option value="20">Pits</option>';
		dropdownSubCategs+='</select>';
	}
	else if (what=='RVs')
	{
		getStyleObject('lySearchBox').backgroundColor='#FFF8D9';
		getStyleObject('lySearchBox').borderColor='#FFE980';
		getStyleObject('o5').backgroundColor='#FFF8D9';		//rvs
		dropdownSubCategs='<select name="dIDSubCateg">';
		dropdownSubCategs+='<option value=0>[All categories]</option>';
		dropdownSubCategs+='<option value="21">Class A</option>';
		dropdownSubCategs+='<option value="22">Class B</option>';
		dropdownSubCategs+='<option value="23">Class C</option>';
		dropdownSubCategs+='<option value="24">Class D</option>';
		dropdownSubCategs+='<option value="25">Pop-ups</option>';
		dropdownSubCategs+='</select>';
	}
	else if (what=='Trailers')
	{
		getStyleObject('lySearchBox').backgroundColor='#DFDFF4';
		getStyleObject('lySearchBox').borderColor='#AEAEE3';
		getStyleObject('o6').backgroundColor='#DFDFF4';		//trailers
		dropdownSubCategs='<select name="dIDSubCateg">';
		dropdownSubCategs+='<option value=0>[All categories]</option>';
		dropdownSubCategs+='<option value="224">Totterhome</option>';
		dropdownSubCategs+='<option value="225">Gooseneck</option>';
		dropdownSubCategs+='<option value="226">Tag</option>';
		dropdownSubCategs+='<option value="227">Stackers</option>';
		dropdownSubCategs+='<option value="228">Toy haulers</option>';
		dropdownSubCategs+='</select>';
	}
	else if (what=='ATVs')
	{
		getStyleObject('lySearchBox').backgroundColor='#E4E4E4';
		getStyleObject('lySearchBox').borderColor='#CCCCCC';
		getStyleObject('o7').backgroundColor='#E4E4E4';		//atvs
		dropdownSubCategs='<select name="dIDSubCateg">';
		dropdownSubCategs+='<option value=0>[All categories]</option>';
		dropdownSubCategs+='<option value="229">2WD</option>';
		dropdownSubCategs+='<option value="230">4WD</option>';
		dropdownSubCategs+='<option value="231">Off road</option>';
		dropdownSubCategs+='</select>';
		
	}
	else if (what=='Jobs')
	{
		getStyleObject('lySearchBox').backgroundColor='#FBEBD9';
		getStyleObject('lySearchBox').borderColor='#F5CFA5';
		getStyleObject('o8').backgroundColor='#FBEBD9';		//jobs                
		dropdownSubCategs='<select name="dIDSubCateg">';
		dropdownSubCategs+='<option value=0>[All categories]</option>';
		dropdownSubCategs+='<option value="60">Admin & clerical</option>';
		dropdownSubCategs+='<option value="61">Auto shop</option>';
		dropdownSubCategs+='<option value="62">Crew</option>';
		dropdownSubCategs+='<option value="63">Customer service</option>';
		dropdownSubCategs+='<option value="64">Design</option>';
		dropdownSubCategs+='<option value="65">Drivers</option>';
		dropdownSubCategs+='<option value="66">Education</option>';
		dropdownSubCategs+='<option value="67">Facilities</option>';
		dropdownSubCategs+='<option value="68">General labor</option>';
		dropdownSubCategs+='<option value="69">Human resources</option>';
		dropdownSubCategs+='<option value="70">Installation - maintenance - repair</option>';
		dropdownSubCategs+='<option value="71">Management</option>';
		dropdownSubCategs+='<option value="72">Marketing</option>';
		dropdownSubCategs+='<option value="73">Professional services</option>';
		dropdownSubCategs+='<option value="74">Purchasing - procurement</option>';
		dropdownSubCategs+='<option value="75">QA - quality control</option>';
		dropdownSubCategs+='<option value="76">Retail / pit vendors</option>';
		dropdownSubCategs+='<option value="77">Sales</option>';
		dropdownSubCategs+='<option value="78">Skilled labor - trades</option>';
		dropdownSubCategs+='<option value="79">Staff - racing venues</option>';
		dropdownSubCategs+='<option value="80">Training</option>';
		dropdownSubCategs+='<option value="81">Transportation</option>';
		dropdownSubCategs+='<option value="82">Warehouse</option>';
		dropdownSubCategs+='</select>';
	}
	else if (what=='Events')
	{
		getStyleObject('lySearchBox').backgroundColor='#FFEAEB';
		getStyleObject('lySearchBox').borderColor='#FF979C';
		getStyleObject('o9').backgroundColor='#FFEAEB';		//events
	}
	else if (what=='Services')
	{
		getStyleObject('lySearchBox').backgroundColor='#C5E0FE';
		getStyleObject('lySearchBox').borderColor='#9DCBFD';
		getStyleObject('o10').backgroundColor='#C5E0FE';		//services
	}
	else if (what=='Venues')
	{
		getStyleObject('lySearchBox').backgroundColor='#EEEADB';
		getStyleObject('lySearchBox').borderColor='#DFD8BB';
		getStyleObject('o11').backgroundColor='#EEEADB';		//venues
		dropdownSubCategs='<select name="szState">';
		dropdownSubCategs+='<option value=0>[All States]</option>';
		dropdownSubCategs+='<option value="Alaska">Alaska</option>';
		dropdownSubCategs+='<option value="Arizona">Arizona</option>';
		dropdownSubCategs+='<option value="Arkansas">Arkansas</option>';
		dropdownSubCategs+='<option value="California">California</option>';
		dropdownSubCategs+='<option value="Colorado">Colorado</option>';
		dropdownSubCategs+='<option value="Connecticut">Connecticut</option>';
		dropdownSubCategs+='<option value="Delaware">Delaware</option>';
		dropdownSubCategs+='<option value="Florida">Florida</option>';
		dropdownSubCategs+='<option value="Georgia">Georgia</option>';
		dropdownSubCategs+='<option value="Hawaii">Hawaii</option>';
		dropdownSubCategs+='<option value="Idaho">Idaho</option>';
		dropdownSubCategs+='<option value="Illinois">Illinois</option>';
		dropdownSubCategs+='<option value="Indiana">Indiana</option>';
		dropdownSubCategs+='<option value="Iowa">Iowa</option>';
		dropdownSubCategs+='<option value="Kansas">Kansas</option>';
		dropdownSubCategs+='<option value="Kentucky">Kentucky</option>';
		dropdownSubCategs+='<option value="Louisiana">Louisiana</option>';
		dropdownSubCategs+='<option value="Maine">Maine</option>';
		dropdownSubCategs+='<option value="Maryland">Maryland</option>';
		dropdownSubCategs+='<option value="Massachusetts">Massachusetts</option>';
		dropdownSubCategs+='<option value="Michigan">Michigan</option>';
		dropdownSubCategs+='<option value="Minnesota">Minnesota</option>';
		dropdownSubCategs+='<option value="Mississippi">Mississippi</option>';
		dropdownSubCategs+='<option value="Missouri">Missouri</option>';
		dropdownSubCategs+='<option value="Montana">Montana</option>';
		dropdownSubCategs+='<option value="Nebraska">Nebraska</option>';
		dropdownSubCategs+='<option value="Nevada">Nevada</option>';
		dropdownSubCategs+='<option value="New Hampshire">New Hampshire</option>';
		dropdownSubCategs+='<option value="New Jersey">New Jersey</option>';
		dropdownSubCategs+='<option value="New Mexico">New Mexico</option>';
		dropdownSubCategs+='<option value="New York">New York</option>';
		dropdownSubCategs+='<option value="North Carolina">North Carolina</option>';
		dropdownSubCategs+='<option value="North Dakota">North Dakota</option>';
		dropdownSubCategs+='<option value="Ohio">Ohio</option>';
		dropdownSubCategs+='<option value="Oklahoma">Oklahoma</option>';
		dropdownSubCategs+='<option value="Oregon">Oregon</option>';
		dropdownSubCategs+='<option value="Pennsylvania">Pennsylvania</option>';
		dropdownSubCategs+='<option value="Rhode Island">Rhode Island</option>';
		dropdownSubCategs+='<option value="South Carolina">South Carolina</option>';
		dropdownSubCategs+='<option value="South Dakota">South Dakota</option>';
		dropdownSubCategs+='<option value="Tennessee">Tennessee</option>';
		dropdownSubCategs+='<option value="Texas">Texas</option>';
		dropdownSubCategs+='<option value="Utah">Utah</option>';
		dropdownSubCategs+='<option value="Vermont">Vermont</option>';
		dropdownSubCategs+='<option value="Virginia">Virginia</option>';
		dropdownSubCategs+='<option value="Washington">Washington</option>';
		dropdownSubCategs+='<option value="Washington D.C.">Washington D.C.</option>';
		dropdownSubCategs+='<option value="West Virginia">West Virginia</option>';
		dropdownSubCategs+='<option value="Wisconsin">Wisconsin</option>';
		dropdownSubCategs+='<option value="Wyoming">Wyoming</option>';
		dropdownSubCategs+='</select>';
	}

	if (what=='Cars' || what=='Trucks' || what=='Bikes' || what=='RVs' || what=='Trailers' || what=='ATVs' || what=='Parts')
	{
		document.getElementById("lySearchBox").innerHTML ='<form name="frmSearch" method="post" action="search/" onsubmit="return checkNonEmptyKw()">'+
			'Search for: &nbsp;<input type="text" maxlength="30" size="20" name="szKeywords" value="keywords here..." onblur="if(this.value==\'\') this.value=\'keywords here...\';" onfocus="if(this.value==\'keywords here...\') this.value=\'\';" /></td>'+
			'&nbsp;&nbsp;'+dropdownSubCategs+
			'&nbsp;&nbsp;Price:&nbsp;	 <input type="text" maxlength="7" size="5" name="fPriceMin" value="min" />'+
			'&nbsp;-&nbsp;<input type="text" maxlength="7" size="5" name="fPriceMax" value="max" />'+
			'&nbsp;&nbsp;<span id="frmDefaultInput"><input type="submit" value="GO" /></span>'+
			'<input type="hidden" name="szCriteria" value="'+what+'" />'+
			'</form>';
	}
	else if (what=='Jobs')
	{
		document.getElementById("lySearchBox").innerHTML ='<form name="frmSearch" method="post" action="search/" onsubmit="return checkNonEmptyKw()">'+
			'Search for: &nbsp;<input type="text" maxlength="30" size="20" name="szKeywords" value="keywords here..." onblur="if(this.value==\'\') this.value=\'keywords here...\';" onfocus="if(this.value==\'keywords here...\') this.value=\'\';" />'+
			'&nbsp;&nbsp;'+dropdownSubCategs+
			'&nbsp;&nbsp;<input type="checkbox" name="chkTelecommute" valign="middle" />Telecommute'+
			'&nbsp;&nbsp;<input type="checkbox" name="chkContract" />Contract'+
			'&nbsp;&nbsp;<input type="checkbox" name="chkPartTime" />Part-time'+
			'&nbsp;&nbsp;<input type="checkbox" name="chkNonProfit" />Non-profit'+
			'&nbsp;&nbsp;&nbsp;<span id="frmDefaultInput"><input type="submit" value="GO" /></span>'+
			'<input type="hidden" name="szCriteria" value="'+what+'" />'+
			'</form>';
	}
	else if (what=='Venues')
	{
		document.getElementById("lySearchBox").innerHTML ='<form name="frmSearch" method="post" action="search/" onsubmit="return checkNonEmptyKw()">'+
			'Search for: &nbsp;<input type="text" maxlength="30" size="20" name="szKeywords" value="keywords here..." onblur="if(this.value==\'\') this.value=\'keywords here...\';" onfocus="if(this.value==\'keywords here...\') this.value=\'\';" /></td>'+
			'&nbsp;&nbsp;'+dropdownSubCategs+
			'&nbsp;&nbsp;<span id="frmDefaultInput"><input type="submit" value="GO" /></span>'+
			'<input type="hidden" name="szCriteria" value="'+what+'" />'+
			'</form>';
	}
	else
	{
		document.getElementById("lySearchBox").innerHTML ='<form name="frmSearch" method="post" action="search/" onsubmit="return checkNonEmptyKw()">'+
			'Search for: &nbsp;<input type="text" maxlength="30" size="20" name="szKeywords" value="keywords here..." onblur="if(this.value==\'\') this.value=\'keywords here...\';" onfocus="if(this.value==\'keywords here...\') this.value=\'\';" /></td>'+
			'&nbsp;&nbsp;<span id="frmDefaultInput"><input type="submit" value="GO" /></span>'+
			'<input type="hidden" name="szCriteria" value="'+what+'" />'+
			'</form>';
	}
}

function MM_jumpMenu(targ,selObj,restore)
{ 
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function getStyleObject(objectId) 
{
  // checkW3C DOM, then MSIE 4, then NN 4.
  //
  if(document.getElementById && document.getElementById(objectId)) {
	return document.getElementById(objectId).style;
   }
   else if (document.all && document.all(objectId)) {  
	return document.all(objectId).style;
   } 
   else if (document.layers && document.layers[objectId]) { 
	return document.layers[objectId];
   } else {
	return false;
   }
}

function termsStuff(action)
{
	if (action==0)		/* Doesn't agree with terms of use */
	{
		var name=confirm("Are you sure? Click OK to go back or Cancel to continue posting.")
		if (name==true)
		{
			window.location.href="index.php";
			return(false);
		}
		else
		{
			return(false);
		}
		return false;
	}
	else if (action==1)		/* Agrees with terms of use */
	{
			/* has the checkbox has been checked? */
			if (document.frmTerms.chkHaveReadTerms.checked==true)
			{
				return true;
			}
			else
			{
				alert('Please confirm that you have read the Terms of Use, by checking the "I have read the terms of use" checkbox.');
				return false;
			}
	}
}

function ja_UpdateBillingInfo()
{
	/* If the user clicks on "Billing Information (same as account info)
	   copy all info from account fields to billing fields. */
	if (document.frmJAform.chkBillingAsAccount.checked==true)
	{
		document.frmJAform.szBill_CompanyName.value=document.frmJAform.szAcc_CompanyName.value;
		document.frmJAform.szBill_Address1.value=document.frmJAform.szAcc_Address1.value;
		document.frmJAform.szBill_Address2.value=document.frmJAform.szAcc_Address2.value;
		document.frmJAform.szBill_Address3.value=document.frmJAform.szAcc_Address3.value;
		document.frmJAform.szBill_City.value=document.frmJAform.szAcc_City.value;
		document.frmJAform.szBill_State.value=document.frmJAform.szAcc_State.value;
		document.frmJAform.szBill_County.value=document.frmJAform.szAcc_County.value;
		document.frmJAform.szBill_ZIP.value=document.frmJAform.szAcc_ZIP.value;
		document.frmJAform.szBill_Email.value=document.frmJAform.szAcc_Email.value;
		document.frmJAform.szBill_Phone1.value=document.frmJAform.szAcc_Phone1.value;
		document.frmJAform.szBill_Phone2.value=document.frmJAform.szAcc_Phone2.value;
		document.frmJAform.szBill_Phone3.value=document.frmJAform.szAcc_Phone3.value;
		document.frmJAform.szBill_Fax1.value=document.frmJAform.szAcc_Fax1.value;
		document.frmJAform.szBill_Fax2.value=document.frmJAform.szAcc_Fax2.value;
		document.frmJAform.szBill_Fax3.value=document.frmJAform.szAcc_Fax3.value;
	}
	else		/* clear billing fields */
	{
		document.frmJAform.szBill_CompanyName.value='';
		document.frmJAform.szBill_AccountManager.value='';
		document.frmJAform.szBill_Address1.value='';
		document.frmJAform.szBill_Address2.value='';
		document.frmJAform.szBill_Address3.value='';
		document.frmJAform.szBill_City.value='';
		document.frmJAform.szBill_State.value=0;
		document.frmJAform.szBill_County.value='';
		document.frmJAform.szBill_ZIP.value='';
		document.frmJAform.szBill_Email.value='';
		document.frmJAform.szBill_Phone1.value='';
		document.frmJAform.szBill_Phone2.value='';
		document.frmJAform.szBill_Phone3.value='';
		document.frmJAform.szBill_Fax1.value='';
		document.frmJAform.szBill_Fax2.value='';
		document.frmJAform.szBill_Fax3.value='';
	}
}

function confirmDelAd()
{
	var name=confirm("Are you sure you want to delete this ad?")
	if (name==true)
	{
		//window.location.href="index.php";
		return(true);
	}
	else
	{
		return(false);
	}
}

function checkNonEmptyKw()
{
	if (document.frmSearch.szKeywords.value=='')
	{
		alert('Please type at least one keyword');
		return false;
	}
	else
	{
		return true;
	}
}

function send2Friend()
{
	document.getElementById("lyEmailPosting").style.visibility="visible";
	document.getElementById("lyEmailPosting").innerHTML ='<form name="frmSend2Friend" method="post" action="emailposting.php">'+
			 '<span class="txtA16Black">E-mail this posting to a friend</span><br /><br /><table class="txtA12Black">'+
			 '<tr><td align="right">Your e-mail address:</td>'+
			 '<td><input type="text" name="szEmail" size="20" maxlength="50" /></td></tr>'+
			 '<tr><td align="right">Your friend\'s e-mail address:</td>'+
			 '<td><input type="text" name="szFriendEmail" size="20" maxlength="50" /></td></tr>'+
			 '<tr><td colspan="2"><hr></td></tr>'+
			 '<tr><td>&nbsp;</td><td><input type="submit" value="Send" /></td></tr></table>'+
			 '</form>';
	document.getElementById("lyEmailPosting").style.backgroundColor="#F3F8FE";
	document.frmSend2Friend.szEmail.focus();
}

function Check4Delete()
{
	if (document.frmEditAd.chkDelImg1.checked==true || document.frmEditAd.chkDelImg2.checked==true || document.frmEditAd.chkDelImg3.checked==true || document.frmEditAd.chkDelImg4.checked==true)
	{
		var name=confirm("Submitting now will delete all current images checked for deletion! Are you sure you want to continue?")
		if (name==true)
		{
			return(true);
		}
		else
		{
			return(false);
		}
	}
	else
		return(true);
}
