﻿$(document).ready(function() {
    $('.content_box, .side_box, .side_box_green').corner('5px');
    $('.sf-menu').superfish({ autoArrows: false, dropShadows:true,
    onBeforeShow : function(){
        $(this).attr('style', "background:	white");
    },
    onShow : function(){
        width = 0;
        $(this).find("li a").each(function(){
            if($(this).outerWidth() > width) { width = $(this).outerWidth(); }
        });
        $(this).find('li').css('width', width).css('clear', 'both');
        $(this).attr('style', "background:	url('/images/shadow.png') no-repeat bottom right");
    }});
    
    $('.sf-menu').find('li.top:last').attr('style', 'background-image:none !important');
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(positionFooter);
    
    $("input[id$='searchTextbox']").Watermark("search", "#333");
});

$(window).load(function(){
    positionFooter();
})

function positionFooter(){
    if($('#content').height() > $(document).height() || $('#content').height() < $('#left').height() || $('#content').height() < $('#right').height()) {
        $('#footer').css('top', $(document).height()).css('display', 'block');
    } else {
        $('#footer').css('top', $('#content').height() + 160).css('display', 'block');
    }
}

function changeTextCSS(title) {
    var i, link;
    for(i=0; (link = document.getElementsByTagName("link")[i]); i++)
    {
        if(link.getAttribute("rel").indexOf("style") != -1 && link.getAttribute("title"))
        {
             link.disabled = true;
             if(link.getAttribute("title") == title) link.disabled = false; 
        }  
    }
}