$(document).ready(function(){
	
	// Keeps the extraSmallShadow DIVs on the Details page the same height, just incase one gets to tall.
	var columnCountextraSmallShadows = $('.extraSmallShadow').length;
	var extraSmallShadowTallestCol = 0;
	
	for(var i = 0; i < columnCountextraSmallShadows; i++)
    {
        var extraSmallShadowDivUsed = $('.extraSmallShadow')[i];
		
		var extraSmallShadowDivHeight = jQuery(extraSmallShadowDivUsed).height();
        
        if(extraSmallShadowDivHeight != "NaN")
        {
            if(extraSmallShadowDivHeight > extraSmallShadowTallestCol)
            {
                extraSmallShadowTallestCol = extraSmallShadowDivHeight;
            }
        }
	}
	jQuery($('.extraSmallShadow')).css("height",extraSmallShadowTallestCol);
	
	$("#rHeaderRight ul li:first").css("border-left", "solid 0px #fff");
	
	$("sup").each(function () {
      $(this).replaceWith("<span class='supReplace'>" + $(this).text() + "</span>");
    });
    
    $('#BrandPages').slideToggle();
    
	var styleCount = $("#WindowWindowStyles .style").length;
	var style = 5;
	
	if(styleCount < 6)
	{
		$("#WindowWindowStyles .style:last-child").css({'margin-right':'0'}).after('<div class="clearFix"></div>');
	}

    var gridpattern = 5;
    $('.GridPattern').each(function(){
        $(this).eq(gridpattern).css('margin-right', '0');
        $(this).eq(gridpattern).after('<div class="clear"></div>');
        
        gridpattern = gridpattern + 6;
    });
    
    var gridprofile = 5;
    $('.GridProfile').each(function(){
        if($('.GridProfile').length != 7)
        {
            $('.GridProfile').eq(gridprofile).css('margin-right', '0');
            $('.GridProfile').eq(gridprofile).after('<div class="clear"></div>');
            
            gridprofile = gridprofile + 6 ;
        }
        else
        {
            $('.GridProfile').eq(3).after('<div class="clear"></div>');
        }
    });

    $('ul li p:last').css('padding-bottom', '0');
    
    $(".BeveledSmall:first").css({"clear":"left"});

	// Banner
	if($(".banner img").length < 1)
	{
		$(".banner").hide();
	}
	
	
	var leftCol = $("#gLeftColumn").height();
	var rightCol = $("#gRightColumn").height();
	
	if(leftCol > rightCol) { 
		$("#gRightColumn").css({"height": leftCol});		
	} else {
		$("#gLeftColumn").css({"height": rightCol});
	}
	
	leftCol = 0;
	rigtCol = 0;
	
	
	$(".Grids").each(function(){
		//alert($(this).find("h4").length);
		
		if($(this).find("h4").length < 1)
		{
			$(this).css({"border":"0", "margin":"0"});
		}
	});
	
	if($(".DetailSecondTextAreaContainer .DetailSecondTextArea").length < 1)
	{
		$(".DetailSecondTextAreaContainer").hide();
	}
       
});
