var SEARCH_CORE=$H();SEARCH_CORE.CONTROLLER_CALL_URL="/?page=api_speed&content=main&params=";SEARCH_CORE.HTML_Elements=$H();SEARCH_CORE.DATA=$H();SEARCH_CORE.MEM_STATE=$H();SEARCH_CORE.TMP=$H();SEARCH_CORE.STYLE=$H();SEARCH_CORE.STYLE.Selects=$H();SEARCH_CORE.CONST=$H();SEARCH_CORE.RELOAD=$H();SEARCH_CORE.RELOAD.DATA=$A();SEARCH_CORE.STYLE.Selects.Headings_BG_Color="#003466";SEARCH_CORE.STYLE.Selects.Headings_Font_Color="#ffffff";SEARCH_CORE.MEM_STATE.search_Suburb_filter=$H();SEARCH_CORE.MEM_STATE.search_Suburb_filter.TimerID=0;SEARCH_CORE.MEM_STATE.search_Suburb_filter.Value="";SEARCH_CORE.CONST.Price_Ranges=$H();SEARCH_CORE.CONST.Price_Ranges.Sale=$H();SEARCH_CORE.CONST.Price_Ranges.Sale[0]=250000;SEARCH_CORE.CONST.Price_Ranges.Sale[1]=500000;SEARCH_CORE.CONST.Price_Ranges.Sale[2]=750000;SEARCH_CORE.CONST.Price_Ranges.Sale[3]=1000000;SEARCH_CORE.CONST.Price_Ranges.Sale[4]=1500000;SEARCH_CORE.CONST.Price_Ranges.Sale[5]=2000000;SEARCH_CORE.CONST.Price_Ranges.Sale[6]=3000000;SEARCH_CORE.CONST.Price_Ranges.Sale[7]=4000000;SEARCH_CORE.CONST.Price_Ranges.Sale[8]=5000000;SEARCH_CORE.CONST.Price_Ranges.Sale[9]=6000000;SEARCH_CORE.CONST.Price_Ranges.Sale[10]=7000000;SEARCH_CORE.CONST.Price_Ranges.Sale[11]=9000000;SEARCH_CORE.CONST.Price_Ranges.Sale[12]=10000000;SEARCH_CORE.CONST.Price_Ranges.Rental=$H();SEARCH_CORE.CONST.Price_Ranges.Rental[0]=1000;SEARCH_CORE.CONST.Price_Ranges.Rental[1]=2000;SEARCH_CORE.CONST.Price_Ranges.Rental[2]=3000;SEARCH_CORE.CONST.Price_Ranges.Rental[3]=4000;SEARCH_CORE.CONST.Price_Ranges.Rental[4]=5000;SEARCH_CORE.CONST.Price_Ranges.Rental[5]=6000;SEARCH_CORE.CONST.Price_Ranges.Rental[6]=7000;SEARCH_CORE.CONST.Price_Ranges.Rental[7]=8000;SEARCH_CORE.CONST.Price_Ranges.Rental[8]=9000;SEARCH_CORE.CONST.Price_Ranges.Rental[9]=10000;SEARCH_CORE.RELOAD.STATE=false;var SetpaymentID=0;var SetpropTypeID=0;function RepopulateCurrentRegion()
{var oOption=$("search_Province_select").options[$("search_Province_select").selectedIndex];_search_Province_Handler(oOption.text,oOption.value);}
function property_search_init(OfficeIDs,ProvinceID,ProvinceName,UserIDs,GET,PaymentID)
{try
{if(PaymentID)
{SetpaymentID=PaymentID;}
if(GET){SetpropTypeID=GET;}
_init_Search_HTML_Elements();_init_Search_Observers();_get_Property_Types();_get_Property_PaymentTypes();if(ProvinceID>0)
{if(OfficeIDs)
{SEARCH_CORE.DATA.OfficesIDs=unserialize(OfficeIDs).join(",");}
if(UserIDs)
{SEARCH_CORE.DATA.UserIDs=unserialize(UserIDs).join(",");}
if(RESULTS_CORE_In_Data)
{SEARCH_CORE.RELOAD.STATE=true;SEARCH_CORE.RELOAD.TMP=unserialize(RESULTS_CORE_In_Data);SEARCH_CORE.RELOAD.DATA['Province']=SEARCH_CORE.RELOAD.TMP['Province'].split(',');SEARCH_CORE.RELOAD.DATA['Regions']=SEARCH_CORE.RELOAD.TMP['Regions'].split(',');SEARCH_CORE.RELOAD.DATA['Suburbs']=SEARCH_CORE.RELOAD.TMP['Suburbs'].split(',');SEARCH_CORE.RELOAD.DATA['Types']=SEARCH_CORE.RELOAD.TMP['Types'].split(',');SEARCH_CORE.RELOAD.DATA['Suburbs']=SEARCH_CORE.RELOAD.TMP['Suburbs'].split(',');SEARCH_CORE.RELOAD.DATA['SuburbFilter']=SEARCH_CORE.RELOAD.TMP['SuburbFilter'].replace("_"," ");SEARCH_CORE.RELOAD.DATA['Payment']=SEARCH_CORE.RELOAD.TMP['Payment'];if(SEARCH_CORE.RELOAD.TMP['Rental_MIN'])
{SEARCH_CORE.RELOAD.DATA['Rental_MIN']=SEARCH_CORE.RELOAD.TMP['Rental_MIN'];}
if(SEARCH_CORE.RELOAD.TMP['Rental_MAX'])
{SEARCH_CORE.RELOAD.DATA['Rental_MAX']=SEARCH_CORE.RELOAD.TMP['Rental_MAX'];}
if(SEARCH_CORE.RELOAD.TMP['Sale_MIN'])
{SEARCH_CORE.RELOAD.DATA['Sale_MIN']=SEARCH_CORE.RELOAD.TMP['Sale_MIN'];}
if(SEARCH_CORE.RELOAD.TMP['Sale_MAX'])
{SEARCH_CORE.RELOAD.DATA['Sale_MAX']=SEARCH_CORE.RELOAD.TMP['Sale_MAX'];}
SEARCH_CORE.RELOAD.TMP=$H();_repopulate_Search();}
else
{setTimeout(RepopulateCurrentRegion,100);}}
else
{SEARCH_CORE.HTML_Elements.search_Location_select.options[0]=new Option("Please select region...",'0');}}
catch(e)
{_error_message("file : "+e.fileName+" <br >on line :"+e.lineNumber+"<br>"+e.message);}}
function _repopulate_Search()
{SEARCH_CORE.HTML_Elements.search_Province_select.disabled=true;_search_ProvinceMap_Handler(SEARCH_CORE.RELOAD.DATA['Province'][0]);}
function _init_Search_HTML_Elements()
{try
{SEARCH_CORE.HTML_Elements.search_Province_select_div=$('search_Province_select_div');SEARCH_CORE.HTML_Elements.search_Province_select=$('search_Province_select');SEARCH_CORE.HTML_Elements.search_Suburb_filter=$('search_Region_Suburb_filter');SEARCH_CORE.HTML_Elements.search_Suburb_filter.value="Suburb Filter";SEARCH_CORE.HTML_Elements.search_Region_Suburb_select_div=$('search_Region_Suburb_select_div');SEARCH_CORE.HTML_Elements.search_Location_select=$('search_Region_Suburb_select');$('search_Region_Suburb_select').style.maxWidth=$('search_Region_Suburb_select').offsetWidth+'px';SEARCH_CORE.HTML_Elements.search_Property_Type_select_div=$('search_Property_Type_select_div');SEARCH_CORE.HTML_Elements.search_Type_select=$('search_Property_Type_select');SEARCH_CORE.HTML_Elements.search_Type_select.hideFocus=true;SEARCH_CORE.HTML_Elements.search_PaymentType_select=$('search_PaymentType_select');SEARCH_CORE.HTML_Elements.search_PaymentType_select_div=$('search_PaymentType_select_div');SEARCH_CORE.HTML_Elements.search_Sale_price_options_div=$('search_Sale_price_options_div');SEARCH_CORE.HTML_Elements.search_Sale_Count_lable=$('search_Sale_Count');SEARCH_CORE.HTML_Elements.search_Sale_Min_Price_select=$('search_Sale_Min_Price_select');SEARCH_CORE.HTML_Elements.search_Sale_Max_Price_select=$('search_Sale_Max_Price_select');SEARCH_CORE.HTML_Elements.search_Rental_price_options_div=$('search_Rental_price_options_div');SEARCH_CORE.HTML_Elements.search_Rental_Count_label=$('search_Rental_Count');SEARCH_CORE.HTML_Elements.search_Rental_Min_Price_select=$('search_Rental_Min_Price_select');SEARCH_CORE.HTML_Elements.search_Rental_Max_Price_select=$('search_Rental_Max_Price_select');SEARCH_CORE.HTML_Elements.search_Submit_button=$('search_Submit_button');}
catch(e)
{_error_message("file : "+e.fileName+" <br >on line :"+e.lineNumber+"<br>"+e.message);}}
function _init_Search_Observers()
{try
{Event.observe(SEARCH_CORE.HTML_Elements.search_Province_select,'change',_search_Province_Handler,false);Event.observe(SEARCH_CORE.HTML_Elements.search_Location_select,'change',_populate_Type_List,false);Event.observe(SEARCH_CORE.HTML_Elements.search_Type_select,'change',_search_Payment_Handler,false);Event.observe(SEARCH_CORE.HTML_Elements.search_Submit_button,'click',_search_Submit_Handler,false);Event.observe(SEARCH_CORE.HTML_Elements.search_Suburb_filter,'focus',_search_Filter_Handler,false);Event.observe(SEARCH_CORE.HTML_Elements.search_Suburb_filter,'keyup',_search_Filter_Handler,false);Event.observe(SEARCH_CORE.HTML_Elements.search_Sale_Min_Price_select,'change',_search_Sale_Price_Handler,false);Event.observe(SEARCH_CORE.HTML_Elements.search_Sale_Max_Price_select,'change',_search_Sale_Price_Handler,false);Event.observe(SEARCH_CORE.HTML_Elements.search_PaymentType_select,'change',_search_PaymentType_Handler,false);}
catch(e)
{_error_message("file : "+e.fileName+" <br >on line :"+e.lineNumber+"<br>"+e.message);}}
function _search_ProvinceMap_Handler(provinceID,provinceName)
{try
{if(provinceID)
{SEARCH_CORE.HTML_Elements.search_Province_select.selectedIndex="-1";for(i=0;i<=(SEARCH_CORE.HTML_Elements.search_Province_select.options.length-1);i++)
{switch(true)
{case(SEARCH_CORE.HTML_Elements.search_Province_select.options[i].value==provinceID):switch(true)
{case(SEARCH_CORE.HTML_Elements.search_Province_select.selectedIndex!=SEARCH_CORE.HTML_Elements.search_Province_select.options[i].index):SEARCH_CORE.HTML_Elements.search_Province_select.selectedIndex=SEARCH_CORE.HTML_Elements.search_Province_select.options[i].index;_search_Province_Handler();break;}
return;}}
SEARCH_CORE.HTML_Elements.search_Province_select.options[SEARCH_CORE.HTML_Elements.search_Province_select.options.length]=new Option(provinceName,provinceID);SEARCH_CORE.HTML_Elements.search_Province_select.options[SEARCH_CORE.HTML_Elements.search_Province_select.options.length-1].selected=true;_search_Province_Handler();}}
catch(e)
{_error_message("file : "+e.fileName+" <br >on line :"+e.lineNumber+"<br>"+e.message);}}
function _search_Filter_Handler()
{try
{if(!SEARCH_CORE.MEM_STATE.search_Suburb_filter.Activated)
{SEARCH_CORE.MEM_STATE.search_Suburb_filter.Activated=true;SEARCH_CORE.HTML_Elements.search_Suburb_filter.value="";return;}
if(SEARCH_CORE.MEM_STATE.search_Suburb_filter.TimerID!=0){clearTimeout(SEARCH_CORE.MEM_STATE.search_Suburb_filter.TimerID);}
switch(true)
{case(trim(SEARCH_CORE.HTML_Elements.search_Suburb_filter.value)!=""&&trim(SEARCH_CORE.HTML_Elements.search_Suburb_filter.value).toUpperCase()!=SEARCH_CORE.MEM_STATE.search_Suburb_filter.Value):SEARCH_CORE.MEM_STATE.search_Suburb_filter.TimerID=setTimeout('_search_Filter()',750);break;case(SEARCH_CORE.MEM_STATE.search_Suburb_filter.Activated&&trim(SEARCH_CORE.HTML_Elements.search_Suburb_filter.value)==""&&SEARCH_CORE.MEM_STATE.search_Suburb_filter.Value!=""):SEARCH_CORE.MEM_STATE.search_Suburb_filter.Value="";_populate_Region_Suburb_List();break;}}
catch(e)
{_error_message("file : "+e.fileName+" <br >on line :"+e.lineNumber+"<br>"+e.message);}}
function _search_Filter()
{try
{clearTimeout(SEARCH_CORE.MEM_STATE.search_Suburb_filter.TimerID);SEARCH_CORE.MEM_STATE.search_Suburb_filter.Value=trim(SEARCH_CORE.HTML_Elements.search_Suburb_filter.value).toUpperCase();_populate_Region_Suburb_List();}
catch(e)
{_error_message("file : "+e.fileName+" <br >on line :"+e.lineNumber+"<br>"+e.message);}}
function _search_Province_Handler()
{try
{SEARCH_CORE.DATA.ProvinceID=get_Selected_Options(SEARCH_CORE.HTML_Elements.search_Province_select,true);if(SEARCH_CORE.DATA.ProvinceID>0)
{SEARCH_CORE.HTML_Elements.search_Province_select.disabled=true;SEARCH_CORE.HTML_Elements.search_Suburb_filter.disabled=true;SEARCH_CORE.HTML_Elements.search_Suburb_filter.value="Type in suburb or region";SEARCH_CORE.MEM_STATE.search_Suburb_filter.Value="";SEARCH_CORE.HTML_Elements.search_Location_select.disabled=true;SEARCH_CORE.HTML_Elements.search_PaymentType_select.disabled=true;SEARCH_CORE.MEM_STATE.search_Suburb_filter.Activated=false;SEARCH_CORE.HTML_Elements.search_Type_select.disabled=true;SEARCH_CORE.HTML_Elements.search_Sale_Min_Price_select.disabled=true;SEARCH_CORE.HTML_Elements.search_Sale_Max_Price_select.disabled=true;SEARCH_CORE.HTML_Elements.search_Rental_Min_Price_select.disabled=true;SEARCH_CORE.HTML_Elements.search_Rental_Max_Price_select.disabled=true;SEARCH_CORE.HTML_Elements.search_Location_select.style.textAlign="left";_search_loading_layer(SEARCH_CORE.HTML_Elements.search_Region_Suburb_select_div,SEARCH_CORE.HTML_Elements.search_Location_select,true);_search_loading_layer(SEARCH_CORE.HTML_Elements.search_Property_Type_select_div,SEARCH_CORE.HTML_Elements.search_Type_select,true);_get_Province_Properties(SEARCH_CORE.DATA.ProvinceID);}}
catch(e)
{_error_message("file : "+e.fileName+" <br >on line :"+e.lineNumber+"<br>"+e.message);}}
function _search_Type_Handler(e)
{switch(e.currentTarget.options[e.currentTarget.selectedIndex].value)
{}}
function _search_PaymentType_Handler()
{var selected_options=get_Selected_Options(SEARCH_CORE.HTML_Elements.search_PaymentType_select);$H(selected_options).each(function(payment)
{switch(payment.value)
{case("1"):SEARCH_CORE.HTML_Elements.search_Sale_Min_Price_select.disabled=true;SEARCH_CORE.HTML_Elements.search_Sale_Max_Price_select.disabled=true;SEARCH_CORE.HTML_Elements.search_Rental_Min_Price_select.disabled=false;SEARCH_CORE.HTML_Elements.search_Rental_Max_Price_select.disabled=false;break;case("2"):SEARCH_CORE.HTML_Elements.search_Sale_Min_Price_select.disabled=false;SEARCH_CORE.HTML_Elements.search_Sale_Max_Price_select.disabled=false;SEARCH_CORE.HTML_Elements.search_Rental_Min_Price_select.disabled=true;SEARCH_CORE.HTML_Elements.search_Rental_Max_Price_select.disabled=true;break;case("3"):SEARCH_CORE.HTML_Elements.search_Sale_Min_Price_select.disabled=true;SEARCH_CORE.HTML_Elements.search_Sale_Max_Price_select.disabled=true;SEARCH_CORE.HTML_Elements.search_Rental_Min_Price_select.disabled=true;SEARCH_CORE.HTML_Elements.search_Rental_Max_Price_select.disabled=true;break;}});}
function _search_Sale_Price_Handler()
{}
function _get_Province_Properties(province_array)
{try
{var data=$A();data['property_search_options']=$A();data['property_search_options']['officeIDs']=SEARCH_CORE.DATA.OfficesIDs;data['property_search_options']['userIDs']=SEARCH_CORE.DATA.UserIDs;data['property_search_options']['provinceIDs']=province_array.join(",");data['property_search_options']['paymentIDs']=SetpaymentID;data['property_search_options']['typeIDs']=SetpropTypeID;CtrlCall(SEARCH_CORE.CONTROLLER_CALL_URL+"feed:property_search_options;filter:property_search_options;","data="+serialize(data),"_load_Province_Properties");}
catch(e)
{_error_message("file : "+e.fileName+" <br >on line :"+e.lineNumber+"<br>"+e.message);}}
function _get_Property_Types()
{CtrlCall(SEARCH_CORE.CONTROLLER_CALL_URL+"feed:types;","","_load_Search_Types");}
function _get_Property_PaymentTypes()
{CtrlCall(SEARCH_CORE.CONTROLLER_CALL_URL+"feed:payment_types;","data=null","_load_Payment_Types");}
function _search_loading_layer(containerDiv,Element,show)
{eval("if(!SEARCH_CORE.HTML_Elements."+containerDiv.id+"_loader){SEARCH_CORE.HTML_Elements."+containerDiv.id+"_loader = document.createElement('div');}");eval("containerDiv.appendChild(SEARCH_CORE.HTML_Elements."+containerDiv.id+"_loader);");switch(show)
{case true:Element.style.display="none";eval("SEARCH_CORE.HTML_Elements."+containerDiv.id+"_loader.style.backgroundColor                                     = '#f1f1f1';");eval("SEARCH_CORE.HTML_Elements."+containerDiv.id+"_loader.style.top                                             = Element.style.top;");eval("SEARCH_CORE.HTML_Elements."+containerDiv.id+"_loader.style.left                                             = Element.style.left;");eval("SEARCH_CORE.HTML_Elements."+containerDiv.id+"_loader.style.width                                         = Element.style.width;");eval("SEARCH_CORE.HTML_Elements."+containerDiv.id+"_loader.style.height                                         = Element.style.height;");eval("SEARCH_CORE.HTML_Elements."+containerDiv.id+"_loader.style.zIndex                = '999';");eval("SEARCH_CORE.HTML_Elements."+containerDiv.id+"_loader.innerHTML                          = \"<table cellpadding='0' cellspacing=0' style='width:\"+SEARCH_CORE.HTML_Elements."+containerDiv.id+"_loader.style.width+\";height:\"+SEARCH_CORE.HTML_Elements."+containerDiv.id+"_loader.style.height+\";'><tr><td style='width:\"+SEARCH_CORE.HTML_Elements."+containerDiv.id+"_loader.style.width+\";height:\"+SEARCH_CORE.HTML_Elements."+containerDiv.id+"_loader.style.height+\"; vertical-align: middle' align='center' valign='middle'><img src ='"+MUFFIN_SHARED_URL+"/images/property_search/remaxloading.gif' align='middle'></td></tr></table>\";");eval("SEARCH_CORE.HTML_Elements."+containerDiv.id+"_loader.style.display = 'block';");break;default:Element.style.display="block";eval("SEARCH_CORE.HTML_Elements."+containerDiv.id+"_loader.style.display = 'none';");break;}}
function _load_Payment_Types(response)
{try
{SEARCH_CORE.DATA.PaymentTypes=$H();SEARCH_CORE.TMP._type_reponseSet=$M(response);SEARCH_CORE.TMP._type_inc=0;switch(true)
{case(SEARCH_CORE.TMP._type_reponseSet!=null):$H(SEARCH_CORE.TMP._type_reponseSet.PaymentTypes.PaymentType).each(function(type)
{SEARCH_CORE.DATA.PaymentTypes[type.value.PaymentID]=$H();SEARCH_CORE.DATA.PaymentTypes[type.value.PaymentID].Name=type.value.MethodDescription;SEARCH_CORE.DATA.PaymentTypes[type.value.PaymentID].PropertyCount=0;SEARCH_CORE.HTML_Elements.search_PaymentType_select.options[SEARCH_CORE.TMP._type_inc]=new Option(type.value.MethodDescription,type.value.PaymentID);SEARCH_CORE.TMP._type_inc++;});break;default:_error_message("No Payment Types found");break;}
SEARCH_CORE.TMP=$H();}
catch(e)
{_error_message("file : "+e.fileName+" <br >on line :"+e.lineNumber+"<br>"+e.message);}}
function _load_Search_Types(response)
{try
{SEARCH_CORE.DATA.Types=$H();SEARCH_CORE.TMP._type_reponseSet=$M(response);SEARCH_CORE.TMP.optioncount=0;switch(true)
{case(SEARCH_CORE.TMP._type_reponseSet!=null):$H(SEARCH_CORE.TMP._type_reponseSet.Types.Type).each(function(type)
{SEARCH_CORE.DATA.Types[type.value.PropTypeID]=$H();SEARCH_CORE.DATA.Types[type.value.PropTypeID].Name=type.value.TypeName;SEARCH_CORE.DATA.Types[type.value.PropTypeID].PropertyCount=0;});break;default:_error_message("No Property Types found");break;}
SEARCH_CORE.TMP=$H();_populate_default_PropertyTypes_list();}
catch(e)
{_error_message("file : "+e.fileName+" <br >on line :"+e.lineNumber+"<br>"+e.message);}}
function _populate_default_PropertyTypes_list()
{try
{SEARCH_CORE.TMP.optioncount=0;SEARCH_CORE.DATA.Types.each(function(type)
{SEARCH_CORE.HTML_Elements.search_Type_select.options[SEARCH_CORE.TMP.optioncount]=new Option(type.value.Name,type.key);SEARCH_CORE.HTML_Elements.search_Type_select.options[SEARCH_CORE.TMP.optioncount].disabled="true";SEARCH_CORE.HTML_Elements.search_Type_select.options[SEARCH_CORE.TMP.optioncount].style.color="#c1c1c1";SEARCH_CORE.TMP.optioncount++;});SEARCH_CORE.TMP=$H();}
catch(e)
{_error_message("file : "+e.fileName+" <br >on line :"+e.lineNumber+"<br>"+e.message);}}
function _load_Province_Properties(response)
{if(response.responseText[0]=='|')alert(response.responseText);try
{SEARCH_CORE.TMP=$H();SEARCH_CORE.TMP.options_reponseSet=$M(response);switch(true)
{case(SEARCH_CORE.TMP.options_reponseSet!=null&&SEARCH_CORE.TMP.options_reponseSet.Regions!=null&&SEARCH_CORE.TMP.options_reponseSet.Suburbs!=null):SEARCH_CORE.DATA.Locations=$H();SEARCH_CORE.DATA.Locations.Regions=$H();SEARCH_CORE.DATA.Locations.SuburbGroupings=$H();SEARCH_CORE.DATA.Locations.Suburbs=$H();SEARCH_CORE.DATA.Locations.Regions=SEARCH_CORE.TMP.options_reponseSet.Regions.Region;SEARCH_CORE.DATA.Locations.SuburbGroupings=SEARCH_CORE.TMP.options_reponseSet.SuburbGroupings.SuburbGrouping;SEARCH_CORE.DATA.Locations.Suburbs=SEARCH_CORE.TMP.options_reponseSet.Suburbs.Suburb;_populate_Region_Suburb_List();break;default:SEARCH_CORE.HTML_Elements.search_Location_select.options.length=0;SEARCH_CORE.HTML_Elements.search_Location_select.options[0]=new Option('No Properties In Province','false');_populate_default_PropertyTypes_list();_search_loading_layer(SEARCH_CORE.HTML_Elements.search_Property_Type_select_div,SEARCH_CORE.HTML_Elements.search_Type_select,false);_search_loading_layer(SEARCH_CORE.HTML_Elements.search_Region_Suburb_select_div,SEARCH_CORE.HTML_Elements.search_Location_select,false);SEARCH_CORE.HTML_Elements.search_Province_select.disabled=false;break;}}
catch(e)
{_error_message("file : "+e.fileName+" <br >on line :"+e.lineNumber+"<br>"+e.message);}}
function _populate_Region_Suburb_List()
{try
{SEARCH_CORE.TMP=$H();SEARCH_CORE.MEM_STATE.location_options=$H();SEARCH_CORE.MEM_STATE.location_options.Regions=$H();SEARCH_CORE.MEM_STATE.location_options.SuburbGroupings=$H();SEARCH_CORE.HTML_Elements.search_Location_select.options.length=0;SEARCH_CORE.TMP.optioncount=0;SEARCH_CORE.TMP.propertyCount=0;$H(SEARCH_CORE.DATA.Locations.Suburbs).each(function(suburb)
{if(SEARCH_CORE.MEM_STATE.search_Suburb_filter.Value!="")
{if(in_string(SEARCH_CORE.MEM_STATE.search_Suburb_filter.Value,SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].Name.toUpperCase())||in_string(SEARCH_CORE.MEM_STATE.search_Suburb_filter.Value,SEARCH_CORE.DATA.Locations.Regions[SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].Region].Name.toUpperCase())||in_string(SEARCH_CORE.MEM_STATE.search_Suburb_filter.Value,SEARCH_CORE.DATA.Locations.SuburbGroupings[SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].SuburbGrouping].Name.toUpperCase()))
{if(!SEARCH_CORE.MEM_STATE.location_options.SuburbGroupings[suburb.value.SuburbGrouping])
{SEARCH_CORE.MEM_STATE.location_options.SuburbGroupings[suburb.value.SuburbGrouping]=$H();SEARCH_CORE.MEM_STATE.location_options.SuburbGroupings[suburb.value.SuburbGrouping].Suburbs=$H();}
SEARCH_CORE.MEM_STATE.location_options.SuburbGroupings[suburb.value.SuburbGrouping].Suburbs[suburb.key]=$H();SEARCH_CORE.TMP.propertyCount+=SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].PropertyCount;}}
else
{if(!SEARCH_CORE.MEM_STATE.location_options.Regions[suburb.value.Region])
{SEARCH_CORE.MEM_STATE.location_options.Regions[suburb.value.Region]=$H();SEARCH_CORE.MEM_STATE.location_options.Regions[suburb.value.Region].Suburbs=$H();}
if(!SEARCH_CORE.MEM_STATE.location_options.SuburbGroupings[suburb.value.SuburbGrouping])
{SEARCH_CORE.MEM_STATE.location_options.SuburbGroupings[suburb.value.SuburbGrouping]=$H();SEARCH_CORE.MEM_STATE.location_options.SuburbGroupings[suburb.value.SuburbGrouping].Suburbs=$H();}
SEARCH_CORE.MEM_STATE.location_options.SuburbGroupings[suburb.value.SuburbGrouping].Suburbs[suburb.key]=$H();SEARCH_CORE.MEM_STATE.location_options.Regions[suburb.value.Region].Suburbs[suburb.key]=$H();SEARCH_CORE.TMP.propertyCount+=SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].PropertyCount;}});if($A(SEARCH_CORE.MEM_STATE.location_options.SuburbGroupings).length>0)
{$H(SEARCH_CORE.DATA.Locations.SuburbGroupings).each(function(suburb_grouping)
{if(SEARCH_CORE.MEM_STATE.location_options.SuburbGroupings[suburb_grouping.key])
{var varOptionCount=0;var varSuburbIDs=0;SEARCH_CORE.HTML_Elements.search_Location_select.options[SEARCH_CORE.TMP.optioncount]=new Option(SEARCH_CORE.DATA.Locations.SuburbGroupings[suburb_grouping.key].Name,'0');varOptionCount=SEARCH_CORE.TMP.optioncount;SEARCH_CORE.TMP.optioncount++;SEARCH_CORE.MEM_STATE.location_options.SuburbGroupings[suburb_grouping.key].Suburbs.each(function(suburbid)
{SEARCH_CORE.HTML_Elements.search_Location_select.options[SEARCH_CORE.TMP.optioncount]=new Option(SEARCH_CORE.DATA.Locations.Suburbs[suburbid.key].Name+" [ "+SEARCH_CORE.DATA.Locations.Suburbs[suburbid.key].PropertyCount+" ]",SEARCH_CORE.DATA.Locations.Suburbs[suburbid.key].SuburbID);varSuburbIDs+=SEARCH_CORE.DATA.Locations.Suburbs[suburbid.key].SuburbID+", ";if(SEARCH_CORE.RELOAD.STATE&&in_array(","+suburbid.key,SEARCH_CORE.RELOAD.DATA['Suburbs']))
{SEARCH_CORE.HTML_Elements.search_Location_select.options[SEARCH_CORE.TMP.optioncount].selected="true";}
SEARCH_CORE.TMP.optioncount++;});SEARCH_CORE.HTML_Elements.search_Location_select.options[varOptionCount]=new Option(SEARCH_CORE.DATA.Locations.SuburbGroupings[suburb_grouping.key].Name,varSuburbIDs+'0');SEARCH_CORE.HTML_Elements.search_Location_select.options[varOptionCount].style.backgroundColor=SEARCH_CORE.STYLE.Selects.Headings_BG_Color;SEARCH_CORE.HTML_Elements.search_Location_select.options[varOptionCount].style.color=SEARCH_CORE.STYLE.Selects.Headings_Font_Color;}});SEARCH_CORE.TMP=$H();SEARCH_CORE.HTML_Elements.search_Suburb_filter.disabled=false;SEARCH_CORE.HTML_Elements.search_Location_select.disabled=false;SEARCH_CORE.HTML_Elements.search_Province_select.disabled=false;_search_loading_layer(SEARCH_CORE.HTML_Elements.search_Region_Suburb_select_div,SEARCH_CORE.HTML_Elements.search_Location_select,false);_populate_Type_List();}
else
{SEARCH_CORE.HTML_Elements.search_Location_select.disabled=true;SEARCH_CORE.HTML_Elements.search_Location_select.options[SEARCH_CORE.TMP.optioncount]}}
catch(e)
{_error_message("file : "+e.fileName+" <br >on line :"+e.lineNumber+"<br>"+e.message);}}
function _populate_Type_List()
{try
{_search_loading_layer(SEARCH_CORE.HTML_Elements.search_Property_Type_select_div,SEARCH_CORE.HTML_Elements.search_Type_select,true);SEARCH_CORE.TMP.Selected_Locations=get_Selected_Options(SEARCH_CORE.HTML_Elements.search_Location_select);SEARCH_CORE.MEM_STATE.available_Types=$H();SEARCH_CORE.MEM_STATE.available_Types.regions_loaded=$A();SEARCH_CORE.MEM_STATE.available_Types.region_loaded_inc=0;SEARCH_CORE.TMP.post_regions=$H();SEARCH_CORE.TMP.post_regions.list=$A();SEARCH_CORE.TMP.post_regions.inc=0;SEARCH_CORE.MEM_STATE.PostSuburbs="-1";SEARCH_CORE.MEM_STATE.PostRegions="-1";switch(true)
{case($A(SEARCH_CORE.TMP.Selected_Locations).length>0):switch(in_array("-1",SEARCH_CORE.TMP.Selected_Locations))
{case true:SEARCH_CORE.MEM_STATE.location_options.Regions.each(function(region)
{SEARCH_CORE.MEM_STATE.PostRegions+=","+region.key.substring(7,region.key.length);region.value.Suburbs.each(function(suburb)
{SEARCH_CORE.MEM_STATE.PostSuburbs+=","+SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].SuburbID;SEARCH_CORE.TMP.PostSuburbs_inc++;$H(SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].Types).each(function(type)
{if(!SEARCH_CORE.MEM_STATE.available_Types[type.key])
{SEARCH_CORE.MEM_STATE.available_Types[type.key]=$H();SEARCH_CORE.MEM_STATE.available_Types[type.key].PropertyCount=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment=$H();}
SEARCH_CORE.MEM_STATE.available_Types[type.key].PropertyCount+=type.value.PropertyCount;$H(type.value.Payment).each(function(payment)
{if(!SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key])
{SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key]=$H();SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].PropertyCount=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min=null;}
SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max=Math.max(parseInt(payment.value.Max),SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max);SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min=(parseInt(payment.value.Min)<SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min||SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min==null)?parseInt(payment.value.Min):SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].PropertyCount+=payment.value.PropertyCount;});});});});break;default:SEARCH_CORE.TMP.regionTypesloaded=$A();SEARCH_CORE.TMP.Selected_Locations.each(function(location)
{if(in_string("region_",location))
{SEARCH_CORE.TMP.location_key="Regions";}
else
{SEARCH_CORE.TMP.location_key="Suburbs";location="sb_"+location;}
$H(SEARCH_CORE.DATA.Locations[SEARCH_CORE.TMP.location_key][location].Types).each(function(type)
{switch(SEARCH_CORE.TMP.location_key)
{case"Regions":SEARCH_CORE.MEM_STATE.available_Types.regions_loaded[SEARCH_CORE.MEM_STATE.available_Types.region_loaded_inc]=location;SEARCH_CORE.MEM_STATE.PostRegions+=","+location.substring(7,location.length);SEARCH_CORE.MEM_STATE.location_options.Regions[location].Suburbs.each(function(suburb)
{if(SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].Types[type.key])
{$H(SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].Types[type.key].Payment).each(function(payment)
{switch(!SEARCH_CORE.MEM_STATE.available_Types[type.key])
{case true:SEARCH_CORE.MEM_STATE.available_Types[type.key]=$H();SEARCH_CORE.MEM_STATE.available_Types[type.key].PropertyCount=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment=$H();break;}
if(!SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key])
{SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key]=$H();SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].PropertyCount=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min=null;}
SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max=Math.max(parseInt(payment.value.Max),SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max);SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min=(parseInt(payment.value.Min)<SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min||SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min==null)?parseInt(payment.value.Min):SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].PropertyCount+=payment.value.PropertyCount;});SEARCH_CORE.MEM_STATE.available_Types[type.key].PropertyCount+=SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].Types[type.key].PropertyCount;}
SEARCH_CORE.MEM_STATE.PostSuburbs+=","+SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].SuburbID;});SEARCH_CORE.MEM_STATE.available_Types.region_loaded_inc++;break;default:switch(!in_array(SEARCH_CORE.DATA.Locations.Suburbs[location].Region,SEARCH_CORE.MEM_STATE.available_Types.regions_loaded))
{case true:switch(!SEARCH_CORE.MEM_STATE.available_Types[type.key])
{case true:SEARCH_CORE.MEM_STATE.available_Types[type.key]=$H();SEARCH_CORE.MEM_STATE.available_Types[type.key].PropertyCount=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment=$H();break;}
if(!in_array(SEARCH_CORE.DATA.Locations.Suburbs[location].Region,SEARCH_CORE.TMP.post_regions.list))
{SEARCH_CORE.TMP.post_regions.list[SEARCH_CORE.TMP.post_regions.inc]=SEARCH_CORE.DATA.Locations.Suburbs[location].Region;SEARCH_CORE.MEM_STATE.PostRegions+=","+SEARCH_CORE.DATA.Locations.Suburbs[location].Region.substring(7,SEARCH_CORE.DATA.Locations.Suburbs[location].Region.length);SEARCH_CORE.TMP.post_regions.inc++;}
$H(type.value.Payment).each(function(payment)
{if(!SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key])
{SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key]=$H();SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].PropertyCount=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min=payment.value.Min;}
SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max=Math.max(parseInt(payment.value.Max),SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max);SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min=(parseInt(payment.value.Min)<SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min||SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min==null)?parseInt(payment.value.Min):SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].PropertyCount+=payment.value.PropertyCount;});SEARCH_CORE.MEM_STATE.PostSuburbs+=","+SEARCH_CORE.DATA.Locations.Suburbs[location].SuburbID;SEARCH_CORE.MEM_STATE.available_Types[type.key].PropertyCount+=type.value.PropertyCount;break;}
break;}});});break;}
break;}
SEARCH_CORE.TMP.type_avail=$H();SEARCH_CORE.TMP.type_grayd=$H();SEARCH_CORE.TMP.type_avail_count=0;SEARCH_CORE.TMP.type_grayd_count=0;SEARCH_CORE.MEM_STATE.available_Types=$H();SEARCH_CORE.MEM_STATE.available_Types.regions_loaded=$A();SEARCH_CORE.MEM_STATE.available_Types.region_loaded_inc=0;SEARCH_CORE.TMP.post_regions=$H();SEARCH_CORE.TMP.post_regions.list=$A();SEARCH_CORE.TMP.post_regions.inc=0;SEARCH_CORE.TMP.post_suburb_groupings=$H();SEARCH_CORE.TMP.post_suburb_groupings.list=$A();SEARCH_CORE.TMP.post_suburb_groupings.inc=0;SEARCH_CORE.MEM_STATE.PostSuburbs="-1";SEARCH_CORE.MEM_STATE.PostRegions="-1";switch(true)
{case($A(SEARCH_CORE.TMP.Selected_Locations).length>0):switch(in_array("-1",SEARCH_CORE.TMP.Selected_Locations))
{case true:SEARCH_CORE.MEM_STATE.location_options.Regions.each(function(region)
{SEARCH_CORE.MEM_STATE.PostRegions+=","+region.key.substring(7,region.key.length);region.value.Suburbs.each(function(suburb)
{SEARCH_CORE.MEM_STATE.PostSuburbs+=","+SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].SuburbID;SEARCH_CORE.TMP.PostSuburbs_inc++;$H(SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].Types).each(function(type)
{if(!SEARCH_CORE.MEM_STATE.available_Types[type.key])
{SEARCH_CORE.MEM_STATE.available_Types[type.key]=$H();SEARCH_CORE.MEM_STATE.available_Types[type.key].PropertyCount=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment=$H();}
SEARCH_CORE.MEM_STATE.available_Types[type.key].PropertyCount+=type.value.PropertyCount;$H(type.value.Payment).each(function(payment)
{if(!SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key])
{SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key]=$H();SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].PropertyCount=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min=null;}
SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max=Math.max(parseInt(payment.value.Max),SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max);SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min=(parseInt(payment.value.Min)<SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min||SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min==null)?parseInt(payment.value.Min):SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].PropertyCount+=payment.value.PropertyCount;});});});});break;default:SEARCH_CORE.TMP.regionTypesloaded=$A();SEARCH_CORE.TMP.Selected_Locations.each(function(location)
{if(in_string("region_",location))
{SEARCH_CORE.TMP.location_key="Regions";}
else
{SEARCH_CORE.TMP.location_key="Suburbs";location="sb_"+location;}
$H(SEARCH_CORE.DATA.Locations[SEARCH_CORE.TMP.location_key][location].Types).each(function(type)
{switch(SEARCH_CORE.TMP.location_key)
{case"SuburbGroupings":SEARCH_CORE.MEM_STATE.available_Types.suburb_groupings_loaded[SEARCH_CORE.MEM_STATE.available_Types.suburb_groupings_loaded_inc]=location;SEARCH_CORE.MEM_STATE.PostSuburb_groupings+=","+location.substring(7,location.length);SEARCH_CORE.MEM_STATE.location_options.SuburbGroupings[location].Suburbs.each(function(suburb)
{if(SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].Types[type.key])
{$H(SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].Types[type.key].Payment).each(function(payment)
{switch(!SEARCH_CORE.MEM_STATE.available_Types[type.key])
{case true:SEARCH_CORE.MEM_STATE.available_Types[type.key]=$H();SEARCH_CORE.MEM_STATE.available_Types[type.key].PropertyCount=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment=$H();break;}
if(!SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key])
{SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key]=$H();SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].PropertyCount=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min=null;}
SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max=Math.max(parseInt(payment.value.Max),SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max);SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min=(parseInt(payment.value.Min)<SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min||SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min==null)?parseInt(payment.value.Min):SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].PropertyCount+=payment.value.PropertyCount;});SEARCH_CORE.MEM_STATE.available_Types[type.key].PropertyCount+=SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].Types[type.key].PropertyCount;}
SEARCH_CORE.MEM_STATE.PostSuburbs+=","+SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].SuburbID;});SEARCH_CORE.MEM_STATE.available_Types.suburb_grouping_loaded_inc++;break;case"Regions":SEARCH_CORE.MEM_STATE.available_Types.regions_loaded[SEARCH_CORE.MEM_STATE.available_Types.region_loaded_inc]=location;SEARCH_CORE.MEM_STATE.PostRegions+=","+location.substring(7,location.length);SEARCH_CORE.MEM_STATE.location_options.Regions[location].Suburbs.each(function(suburb)
{if(SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].Types[type.key])
{$H(SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].Types[type.key].Payment).each(function(payment)
{switch(!SEARCH_CORE.MEM_STATE.available_Types[type.key])
{case true:SEARCH_CORE.MEM_STATE.available_Types[type.key]=$H();SEARCH_CORE.MEM_STATE.available_Types[type.key].PropertyCount=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment=$H();break;}
if(!SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key])
{SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key]=$H();SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].PropertyCount=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min=null;}
SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max=Math.max(parseInt(payment.value.Max),SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max);SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min=(parseInt(payment.value.Min)<SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min||SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min==null)?parseInt(payment.value.Min):SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].PropertyCount+=payment.value.PropertyCount;});SEARCH_CORE.MEM_STATE.available_Types[type.key].PropertyCount+=SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].Types[type.key].PropertyCount;}
SEARCH_CORE.MEM_STATE.PostSuburbs+=","+SEARCH_CORE.DATA.Locations.Suburbs[suburb.key].SuburbID;});SEARCH_CORE.MEM_STATE.available_Types.region_loaded_inc++;break;default:switch(!in_array(SEARCH_CORE.DATA.Locations.Suburbs[location].Region,SEARCH_CORE.MEM_STATE.available_Types.regions_loaded))
{case true:switch(!SEARCH_CORE.MEM_STATE.available_Types[type.key])
{case true:SEARCH_CORE.MEM_STATE.available_Types[type.key]=$H();SEARCH_CORE.MEM_STATE.available_Types[type.key].PropertyCount=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment=$H();break;}
if(!in_array(SEARCH_CORE.DATA.Locations.Suburbs[location].Region,SEARCH_CORE.TMP.post_regions.list))
{SEARCH_CORE.TMP.post_regions.list[SEARCH_CORE.TMP.post_regions.inc]=SEARCH_CORE.DATA.Locations.Suburbs[location].Region;SEARCH_CORE.MEM_STATE.PostRegions+=","+SEARCH_CORE.DATA.Locations.Suburbs[location].Region.substring(7,SEARCH_CORE.DATA.Locations.Suburbs[location].Region.length);SEARCH_CORE.TMP.post_regions.inc++;}
$H(type.value.Payment).each(function(payment)
{if(!SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key])
{SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key]=$H();SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].PropertyCount=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max=0;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min=payment.value.Min;}
SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max=Math.max(parseInt(payment.value.Max),SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Max);SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min=(parseInt(payment.value.Min)<SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min||SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min==null)?parseInt(payment.value.Min):SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].Min;SEARCH_CORE.MEM_STATE.available_Types[type.key].Payment[payment.key].PropertyCount+=payment.value.PropertyCount;});SEARCH_CORE.MEM_STATE.PostSuburbs+=","+SEARCH_CORE.DATA.Locations.Suburbs[location].SuburbID;SEARCH_CORE.MEM_STATE.available_Types[type.key].PropertyCount+=type.value.PropertyCount;break;}
break;}});});break;}
break;}
SEARCH_CORE.TMP.type_avail=$H();SEARCH_CORE.TMP.type_grayd=$H();SEARCH_CORE.TMP.type_avail_count=0;SEARCH_CORE.TMP.type_grayd_count=0;SEARCH_CORE.HTML_Elements.search_Type_select.options.length=0;SEARCH_CORE.DATA.Types.each(function(type)
{switch(!SEARCH_CORE.MEM_STATE.available_Types[type.key])
{case false:SEARCH_CORE.HTML_Elements.search_Type_select.options[SEARCH_CORE.TMP.type_avail_count]=new Option(type.value.Name+" [ "+SEARCH_CORE.MEM_STATE.available_Types[type.key].PropertyCount+" ]",type.key);switch(SEARCH_CORE.RELOAD.STATE)
{case(true):switch(in_array(","+type.key,SEARCH_CORE.RELOAD.DATA['Types']))
{case true:SEARCH_CORE.HTML_Elements.search_Type_select.options[SEARCH_CORE.TMP.type_avail_count].selected=true;break;}
break;default:SEARCH_CORE.HTML_Elements.search_Type_select.options[SEARCH_CORE.TMP.type_avail_count].selected=true;break;}
SEARCH_CORE.TMP.type_avail_count++;break;default:SEARCH_CORE.TMP.type_grayd[SEARCH_CORE.TMP.type_grayd_count]=new Option(type.value.Name+" [ 0 ]",type.key);SEARCH_CORE.TMP.type_grayd[SEARCH_CORE.TMP.type_grayd_count].style.color="#d1d1d1";SEARCH_CORE.TMP.type_grayd[SEARCH_CORE.TMP.type_grayd_count].disabled=true;SEARCH_CORE.TMP.type_grayd_count++;break;}});SEARCH_CORE.TMP.type_grayd.each(function(option)
{SEARCH_CORE.HTML_Elements.search_Type_select.options[SEARCH_CORE.TMP.type_avail_count]=option.value;SEARCH_CORE.TMP.type_avail_count++});SEARCH_CORE.HTML_Elements.search_Type_select.disabled=false;_search_Payment_Handler();_search_loading_layer(SEARCH_CORE.HTML_Elements.search_Property_Type_select_div,SEARCH_CORE.HTML_Elements.search_Type_select,false);}
catch(e)
{_error_message("file : "+e.fileName+" <br >on line :"+e.lineNumber+"<br>"+e.message);}}
function _search_Payment_Handler()
{try
{for(i=0;i<SEARCH_CORE.HTML_Elements.search_Type_select.options.length;i++)
{switch(SEARCH_CORE.HTML_Elements.search_Type_select.options[i].disabled)
{case true:SEARCH_CORE.HTML_Elements.search_Type_select.options[i].selected=false;break;}}
SEARCH_CORE.TMP.available_Payment=$H();SEARCH_CORE.HTML_Elements.search_PaymentType_select.options.length=0;SEARCH_CORE.HTML_Elements.search_PaymentType_select.disabled=true;var selectedTypes=get_Selected_Options(SEARCH_CORE.HTML_Elements.search_Type_select);if(selectedTypes.length>0)
{$H(selectedTypes).each(function(type)
{SEARCH_CORE.MEM_STATE.available_Types[type.value].Payment.each(function(payment)
{if(!SEARCH_CORE.TMP.available_Payment[payment.key])
{SEARCH_CORE.TMP.available_Payment[payment.key]=$H();SEARCH_CORE.TMP.available_Payment[payment.key].PropertyCount=0;SEARCH_CORE.TMP.available_Payment[payment.key].Max=payment.value.Max;SEARCH_CORE.TMP.available_Payment[payment.key].Min=payment.value.Min;SEARCH_CORE.TMP.available_Payment[payment.key].PropertyCount=0;}
SEARCH_CORE.TMP.available_Payment[payment.key].PropertyCount+=payment.value.PropertyCount;});});}
var inc=0;SEARCH_CORE.TMP.available_Payment.each(function(payment)
{SEARCH_CORE.HTML_Elements.search_PaymentType_select.options[inc]=new Option(SEARCH_CORE.DATA.PaymentTypes[payment.key].Name+" [ "+payment.value.PropertyCount+" ]",payment.key);switch(SEARCH_CORE.RELOAD.STATE)
{case(true):switch(payment.key==SEARCH_CORE.RELOAD.DATA['Payment'])
{case true:SEARCH_CORE.HTML_Elements.search_PaymentType_select.options[inc].selected=true;break;}
break;}
inc++;});SEARCH_CORE.HTML_Elements.search_PaymentType_select.disabled=false;SEARCH_CORE.HTML_Elements.search_Rental_Min_Price_select.disabled=true;SEARCH_CORE.HTML_Elements.search_Rental_Max_Price_select.disabled=true;SEARCH_CORE.HTML_Elements.search_Sale_Min_Price_select.disabled=true;SEARCH_CORE.HTML_Elements.search_Sale_Max_Price_select.disabled=true;SEARCH_CORE.TMP.SaleRange=$H();SEARCH_CORE.TMP.SaleRange.from_inc=0;SEARCH_CORE.TMP.SaleRange.to_inc=0;for(i=0;i<SEARCH_CORE.HTML_Elements.search_Type_select.options.length;i++)
{switch(SEARCH_CORE.HTML_Elements.search_Type_select.options[i].disabled)
{case true:SEARCH_CORE.HTML_Elements.search_Type_select.options[i].selected=false;break;}}
SEARCH_CORE.TMP.available_Payment=$H();SEARCH_CORE.HTML_Elements.search_PaymentType_select.options.length=0;SEARCH_CORE.HTML_Elements.search_PaymentType_select.disabled=true;var selectedTypes=get_Selected_Options(SEARCH_CORE.HTML_Elements.search_Type_select);if(selectedTypes.length>0)
{$H(selectedTypes).each(function(type)
{SEARCH_CORE.MEM_STATE.available_Types[type.value].Payment.each(function(payment)
{if(!SEARCH_CORE.TMP.available_Payment[payment.key])
{SEARCH_CORE.TMP.available_Payment[payment.key]=$H();SEARCH_CORE.TMP.available_Payment[payment.key].PropertyCount=0;SEARCH_CORE.TMP.available_Payment[payment.key].Max=payment.value.Max;SEARCH_CORE.TMP.available_Payment[payment.key].Min=payment.value.Min;SEARCH_CORE.TMP.available_Payment[payment.key].PropertyCount=0;}
SEARCH_CORE.TMP.available_Payment[payment.key].PropertyCount+=payment.value.PropertyCount;});});}
var inc=0;SEARCH_CORE.TMP.available_Payment.each(function(payment)
{SEARCH_CORE.HTML_Elements.search_PaymentType_select.options[inc]=new Option(SEARCH_CORE.DATA.PaymentTypes[payment.key].Name+" [ "+payment.value.PropertyCount+" ]",payment.key);switch(SEARCH_CORE.RELOAD.STATE)
{case(true):switch(payment.key==SEARCH_CORE.RELOAD.DATA['Payment'])
{case true:SEARCH_CORE.HTML_Elements.search_PaymentType_select.options[inc].selected=true;break;}
break;}
inc++;});SEARCH_CORE.HTML_Elements.search_PaymentType_select.disabled=false;SEARCH_CORE.TMP.available_Payment.each(function(payment)
{switch(payment.key)
{case"1":SEARCH_CORE.CONST.Price_Ranges.Rental.each(function(range)
{switch(true)
{case(payment.value.Max>=range.value):SEARCH_CORE.HTML_Elements.search_Rental_Min_Price_select.options[SEARCH_CORE.TMP.RentRange.from_inc]=new Option(addCommas(range.value.toFixed(2)),range.value);if(SEARCH_CORE.RELOAD.DATA['Rental_MIN'])
{switch(SEARCH_CORE.RELOAD.STATE)
{case(true):switch(range.value==SEARCH_CORE.RELOAD.DATA['Rental_MIN'])
{case true:SEARCH_CORE.HTML_Elements.search_Rental_Min_Price_select.options[SEARCH_CORE.TMP.RentRange.from_inc].selected=true;break;}
break;}}
SEARCH_CORE.TMP.RentRange.from_inc++;break;}
switch(true)
{case(payment.value.Min<=range.value):SEARCH_CORE.HTML_Elements.search_Rental_Max_Price_select.options[SEARCH_CORE.TMP.RentRange.to_inc]=new Option(addCommas(range.value.toFixed(2)),range.value);if(SEARCH_CORE.RELOAD.DATA['Rental_MAX'])
{switch(SEARCH_CORE.RELOAD.STATE)
{case(true):switch(range.value==SEARCH_CORE.RELOAD.DATA['Rental_MAX'])
{case true:SEARCH_CORE.HTML_Elements.search_Rental_Max_Price_select.options[SEARCH_CORE.TMP.RentRange.to_inc].selected=true;break;}
break;}}
SEARCH_CORE.TMP.RentRange.to_inc++;break;}});break;case"2":SEARCH_CORE.CONST.Price_Ranges.Sale.each(function(range)
{switch(true)
{case(payment.value.Max>=range.value):SEARCH_CORE.HTML_Elements.search_Sale_Min_Price_select.options[SEARCH_CORE.TMP.SaleRange.from_inc]=new Option(addCommas(range.value.toFixed(2)),range.value);if(SEARCH_CORE.RELOAD.DATA['Sale_MIN'])
{switch(SEARCH_CORE.RELOAD.STATE)
{case(true):switch(range.value==SEARCH_CORE.RELOAD.DATA['Sale_MIN'])
{case true:SEARCH_CORE.HTML_Elements.search_Sale_Min_Price_select.options[SEARCH_CORE.TMP.SaleRange.from_inc].selected=true;break;}
break;}}
SEARCH_CORE.TMP.SaleRange.from_inc++;break;}
switch(true)
{case(payment.value.Min<=range.value):SEARCH_CORE.HTML_Elements.search_Sale_Max_Price_select.options[SEARCH_CORE.TMP.SaleRange.to_inc]=new Option(addCommas(range.value.toFixed(2)),range.value);if(SEARCH_CORE.RELOAD.DATA['Sale_MAX'])
{switch(SEARCH_CORE.RELOAD.STATE)
{case(true):switch(range.value==SEARCH_CORE.RELOAD.DATA['Sale_MAX'])
{case true:SEARCH_CORE.HTML_Elements.search_Sale_Max_Price_select.options[SEARCH_CORE.TMP.SaleRange.to_inc].selected=true;break;}
break;}}
SEARCH_CORE.TMP.SaleRange.to_inc++;break;}});break;}});switch(SEARCH_CORE.RELOAD.STATE)
{case(true):SEARCH_CORE.HTML_Elements.search_Province_select.disabled=false;SEARCH_CORE.RELOAD.STATE=false;break;}
_search_PaymentType_Handler();}
catch(e)
{_error_message("file : "+e.fileName+" <br >on line :"+e.lineNumber+"<br>"+e.message);}}
function _search_Submit_Handler()
{SEARCH_CORE.TMP.Post=$A();switch(true)
{case(get_Selected_Options(SEARCH_CORE.HTML_Elements.search_Province_select).length==0||SEARCH_CORE.HTML_Elements.search_Province_select.options[SEARCH_CORE.HTML_Elements.search_Province_select.selectedIndex].value=='-1'):_Ciriteria_error("Please Select a Property Province (Step 1)",SEARCH_CORE.HTML_Elements.search_Province_select_div.id);return;default:SEARCH_CORE.TMP.Post['Province']=SEARCH_CORE.HTML_Elements.search_Province_select.options[SEARCH_CORE.HTML_Elements.search_Province_select.selectedIndex].value;}
SEARCH_CORE.TMP.Post['SuburbFilter']=SEARCH_CORE.MEM_STATE.search_Suburb_filter.Value.replace(" ","_");switch(true)
{case(get_Selected_Options(SEARCH_CORE.HTML_Elements.search_Location_select).length==0):_Ciriteria_error("Please Select a Property Location (Step 1)",SEARCH_CORE.HTML_Elements.search_Region_Suburb_select_div.id);return;default:SEARCH_CORE.TMP.Post['Suburbs']=SEARCH_CORE.MEM_STATE.PostSuburbs;SEARCH_CORE.TMP.Post['Regions']=SEARCH_CORE.MEM_STATE.PostRegions;}
switch(true)
{case(get_Selected_Options(SEARCH_CORE.HTML_Elements.search_Type_select).length==0):_Ciriteria_error("Please Select a Property Type (Step 2)");return;default:SEARCH_CORE.TMP.Post['Types']="-1";SEARCH_CORE.TMP.selectedTypes=$H(get_Selected_Options(SEARCH_CORE.HTML_Elements.search_Type_select));SEARCH_CORE.TMP.selectedTypes.each(function(type)
{SEARCH_CORE.TMP.Post['Types']+=","+type.value;});}
switch(true)
{case(get_Selected_Options(SEARCH_CORE.HTML_Elements.search_PaymentType_select).length==0):_Ciriteria_error("Please Select a Payment Type (Step 2)",SEARCH_CORE.HTML_Elements.search_PaymentType_select_div.id);return;default:SEARCH_CORE.TMP.Post['Payment']=SEARCH_CORE.HTML_Elements.search_PaymentType_select.options[SEARCH_CORE.HTML_Elements.search_PaymentType_select.selectedIndex].value;}
switch(SEARCH_CORE.TMP.Post['Payment'])
{case'1':SEARCH_CORE.TMP.Post['Rental_MIN']=SEARCH_CORE.HTML_Elements.search_Rental_Min_Price_select.options[SEARCH_CORE.HTML_Elements.search_Rental_Min_Price_select.selectedIndex].value;SEARCH_CORE.TMP.Post['Rental_MAX']=SEARCH_CORE.HTML_Elements.search_Rental_Max_Price_select.options[SEARCH_CORE.HTML_Elements.search_Rental_Max_Price_select.selectedIndex].value;break;case'2':SEARCH_CORE.TMP.Post['Sale_MIN']=SEARCH_CORE.HTML_Elements.search_Sale_Min_Price_select.options[SEARCH_CORE.HTML_Elements.search_Sale_Min_Price_select.selectedIndex].value;SEARCH_CORE.TMP.Post['Sale_MAX']=SEARCH_CORE.HTML_Elements.search_Sale_Max_Price_select.options[SEARCH_CORE.HTML_Elements.search_Sale_Max_Price_select.selectedIndex].value;break;}
CtrlCall(SEARCH_CORE.CONTROLLER_CALL_URL+"&param=function:_search_stats_criteria_update;lang:js;","data="+serialize(SEARCH_CORE.TMP.Post),"_search_Submit");CtrlCall("/?page=property_search_response&content=main","data="+serialize(SEARCH_CORE.TMP.Post),"_search_Submit");}
function _search_Submit(response)
{window.location="/Property-One-Liners/Search/"+response.responseText+"/";}
var muffin_box;function _Ciriteria_error(msg,id)
{muffin_box=new MaJiG_BOX("<table class='section_grey' style='width:300px;font-size:7pt;'><tr><td align='center'><strong>Search Criteria Missing</strong></td></tr><tr><td align='center'>"+msg+"</td></tr><tr><td align='center'><input style='font-size: 8pt' type='button' value='Ok' onclick='muffin_box._close();Effect.Shake(\""+id+"\");'></td></tr></table>");}
function getSelectedSuburbs(ele){var foo="";var counter=0;jQuery("#search_Region_Suburb_select").each(function(i,selected){foo=jQuery(selected).val();});var suburbIDs="";if(foo.length>=1){for(var i=0;i<foo.length;i++){if(foo[i].substring(0,3)!="reg"){suburbIDs=suburbIDs+foo[i];if(i+1!=foo.length){suburbIDs+=",";}}}
jQuery("#adv_search_region_suburb_ids").val(suburbIDs);}}
function setAdvancedPaymentType(){if(jQuery("#adv_search_payment_type_rental").is(':checked'))
{jQuery("#adv_search_price_from").replaceWith(rentFrom);jQuery("#adv_search_price_to").replaceWith(rentTo);jQuery("#adv_payment").val("1");property_search_init('',jQuery('#search_Province_select').val(),jQuery('#js_province_full').val(),null,jQuery('#adv_types').val(),"1");}
if(jQuery("#adv_search_payment_type_sale").is(':checked'))
{jQuery("#adv_search_price_from").replaceWith(saleFrom);jQuery("#adv_search_price_to").replaceWith(saleTo);jQuery("#adv_payment").val("2");property_search_init('',jQuery('#search_Province_select').val(),jQuery('#js_province_full').val(),null,jQuery('#adv_types').val(),"2");}
if(!jQuery("#adv_search_payment_type_sale").is(':checked')&&!jQuery("#adv_search_payment_type_rental").is(':checked')){jQuery("#adv_search_price_from").replaceWith(saleFrom);jQuery("#adv_search_price_to").replaceWith(saleTo);jQuery("#adv_payment").val("-1");property_search_init('',jQuery("#search_Province_select").val(),jQuery("#js_province_full").val(),null,jQuery("#adv_types").val(),"-1");}else if(jQuery("#adv_search_payment_type_sale").is(':checked')&&jQuery("#adv_search_payment_type_rental").is(':checked')){property_search_init('',jQuery('#search_Province_select').val(),jQuery('#js_province_full').val(),null,jQuery('#adv_types').val(),"-1");jQuery("#adv_payment").val("-1");}}
function setSimplePaymentType(){if(jQuery("#adv_search_sale_type_rental").is(':checked'))
{if(jQuery("#adv_search_price_to").val()!==undefined){jQuery("#search_price").replaceWith(rentSimpleFrom);jQuery("#Payment").val(jQuery("#adv_search_sale_type_rental").val());}else{}}
if(jQuery("#adv_search_sale_type_sale").is(':checked'))
{if(jQuery("#adv_search_price_to").val()!==undefined){jQuery("#search_price").replaceWith(saleSimpleFrom);jQuery("#Payment").val(jQuery("#adv_search_sale_type_sale").val());}}
if(!jQuery("#adv_search_sale_type_sale").is(':checked')&&!jQuery("#adv_search_sale_type_rental").is(':checked')){if(jQuery("#adv_search_price_to").val()!==undefined){jQuery("#search_price").replaceWith(saleSimpleFrom);jQuery("#Payment").val("-1");}}else{if(jQuery("#adv_search_sale_type_sale").is(':checked')&&jQuery("#adv_search_sale_type_rental").is(':checked')){jQuery("#Payment").val(jQuery("#adv_search_sale_type_sale").val()+","+jQuery("#adv_search_sale_type_rental").val());}}}
function setSimplePropType(){if(jQuery("#adv_search_prop_type_comm").is(':checked'))
{jQuery("#Types").val(jQuery("#adv_search_prop_type_comm").val());}
if(jQuery("#adv_search_prop_type_indust").is(':checked'))
{jQuery("#Types").val(jQuery("#adv_search_prop_type_indust").val());}
if(!jQuery("#adv_search_prop_type_comm").is(':checked')&&!jQuery("#adv_search_prop_type_indust").is(':checked')){jQuery("#Types").val("-1");}else if(jQuery("#adv_search_prop_type_comm").is(':checked')&&jQuery("#adv_search_prop_type_indust").is(':checked')){jQuery("#Types").val(jQuery("#adv_search_prop_type_indust").val()+","+jQuery("#adv_search_prop_type_comm").val());}}
function setAdvancedPropType(){if(jQuery("#adv_search_prop_type_com").is(':checked'))
{jQuery("#adv_types").val(jQuery("#adv_search_prop_type_com").val());jQuery("#adv_search_building_type").replaceWith(commHTMLOptions);property_search_init('',jQuery('#search_Province_select').val(),jQuery('#js_province_full').val(),null,jQuery('#adv_types').val(),jQuery("#adv_payment").val());}
if(jQuery("#adv_search_prop_type_indus").is(':checked'))
{jQuery("#adv_types").val(jQuery("#adv_search_prop_type_indus").val());jQuery("#adv_search_building_type").replaceWith(industHTMLOptions);property_search_init('',jQuery('#search_Province_select').val(),jQuery('#js_province_full').val(),null,jQuery('#adv_types').val(),jQuery("#adv_payment").val());}
if(!jQuery("#adv_search_prop_type_com").is(':checked')&&!jQuery("#adv_search_prop_type_indus").is(':checked')){jQuery("#adv_types").val("-1");jQuery("#adv_search_building_type").replaceWith(commHTMLOptions);property_search_init('',jQuery('#search_Province_select').val(),jQuery('#js_province_full').val(),null,jQuery('#adv_types').val(),jQuery("#adv_payment").val());}else if(jQuery("#adv_search_prop_type_com").is(':checked')&&jQuery("#adv_search_prop_type_indus").is(':checked')){jQuery("#adv_types").val(jQuery("#adv_search_prop_type_indus").val()+","+jQuery("#adv_search_prop_type_com").val());jQuery("#adv_search_building_type").replaceWith(commHTMLOptions);property_search_init('',jQuery('#search_Province_select').val(),jQuery('#js_province_full').val(),null,jQuery('#adv_types').val(),jQuery("#adv_payment").val());}}
function redirWebRef(eleName){url2='http://'+document.domain+'/?page=api_speed&content=main&params=feed:seo_build;&seoweb='+jQuery("#"+eleName).val()+''
new Ajax.Request(url2,{onSuccess:function(response)
{window.location="http://"+document.domain+"/"+response.responseText+jQuery("#"+eleName).val()+"/";},onFailure:function(response)
{}});}
function redirAgentSearch(eleName){var agent_name=jQuery("#"+eleName).val();agent_name=agent_name.replace(/\s+/g,'+');window.location="http://"+document.domain+"/Agents/Find/"+agent_name+"/";}
function redirOfficeSearch(eleName){var officeDetails=jQuery("#"+eleName).val();var officeDetailsArr=officeDetails.split(" - ");var officeName=officeDetailsArr[0].replace(/\s+/g,'+');var suburb=officeDetailsArr[1].replace(/\s+/g,'+');var city=officeDetailsArr[2].replace(/\s+/g,'+');var state=officeDetailsArr[3].replace(/\s+/g,'+');if(officeDetails=="Enter Area or Office Name"){window.location="http://"+document.domain+"/Office-Search/";}else{window.location="http://"+document.domain+"/Office-Search/"+state+"/"+city+"/"+suburb+"/"+officeName+"/";}}
function setProvinceSelection(selIndex,subIds){jQuery('#search_Province_select').val(selIndex);jQuery('search_Province').val(selIndex);_search_Province_Handler();jQuery('#adv_search_region_suburb_ids').val(subIds);setSelectedSuburbs(subIds);}
function setProvinceSelectionOnly(selIndex){jQuery('#search_Province_select').val(selIndex);jQuery('search_Province').val(selIndex);_search_Province_Handler();}
function setSelectedSuburbs(subIds){if(!isNaN(subIds)){jQuery('#search_Region_Suburb_select').val(subIds);}else{var suburbs=subIds.split("-");for(var i=0;i<suburbs.length;i++){jQuery('#search_Region_Suburb_select').val(suburbs[i]);}}}
function clearText(field){if(field.defaultValue==field.value){field.value='';}else if(field.value.strip()==''){field.value=field.defaultValue;}}
function toggleAdvanced(url,type)
{
var el = document.getElementById("advanced-search");
if ( el.style.display != 'none' ) {
    //        Effect.Fade(el.id, { duration: 0.4, queue: 'front' });
    //        Effect.Appear(document.getElementById("quick-search"), { duration: 0.4, queue: 'end' });
    document.getElementById("advanced-search").style.display = "none";
    document.getElementById("quick-search").style.display = "block";
    document.getElementById("advanced-search-link").innerHTML = "Advanced search &raquo;";
} else {
    //        Effect.Fade(document.getElementById("quick-search"), { duration: 0.4, queue: 'front' });
    //        Effect.Appear(el.id, { duration: 0.4, queue: 'end' });
    document.getElementById("advanced-search").style.display = "block";
    document.getElementById("quick-search").style.display = "none";
    document.getElementById("advanced-search-link").innerHTML = "Simple search &raquo;";

    /*Only log to DB on open*/
    type = type.replace(" ","+");
    new Ajax.Request(url+'php/advanced_search_tracker.php?type='+type,
    {
        onSuccess : function(response)
        {
            //alert('#win');
        },
        onFailure : function(response)
        {
            //alert('Error loading advanced search');
        }
    });
}
}

