$(document).ready(function(){
	//Pre-load the Nav over and BG images so there is no flashing					   
	$('.pre_load').addClass('hideMe');//this is just a pre-load on the menu image, no need to use a full site preloader for one image
	//Subnav hiding and showing
	$("ul.topnav li").bind("mouseenter",function(){
		$(this).children('.subnav').removeClass('hideMe');
		//$(this).children('.subnav').css('display','block');
	}).bind("mouseleave",function(){
		//$(this).children('.subnav').fadeOut('normal');
		$(this).children('.subnav').addClass('hideMe');	
	});
	//hoever effects on a non-href element, so IE gets the effect
	$("#windowTypes li").bind("mouseenter",function(){
		$(this).addClass('hover');
	}).bind("mouseleave",function(){
		$(this).removeClass('hover');
	});	
	//Fancy box appling
	$("a[rel=feature_group], a[rel=feature_group2], a[rel=post_group], a.postBox, a[rel=product_group], a[rel=product_group_0], a[rel=product_group_1], a[rel=product_group_2], a[rel=product_group_3], a[rel=product_group_4], a[rel=product_group_5]").fancybox({
		'titleShow'			: false,					   	
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic'
	});
	//AutoComplete for seach field top right
	$("#keyword").attr("autocomplete", "off");
	//This is the PNG fix, but i have to specify IE6 only beacuse IE8 was getting errors 
	if ($.browser.msie && $.browser.version.substr(0,1)<7)
		DD_belatedPNG.fix("#headerFunctions, #logo, #warrantyTag, #vbwarranty, #vbzerodef, #absoluteRightColumn, .sidePromoLogo, #absoluteLeftMidColumn, #innerWrapperIndex, #mainHeader_IEcont, #footerWrapper, ul.topnav li a, ul.items li a img, .productImgFloater img, #actions a, #subMenu, #subMenu ul, .productImgFloater, .paintChips, .featureHovers, #windowTypes li, .shashoverlap, h2.special, .indexBoxes");
	//this will increase performance but remove the ability to sleect the text
	_typeface_js.configure({ disableSelection: true });
	// initialize scrollable  
	$("div.scrollable").scrollable({ 
		vertical:true,  
		size: 3 
	}).circular();  
	// initialize home impage rotation
	$('#backHouseImg').cycle({
		fx: 'fade',
		timeout: 20000,
		random: 1,
		pause: 1
	});	
	//dealer locator click effects
	$('#dealerButton').click(function () { 
		validateDealerLocator();
    });
	//search button click effect
	$('#searchButton').click(function () { 
		$('#frmSearch').submit();
    });
	
	if (!$.browser.msie) {
		$('#vbwarranty, #vbzerodef').addClass('opac').bind("mouseenter",function(){
			$(this).removeClass('opac');
		}).bind("mouseleave",function(){
			$(this).addClass('opac');
		});	
	}
	//this will make the two left and right boxes have the same height 
	/*not sure why but the forms do not show if the hight is set via VS
	if ( $('#leftColumn.pagePages').length ) {
		var leftContain = $('.doubleContain.leftSide').height()+9;
		if ( $('.doubleContain.rightSide').height() < leftContain )
			$('.doubleContain.rightSide').height(leftContain);
	}*/
});

