var topMenuFontSizeMin = 130; //%
var topMenuFontSizeMax = "140%";

var headTextLeftMin = 65; //%
var headTextLeftMax = "70%";
var headTextFontSizeMin = 120; //%
var headTextFontSizeMax = "145%";

var topMenuFontSizeTrigger = 1200;

$(window).resize(function(){
	var windowWidth = $("body").width();
	if (windowWidth < topMenuFontSizeTrigger) {
		var fontCoeff = windowWidth / topMenuFontSizeTrigger;
		$(".menu-top").css("font-size", Math.ceil(fontCoeff * topMenuFontSizeMin) + "%");
		$("#head-text").css("font-size", Math.ceil(fontCoeff * headTextFontSizeMin) + "%");
		$("#head-text").css("left", (headTextLeftMin + Math.floor(fontCoeff * 10)) + "%").css("width", "15%");
	} else {
		if ($(".menu-top").css("font-size") != topMenuFontSizeMax) {
			$(".menu-top").css("font-size", topMenuFontSizeMax);
		}
		if ($("#head-text").css("font-size") != headTextFontSizeMax) {
			$("#head-text").css("font-size", headTextFontSizeMax);
		}
		$("#head-text").css("left", headTextLeftMax).css("width", "25%");
	}
	$("#content-left, #content-right, #content-right-inner2").height("auto");
	if ($("#content-left").height() < 601) {
		$("#content-left").height(600);
	} 
	if( $("#content-right").height() < $("#content-left").height() ){
		$("#content-right, #content-right-inner2").height($("#content-left").height());
	}
	
	$(".menu-top li").hover(function(){
		$(this).children("ul").slideDown("fast");
	}, function(){
		$(this).children("ul").slideUp("fast");
	});
	
	$(".menu-top").css("width", windowWidth);
	
	$("img[align=left]").addClass("align-left");
	$("img[align=right]").addClass("align-right");
});

$(document).ready(function(){
	//$("font").replaceWith($(this).html());
	setTimeout('$(window).trigger("resize");', 200);
	$("#head-banner-logo1").hover(function(){
		$("#head-banner-logo1-hover").show();
	}, function(){
		$("#head-banner-logo1-hover").hide();
	});
});