function SiteSearchPanel_ListingType_onChange(listingType){
	HttpManager.Document.GetObject("umc").value = ( listingType.selectedIndex == 2 ? "1" : "" );
	PropertySearch_ListingType_OnSelectionChange(listingType, 
																		HttpManager.Document.GetObject("categoryID").value, 
																		document.isc.igid.value, 
																		document.isc.egid.value, 
																		document.isc.imgid.value, 
																		document.isc.emgid.value,
																		HttpManager.Document.GetObject("umc").value );
																		


	HttpManager.Document.GetObject("bedrooms").options[0].text = (document.isc.ListingType.selectedIndex == 2 ? "Sleeps" : "Bedrooms" );
	HttpManager.Document.GetObject("pnlAdvancedSearch").style.display =  ( listingType.selectedIndex == 2 ? "block" : "none" );

}

function ListingType_CheckAdvanced(o){
	//WA - Removed based on ticket : 2349
	//	HttpManager.Document.GetObject("AdvanceSearch").checked = ( o.selectedIndex == 2 ? true : false );
	//showHideDIV('advsearch',HttpManager.Document.GetObject("AdvanceSearch"));
	AdvanceSearch_onClick( HttpManager.Document.GetObject("AdvanceSearch") );
}

function AdvanceSearch_onClick(o){
	if ( o.checked == false ){
		for ( var i = 0; i < document.isc.att.length; i ++ ){
			document.isc.att[i].checked = o.checked;
		}
	}
}

var olistingtype = new Object();
olistingtype.value = "";
var idefaultlistingtype = HttpManager.Request.QueryString("listingtype");

var defaultindex = 0;
if ( HttpManager.Request.QueryString("listingtype").length ==0){
	defaultindex =2
}
if ( idefaultlistingtype.length == 0 ){
	if ( HttpManager.Document.GetObject("defaultlistingtype").value.length > 0 ){
		idefaultlistingtype = HttpManager.Document.GetObject("defaultlistingtype").value;
	}
}

if ( HttpManager.Document.GetObject("rdoListingType_Sales") ){
	HttpManager.Document.Forms.HtmlRadio.SetValue( document.isc.ListingType , idefaultlistingtype );
	olistingtype.value = HttpManager.Document.Forms.HtmlRadio.GetCheckedItem( document.isc.ListingType ).value;
}else if ( document.isc.ListingType ){
	if ( typeof document.isc.ListingType.options != "undefined" ){		
			if ( HttpManager.Request.QueryString("umc").length > 0 ){
				document.isc.ListingType.selectedIndex = 2;
			}else{
				if (defaultindex>0){
					document.isc.ListingType.selectedIndex = defaultindex
				} else {
					HttpManager.Document.Forms.HtmlSelect.SelectedValue("isc","ListingType", idefaultlistingtype );
				}
			}
		
	}else{
		if ( idefaultlistingtype.length > 0 ){
			document.isc.ListingType.value = idefaultlistingtype;		
		}
	}
	
	olistingtype.value = document.isc.ListingType.value;
	olistingtype.selectedIndex = document.isc.ListingType.selectedIndex
	//WA - Removed based on ticket : 2349
//	ListingType_CheckAdvanced(document.isc.ListingType)
}

if ( olistingtype.value.length > 0 ){
	SiteSearchPanel_ListingType_onChange( olistingtype );
	HttpManager.Document.Forms.HtmlSelect.SelectedValue("isc","minprice", HttpManager.Request.QueryString("minprice") );
	HttpManager.Document.Forms.HtmlSelect.SelectedValue("isc","maxprice", HttpManager.Request.QueryString("maxprice") );
	HttpManager.Document.Forms.HtmlSelect.SelectedValue("isc","pt", HttpManager.Request.QueryString("pt") );
	HttpManager.Document.Forms.HtmlSelect.SelectedValue("isc","bedrooms", HttpManager.Request.QueryString("bedrooms") );
	HttpManager.Document.Forms.HtmlSelect.SelectedValue("isc","area", HttpManager.Request.QueryString("area") );
	HttpManager.Document.Forms.HtmlSelect.SelectedValue("isc","location", HttpManager.Request.QueryString("location") );
	document.isc.obd.value = HttpManager.Request.QueryString("obd") 
	if ( HttpManager.Request.QueryString("att").length > 0 ){
		HttpManager.Document.GetObject("AdvanceSearch").checked = true;
		showHideDIV('advsearch',HttpManager.Document.GetObject("AdvanceSearch"));
		HttpManager.Document.GetObject("pnlAdvancedSearch").style.display = "block";
	}
	if ( HttpManager.Request.QueryString("umc").length > 0 ){
		HttpManager.Document.GetObject("pnlAdvancedSearch").style.display = "block";
		HttpManager.Document.GetObject("umc").value = "1";
	}
}else{
	alert("Listingtype not found");
}
