function GoGo(destination, delay) {
	if ($.browser.webkit) {
		var obj = $('body')
	} else {
		var obj = $('html')			
	}
	obj.animate({ scrollLeft: destination}, delay);
}	

function doHeight() {
	if ($(document).height() < 520) {
		$("h3").hide()
	} else {
		$("h3").show()
	}
	if ($(document).height() < 806) {
		var temp = (806 - $(document).height());
		var ultemp = (ulb - Math.round(temp/2));
		if (ultemp < 32) {ultemp = 32}
		ordertemp = (orderb - Math.round(temp/2));
		if (ordertemp < 0) {ordertemp = 0}
		$("dl").css({"bottom":(dlb - temp - 13) + 'px'})
		$("ul").css({"bottom":ultemp + 'px'})
		$("#order").css({"bottom":ordertemp + 'px'})
		var h1temp = (98-Math.round(temp/4));
		if (h1temp < 30) {h1temp = 30}
		$("h1").css({"height":h1temp + 'px'})
	} else {
		$("dl").css({"bottom":dlb + 'px'})
		$("ul").css({"bottom":ulb + 'px'})
		$("#order").css({"bottom":orderb + 'px'})	
		$("h1").css({"height":'98px'})	
	}
}

$(document).ready( function() {
	var width = 0;
	dlb = $("dl").css("bottom").substr(0,$("dl").css("bottom").length-2);
	ulb = $("ul").css("bottom").substr(0,$("ul").css("bottom").length-2);;
	orderb = $("#order").css("bottom").substr(0,$("#order").css("bottom").length-2);;
	
	doHeight()	
	$(window).resize( function(){
		doHeight()	
	})
	
	$("ul").each( function() {
		$("ul li").each( function() {
			width = width + $(this).outerWidth()
		})
		$("body").css({"width":width + 'px'})
		$("ul").css({"width":width + 'px'})
	})
		
	GoGo($("#contact").offset().left, 0)
	GoGo(0, 1000)
	
	$("#order").click (function(){
		GoGo($("#contact").offset().left, 1000)
		return false;
	})
	
})

