var textSmall = 11;
var textNormal = 13;
var textBig = 18;
var IE6=false;

jQuery(document).ready(function(){
	if (jQuery.browser.msie && jQuery.browser.version=="6.0")
	{
		IE6=true;
	}
	
    updateBackground();
    setInterval("updateBackground()",1000);
    jQuery("#mainMenu>li>a").mouseover(function(){
        deselectAll();
        jQuery(this).addClass("selected");
        var submenu=jQuery(this).siblings("ul");
		var offX=jQuery(this).offset().left;
		if (IE6)
		{
			offX=offX-605;
		}
		var offX2=jQuery("#mainWrapper").offset().left;
		submenu.css({
            "display": "block",
			"left": offX-offX2
        });
    });
    
    jQuery("#mainMenu").mouseleave(function(){
        deselectAll();
    });
    
    jQuery("#textScale a").click(function(){
        jQuery("#textScale a").removeClass("selected");
        var size = textSmall;
        if (jQuery(this).hasClass("textScaleNormal")) 
            size = textNormal;
        if (jQuery(this).hasClass("textScaleBig")) 
            size = textBig;
        jQuery("#container .contentRight p, #container .contentRight li, #container .contentRight strong, #container .contentRight a").css({
            "fontSize": size
        });
		jQuery("#container .contentRight h2").css({
            "fontSize": size + 3
        });
        jQuery("#container .contentRight h1").css({
            "fontSize": size + 5
        });
        jQuery(this).addClass("selected");
		updateBackground();
    });
    
});
function updateBackground(){
	
    var mainWrapper=jQuery("#mainWrapper");
	var back=jQuery("#background");
	mainWrapper.css({"height":"auto"});
	//back.css({"height":"auto"});
	var doc = jQuery(document);
	//console.log("body height:"+jQuery(document).height()+"; doc height:"+);
	if ((mainWrapper.height() != doc.height())||(back.height() != doc.height())) {
		back.height(doc.height());
		mainWrapper.height(doc.height());
	}
}

function deselectAll(){
    jQuery("#mainMenu>li>a").removeClass("selected");
    jQuery("#mainMenu>li>ul").css({
        "display": "none"
    });
}

