$(document).ready(function(){   
	tx_init_stab();
	$("a.out").click(function(){
		link_out(this.href);
		return true;
	});
	fixbanner();
	$("#offpagebanner").show();
});

function link_out(u) {
	try {
		$.ajax({url: "link", data: "u="+escape(u)})
	} catch(e) {
		//nothing here
	}
}

function tx_init_stab() {
	if (typeof(stab_active) == 'undefined') stab_active="shop";

	if (stab_active==="product") {
		$("#stab_shop").attr("class", "stab");
		$("#stab_product").attr("class", "stab_a");
		$("#stab_special").attr("class", "stab");
		$("#search_form_product").show();
	} else if (stab_active==="special") {
		$("#stab_shop").attr("class", "stab");
		$("#stab_product").attr("class", "stab");
		$("#stab_special").attr("class", "stab_a");
		$("#search_form_special").show();
	} else {
		$("#stab_shop").attr("class", "stab_a");
		$("#stab_product").attr("class", "stab");
		$("#stab_special").attr("class", "stab");
		$("#search_form_shop").show();
	}

	$("#stab_shop").bind("mousedown",function(event) {
		$("#stab_shop").attr("class", "stab_a");
		$("#stab_product").attr("class", "stab");
		$("#stab_special").attr("class", "stab");
		$("#search_form_product").hide();
		$("#search_form_special").hide();
		$("#search_form_shop").show();
	});
	$("#stab_product").bind("mousedown",function(event) {
		$("#stab_product").attr("class", "stab_a");
		$("#stab_shop").attr("class", "stab");
		$("#stab_special").attr("class", "stab");
		$("#search_form_special").hide();
		$("#search_form_shop").hide();
		$("#search_form_product").show();
	});
	$("#stab_special").bind("mousedown",function(event) {
		$("#stab_special").attr("class", "stab_a");
		$("#stab_product").attr("class", "stab");
		$("#stab_shop").attr("class", "stab");
		$("#search_form_product").hide();
		$("#search_form_shop").hide();
		$("#search_form_special").show();
	});

}

$(window).resize(function(){
	fixbanner();
});
function fixbanner(){
	$("#offpagebanner").css("left", document.body.clientWidth/2+480+"px");
}
