// JavaScript Document
$(document).ready(function() {
	main("body");
});

function main(context) {
	
	/*if(ltIE7){
		/*$("head").append("<link>");
	    css = $("head").children(":last");
		css.attr({
		      rel:  "stylesheet",
		      type: "text/css",
		      href: "/Styles/ie6.css"
		    });
		DD_belatedPNG.fix('.png-fix');
	}*/
	
	if ($(".sheets_accordion", context).length > 0) {
		$(".sheets_accordion", context).accordion();
	}

	/*if ($("#sheets .spotlight_inner_content", context).length > 0) {
		$("#sheets .spotlight_inner_content", context).accordion();
	}*/

	if ($(".banner", context).length > 0) {
		$('.banner', context).cycle( {
			fx : 'fade',
			timeout : 4000
		});
	}
	
	$(".category_product_container a", context).addClass('current');
	if ($(".category_images_inner_container", context).length > 1) {
		$('.category_images_inner_container', context).cycle( {
			fx : 'fade',
			sync : 1,
			timeout : 4000,
			before : function(element) {
				var parent = $(this).parents('.category_container_inner');
				$(parent).find('a.current').removeClass("current");
			},
			after : function(element) {
				$('#'+$(this).attr("id")+'_link').addClass('current');
			}
		});
	}
	
	

	if ($("a.fancy_image", context).length > 0) {
		$('a.fancy_image', context).fancybox( {
			zoomSpeedIn : 300,
			zoomSpeedOut : 300,
			hideOnContentClick : true,
			overlayShow : true,
			overlayOpacity : 0.7,
			width : 400,
			height : 330,
			cyclic : true
		});
	}

	if ($(".spotlight_title:first", context).length > 0) {
		$('.spotlight_title:first', context).blink(); // default is 500ms blink interval.
		// $('.blink').blink(100); // causes a 100ms blink interval.
	}

	$("#video_player").click(function() {
	$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'		: 680,
			'height'		: 495,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});

	return false;
});

}

function ltIE7() {
	var semaphore;
	semaphore = !$.browser.msie || ($.browser.msie && ($.browser.version > 6));

	return semaphore;
}
