function submitFindForm(buttonValue)
{
	check=true;
	/**if(buttonValue=='Find Classifieds')
	{
		if(document.classifiedSearchForm.country.value=="US")
		{
			if(document.classifiedSearchForm.city.value!="" && document.classifiedSearchForm.metroArea.value!="")
			{
				if(confirm("You have selectd both Metro Area and City. This search will match on City. Do you want to continue ?"))
				{
					check=true;				
				}
				else
					check=false;
			}
			else
			{
				check=true;
			}
		}		
		
	}
		
	if(check==true)
	{
		document.classifiedSearchForm.submitButton.value=buttonValue;
		document.classifiedSearchForm.submit();
	}*/
	if(buttonValue == 'Find Classifieds')
	{
	if(document.classifiedSearchForm.logInCheck.value=="" && document.classifiedSearchForm.searchProfileName.value!="" && check==true)
	{
		if(confirm("You have to login to save this search. 'OK' will send you to login page 'Cancel' will send you to search with out saving"))
		{
			check=true;
		}
		else
		{
			document.classifiedSearchForm.searchProfileName.value="";
			check=true;
		}
			
	}
	}
	else 
		check = true;
	if(check==true)
	{
		document.classifiedSearchForm.submitButton.value=buttonValue;
		document.classifiedSearchForm.submit();
	}
}
function submitFindForm1(buttonValue)
{
	document.classifiedSearchForm.submitButton.value=buttonValue;
	if(document.classifiedSearchForm.locationZipCode.value!="")
	{
		document.classifiedSearchForm.metroZipCode.value="Z";
	}
	document.classifiedSearchForm.submit();
}
function loadStates()
{	
	document.classifiedSearchForm.state.selectedIndex = -1;
	document.classifiedSearchForm.submit();
}
function loadCities()
{
	document.classifiedSearchForm.submit();
}

//This fuction will fire when loading the categories
function loadLevel(catId, levels)
{
	cct = catId.substr(3,1);	
	for(i =1;i<levels;i++)
	{
		cId = "cat"+i;
		if(i > cct)
			document.getElementById(cId).selectedIndex=-1;
	}
	document.classifiedSearchForm.submit();
}


function classifiedResultSort(sortValue)
{
	document.searchResultForm.sortBy.value = sortValue;
	document.searchResultForm.pageNumber.value =0;
	document.searchResultForm.chooseAction.value="sort";
	document.searchResultForm.submit();
}
function classifiedResultPage(pageValue)
{
	document.searchResultForm.pageNumber.value = pageValue;
	document.searchResultForm.chooseAction.value="page";
	document.searchResultForm.submit();
}
function submitResult(pageNo)
{
	document.searchResultForm.pageNumber.value = pageNo;
	document.searchResultForm.chooseAction.value="page";
	document.searchResultForm.submit();
}

function saveClassified(adId,memberId,memberRatingId)
{
	if(memberId == memberRatingId)
		alert("You are the owner of this listing, you cannot save it.");
	else
	{
		document.searchResultForm.chooseAction.value="save";
		document.searchResultForm.saveAdId.value=adId;
		document.searchResultForm.submit();
	}
}
function classifiedResultView(adId, chooseAction)
{
	document.searchResultForm.chooseAction.value=chooseAction;
	document.searchResultForm.saveAdId.value=adId;
	document.searchResultForm.submit();
}

function loadProperties()
{
	document.classifiedSearchForm.submit();
}



function expandAdvanceSection(path, expValue)
{
	if(expValue=='Y')
	{
		document.classifiedSearchForm.advanceFilter.value=null;
		document.classifiedSearchForm.featureImage.src= path +"/images/plus.gif";
		advFilterTable.style.display='none';
	}
	else
	{
		document.classifiedSearchForm.advanceFilter.value='Y';
		document.classifiedSearchForm.featureImage.src= path +"/images/minus.gif";
		advFilterTable.style.display='inline';
	}
}

function expandVehicleSection(path, expValue)
{
	if(expValue=='Y')
	{
		document.classifiedSearchForm.interExpandFeature.value=null;
		document.classifiedSearchForm.featImage.src= path +"/images/plus.gif";
		vehicleFeature.style.display='none';
	}
	else
	{
		document.classifiedSearchForm.interExpandFeature.value='Y';
		document.classifiedSearchForm.featImage.src= path +"/images/minus.gif";
		vehicleFeature.style.display='inline';
	}
}

function expandInterFeatures(path, expValue)
{
	if(expValue=='Y')
	{
		document.classifiedSearchForm.interExpandFeature.value=null;
		document.classifiedSearchForm.fetImage.src= path +"/images/plus.gif";
		interiorFeatures.style.display='none';
	}
	else
	{
		document.classifiedSearchForm.interExpandFeature.value='Y';
		document.classifiedSearchForm.fetImage.src= path +"/images/minus.gif";
		interiorFeatures.style.display='inline';
	}
}

function expandExterFeatures(path, expValue)
{
	if(expValue=='Y')
	{
		document.classifiedSearchForm.exterExpandFeature.value=null;
		document.classifiedSearchForm.fertImage.src= path +"/images/plus.gif";
		exteriorFeatures.style.display='none';
	}
	else
	{
		document.classifiedSearchForm.exterExpandFeature.value='Y';
		document.classifiedSearchForm.fertImage.src= path +"/images/minus.gif";
		exteriorFeatures.style.display='inline';
	}
}

function submitLocationSearch(country,state,city)
{
	document.searchResultForm.locationCountry.value = country;
	document.searchResultForm.locationState.value = state;
	document.searchResultForm.locationCity.value = city;
	document.searchResultForm.chooseAction.value="location";
	document.searchResultForm.submit();
}

function submitCategorySearch(cat1,cat2)
{
	var category = cat1;
	
	if(cat2!="")
		category = cat1+";"+cat2;
	document.searchResultForm.searchCategory.value = category;
	document.searchResultForm.chooseAction.value="category";
	document.searchResultForm.submit();
}

function submitLevel2CategorySearch(cat1,cat2,cat3)
{
	var category = cat1;
	
	if(cat2!="")
		category = cat1+";"+cat2;
	if(cat3!="")
		category = cat1+";"+cat2+";"+cat3;
	document.searchResultForm.searchCategory.value = category;
	document.searchResultForm.chooseAction.value="category";
	document.searchResultForm.submit();
}