$(document).ready(function(){
	//Run the script to preload images from CSS
	$.preloadCssImages(); 
	});
 
/*
Open new window jq
*/
$(function(){
    $('a.new-window').click(function(){
        window.open(this.href);
        return false;
    });
});


$(document).ready(function(){ 
        $(document).pngFix(); 
    }); 

//Target scroll

function scrollShirts(){
$('html, body').animate({
scrollTop: $("#shirts").offset().top
}, 200);
};

// style switch

$(".styleswitch").click(function() {
    $('link[rel=stylesheet]').attr('href' , $(this).attr('rel')); 
  });


// swap image

	$.swapImage(".swapImage");
	$.swapImage(".swapImageClick", true, true, "click");
	$.swapImage(".swapImageDoubleClick", true, true, "dblclick");
	$.swapImage(".swapImageSingleClick", true, false, "click");
	$.swapImage(".swapImageDisjoint");

// shirt filter
$(document).ready(function() {
 // hides the slickbox as soon as the DOM is ready
 // (a little sooner than page load)
  $('#box_hell').hide();
  $('#box_tp').hide();
  $('#box_baby').show();
  $('#f_baby').attr("src", "/img/main_page/filter_baby_o.gif");
 // shows the slickbox on clicking the noted link
  $('a#hell-show').click(function() {
 	$('#box_hell').fadeIn('fast');
	$('#box_tp').fadeIn('fast');
	$('#box_baby').fadeOut('fast');
	$('#f_hell').attr("src", "/img/main_page/filter_hell_o.gif");
	$('#f_baby').attr("src", "/img/main_page/filter_baby.gif");
	$('#f_tp').attr("src", "/img/main_page/filter_tp.gif");
 return false;
  });
  
   $('a#tp-show').click(function() {
 	$('#box_tp').fadeIn('fast');
	$('#box_hell').fadeOut('fast');
	$('#box_baby').fadeOut('fast');
	$('#f_hell').attr("src", "/img/main_page/filter_hell.gif");
	$('#f_baby').attr("src", "/img/main_page/filter_baby.gif");
	$('#f_tp').attr("src", "/img/main_page/filter_tp_o.gif");
 return false;
  });
   
  $('a#baby-show').click(function() {
 	$('#box_baby').fadeIn('fast');
	$('#box_hell').fadeOut('fast');
	$('#box_tp').fadeOut('fast');
	$('#f_hell').attr("src", "/img/main_page/filter_hell.gif");
	$('#f_baby').attr("src", "/img/main_page/filter_baby_o.gif");
	$('#f_tp').attr("src", "/img/main_page/filter_tp.gif");
 return false;
  });
 // shows the slickbox on clicking the topnav link

  $('a#hell-show-tn').click(function() {
 	$('#box_hell').fadeIn('fast');
	$('#box_tp').fadeIn('fast');
	$('#box_baby').fadeOut('fast');
	$('#f_hell').attr("src", "/img/main_page/filter_hell_o.gif");
	$('#f_baby').attr("src", "/img/main_page/filter_baby.gif");
	$('#f_tp').attr("src", "/img/main_page/filter_tp.gif");
 return false;
  });
  
   $('a#tp-show-tn').click(function() {
 	$('#box_tp').fadeIn('fast');
	$('#box_hell').fadeOut('fast');
	$('#box_baby').fadeOut('fast');
	$('#f_hell').attr("src", "/img/main_page/filter_hell.gif");
	$('#f_baby').attr("src", "/img/main_page/filter_baby.gif");
	$('#f_tp').attr("src", "/img/main_page/filter_tp_o.gif");
 return false;
  });
   
  $('a#baby-show-tn').click(function() {
 	$('#box_baby').fadeIn('fast');
	$('#box_hell').fadeOut('fast');
	$('#box_tp').fadeOut('fast');
	$('#f_hell').attr("src", "/img/main_page/filter_hell.gif");
	$('#f_baby').attr("src", "/img/main_page/filter_baby_o.gif");
	$('#f_tp').attr("src", "/img/main_page/filter_tp.gif");
 return false;
  });
});
 function EraseSearch(obj) {
    	obj.value = '';
    }
    
    function DoBlur(obj) {
    	if(obj.value.length == 0){
    		obj.value = "SEARCH";
    	}
    }
	
// Affiliate Nav	
function affmenu(){
$(" #affnav ul ").css({display: "none"}); // Opera Fix
$(" #affnav li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		});
}
	$(document).ready(function(){					
	affmenu();
});
 
 $(document).ready(function(){
if 
(jQuery.url.attr('anchor') == 'hell'){
    $('#box_hell').fadeIn('fast');
	$('#box_tp').fadeIn('fast');
	$('#box_baby').fadeOut('fast');
	$('#f_hell').attr("src", "/img/main_page/filter_hell_o.gif");
	$('#f_baby').attr("src", "/img/main_page/filter_baby.gif");
	$('#f_tp').attr("src", "/img/main_page/filter_tp.gif");
	return false;
}
else if
(jQuery.url.attr('anchor') == 'tp'){
        $('#box_tp').fadeIn('fast');
	$('#box_hell').fadeOut('fast');
	$('#box_baby').fadeOut('fast');
	$('#f_hell').attr("src", "/img/main_page/filter_hell.gif");
	$('#f_baby').attr("src", "/img/main_page/filter_baby.gif");
	$('#f_tp').attr("src", "/img/main_page/filter_tp_o.gif");
 return false;
}
else if
(jQuery.url.attr('anchor') == 'baby'){
        $('#box_baby').fadeIn('fast');
	$('#box_hell').fadeOut('fast');
	$('#box_tp').fadeOut('fast');
	$('#f_hell').attr("src", "/img/main_page/filter_hell.gif");
	$('#f_baby').attr("src", "/img/main_page/filter_baby_o.gif");
	$('#f_tp').attr("src", "/img/main_page/filter_tp.gif");
 return false;
}

});