    //inits the popup logic 
    function initPopup() {

        jQuery('.AccountSearchPane').hide();      
        jQuery('.AccountHeaderPane').click(function () { jQuery('.AccountSearchPane').slideToggle('normal'); });

        jQuery("a.close").click(function () { jQuery(this).parent().slideUp(); return false; });  //links with class 'close' close parent div
        jQuery('.menuitem').click(function () { jQuery(this).next().toggle("slow"); }).next().hide();
        jQuery('.selected').parent().show();
        jQuery("#activated").click(function () { centerPopup(); loadPopup(); });
        jQuery("#popup_searchclose").click(function () { disablePopup(); });

    }
    
    //loading popup with jQuery magic!      
    function loadPopup() {   
        
        //loads popup only if it is disabled   
        if(popupStatus==0){
           jQuery("#background_popup").css({"opacity": "0.7"});
           jQuery("#background_popup").fadeIn("slow");   
           jQuery(".popup_search").fadeIn("slow");
           popupStatus = 1;
           if(navigator.appName=='Microsoft Internet Explorer' && parseFloat(navigator.appVersion.substring(22,23))<7){
               jQuery("select").hide();
           }
       }       

     }  
    
    //disabling popup with jQuery magic!
    function disablePopup(){  //disables popup only if it is enabled
        if(popupStatus==1){
            jQuery("#background_popup").fadeOut("slow");
            jQuery(".popup_search").fadeOut("slow");
            popupStatus = 0;
            if(navigator.appName=='Microsoft Internet Explorer' && parseFloat(navigator.appVersion.substring(22,23))<7){
               jQuery("select").show();
           }
        }
    }
    
    //centering popup
    function centerPopup(){  //request data for centering
        var windowWidth = document.documentElement.clientWidth;
        var windowHeight = document.documentElement.clientHeight;
        var popupHeight = jQuery(".popup_search").height();
        var popupWidth = jQuery(".popup_search").width();
        //centering
        jQuery(".popup_search").css({"position": "absolute", "top": -150, "left": windowWidth/2-popupWidth/2 });
        //only need force for IE6
        jQuery("#background_popup").css({"height": windowHeight});
    }
