// browser feature detection;
var isIE6 = ((window.XMLHttpRequest == undefined) && (ActiveXObject != undefined))? true : false;

// ===== Initial DOM Manipulation =====
jQuery(document).ready(function($){
	$('select#product')
	    .each(function(){
            //[name$=value]
            $(this).find("> option[value$='"+window.location.search.substring(1)+"']").attr('selected', 'selected');
	    })
		.styledSelect({innerClass:'select-product'})
		.bind('change',function(e){
			//alert(this.value);
			if (this.value!='') {
    			window.location.href = this.value;
			}
		});
		
	// ~~~~~ CAROUSEL ~~~~~
	if($('#mainContent').find('.galleryIndex').length){
		$('#mainContent').find('.galleryIndex').simpleCarousel({'showNextPrev':false,'showPageNumbers':false,'fade':750});
	};
	
	// ~~~~~ VIDEO PLAYER ~~~~~
	if($('body.index .videoContainer').length){
		$('body.index .videoContainer').videoCarousel();
	};
	
	if(isIE6){
		// ===== MENU: Add :hover event ====================
		$.getScript('/javascripts/jquery.bgiframe.min.js', function(){
			$('#menu ul').bgiframe();									  
		});
		
		$("ul#menu > li").hover(function(){
			$(this).addClass('hover');
		}, function() {
			$(this).removeClass('hover');
		});
	};

});

// ===== Non-Essential DOM Events =====
jQuery(window).load(function($){
	//
});

