(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 */
	$('ul.slideshow').innerfade({
		speed: 1000,
		timeout: 4000,
		type: 'sequence',
		containerheight: '700px'
	});
	
	/* Dropdown Menu */
	$('li.headlink').hover(
		function() { 
			$('ul', this).css('display', 'block');
		},
		function() {
			$('ul', this).css('display', 'none');
		}
	);
	
	/* 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;
		}
		
	});
	
	/* Preload Images */
	$.preload(
		[ 'btn_newsletter_join_actv.gif', 'btn_submit_actv.gif', 'gfc_subnav_top.gif', 'gfc_subnav_bottom.gif' ], {
		base:'skins/Custom/styleImages/'
	});
	
	/* Swaps */
	$.swapImage(".swapImage");
	
	$(".product_thumbs a").click(function(event) {
		event.preventDefault();
		var image = $(this).attr("href");
		$("img.product_image").attr("src", image);
	});
	
	$('.newsletter 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:''});
		}
	});
	$('.newsletter 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'});
		}
	});
	
	$('.btn_submit').hover(
		function() {
			$(this).attr({src:'skins/Custom/styleImages/btn_submit_actv.gif'});
		}, 
		function() {
			$(this).attr({src:'skins/Custom/styleImages/btn_submit.gif'});
		}
	);
	
	$('#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'});
		}
	);
	
	/* No Spam */
	$('a.email_replace_low').nospam({replaceText: true});
	
	/* PNG Fix */
	$('.sale_items').pngFix();
});