jQuery(document).ready(function(){
	jQuery("#sectionTopNew #caption-container").css("top",jQuery("#sectionTopNew #breadcrumb-container").height()+10);
	jQuery("#sectionTopNew").css("height", jQuery("#sectionTopNew #caption-container").height() + jQuery("#sectionTopNew #breadcrumb-container").height() + 10);

	jQuery("#conttable").before( jQuery("#body-section #breadcrumb-container") );
	jQuery("#conttable").before( jQuery("#body-section #sectionCaption") );
	jQuery("#conttable").before( jQuery("#item-page-top #breadcrumb-container-item") );

	if ( jQuery("#item-page-top").height() > 0 )
	{
		jQuery("#rightcont").css("cssText","margin-top: 50px;width: 190px !important;");
		jQuery("#tabcontent").css("cssText","width: auto !important;");
		jQuery("#overall").css("cssText","position: relative;");

		if ( jQuery("#rightcont").height() < jQuery("#central-item").height() - 70 )
		{
			jQuery("#rightcont").height( jQuery("#central-item").height() - 70 );
		}

		if ( jQuery("#breadcrumb-container-item").height() > 50 )
		{
			jQuery("#rightcont").css("margin-top", jQuery("#breadcrumb-container-item").height() )
			jQuery("#pit-cont").css("margin-top", jQuery("#breadcrumb-container-item").height() + 10 )
		}
	}


	var ytTopnavTimeout = 0;
	var ytTopnavOverTimeout = 0;

	jQuery("#topMenuLeft .topMenuFrame").mouseenter(function() {
		jQuery("#topMenuLeft .topMenuFrame .subMenu").hide();
		jQuery(".subMenu", this).show();
		jQuery("#topMenuLeft .topMenuFrame div.subMenu .level2").hide();
		jQuery("#topMenuLeft .topMenuFrame div.subMenu .level2 .level3").hide();
		jQuery("a.topsection", this).css("cssText","color: #aa822e;background-color: white;");
	}).mouseleave(function() {
		jQuery("div.subMenu", this).css("height","auto");
		jQuery("div.subMenu .level2", this).css("height","auto");
		jQuery("div.subMenu .level2 .level3", this).css("height","auto");
		jQuery("div.subMenu .level2 .level3", this).hide();
		jQuery("div.subMenu .level2", this).hide();
		jQuery("div.subMenu", this).hide();
		jQuery("a.topsection", this).css("cssText","color: white;background-color: transparent;");
	});
	jQuery("#topMenuLeft .topMenuFrame div.subMenu a").mouseenter(function() {
		jQuery(this).css("cssText","color: white;background-color: #c6cca6;");
        clearTimeout(ytTopnavTimeout);
        clearTimeout(ytTopnavOverTimeout);
		actElement = this;
		ytTopnavOverTimeout = setTimeout(function() {
            clearTimeout(ytTopnavTimeout);
            clearTimeout(ytTopnavOverTimeout);
			jQuery(actElement).parent().find(".level2").hide();
			jQuery(actElement).next("div.level2").show();
			if ( jQuery(actElement).parent().height() < jQuery(actElement).next("div.level2").height() ) 
			{
				if ( jQuery.browser.msie)
				{
					jQuery(actElement).parent().height( jQuery(actElement).next("div.level2").outerHeight() );
				}
				else
				{
					jQuery(actElement).parent().height( jQuery(actElement).next("div.level2").height() );
				}				
			}
			else
			{
				if ( jQuery.browser.msie)
				{
					jQuery(actElement).next("div.level2").height( jQuery(actElement).parent().outerHeight() );
				}
				else
				{
					jQuery(actElement).next("div.level2").height( jQuery(actElement).parent().height() );
				}				}
		}, 200);
	}).mouseleave(function() {
		clearTimeout(ytTopnavOverTimeout);
		jQuery(this).css("cssText","color: black;background-color: transparent;");
	});
	jQuery("#topMenuLeft div.subMenu div.level2 a").mouseenter(function() {
		jQuery(this).css("cssText","color: white;background-color: #c6cca6;");
        clearTimeout(ytTopnavTimeout);
        clearTimeout(ytTopnavOverTimeout);
		actElement = this;
		ytTopnavOverTimeout = setTimeout(function() {
            clearTimeout(ytTopnavTimeout);
            clearTimeout(ytTopnavOverTimeout);
			jQuery(actElement).parent().find(".level3").hide();
			jQuery(actElement).next("div.level3").show();
			if ( jQuery(actElement).parent().height() < jQuery(actElement).next("div.level3").height() ) 
			{
				if ( jQuery.browser.msie)
				{
					jQuery(actElement).parent().height( jQuery(actElement).next("div.level3").outerHeight() );
				}
				else
				{
					jQuery(actElement).parent().height( jQuery(actElement).next("div.level3").height() );
				}				
			}
			else
			{
				if ( jQuery.browser.msie)
				{
					jQuery(actElement).next("div.level3").height( jQuery(actElement).parent().outerHeight() );
				}
				else
				{
					jQuery(actElement).next("div.level3").height( jQuery(actElement).parent().height() );
				}				
			}
		}, 200);			
	}).mouseleave(function() {
		clearTimeout(ytTopnavOverTimeout);
		jQuery(this).css("cssText","color: black;background-color: transparent;");
	});	
	jQuery("#topMenuLeft div.subMenu div.level2").mouseenter(function() {
        jQuery(this).prev("a").css("cssText","color: white;background-color: #c6cca6;");
	}).mouseleave(function() {
        jQuery(this).prev("a").css("cssText","color: black;background-color: transparent;");
	});	
	jQuery("#topMenuLeft div.subMenu div.level3").mouseenter(function() {
        jQuery(this).prev("a").css("cssText","color: white;background-color: #c6cca6;");
	}).mouseleave(function() {
        jQuery(this).prev("a").css("cssText","color: black;background-color: transparent;");
	});	

	jQuery("#topMenuRight .topMenuFrame").mouseenter(function() {
			jQuery("#topMenuLeft .topMenuFrame div.subMenu").hide();
			jQuery(this).find("div.subMenu").show();
			jQuery("#topMenuLeft .topMenuFrame div.subMenu .level2").hide();
			jQuery("#topMenuLeft .topMenuFrame div.subMenu .level2 .level3").hide();
			jQuery("a.topsection", this).css("cssText","color: #aa822e;background-color: white;");
	}).mouseleave(function() {
			jQuery("div.subMenu", this).css("height","auto");
			jQuery("div.subMenu .level2", this).css("height","auto");
			jQuery("div.subMenu .level2 .level3", this).css("height","auto");
			jQuery("div.subMenu .level2 .level3", this).hide();
			jQuery("div.subMenu .level2", this).hide();
			jQuery("div.subMenu", this).hide();
			jQuery("a.topsection", this).css("cssText","color: white;background-color: transparent;");
	});

	jQuery("#topMenuRight .topMenuFrame div.subMenu a").mouseenter(function() {
        clearTimeout(ytTopnavTimeout);
        clearTimeout(ytTopnavOverTimeout);
		actElement = this;
		ytTopnavOverTimeout = setTimeout(function() {
            clearTimeout(ytTopnavTimeout);
            clearTimeout(ytTopnavOverTimeout);
			jQuery(actElement).parent().find(".level2").hide();
			jQuery(actElement).next("div.level2").show();
			if ( jQuery(actElement).parent().height() < jQuery(actElement).next("div.level2").height() ) 
			{
				if ( jQuery.browser.msie)
				{
					jQuery(actElement).parent().height( jQuery(actElement).next("div.level2").outerHeight() );
				}
				else
				{
					jQuery(actElement).parent().height( jQuery(actElement).next("div.level2").height() );
				}				
			}
			else
			{
				if ( jQuery.browser.msie)
				{
					jQuery(actElement).next("div.level2").height( jQuery(actElement).parent().outerHeight() );
				}
				else
				{
					jQuery(actElement).next("div.level2").height( jQuery(actElement).parent().height() );
				}	
			}
		}, 200);
	}).mouseleave(function() {
		actElement = this;
		clearTimeout(ytTopnavOverTimeout);
	});

	
	if ( jQuery("#tabcontents").height() > jQuery("#itemRelatedNew").height() )
	{
		jQuery("#itemRelatedNew").height( jQuery("#tabcontents").height() - 20 );
	}
	else 
	{
		jQuery("#tabcontents").height( jQuery("#itemRelatedNew").height() + 20 );
		jQuery(".tab_content").height( jQuery("#itemRelatedNew").height() - 19 );
	}

	jQuery("#homeSpecialBox td:last").css("border-width","0px");

	jQuery(".multiAddOneItem:last").css("border-width","0px");

	if ( jQuery("#paginateItemTable tr:first td").length == 3 )
	{
		jQuery("#paginateItemTable td.pagingcell").css("width","33%");
	}
	if ( jQuery("#paginateItemTable tr:first td").length == 4 )
	{
		jQuery("#paginateItemTable td.pagingcell").css("width","25%");
	}

	if ( jQuery("#tabcontents #itemRelatedNew").height() < 10 )
	{
		jQuery("#itemTabsContainer #itemRelatedNew").css("display","none");
		jQuery("#itemTabsContainer .tab_content").css("width","900px");
		jQuery("#itemTabsContainer .tab_content").css("border-width","0px");
	}

});

if ( navigator.platform.indexOf("iPhone") != -1 )
{
	jQuery("#main").css("overflow-x","hidden");
}