function suburb_search_validation(){
var ele = jQuery('#suburbinput');
var ele2 = jQuery('#search_suburb_city');
var pass = false;
//    jQuery('#search_suggestion').removeClass();
//    jQuery('#search_suggestion').addClass("search_labels_small_white center");
if(ele.val() != undefined && ele.val() ){
    // redirect to property_search_suburb view via post
    var params = {"suburb_region_suburb_grouping": ele.val()}
    var method = "post";
    post_to_url("http://"+document.domain+"/property_search_suburb/" , params , method);
    pass = false;
}else{
    if(ele2.val() != undefined && ele2.val()){
        document.remax_search_form.submit();
    }else{
        //            jQuery('#search_suggestion').removeClass();
        //            jQuery('#search_suggestion').addClass("search_labels_small_white_large center");
        alert('Type an area name and make a selection from the drop down menu.');
        pass = false;
    }
}
return pass;
}

function property_search_suburb_submit(ele){
// redirect to property_search_suburb view via post
var params = {"search_suburb_city": ''+jQuery('#'+ele).val() ,
    "search_type" : 'quick_search' ,
    'Types' : '-1' ,
    'Payment' : '-1' ,
    'adv_search_price_from' : '0' ,
    'adv_search_price_to' : '0'
}
var method = "POST";
post_to_url("http://"+document.domain+"/index.php?page=property_search_response" , params , method);
}

