/*
Static menu script II (By maXimus, maximus@nsimail.com, http://maximus.ravecore.com/)
Modified slightly/ permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/

//configure below variable for menu width, position on page
var menuwidth=110
var offsetleft=79
var offsettop=90

var ns4=document.layers?1:0
var ie4=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0

function getIEVersionNumber() {
    var ua = navigator.userAgent;
    var MSIEOffset = ua.indexOf("MSIE ");
    
    if (MSIEOffset == -1) {
        return 0;
    } else {
        return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));
    }
}

var isIE5Min = getIEVersionNumber();
//alert(isIE5Min+" --- "+navigator.appName+" -- "+navigator.appVersion+" --> ie4="+ie4+" --> ns6="+ns6+" --> ns4="+ns4);

function makeStatic() {
	if (ie4) {
		if(navigator.appName.toLowerCase()=='microsoft internet explorer') {
			switch (isIE5Min) {
				case 6:
					object1.style.pixelTop=document.documentElement.scrollTop+offsettop-75;
					break;
				case 7:
					object1.style.pixelTop=document.documentElement.scrollTop+offsettop-75;
					break;
				case 8:
					object1.style.pixelTop=document.documentElement.scrollTop+offsettop-83;
					break;
			}
		}
	} else if (ns6) {
		document.getElementById("object1").style.top=(window.pageYOffset+offsettop-90)+"px";
	} else if (ns4) {
		eval(document.object1.top=eval(window.pageYOffset+offsettop-90));
	}
	//setTimeout("makeStatic()",0);
	//document.getElementById("spec").innerHTML=(window.pageYOffset+offsettop)+" --> "+document.getElementById("object1").style.top;
}
	if (ie4||ns6) {	// IE+Firefox
		var marginTop=0; var marginLeft=0;
		if(navigator.appName.toLowerCase()=='microsoft internet explorer') {
			switch (isIE5Min) {
				case 6:
					marginTop='174px';
					marginLeft=-480;
					document.write('<div ALIGN="CENTER" ID="object1" STYLE="Position:absolute; margin-top:'+marginTop+'; margin-left:0 auto; Z-Index:5 ;cursor:hand; background:none; text-align:center;">&nbsp;<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="950" height="145"><param name="movie" value="plane.swf" /><param name="wmode" value="transparent"><param name="quality" value="high" /><embed src="plane.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="950" height="145" wmode="transparent"></embed></object></div>');
					break;
				case 7:
					marginTop='168px';
					marginLeft=-480;
					document.write('<div ALIGN="CENTER" ID="object1" STYLE="Position:absolute; margin-top:'+marginTop+'; Z-Index:5 ;cursor:hand; background:none; text-align:center;"><div>&nbsp;<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="950" height="145"><param name="movie" value="plane.swf" /><param name="wmode" value="transparent"><param name="quality" value="high" /><embed src="plane.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="950" height="145" wmode="transparent"></embed></object></div></div>');
					break;
				case 8:
					marginTop='176px';
					marginLeft=offsetleft;
					document.write('<DIV ALIGN="CENTER" ID="object1" STYLE="position:absolute; margin-top:'+marginTop+'; Z-Index:5 ;cursor:hand; background:none; text-align:center; width:100%;"><DIV>&nbsp;<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="950" height="145"><param name="movie" value="plane.swf" /><param name="wmode" value="transparent"><param name="quality" value="high" /><embed src="plane.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="950" height="145" wmode="transparent"></embed></object></DIV></DIV>');
					break;
			}
		} else {	//FF
			marginTop='183px';
			marginLeft=125;
			document.write('<DIV ALIGN="CENTER" ID="object1" STYLE="Position:absolute; margin-top:'+marginTop+'; Z-Index:5 ;cursor:hand; background:none; text-align:center; width:100%;"><div>&nbsp;<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="950" height="145"><param name="movie" value="plane.swf" /><param name="wmode" value="transparent"><param name="quality" value="high" /><embed src="plane.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="950" height="145" wmode="transparent"></embed></object></DIV></DIV>');
		}
		
	} else if (ns4)	{
		document.write('<LAYER margin-top="100" name="object1" id="object1" left="'+offsetleft+'" BGCOLOR=white><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="950" height="145"><param name="movie" value="plane.swf" /><param name="quality" value="high" /><embed src="plane.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="950" height="145"></embed></object><?LAYER>');
	}



function menu3(){
if (ns6||ie4||ns4)
//makeStatic();
	if (typeof document.attachEvent!='undefined') {
	   //document.attachEvent('DOMMouseScroll',makeStatic);
	   document.onmousewheel = makeStatic;
	}
	else {
	   document.addEventListener('DOMMouseScroll',makeStatic,false);
	}
	var one_sec=1000;
	var current_time=new Date();
	var login_time=Math.floor((current_time-login_ms)/one_sec);
	if(login_time<=17) {
		loop_time();
	}
}

var d_title="คุณเข้าหน้านี้มาเป็นเวลา : "
var get_time
//get the login time
var login_h=new Date()
var login_ms=login_h.getTime()
function get_current_time(){
var one_sec=1000
current_time=new Date()
current_time.getTime()
//hold the login time of the user 
var login_time=Math.floor((current_time-login_ms)/one_sec)
//document.title=d_title+" "+login_time+" "+"วินาที"
	if(login_time>17) {
		document.getElementById("object1").innerHTML='';
	} else {
		setTimeout("makeStatic()",0);
	}
//if he pass the minute
if  (login_time>60){
var m=Math.floor(login_time/60)
var s=login_time%60
//document.title=d_title+" "+m+" "+"นาที "+s+" "+"วินาที"
		
	}
}
function loop_time() {
setInterval("get_current_time()",100)
}


window.onload=menu3;