(function(){ /*Use Object Detection to detect IE6*/ var m = document.uniqueID /*IE*/ && document.compatMode /*>=IE6*/ && !window.XMLHttpRequest /*<=IE6*/ && document.execCommand ; try{ if(!!m){ m("BackgroundImageCache", false, true) /* = IE6 only */ } }catch(oh){}; })();

$(document).ready(function() {
	
	/* Slideshow */
	$('#slideshow').cycle()
	
	/* Dropdown Menu */
	$('li.headlink').hover(
		function() { 
			$('ul', this).css('display', 'block');
		},
		function() {
			$('ul', this).css('display', 'none');
		}
	);
	
	/* Image Swap */
	$.swapImage(".swapImage");
	
	/* Preload Images */
	$.preload(
		[ 'btn_newsletter_join_actv.gif', 'btn_submit_actv.gif', 'gfc_subnav_top.gif', 'gfc_subnav_bottom.gif' ], {
		base:'skins/Custom/styleImages/'
	});
	
	/* PNG Fix */
	$('.sale_items').pngFix();
	
	/* Change Newsletter Form BGs */
	$('input.input_newsletter').focus(function() {
		$('#newsletter input.btn_join').attr({src:'skins/Custom/styleImages/btn_newsletter_join_actv.gif'});
		$('#newsletter form').addClass("active");
		if($(this).attr("value") == 'Email Address') {
			$(this).attr({value:''});
		}
	});
	$('input.input_newsletter').blur(function() {
		$('#newsletter input.btn_join').attr({src:'skins/Custom/styleImages/btn_newsletter_join.gif'});
		$('#newsletter form').removeClass("active");
		if($(this).attr("value") == '') {
			$(this).attr({value:'Email Address'});
		}
	});
	$('#newsletter_lrg input.input_newsletter').focus(function() {
		$('#newsletter_lrg input.btn_join').attr({src:'skins/Custom/styleImages/btn_newsletter_join_actv.gif'});
		$('#newsletter_lrg form').addClass("active");
		if($(this).attr("value") == 'Email Address') {
			$(this).attr({value:''});
		}
	});
	$('#newsletter_lrg input.input_newsletter').blur(function() {
		$('#newsletter_lrg input.btn_join').attr({src:'skins/Custom/styleImages/btn_newsletter_join.gif'});
		$('#newsletter_lrg form').removeClass("active");
		if($(this).attr("value") == '') {
			$(this).attr({value:'Email Address'});
		}
	});
	
	/* Change Pagination Images */
	$('#pagination a.first').hover(
		function() {
			$('#pagination a.first img').attr({src:'skins/Custom/styleImages/btn_pag_first_actv.gif'});
		}, 
		function() {
			$('#pagination a.first img').attr({src:'skins/Custom/styleImages/btn_pag_first.gif'});
		}
	);
	$('#pagination a.prev').hover(
		function() {
			$('#pagination a.prev img').attr({src:'skins/Custom/styleImages/btn_pag_prev_actv.gif'});
		}, 
		function() {
			$('#pagination a.prev img').attr({src:'skins/Custom/styleImages/btn_pag_prev.gif'});
		}
	);
	$('#pagination a.next').hover(
		function() {
			$('#pagination a.next img').attr({src:'skins/Custom/styleImages/btn_pag_next_actv.gif'});
		}, 
		function() {
			$('#pagination a.next img').attr({src:'skins/Custom/styleImages/btn_pag_next.gif'});
		}
	);
	$('#pagination a.last').hover(
		function() {
			$('#pagination a.last img').attr({src:'skins/Custom/styleImages/btn_pag_last_actv.gif'});
		}, 
		function() {
			$('#pagination a.last img').attr({src:'skins/Custom/styleImages/btn_pag_last.gif'});
		}
	);
	
	/* Product Image Swapper */
	$(".product_thumbs a").click(function(event) {
		event.preventDefault();
		var image = $(this).attr("href");
		$(".product_images img.product_image").attr("src", image);
	});
	
	/* Product Options */
	$('input:radio').each(function() {
		(this.checked) ? $('#r_'+this.id).addClass('fakechecked') : $('#r_'+this.id).removeClass('fakechecked');
	});
	$('input:radio').each(function() {
		if($(this).hasClass('oos')) {
			$('#r_'+this.id).addClass('oos');
		}
	});
	$('.fakecheck').click(function() {
		if($(this).hasClass('oos')) {
			return false;
		} else {
			$('.fakecheck').removeClass('fakechecked');
			$(this).addClass('fakechecked');
			$(this.hash).trigger('click');
			return false;
		}
		
	});
	
	/* Social Bookmark Menu */
	$('.btn_share, .social_bookmarks').hover(
		function() {
			$('.social_bookmarks').css('display', 'block');
			$('.btn_share').css('background-position', '0 -19px')
		}, 
		function() {
			$('.social_bookmarks').css('display', 'none');
			$('.btn_share').css('background-position', '0 0')
		}
	);
	
	/* Button Swaps */
	$('.btn_submit').hover(
		function() {
			$(this).attr({src:'skins/Custom/styleImages/btn_submit_actv.gif'});
		}, 
		function() {
			$(this).attr({src:'skins/Custom/styleImages/btn_submit.gif'});
		}
	);
	
	/* No Spam */
	$('a.email_replace_low').nospam({
	  replaceText: true
	});
	
});