function property_search_suburb_submit_to_hq(ele){
// redirect to property_search_suburb view via post
var params = {"search_suburb_city": ''+jQuery('#'+ele).val() ,
    "search_type" : 'quick_search' ,
    'Types' : '-1' ,
    'Payment' : '-1' ,
    'adv_search_price_from' : '0' ,
    'adv_search_price_to' : '0'
}
var method = "POST";
post_to_url("http://www.remax.co.za/index.php?page=property_search_response" , params , method);
}

function property_search_suburb_submit_my_alerts(SuburbID , from , to , bedrooms , bathrooms){
// redirect to property_search_suburb view via post
var params = {"search_suburb_city": ''+jQuery('#'+ele).val() ,
    "search_type" : 'quick_search' ,
    'Types' : '-1' ,
    'Payment' : '-1' ,
    'adv_search_price_from' : '0' ,
    'adv_search_price_to' : '0'
}
var method = "POST";
post_to_url("http://"+document.domain+"/index.php?page=property_search_response" , params , method);
}



function post_to_url(path, params, method) {
method = method || "post"; // Set method to post by default, if not specified.

// The rest of this code assumes you are not using a library.
// It can be made less wordy if you use one.
var form = document.createElement("form");
form.setAttribute("method", method);
form.setAttribute("action", path);

for(var key in params) {
    var hiddenField = document.createElement("input");
    hiddenField.setAttribute("type", "hidden");
    hiddenField.setAttribute("name", key);
    hiddenField.setAttribute("value", params[key]);

    form.appendChild(hiddenField);
}

document.body.appendChild(form);    // Not entirely sure if this is necessary
form.submit();
}

