NowState = "";
SWidth = "";
SHeight = "";
document.write("<div id='BackGround' style='background-color:#000000;position:absolute;filter:alpha(opacity=60);opacity:0.6;display:none;top:0px;Left:0px'><a href=\"JavaScript:OpenWin('hidden','','','');\"><iframe src='black.html' width='100%' height='100%' scrolling=no frameborder=0></iframe></a></div>");
document.write("<div style='position:absolute;display:none;' id='ShowWin'><div id='InShowWin' style='position:absolute;left:0px;top:0px;width:100%;height:100%;'><iframe src='menu.php' width='100%' height='100%' scrolling='no' frameborder='0' id='subdiv' name='subdiv' onload='ShowWin()'></iframe></div></div>");

function OpenWin(State,Html,Width,Height){
		  NowState = State;		      
		  SWidth = Width;
		  SHeight = Height;
		  if(State == "show" && !subdiv.location.href.match(Html)){
			    subdiv.location.href = Html;
		  }else{
			 ShowWin();  
		  }

}
function ShowWin(){
          if(NowState == "show"){
             $('ShowWin').style.top = document.body.clientHeight/2+document.body.scrollTop-SHeight/2+"px";
             $('ShowWin').style.left = document.body.clientWidth/2-SWidth/2+"px";
			 $('ShowWin').style.width = SWidth;
             $('ShowWin').style.height = SHeight;
			 $('ShowWin').style.display = "block";
			 
			 $('BackGround').style.width=document.body.clientWidth
             $('BackGround').style.height=(document.body.clientHeight > document.body.scrollHeight-4) ? document.body.clientHeight-4 : document.body.scrollHeight-4;
			 $('BackGround').style.display = 'block';
			 
			 Spry.Effect.AppearFade('InShowWin', {duration: 400, from: 50, to: 0, toggle: true, finish: CheckWin}); 
			 //Spry.Effect.GrowShrink('InShowWin', {duration: 400, from: '0%', to: '100%', toggle: true, finish: CheckWin});
		  }
		  else{
             Spry.Effect.AppearFade('InShowWin', {duration: 400, from: 50, to: 0, toggle: true, finish: CheckWin}); 
			 //Spry.Effect.GrowShrink('InShowWin', {duration: 400, from: '0%', to: '100%', toggle: true, finish: CheckWin});
		  }
}

CheckWin = function (){
		   if(NowState == "hidden"){
			  $('ShowWin').style.display = "none";
		      $('BackGround').style.display = 'none';
		   }
}
