// JavaScript Document

$(document).ready(function(){   
	fullscreen();
});

function fullscreen() {
	$screenHeight = $(window).height();
	$headerHeight = $('#Header').outerHeight();
	$contentHeight = $('#Content').outerHeight();
	$footerHeight = $('#Footer').outerHeight();
	$totalHeight = $headerHeight+$contentHeight+$footerHeight;
	if ($totalHeight<=$screenHeight){
		$newHeight = $screenHeight - $headerHeight - $footerHeight - ($("#Content").outerHeight()-$("#Content").height());
		$("#Content").css({'height' : $newHeight});
	}
}

$.ajaxSetup({
	beforeSend: function(xhr) {
		var currentURL = document.location.href;
		if( currentURL.lastIndexOf( "?" ) >= 0 ) {
			currentURL = currentURL.substr( 0, currentURL.lastIndexOf( "?" ) );
		}
		xhr.setRequestHeader("Referer", currentURL );
    },
	global: true,
	type: "POST"
});

function ajax(aurl,adata) {
	$.ajax({
		url: aurl,
		data: adata,
		success: function(msg){
			$("#Main").html(msg);
		}
	});
	fullscreen();
}

function tabShow(id) {
    $.ajax({
		url: 'shop_'+id+'.htm',
		data: '',
		success: function(msg){
			$("#Main .List").html(msg);
		}
	});
    $('#Main .Subnav ul li a').removeClass("Current");
    $('#Main #nav'+id).addClass("Current");
}
