
$(document).ready(function(){
	Cufon.replace('.pitch h1'); 
	Cufon.replace('.main-content h2');
	Cufon.replace('.cufon');
});

$(document).ready(function() {
  
  /*tshirt button hover gradient*/
  
  $(".product_list .sizes a").hover(
      function () {
        $(this).css("background","url('/images/tshirts/gradhover.png') center no-repeat scroll");
		$(this).addClass("iehover");
      }, 
      function () {
        $(this).css("background","none");
		$(this).removeClass("iehover");
      }
    );

});


$(document).ready(function() {
  
  /*tshirt button hover gradient*/
  
  $(".product_list .sizes .xs").hover(
      function () {
        $(this).attr("src","/images/amazon/XS-roll.gif");
      }, 
      function () {
        $(this).attr("src","/images/amazon/XS-button.gif");
      }
    );
	$(".product_list .sizes .s").hover(
      function () {
        $(this).attr("src","/images/amazon/S-roll.gif");
      }, 
      function () {
        $(this).attr("src","/images/amazon/S-button.gif");
      }
    );
	$(".product_list .sizes .m").hover(
      function () {
        $(this).attr("src","/images/amazon/M-roll.gif");
      }, 
      function () {
        $(this).attr("src","/images/amazon/M-button.gif");
      }
    );
	$(".product_list .sizes .l").hover(
      function () {
        $(this).attr("src","/images/amazon/L-roll.gif");
      }, 
      function () {
        $(this).attr("src","/images/amazon/L-button.gif");
      }
    );
	$(".product_list .sizes .xl").hover(
      function () {
        $(this).attr("src","/images/amazon/XL-roll.gif");
      }, 
      function () {
        $(this).attr("src","/images/amazon/XL-button.gif");
      }
    );

});

$(document).ready(function() {

	/* t-shirt awesomeness. */ 
	
	$("a.img_lighbox").fancybox({
	  'hideOnContentClick': true,
	  'titleShow' : false,
	  'overlayColor' : '#000',
	  'overlayOpacity' : 0.6
	});
	
	
});

function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
	x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
	y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
	x=x.replace(/^\s+|\s+$/g,"");
	if (x==c_name)
		{
		return unescape(y);
		}
	}
}

$(document).ready(function() {
	var iwssession = getCookie("iwssession");

	/* set session cookie to comply with Amazon CSRF protection, if not already set */
	if(iwssession==null)
	{
		iwssession = Math.floor(Math.random() * (9999999999)) + 1;
		document.cookie = "iwssession=" + iwssession + "; domain=.mstaken.com;";
	}

	/* fetch session ID (which may be previously set) and use it to reform all add cart URLs */
	for (var i = 0; i < document.links.length; i++)
        {
		if (document.links[i].href.substring(0, 43) == "http://storefront.mstaken.com/addToCart.htm")
		{
			document.links[i].href = document.links[i] + "&sessionId=" + iwssession;
			document.links[i].removeAttribute("onclick");
		}
	}
});


