var dR=document.referrer.toString();

function toShopping(){
	history.go(-1);
	return false;
}

function doCheckout(form,checkout_type) {
	if (checkout_type == "google")
		form.next_location.value = "google";
	else if (checkout_type == "paypal")
		form.next_location.value = "paypal";
	else if( checkout_type == "ebillme")
		form.action = form.action + '?selected=eBillme';
	else if( checkout_type == "moneta")
		form.action = form.action + '?selected=Moneta';
}

function Rcertify() {
	popupWin = window.open('http://www.bbbonline.org/cks.asp?id=10303251215530818','Participant','location=yes,scrollbars=yes,width=450,height=300'); 
	window.name = 'opener';
}

function check_default(form) {
	if (form.value == $(form).attr("rel"))
		return false; 
	else 
		return true;
}
$(function(){
	$('#checkme').click(function(){
		var checkedValue = $('#checkme').attr('checked') ? 'checked' : '';
		$(':checkbox').attr('checked', checkedValue);
	});
	
	$("#promocode,#zipcodelookup,#gcertpin,#gcertcode").focus(function(){
		if (this.value == $(this).attr("rel")) this.value = '';
		$(this).css('color','#000000');
	});
	$("#promocode,#zipcodelookup,#gcertpin,#gcertcode").blur(function(){
		rel = $(this).attr("rel");
		if (this.value == '') {
			$(this).val(rel).css('color','#666666');
		}
	});
	
	$("#shippingmethod").change(function() {
		this.form.submit();
	});

	$("#whatsthis").hover(function () {
			$("#explain").show();
		},
		function () {
			$("#explain").hide();
	});
	
	$('#monetaexplain').click(function() {
		doCheckout(this.form,'moneta');
	});
	
	$('#monetaexplain,#googleexplain').hover(function() {
			var pos = $(this).parent().position(),
				img = $('#'+this.id+'edpop'),
				top = pos.top - img.height() - 20,
				left = pos.left;
				
			img.css({top:top,left:left}).show();			
		},
		function(){
			$('#'+this.id+'edpop').hide();
	});
}); 
