﻿function ChangeClass(objToChange, toClass){
    objToChange.className = toClass;
}

function AddToSearchWhere(Value){
    var txtSearchWhere = document.getElementById("pageTop_txtSearchWhere");
    txtSearchWhere.value += " " + Value;
}

function AddToSearchWho(Value){
    var txtSearchWho = document.getElementById("pageTop_txtSearchWho");
    txtSearchWho.value += " " + Value;
}

function ShowCategories(){
   ShowHideSwap("Categories");
   ShowHide("Citys", false);
}

function ShowCitys(){
   ShowHide("Categories", false);
   ShowHideSwap("Citys");
}

//if the object should be visible or hidden
function ShowHide(Object, Show){
    var obj = document.getElementById(Object);
    if(Show == true){
        obj.style.display = "block";
    }else{
        obj.style.display = "none";
    }
}

//swaps the visibility, if its hidden show it..
function ShowHideSwap(Object){
    var obj = document.getElementById(Object);
    if(obj.style.display == "block"){
        obj.style.display = "none";
    }else{
        obj.style.display = "block";
    }
}

function AddAreaCode(Value){
    document.getElementById("txtAreaCode").value = Value;
}

function SetCityInfo(CityId)
{
    if(CityId > 0){
        document.getElementById("aAreaCode").innerHTML = GetCityInfo(CityId, false);
        document.getElementById("tdZipCode").innerHTML = GetCityInfo(CityId, true);
    }
}



function addToBookmarks() {
title = document.title;
url = document.location.href;
if(window.sidebar){
    // Mozilla Firefox Bookmark
    window.sidebar.addPanel(title, url,"");
}else if( window.external ) {
    // IE Favorite
    window.external.AddFavorite( url, title);
}else if(window.opera && window.print) {
    // Opera Hotlist
    return true;
    }
}


function setAsHomepage()
{
    url = 'http://www.imenik.ba/';
    if (document.all){
        document.body.style.behavior='url(#default#homepage)';
        document.body.setHomePage(url);
    }else if (window.sidebar){
        if(window.netscape){
            try{  
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            }catch(e){  
                alert("this action was aviod by your browser，if you want to enable，please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true");  
            }
        } 
        
        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
        prefs.setCharPref('browser.startup.homepage', url);
    }
}

function menu(obj) {
    var element = document.getElementById(obj);
    var elementImg = document.getElementById(obj + 'b');

    if (element.style.display == "none" || element.style.display == '') {
        element.style.display = "block";
        elementImg.src = "design/_.gif";
    } else {
        element.style.display = "none";
        elementImg.src = "design/+.gif";
    }
}