jQuery(document).ready(function()
    {
        setMenuHandlers();
      

        jQuery("#LoginBtn").mouseover(function(){
            jQuery("#LoginBtn").attr("src","http://cdn.wibiya.com/Graphics_Website/login_btn_small_over.png")
        }).mouseout(function(){
            jQuery("#LoginBtn").attr("src","http://cdn.wibiya.com/Graphics_Website/login_btn_small_normal.png")
        });

    });

window.onload = function() {
    //var pagename = window.location.pathname.replace(/\//g,"");
    //if(pagename != "ToolbarSettings.php"){
    //  SetMainBodyHeight();
    //}
    }

function SetMainBodyHeight()
{
    var agent= navigator.userAgent.toLowerCase();
    var ie = agent.indexOf("msie")>=0;
    var ie7=ie && agent.indexOf("msie 7")>=0;
    if (ie7){
        var body_height = getMainBodyHeight();
        jQuery("#main_body").css("height",body_height);
    }
} 

function setMenuHandlers()
{
    //main menu
    // Home Button
    //jQuery(".menu-item-selected").unbind("click");    

    jQuery(".clickitem").mouseover(function(){
        jQuery(this).removeClass().addClass("clickitemover");
    }).mouseout(function(){
        jQuery(this).removeClass().addClass("clickitem");
    });



}

function upperLoginClick(){
    // check selected attribute and open answer if not selected
    var loginBtn = jQuery("#login_btn");
    if (loginBtn.attr("opened")=="false")
    {
        loginBtn.attr("opened","true");
        jQuery("#login_form").slideDown("fast",function(){
            jQuery("#UserEmailLogin").focus();
        });
    }
    else
    {
        loginBtn.attr("opened","false");
        jQuery("#login_form").slideUp();
    }
}


function getMainBodyHeight()
{
    var height = 0;
    if (typeof window.innerWidth != "undefined")
    {
        height = window.innerHeight;
    }
    else if (typeof document.documentElement != "undefined"
        && typeof document.documentElement.clientWidth !=
        "undefined" && document.documentElement.clientWidth !== 0)
        {
        height = document.documentElement.clientHeight;
    }
    else
    {
        height = document.getElementsByTagName("body")[0].clientHeight;
    }
    //header 118, footer 50 , padding 30
    var abs_height = height-188;
    var measured_height = document.getElementById('main_body').clientHeight;
    var h =  Math.max(abs_height,measured_height);
    return h;
}
