$(document).ready(function () {
	
	checkMainH = function() {
		if(mainBGH != $("#mainContIE6").height()) {
			mainBGH = $("#mainContIE6").height();
		}
		$("#mainBG").attr("height",mainBGH);
	}
	
	if( $.browser.msie && $.browser.version < 7 ) {
		$("#mainCont").attr("id","mainContIE6");
		var mainBGH = $("#mainContIE6").height();
		$("#mainContIE6").prepend("<img id=\"mainBG\" src=\"/CMS_IMAGES/site_main_bg.ccom\" width=\"" + $("#mainContIE6").width() + "\" height=\"" + mainBGH + "\" />");
		var checkMainHInt = setInterval("checkMainH()", 1000);
	} else {
		$("#mainCont").attr("id","mainContAll");
	}
	

//____________________________________________________________________________________________________COMPLEX CORNERS
if(!($.browser.msie && $.browser.version < 7)) {
	$(".complexCorners").prepend("<img class=\"ulCorner\" src=\"/CMS_IMAGES/cont_corner_ul.ccom\"/><img class=\"urCorner\" src=\"/CMS_IMAGES/cont_corner_ur.ccom\"/><img class=\"llCorner\" src=\"/CMS_IMAGES/cont_corner_ll.ccom\"/><img class=\"lrCorner\" src=\"/CMS_IMAGES/cont_corner_lr.ccom\"/>");
}

//____________________________________________________________________________________________________CSS WORKAROUND
$("hr").attr("noshade","noshade");

if($.browser.msie) {
	$("hr").wrap("<div class=\"hr\"></div>");
	$("hr").css("display","none");
	$("#overviewProductsCont div.productCol:last-child div").css("borderRight", "0");
	if($.browser.version < 7) {
		$("#supportOverviewCont.leftColCont > div.content").css("borderBottom", "1px solid #70C5E2");
		//$("div#overviewProductsCont").css("marginLeft","-12px"); //adding a float:left fixed this issue
		$("img[@src$=.png]").bind("load", function() {
			$(this).width() > 0 ? $(this).attr("width", $(this).width()) : null;
			$(this).height() > 0 ? $(this).attr("height", $(this).height()) : null;
		});
	}
}

	//____________________________________________________________________________________________________NAVIGATION CURRENT STATES

	sfCurrentInit = function() {
		if( $("#navCont li").hasClass("current") ) {
			var imgRO = $("#navCont li.current").children("a");
			var imgsrc = imgRO.children(".navImg").attr("src");
			var matches = imgsrc.match(/_on/);

			// don't do the rollover if state is already ON
			if (!matches) {
				imgsrcON = imgsrc.replace(/.ccom$/ig,"_on.ccom"); // strip off extension
				imgRO.children(".navImg").attr("src", imgsrcON);
			}
			imgRO.parent().next().children(".navSep").attr("src","/CMS_IMAGES/site_nav_sep_on.ccom");
			imgRO.prev(".navSep").attr("src","/CMS_IMAGES/site_nav_sep_on.ccom");
		}
	}

	//____________________________________________________________________________________________________NAVIGATION ROLLOVERS
	
	// Preload all rollovers
	$("#navCont img").each(function() {
		// Set the original src
		rollsrc = $(this).attr("src");
		rollON = rollsrc.replace(/.ccom$/ig,"_on.ccom");
		$("<img>").attr("src", rollON);
	});

	$("ul.sf-menu").superfish({ 
		pathClass: 'current',
		onInit: sfCurrentInit
	}); 
		
	//____________________________________________________________________________________________________SPECIAL OFFERS FUNCTIONS
	
	$("#rightColLocalizePhoneForm div a").click(function() {
		$("#rightColLocalizeAddressForm").show();
		$("#rightColLocalizePhoneForm").hide();
	});
	
	$("#rightColLocalizeAddressForm div a").click(function() {
		$("#rightColLocalizePhoneForm").show();
		$("#rightColLocalizeAddressForm").hide();
	});
	
});