$(document).ready(function() {
	var base_url = "http://imperiahouse.com/";
	
	if($.browser.msie)
	{
		$("body").css("background-color", "#943c58");
	}
	
	if($("div.main").height() > $("div.news").height())
	{
		$("div.news").height($("div.main").height());
	}
	
	$("input.button").hover(function() {
		$(this).css("background-position", "0px -25px");
	}, function() {
		$(this).css("background-position", "0px 0px");
	});
	
	$("input.button").click(function() {
		var id = $(this).attr("id").split("_");
		if(id[0] == "detal")
		{
			window.location.href= base_url + "order/" + id[1];
		}
	});
	
	$("div.menu_div").hover(function() {
		var id = $(this).attr("id");
		if($("*").index( $("#" + id + " > a.menu_link")[0] ) == -1)
		{
			$(this).css("cursor", "default");
		}
		$("#" + id + " > a.menu_link").stop();
		$("#" + id + " > a.menu_link").css("opacity", "1.0");
		$("#" + id + " > a.menu_link").animate({opacity: "0"}, "normal");
	}, function() {
		var id = $(this).attr("id");
		$("#" + id + " > a.menu_link").stop();
		$("#" + id + " > a.menu_link").css("opacity", "0");
		$("#" + id + " > a.menu_link").animate({opacity: "show"}, "normal");
		$("#" + id + " > a.menu_link").animate({opacity: "1.0"}, "normal");
	});
	
	$("div.menu_div").click(function() {
		if($("*").index( $("#" + $(this).attr("id") + " > a.menu_link")[0] ) != -1)
		{
			var target = $(this).attr("id").split("_");
			var page = "";
			if(target[1] == "main") page == "";
			else page = target[1] + "/";
			window.location.href = base_url + page;
		}
	});
});

function showFilled(value) 
{
	var result = '';
	result = (value > 9) ? '' + value : '0' + value;
	return result;
}

function clock() 
{
	TheTime = new Date;
	if($.browser.msie) year = TheTime.getYear();
	else year = TheTime.getYear() + 1900;
	document.getElementById("time").innerHTML = showFilled(TheTime.getHours()) + ':' + showFilled(TheTime.getMinutes()) + ':' + showFilled(TheTime.getSeconds());
	setTimeout("clock()", 200);
}