$(document).observe("dom:loaded", function() {
	externalLinks();
	shippingHelp();
	cvvHelp();
	doubleClick();
	navHide();
});

function externalLinks() {
 if (!document.getElementsByTagName) return false;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}

function shippingHelp(){
	if (!document.getElementById("shipping_help_butt")) return false;
	$('shipping_help').hide();
	Event.observe('shipping_help_butt', 'click', function(e){
		Effect.toggle('shipping_help', 'slide');
		Element.toggleClassName('shipping_help_butt', 'close');
		Event.stop(e);
	})
}

function cvvHelp(){
	if (!document.getElementById("cvv_what")) return false;
	$('cvv_definition').hide();
	Event.observe('cvv_what', 'click', function(e){
		Effect.toggle('cvv_definition', 'slide');
		Element.toggleClassName('cvv_what', 'close');
		Event.stop(e);
	})
}


function doubleClick (){
	if (!document.getElementById("submit_butt")) return false;
	Event.observe('submit_butt', 'click', function(){
		$("submit_butt").hide();
	})
}

function navHide() {
	if(!document.getElementById("store_nav")) return false;
	$$('#store_nav ul.off').invoke('hide');
}


function popitup(url) {
	if (!document.getElementsByTagName) return false;
	newwindow=window.open(url,'name','height=800,width=760,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
	return false;
}