function toggleSuburbs(suburbGroupID){
jQuery("#grouped_suburbs_"+suburbGroupID).slideToggle();
}


/*
 * Functions below are used in the blog_to_win view.
 * Start
 */
function validate_blog_entry(){
    jQuery('#blogger_email_error').addClass('hidden');
    jQuery('#blogger_email_error2').addClass('hidden');
    jQuery('#blogger_url_error').addClass('hidden');
    jQuery('#capture_blogger_details').removeClass('continue_show').addClass('hidden');
    jQuery('#capture_blogger_details_error').removeClass('warning_show').addClass('hidden');
    var email = jQuery('#blogger_email').val();
    var url = jQuery('#blogger_url').val();
    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    var proceed = true;
    if(!validate_email(email)) {
        jQuery('#blogger_email_error').removeClass('hidden').addClass('warning_show');
        jQuery('#blogger_email_error2').addClass('hidden');
        jQuery('#blogger_email2').val('');
        proceed = false;
    }
    if(!checkURL(url)){
        jQuery('#blogger_url_error').removeClass('hidden').addClass('warning_show');
        proceed = false;
    }

    if(proceed){
//        document.blog_to_win_form.submit();
//        jQuery Ajax
        jQuery.ajax({
            url: 'http://'+document.domain+'/?page=api_speed&content=main&params=feed:capture_blogger;&blogger_email='+email+'&blogger_url='+url+'',
            success: function(response) {
                if(response == "true"){
                    jQuery('#capture_blogger_details').removeClass('warning_hidden').addClass('continue_show');
                    jQuery('#capture_blogger_details_error').addClass('warning_hidden').removeClass('warning_show');
                    jQuery('#button_container').addClass('warning_hidden');
                }else{
                    jQuery('#capture_blogger_details').addClass('warning_hidden').removeClass('continue_show');
                    jQuery('#capture_blogger_details_error').removeClass('warning_hidden').addClass('warning_show');
                }
            }
        });
    }
}

