﻿
// GLOBAL
function runSearch(searchBtn) {
    try {
      var spanSearchingMsg = document.getElementById("spanSearchingMsg");
      if( spanSearchingMsg !== undefined ) {
          spanSearchingMsg.style.display = "inline";
          searchBtn.style.display = "none";
      }
    } catch (ex) { /* just run the search! */ }
    AjaxRequest(AJAX_URL,"RunSearch","PnlDynamicContent",true,"");
    return false;
}
function newSearch(redirectUrl) {
    try {
        newsearchUrl = redirectUrl;
    } catch (ex) { /* CONTINUE */ }
    AjaxRequest(AJAX_URL,"NewSearch","",false,"");
    return false;
}
function NewSearch_callback() {
    if(newsearchUrl == undefined) {
        window.location = "search";
    } else {
        window.location = newsearchUrl;
    }
}
function sortResultList(sortBy) {
    AjaxRequest(AJAX_URL,"SortResultList","PnlSearchResult",false,"sortBy=" + sortBy);
    return false;
}
function showPage(pageNumber) {
    AjaxRequest(AJAX_URL,"ShowPage","PnlSearchResult",false,"pageNumber=" + pageNumber);
    return false;
}
function submitContactForm() {
    AjaxRequest(AJAX_URL,"SubmitContactForm","",true,"");
    return false;
}
function submitRecommendationForm() {
    AjaxRequest(AJAX_URL,"SubmitRecommendationForm","",true,"");
    return false;
}

// IMMO
function refreshSubcategories(categoryID) {
    AjaxRequest(AJAX_URL,"","spanDrpLstSubcategories",true,"");
}
function refreshPriceList(deal) {
    AjaxRequest(AJAX_URL,"","divPriceFilter",true,"");
}
function show_map(map_url,id) {
	h_px=screen.height-50;
	w_px=screen.width-10;
	if(id)
        map_url += "&id=" + id;
	var w0=window.open(map_url,'Map_Search','width='+w_px+',height='+h_px+',left=0,top=0,location=no,scrollbars=no,status=no,toolbar=no,resizable=yes');
	if(w0&&w0.open)
		w0.focus();
	else
		alert("ERROR");
	return false;
}

// Falls die Seite von www.biel-bienne.ch aufgerufen wird.
function direktsuche()
{
    var knoten = document.getElementById("direktsuche");
    
    // if (knoten != undefined && knoten.getAttributeNode("value").nodeValue == true)
    if (knoten != undefined)
    {
        try
        {
            var spanSearchingMsg = document.getElementById("spanSearchingMsg");
            if( spanSearchingMsg != undefined )
            {
                spanSearchingMsg.style.display = "inline";
                // searchBtn.style.display = "none";
            }
        }
        catch (ex)
        {
            ;
        }
        
        AjaxRequest("ImmoSearch.aspx","RunSearch","PnlDynamicContent",true,"");
        
        return false;
    }
}

