$.isSlideMenuOver = false;
var c =0;
$(document).ready(function(){
	$("#globalNavi .slideMenuParent").mouseover(
		function(e){
			if(e.target.className =="hover"){
				$(".slideMenu").css({display:"none",height:"0"})
				$(this).find(".slideMenu").css({display:"block",height:"218px"})
				$(this).find(".slideMenuBg").animate(
     				{
						height:"218px",
						opacity: 0.8
					},
					{
      					duration: 200,
      					easing: "linear"
     				}
    			);
    			$(this).find(".slideMenuWrap").animate(
					{
      					height:"218px"
					},
					{
						duration: 200,
						easing: "linear"
					}
				);
			}
 		}
 	);
	$("#globalNavi .slideMenuParent").mouseout(
		function(e){
			var ua = navigator.userAgent;		// ユーザーエージェント
			var nWidth, nHeight;               // サイズ
			var nHit = ua.indexOf("MSIE");     // 合致した部分の先頭文字の添え字
			var bIE = (nHit >=  0);			// IE かどうか
			var bVer6 = (bIE && ua.substr(nHit+5, 1) == "6");  // バージョンが 6 かどうか
			var bStd = (document.compatMode && document.compatMode=="CSS1Compat");

			if (bIE) 
			{
				if (bVer6 && bStd) 
				{
					nWidth = document.documentElement.clientWidth;
					nHeight = document.documentElement.clientHeight;
				} 
				else 
				{
					nWidth = document.body.clientWidth;
					nHeight = document.body.clientHeight;
				}
			} 
			else 
			{
					nWidth = window.innerWidth;
					nHeight = window.innerHeight;
			}

			var basePoint = nWidth / 2;
			var tempX = basePoint - e.pageX;
			//alert((basePoint - e.pageX) + "/" + e.pageY + "/" + window.innerWidth);
			if(tempX < 230 && e.pageY < 112){
				var isMouseOut = true;
			}
			if(e.pageY < 112 || e.pageY > 329 || tempX > 242 ||  tempX < -400 || isMouseOut == true){
				$(this).find(".slideMenuBg").animate(
					{
						height:"0px",
						opacity: 0
					},
					{
						duration: 300,
						easing: "linear"
					}
				);
				$(this).find(".slideMenuWrap").animate(
					{
						height:"1px"
					},
					{
						duration: 300,
						easing: "linear",
						complete: function(){
							$(this).closest(".slideMenu").css({display:"none",height:"0"})
						}
					}
				);
			}
		}
	);


});