function validate_email(val){
    var email = val;
    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    if(reg.test(email) == false) {
        return false;
    }else{
        return true;
    }
}

function match_email_address(){
    jQuery('#blogger_email_error2').addClass('hidden');
    jQuery('#blogger_email_error').addClass('hidden');
    tmp1 = $('#blogger_email').val();
    tmp2 = $('#blogger_email2').val();
    if(!validate_email(tmp2)){
        jQuery('#blogger_email_error').addClass('hidden').addClass('warning_show');
        jQuery('#blogger_email_error').removeClass('hidden').addClass('warning_show');
        tmp2 = $('#blogger_email2').val("");
    }else{
        jQuery('#blogger_email_error2').removeClass('warning_show').addClass('hidden');
        jQuery('#blogger_email_error').removeClass('warning_show').addClass('hidden');
    }
    if(tmp1 != tmp2){
        jQuery('#blogger_email_error2').removeClass('hidden').addClass('warning_show');
        jQuery('#blogger_email_error2').focus();
    }
}

function checkURL(url) {
    var RegExp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
    if(RegExp.test(url)){
        return true;
    }else{
        return false;
    }
}

function provide_blogger_link(ele){
    var disploc = jQuery('#blog_banner_code');
    disploc.slideUp();
//    console.log(ele.id);
    var str = '&lt;a href="http://www.remax.co.za" target="_blank" &gt;&lt;img src="http://www.remax.co.za/images/competition_images/'+ele.id+'.gif" alt="RE/MAX Win a MakeOver" title="RE/MAX Win a MakeOver" &gt;&lt;a&gt;';
    disploc.html("");
    disploc.html(str);
    disploc.slideDown();
    window.location = "#step_2";
    
}

