// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults


// This module is javascript specific to the ordering process

//This method makes sure that the AUTH_TOKEN is transmitted
jQuery(document).ajaxSend(function(event, request, settings) {
  if (typeof(AUTH_TOKEN) == "undefined") return;
  // settings.data is a serialized string like "foo=bar&baz=boink" (or null)
  settings.data = settings.data || "";
  settings.data += (settings.data ? "&" : "") + "authenticity_token=" + encodeURIComponent(AUTH_TOKEN);
});

function payment_credit_card_details_show()
{
	Element.toggle('paypal_details');
	Effect.Appear('credit_card_details');
	Effect.Appear('billing_shipping_info')
	Effect.toggle('credit_card_button');
	return true;
}

function payment_credit_card_details_hide()
{
	Element.toggle('credit_card_details');
	Element.toggle('billing_shipping_info');
	Effect.Appear('paypal_details');
	Element.toggle('credit_card_button');
	return  true;
}

function submit_spin(link_id, loader, hide_area) {
	Element.hide(hide_area);
	Element.show(loader);
	return true;
}

/*
  son of suckerfish menu script from:
  http://www.htmldog.com/articles/suckerfish/dropdowns/
 */
sfHover = function() {
 var sfEls = document.getElementById("browse").getElementsByTagName("LI");
 for (var i=0; i<sfEls.length; i++) {
 	sfEls[i].onmouseover = function() {
 		this.className += " sfhover";
 		this.style.zIndex = 200; //this line added to force flyout to be above relatively positioned stuff in IE
 	}
 	sfEls[i].onmouseout = function() {
 		this.className = this.className.replace(new RegExp(" sfhover\\b"), "");
 	}
 }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);