var win=window;
var agent=navigator.userAgent.toLowerCase();
var IE=(agent.indexOf("msie")!=-1&&agent.indexOf("opera")==-1);
var IE7=(agent.indexOf("msie 7")!=-1);
var OPERA=(agent.indexOf("opera")!=-1);
var SAFARI=(agent.indexOf("safari")!=-1);
var FIREFOX=(agent.indexOf("gecko")!=-1);
var STRICT_MODE=(document.compatMode=="CSS1Compat");
var doc=win.document;
var DIV_ID;

function getWindowSize(win){var availW=win.innerWidth;if(availW==undefined||availW===0||isNaN(availW))
availW=win.document.documentElement.clientWidth;if(availW==undefined||availW===0||isNaN(availW))
availW=win.document.body.clientWidth;var availH=win.innerHeight;if(availH==undefined||availH===0||isNaN(availH))
availH=win.document.documentElement.clientHeight;if(availH==undefined||availH===0||isNaN(availH))
availH=win.document.body.clientHeight;return{w:availW,h:availH};}

function getDocumentSize(win){var winSize=getWindowSize(win);var scrollPos=getScrollPos(win);var w=winSize.w+scrollPos.left;var h=winSize.h+scrollPos.top;w=Math.max(w,win.document.body.offsetWidth);h=Math.max(h,win.document.body.offsetHeight);w=Math.max(w,win.document.body.scrollWidth);h=Math.max(h,win.document.body.scrollHeight);return{w:w,h:h};}

function getScrollPos(win){var scrollTop=win.pageYOffset;if(scrollTop==undefined||scrollTop===0)
scrollTop=win.document.documentElement.scrollTop;if(scrollTop==undefined||scrollTop===0)
scrollTop=win.document.body.scrollTop;var scrollLeft=win.pageXOffset;if(scrollLeft==undefined||scrollLeft===0)
scrollLeft=win.document.documentElement.scrollLeft;if(scrollLeft==undefined||scrollLeft===0)
scrollLeft=win.document.body.scrollLeft;return{top:scrollTop,left:scrollLeft};}

function hideLayer(lay){
	document.getElementById(lay).innerHTML = "";
	document.getElementById(lay).style.display = 'none';	
}
function reload_frame(az){
	//alert(az)
	var music = (az) ? 1 : ''; //alert(music)
	//if(parent.frames[0]){
	if(window.opener.frames[0]){	
		//alert(window.opener.frames[0])
		//parent.frames[0].location.href = '../top.php?az=' + az + '&i=' + new Date().getTime();
		var url = '../top.php?az=' + music + '&i=' + new Date().getTime(); //alert(url)
		//alert(window.opener.parent.frames[0].location.href)
		window.opener.parent.frames[0].location.href = url;
	}
}
function goVideo(del){

	if(del){
		reload_frame();
		setTimeout("hideLayer(DIV_ID)",1500);
	}else{ 
		reload_frame(1);
		var div_id = new Date().getTime();
		DIV_ID = div_id;
		var photoBack=doc.createElement("div");
			photoBack.id=div_id;
			photoBack.style.top="0px";
			photoBack.style.left="0px";
			photoBack.style.bottom="0px";
			photoBack.style.right="0px";
			photoBack.style.margin="0";
			photoBack.style.padding="0";
			photoBack.style.border="none";
			photoBack.style.cursor="pointer";
			photoBack.style.zIndex="10000";
			//photoBack.style.backgroundColor="#000000";
			if(IE&&!(IE7&&STRICT_MODE)){
				photoBack.style.position="absolute";
				var docSize=getDocumentSize(win);
				photoBack.style.width=(docSize.w-21)+"px";
				photoBack.style.height=(docSize.h-4)+"px";
			}else{
				photoBack.style.position="fixed";
				photoBack.style.width="100%";
				photoBack.style.height="100%";
			}
			photoBack.onclick=function(){
				//doc.getElementById(div_id).style.visibility = 'hidden'
			}	
			doc.body.appendChild(photoBack);
			document.getElementById(div_id).innerHTML = "<div id='box_video'></div>";
			
		   var fo = new SWFObject("../video/video_halloween.swf", "my", "100%", "100%", "8.0.0.24", "", true);
		   fo.addParam("quality", "high");
		   fo.addParam("scale", "noscale");
		   fo.addParam("wmode", "transparent");
		   fo.write("box_video");	
		  // alert(div_id)
	}	  
}