function initSize() {
	b = $(document.body);
	//oh = $(".title h1").outerHeight();
	h = $(window).height() - 246;
	h = h < 20 ? 20 : h;
	$('#main').jScrollPaneRemove();
	$("#main").css("height", h + "px");
	$("#main").attr("height", h);
	$("#main").css("overflow", "auto");
	$('#main').jScrollPane({showArrows:true,scrollbarWidth:21});
	
	$(".menu").children("li").hover( function(evt) {
		if($(this).find("ul").length > 0) {
			uls = $(this).find("ul");
			$(".menu").find("ul").hide();
			$(".quote").hide();
			uls.show();
		} else {
			$(".quote").show();
		}
	} , function() {
		$(".menu").find("ul").hide();
		uls = $(".menu").children("li.active").find("ul");
		if(uls.length > 0) {
			uls.show();
		} else {
			$(".quote").show();
		}
	});
	uls = $(".menu").children("li.active").find("ul");
	if(uls.length > 0) {
		if($.browser.msie && $.browser.version < 8) {
			$(".menu").find("ul").hide();
			$(".quote").hide();
		}
		uls.show();
	}
	if($.browser.msie && $.browser.version < 8) {
		var t = $(".title").clone();
		$(document.body).append(t);
		t.css("position", "absolute");
		t.css("top", 295);
		t.css("right", 490);
		t.css("zIndex", 5000);
	}
}
$(window).load(function() {
	initSize();

	var bgimg = new Image();
	bgimg.onload = function() {
		$("#background").attr("src", bgimg.src);
		$("#background").hide();
		$("#background").fadeIn(500);
	};
	bgimg.src = backgroundImage;
	
	$("a.refimage").click(function() {
		i = new Image();
		
		i.onload = function() {
			$("#background").attr("src", i.src);
			$("#background").css("opacity", "1");
			$("#background").hide();
			$("#background").fadeIn(500);
			
			$(".closeref").show();
		}
		i.src = $(this).attr("href");
		return false;
	});
	$(".closeref").click(function() {
		var bgimg = new Image();
		bgimg.onload = function() {
			$("#background").attr("src", bgimg.src);
			$("#background").hide();
			$("#background").fadeIn(500);
		};
		bgimg.src = $("#background").attr("orig");
		$(this).hide();
		return false;
	});
});

$(window).resize(function() {
	initSize();
});


