// JavaScript Document


var nestedSpecial = false;
var nestedAbout = false;
var nestedAccessories = false;
var nestedProducts = false;
var searchIsOpen = false;

$(function() {
	
	$('#mainnav').find('.header_navi_products').mouseover(function() {
		$(this).parent().css('z-index','2010');
		var nestedProducts = false;
		var $div = $('#products-nested');
		var height = $div.height() - 14;
		$div.bind('mousemove', function(e) {
			var offset = $div.offset();
			var x = e.pageX - offset.left;
			var y = e.pageY - offset.top;
			if ((x < 14 || y < 11) || (x > 103 && y < 48) || (x > 247) || (y > height)) {
				$div.unbind('mousemove').hide();
				nestedProducts = false;
			$(this).parent().css('z-index','2001');
			}
		});

		if (!nestedProducts) {
			$('#products-nested').show();
			$('#accessories-nested').hide();
			$('#about-nested').hide();
			$('#special-nested').hide();
			nestedProducts = true;
		}
	});
	
	$('#mainnav').find('.header_navi_accessories').mouseover(function() {
		var nestedAccessories = false;
		var $div = $('#accessories-nested');
		var height = $div.height() - 14;
		$div.bind('mousemove', function(e) {
			var $this = $(this);
			var offset = $this.offset();
			var x = e.pageX - offset.left;
			var y = e.pageY - offset.top;
			if ((x < 14 || y < 11) || (x > 103 && y < 48) || (x > 247) || (y > height)) {
				$div.unbind('mousemove').hide();
				nestedAccessories = false;
			}
		});
		if (!nestedAccessories) {
			$('#accessories-nested').show();
			$('#products-nested').hide();
			$('#about-nested').hide();
			$('#special-nested').hide();
			nestedAccessories = true;
		}
	});
	
	$('#mainnav').find('.header_navi_about').mouseover(function() {
		var nestedAbout = false;
		var $div = $('#about-nested');
		var height = $div.height() - 14;
		$div.bind('mousemove', function(e) {
			var $this = $(this);
			var offset = $this.offset();
			var x = e.pageX - offset.left;
			var y = e.pageY - offset.top;
			if ((x < 14 || y < 11) || (x > 103 && y < 48) || (x > 247) || (y > height)) {
				$div.unbind('mousemove').hide();
				nestedAbout = false;
			}
		});
		if (!nestedAbout) {
			$('#about-nested').show();
			$('#products-nested').hide();
			$('#accessories-nested').hide();
			$('#special-nested').hide();
			nestedAbout = true;
		}
	});

	$('#utilitynav').find('.header_navi_special').mouseover(function() {
		var nestedSpecial = false;
		var $div = $('#special-nested');
		var height = $div.height() - 14;
		$div.bind('mousemove', function(e) {
			var $this = $(this);
			var offset = $this.offset();
			var x = e.pageX - offset.left;
			var y = e.pageY - offset.top;
			if ((x < 14 || y < 11) || (x > 103 && y < 48) || (x > 187) || (y > height)) {
				$div.unbind('mousemove').hide();
				nestedSpecial = false;
			}
		});
		if (!nestedSpecial) {
			$('#special-nested').show();
			$('#about-nested').hide();
			$('#products-nested').hide();
			$('#accessories-nested').hide();
			nestedSpecial = true;
		}
	});

	
});

$(function() {
	$(".page_product #products-nested, .page_products #products-nested, .page_accessory #accessories-nested, .page_apparel .header_navi_apparel, .page_about #about-nested, .page_special #special-nested").parent().addClass("selected");
});


$(document).ready (function () {
	if ($.browser.msie && $.browser.version < 7)
    $.getScript('/common/js/DD_belatedPNG.js', function() {
        DD_belatedPNG.fix('#mainnav div, #utilitynav div');
	});
});