/*
 * End blog_to_win section.
 */


/*
 *  My Alerts
 */
function My_Alerts(url)
{
    window.location="http://"+url+"/?page=my_alerts";
}
function loadSignUpForm(url,searchcriteria,feuid,suburbs)
{
    var pricefrom=$('adv_search_price_from').value;
    var priceto=$('adv_search_price_to').value;
    var total_properties = $('total_properties').value;
    var bedrooms=$('adv_search_bedroom').value;
    var forsale=$('adv_payment').value;
    
   
    //var arrayPageSize = getPageSize();
    if(feuid)
    {
        new Ajax.Request("http://"+url+"/?page=api_speed&content=main&params=feed:save_criteria;&searchcriteria="+searchcriteria+"&feuid="+feuid+"&suburbs="+suburbs+"&pricefrom="+pricefrom+"&priceto="+priceto+"&bedrooms="+bedrooms+"&forsale="+forsale+"&total_properties="+total_properties,
        {
            onSuccess : function(response, json)
            {
                if(response.responseText=="true")
                {
                    var savedtext="<span style='text-align:center;padding:4px;'>Your Criteria Has Been Saved</span><br/>\n\
                                            <A style='text-align:center;padding:4px;' onclick='My_Alerts(\""+url+"\")'>Go To My <span style='color:#EC1D25;font-weight:700'>RE</span>/<span style='color:#EC1D25;font-weight:700'>MAX</span></A>";
                    tmp = jQuery('#alert_count_top').html( );
                    tmp++;
                    jQuery('#alert_count_top').html(tmp);
                    jQuery('#status_update_msg').html("").show();
                    jQuery('#status_update_msg').css('opacity', '1');
                    jQuery('#status_update_msg').html(savedtext).animate({
                        opacity: 0.4
                    }, {
                        duration:5000,
                        complete:function(){
                            jQuery('#status_update_msg').hide();
                        }
                    });
                // varMajigWinS = new MaJiG_BOX(savedtext);
                }else if(response.responseText=="alreadysaved"){
                    var savedtext="<span style='text-align:center;padding:4px;'>Your Criteria Has Already Been Saved</span><br/>\n\
                                            <A style='text-align:center;padding:4px;' onclick='My_Alerts(\""+url+"\")'>Go To My <span style='color:#EC1D25;font-weight:700'>RE</span>/<span style='color:#EC1D25;font-weight:700'>MAX</span></A><br/>";
                    jQuery('#status_update_msg').html("").show();
                    jQuery('#status_update_msg').css('opacity', '1');
                    jQuery('#status_update_msg').html(savedtext).animate({
                        opacity: 0.4
                    }, {
                        duration:10000,
                        complete:function(){
                            jQuery('#status_update_msg').hide();
                        }
                    });
                }
                else
                {
                    alert('Your Criteria Did Not Save Try Again');
                }
            //varMajigWin = new MaJiG_BOX(response.responseText);
            },
            onFailure : function(response)
            {
                alert('Error loading agents (load form)');
            },
            parameters : ""
        }
        );
    }
    else
    {
        new Ajax.Request("http://"+url+"/?page=api_speed&content=main&params=feed:load_signup_form;&searchcriteria="+searchcriteria+"&suburbs="+suburbs+"&pricefrom="+pricefrom+"&priceto="+priceto+"&bedrooms="+bedrooms+"&forsale="+forsale+"&curl=yes&_=&data=null",
        {
            onSuccess : function(response, json)
            {
                //alert(response.responseText);
                //varMajigWin = new MaJiG_BOX('<div style="background-image:url(/images/registrationpagebackgroundold.jpg);background-repeat:no-repeat;">'+response.responseText+'</div>');
                varMajigWin = new MaJiG_BOX(response.responseText);
            },
            onFailure : function(response)
            {
                alert('Error loading agents (load form)');
            },
            parameters : ""
        }
        );
    }
}

