$(document).ready(function() {

	$("a.zoom").fancybox();
	
	var p = url_value('p');
	var op = url_value('op');
	$("ul#s" + p).show();
	if (op != '') {
		$("ul#s" + op).show();
	}
	$("li#" + p).children("img").show();
	if (op != '') {
		$("li#" + op).children("img").show();
	}
	
	$("li .link").hover(function() {
		var ulid = $(this).attr("id");
		$("ul#secnav").hide();
		$("li .link").children("img").hide();
		$("li .link").children("a").css({
			"color": "#DDD"
		});
		$(this).children("a").css({
			"color": "#CCC6B6"
		});
		$(this).children("img").show();
		$("ul#s" + ulid).fadeIn();
	});
	
	
	$("input[name=pay_method]").click(function() {
		var method = $(this).val();
		$("div.pay_method").hide();
		$("div#" + method).show();
	});
	
	$("input#shipme").click(function() {
		$("div#othershipping").toggle();
	});
	
});

function url_value(name) {
	name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
	var regexS = "[\\?&]" + name + "=([^&#]*)";
	var regex = new RegExp(regexS);
	var results = regex.exec(window.location.href);
	if (results == null) 
		return "";
	else 
		return results[1];
}