function loadSignUpFormNoDetails(url)
{
    new Ajax.Request("http://"+url+"/?page=api_speed&content=main&params=feed:load_signup_form;&curl=yes&_=&data=null&showtext=no",
    {
        onSuccess : function(response, json)
        {
            varMajigWin = new MaJiG_BOX("<div style='width:995px;height:637px;background-color:white;background-image: url(\"/images/registrationpagebackgroundold.jpg\"); background-repeat: no-repeat;' ><div style='padding-left:160px'><div style='width:550px;padding-left:175px;padding-top:30px'><div style='font-family: Trebuchet MS , Sans Serif;font-size:50px;color:white;'>WELCOME</div><span style='font-family: Arial, Helvetica, sans-serif;font-size:12px;color:white;'>Please register to add Property Search Alerts and save your Favourites.We will send you <br/>an alert via email every time a property is listed that matches your search results.<br/>We will also send you a weekly summary of all the properties that have been found.</span></div>"+response.responseText+"</div></div>");
            jQuery('#MaJiG_BOX').css('padding' , '0');
        },
        onFailure : function(response)
        {
            alert('Error loading agents (load form)');
        },
        parameters : ""
    }
    );
}

function loadFavouriteForm(url,webref)
{

    new Ajax.Request("http://"+url+"/?page=api_speed&content=main&params=feed:load_signup_form;&favouritewebref="+webref+"&curl=yes&_=&data=null",
    {
        onSuccess : function(response, json)
        {
            //alert(response.responseText);
            varMajigWin = new MaJiG_BOX(response.responseText);
            document.getElementById('fav').id = 'fav_clicked';
        },
        onFailure : function(response)
        {
            alert('Error loading agents (load form)');
        },
        parameters : ""
    }
    );
}

function logout(url,criteria,msg)
{
    new Ajax.Request("http://"+url+"/?page=api_speed&content=main&params=feed:logout;&curl=yes&_=&data=null",
    {
        onSuccess : function(response, json)
        {
            if((response.responseText))
            {
                if(msg){
                    alert(msg);
                }else{
                    alert('You have been logged out');
                }
                if(criteria)
                {
                    window.location="http://"+url+"/Property-One-Liners/Search/"+criteria;
                }
                else
                {
                    My_Alerts(url);
                }
            }

        },
        onFailure : function(response)
        {
            alert('Error loading agents (load form)');
        },
        parameters : ""
    }
    );
}

function validateRequiredEmail(url)
{
    var params=Form.serialize($('forgot_form'));
    new Ajax.Request("http://"+url+"/?page=api_speed&content=main&params=feed:forgot_password;&"+params,{
        onSuccess:function(response,json)

        {
            if(response.responseText=="true"){
                SendForgotEmail(url);
            }else{
                var proceed=true;
                var str=response.responseText
                var myObject=eval('('+str+')');
                $('forgot_email_error').style.display='none';
                if(myObject.emailerror)

                {
                    $('forgot_email_error').style.display='block';
                    $('forgot_email_error').innerHTML="<strong>"+myObject.emailerror+"</strong>";
                    proceed=false;
                }
                if(proceed==true)
                {
                    SendForgotEmail(url);
                }
            }
        },
    onFailure:function(response)

    {
        alert('failed. URL = '+url);
    },
    method:'post',
    parameters:""
});
}
function validateRequiredSignUp(url)
{

    var params = Form.serialize($('sign_up_form'));

    new Ajax.Request("http://"+url+"/?page=api_speed&content=main&params=feed:signup_validate;&"+params,
    {
        onSuccess:function(response,json)
        {
            //alert(response.responseText);
            if(response.responseText == "true"){
                SignUpSubmit(url);
            }else{
                var proceed = true;
                var str=response.responseText
                //                str.replace(null,'');
                var myObject = eval('(' + str + ')');
                // $('fname_login_error').style.display = 'none';
                //$('lname_login_error').style.display = 'none';
                // $('cell_login_error').style.display = 'none';
                $('email_login_errors').style.display = 'none';
                $('password_login_errors').style.display = 'none';
                //$('sec_number_errors').style.display = 'none';
                $('terms_errors').style.display = 'none';

                //sec_number
                //terms_errors
                /*
          if(myObject.fname)
              {
          if(myObject.fname!='')
              {
         $('fname_login_error').style.display = 'block';
	$('fname_login_error').innerHTML = "<strong>"+myObject.fname+"</strong>";
              }
              proceed = false;
              }
                if(myObject.lname)
              {
              if(myObject.lname!='')
                {
         $('lname_login_error').style.display = 'block';
	$('lname_login_error').innerHTML = "<strong>"+myObject.lname+"</strong>";

                }
                proceed = false;
                }
 */
                if(myObject.email)
                {
                    if(myObject.email!='')
                    {


                        $('email_login_errors').style.display = 'block';
                        $('email_login_errors').innerHTML = "<strong>"+myObject.email+"</strong>";
                        proceed = false;
                    }
                }

                /*
                  if(myObject.cellphone)
              {
                   if(myObject.cellphone!='')
        {
         $('cell_login_error').style.display = 'block';
	$('cell_login_error').innerHTML = "<strong>"+myObject.cellphone+"</strong>";

         //fname_login_error
        }
        proceed = false;
        }
        */
                if(myObject.password)
                {
                    if(myObject.password!='')
                    {
                        $('password_login_errors').style.display = 'block';
                        $('password_login_errors').innerHTML = "<strong>"+myObject.password+"</strong>";

                    //fname_login_error
                    }
                    proceed = false;
                }
                /*
        if(myObject.sec_number)
              {
         if(myObject.sec_number!='')
        {
         $('sec_number_errors').style.display = 'block';
	$('sec_number_errors').innerHTML = "<strong>"+myObject.sec_number+"</strong>";

         //fname_login_error
        }
        proceed = false;
        }  */

                if(myObject.terms)
                {

                    $('terms_errors').style.display = 'block';
                    $('terms_errors').innerHTML = "<strong>"+myObject.terms+"</strong>";

                    //fname_login_error

                    proceed = false;
                }
                //passwordcon_login_error



                if(proceed==true)
                {
                    SignUpSubmit(url);
                }


            }
        //fname_login_error
        //$('contactForm').innerHTML = response.responseText;
        //sign_up_form._set_Content( response.responseText);
        //Effect.Pulsate('notificationDiv');
        //setTimeout("_removeNotification()",5000);
        //$('title').style.display = 'block';
        },
        onFailure : function(response)
        {
            alert('failed. URL = '+url);
        },
        method: 'post',
        parameters :""
    });
}


function validateRequiredSignIn(url,criteriasearch)
{
    var params = Form.serialize($('sign_in_form'));


    new Ajax.Request("http://"+url+"/?page=api_speed&content=main&params=feed:signin_validate;&"+params,
    {
        onSuccess:function(response,json)
        {

            if(response.responseText == "true"){

                SignInSubmit(url,criteriasearch);
            }else{
                var proceed = true;
                var str=response.responseText
                //                str.replace(null,'');
                var myObject = eval('(' + str + ')');

                $('email_login_error').style.display = 'none';
                $('password_login_error').style.display = 'none';




                if(myObject.email)
                {
                    if(myObject.email!='')
                    {


                        $('email_login_error').style.display = 'block';
                        $('email_login_error').innerHTML = "<strong>"+myObject.email+"</strong>";
                        proceed = false;
                    }
                }



                if(myObject.password)
                {
                    if(myObject.password!='')
                    {
                        $('password_login_error').style.display = 'block';
                        $('password_login_error').innerHTML = "<strong>"+myObject.password+"</strong>";

                    //fname_login_error
                    }
                    proceed = false;
                }
                //passwordcon_login_error



                if(proceed==true)
                {
                    SignInSubmit(url,criteriasearch);
                }


            }
        //fname_login_error
        //$('contactForm').innerHTML = response.responseText;
        //sign_up_form._set_Content( response.responseText);
        //Effect.Pulsate('notificationDiv');
        //setTimeout("_removeNotification()",5000);
        //$('title').style.display = 'block';
        },
        onFailure : function(response)
        {
            alert('failed. URL = '+url);
        },
        method: 'post',
        parameters :""
    });
    return false;
}

function ShowEmailForm()
{
    $('resendemail').toggle();
    $('forgotemailreminder').style.display = 'none';
//alert('your are here');
}
function  SignUpSubmit(url,webref)
{
    // alert(url);
    var params = Form.serialize($('sign_up_form'));

    var proceed = true;


    if(proceed)
    {

        new Ajax.Request("http://"+url+"/?page=api_speed&content=main&params=feed:signup_set;&"+params,
        {
            onSuccess:function(response, json)
            {
                if(response.responseText == "true"){

                    new Ajax.Request("http://"+url+"/?page=contact_agent&content=main&params=feed:signup_password_send;&send_msg=true&signup=yes&url="+url+"&"+params,
                    {
                        onSuccess:function(response, json)
                        {

                            var str=response.responseText

                            if(str=="true")
                            {
                                if(webref)
                                {
                                    window.location= document.URL;
                                    $('fav').style.display = 'none';
                                }
                                else
                                {
                                    My_Alerts(url);
                                }
                            }
            
                        },
                        onFailure : function(response)
                        {
                            alert('failed. URL = '+url);
                        },
                        method: 'post',
                        parameters :""
                    });


                // window.location="http://"+url+"/?page=my_alerts";

                }else{
                    alert("there was a duplicate");
                }

            //$('contactForm').innerHTML = response.responseText;
            //sign_up_form._set_Content( response.responseText);
            //Effect.Pulsate('notificationDiv');
            //setTimeout("_removeNotification()",5000);
            //$('title').style.display = 'block';
            },
            onFailure : function(response)
            {
                alert('failed. URL = '+url);
            },
            method: 'post',
            parameters :""
        });
    }

}

function  SignInSubmit(url,criteriasearch)
{

    var params = Form.serialize($('sign_in_form'));

    // alert(document.URL);

    new Ajax.Request("http://"+url+"/?page=api_speed&content=main&params=feed:signin_set;&"+params,
    {
        onSuccess:function(response, json)
        {

            if(response.responseText=="true"){
                //alert('Your Alert Has Been Saved');
                
                //varMajigWin._close();
                
                if(criteriasearch)
                {
                    window.location="http://"+url+"/Property-One-Liners/Search/"+criteriasearch;
                }
                else
                {
                    My_Alerts(url);
                // window.location="http://"+url+"/My-Remax";
                }
            //window.location="http://"+url+"/?page=my_alerts";

            }
            else if(response.responseText=="favourite")
            {
                window.location= document.URL;
                $('fav').style.display = 'none';
            }    
            else
            {
                alert("Please Enter Correct UserName Or PassWord");
            }

        //$('contactForm').innerHTML = response.responseText;
        //sign_up_form._set_Content( response.responseText);
        //Effect.Pulsate('notificationDiv');
        //setTimeout("_removeNotification()",5000);
        //$('title').style.display = 'block';
        },
        onFailure : function(response)
        {
            alert('failed. URL = '+url);
        },
        method: 'post',
        parameters :""
    });
}


function  FavouriteSubmit(url,webreference)
{

    new Ajax.Request("http://"+url+"/?page=api_speed&content=main&params=feed:add_new_favourite;&webreference="+webreference,
    {
        onSuccess:function(response, json)
        {

            if(response.responseText=="true"){
                //               window.location= document.URL;
                var ele = document.getElementById('favourites_count_top')
                tmp = ele.innerHTML;
                tmp++;
                ele.innerHTML = tmp;
                document.getElementById('fav').id = 'fav_clicked';
                document.getElementById('fav_clicked').onclick = 'alert("You have already added this listing to your Favourites.");';
               
            }else{
                alert("Please Enter Correct User Name Or Password");
            }

        //$('contactForm').innerHTML = response.responseText;
        //sign_up_form._set_Content( response.responseText);
        //Effect.Pulsate('notificationDiv');
        //setTimeout("_removeNotification()",5000);
        //$('title').style.display = 'block';
        },
        onFailure : function(response)
        {
            alert('failed. URL = '+url);
        },
        method: 'post',
        parameters :""
    });
}


function  SendForgotEmail(url)
{
    $('forgot_email_error').style.display = 'none';
    var params = Form.serialize($('forgot_form'));



    //new Ajax.Request("http://"+url+"/?page=api_speed&content=main&params=feed:forgot_password_send;&"+params,
    new Ajax.Request("http://"+url+"/?page=contact_agent&content=main&params=feed:forgot_password_send;&send_msg=true&forgot_pass=yes&url="+url+"&"+params,
    {
        onSuccess:function(response, json)
        {
            var str=response.responseText
            //alert(str);
            var myObject = eval('(' + str + ')');

            $('forgot_email_error').style.display = 'none';




            if(myObject.emailerror)
            {
                $('resendemail').style.display = 'none';
                $('forgotemailreminder').style.display = 'block';
                $('forgotemailreminder').innerHTML = "<strong>"+myObject.emailerror+"</strong>";
                proceed = false;
            }



        //$('contactForm').innerHTML = response.responseText;
        //sign_up_form._set_Content( response.responseText);
        //Effect.Pulsate('notificationDiv');
        //setTimeout("_removeNotification()",5000);
        //$('title').style.display = 'block';
        },
        onFailure : function(response)
        {
            alert('failed. URL = '+url);
        },
        method: 'post',
        parameters :""
    });
}


//DisplaySignUp
function DisplaySignUp()
{
    $('signup').style.display='block';
    $('signin').hide();
}



