// JavaScript Document
var dOpa = "50";
var offHeight;
var MSIE=true;
if(!document.all)
MSIE=false;
//alert(MSIE);
//alert(navigator.appName);
//alert(navigator.userAgent);

function windowOnLoad(){
	var div = document.createElement("DIV");
	div.id = "loginForm";
	div.style.position = "absolute";
	div.style.zIndex="999";
	//div.style.height = "364px";
	div.style.width="500px";
	div.style.backgroundColor="#fff";
	div.style.display = "none";
	div.innerHTML = getHtml();
	document.body.appendChild(div);
}
windowOnLoad();

function login(){
	if(!MSIE)
	{
	  window.location.href="Memory.asp?act=red";
	  return;
	}
	offHeight = window.screen.height;
	var div = document.createElement("DIV");
	div.id = "errMsg";
	div.style.left = 0;
	div.style.top = 0;
	div.style.width=document.body.scrollWidth;
	div.style.height = document.body.scrollHeight;
	div.style.position = "absolute";
	div.style.display = "";
	div.style.zIndex = "998";
	div.style.filter = "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
	div.style.backgroundColor="#2A4A6B";
	document.body.appendChild(div);
	document.getElementById("videoBox").style.display="none";
	//document.getElementById("vPlayer").Pause();
	focusDiv();
	div.scrollIntoView(true);
}

function focusDiv(){
	var loginDiv = document.getElementById("loginForm");
	//alert(document.body.offsetWidth);
	loginDiv.style.left = document.body.scrollWidth/2-250;
	//loginDiv.style.top = (document.body.offsetHeight-361)/2 + document.body.scrollTop;
	loginDiv.style.top = 300;
	loginDiv.style.display = "block";
	
}

function getHtml(){
	var sHtml = "";
	//sHtml += '<div id="loginForm" style="position:absolute;width:500px;z-index:1000;background:#FFF;">';
    sHtml += '<div id="oSignTitle">Sign in</div>';
      sHtml += '<div id="oSignInner">';
       sHtml += ' <div class="signList" style="margin-left:100px;"><b>Member ID: </b>';
        sHtml += '<input type="text" class="log" name="UserId" value="" />';
		sHtml += '</div>';
       sHtml += ' <div class="signList"  style="margin-left:100px;"><b>Password:&nbsp;</b>';
      sHtml += '&nbsp;<input type="Password" class="log" name="PassWord" value="" />&nbsp;&nbsp;<a href="ForgetPassword.asp" class="cata_link">Forget your password?</a>';
   sHtml += ' </div>';
    sHtml += '<div class="signList"  style="margin-left:100px;">';
     sHtml += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="sb" type="button" value=" Back " onclick="javascript:return hiddenLoginWindow();" class="logButton"/>&nbsp;&nbsp;&nbsp;&nbsp;<input name="sb" type="button" value="Submit" onclick="javascript:return chkSignin();" class="logButton"/>';
       sHtml += ' </div>';
       sHtml += ' <div id="noteMsg">';
       sHtml += '&middotNot a member,<a href="Memory.asp?act=reg" class="cata_link">Register now<a/>.';
       sHtml += ' </div>';
       sHtml += ' </div>';
      sHtml += '<p>	</p>';
     //sHtml += '</div>';
	return sHtml;
}

function hiddenLoginWindow()
	{
		var uId=document.getElementById("UserId");
		var uPs=document.getElementById("PassWord");
		uId.value = "";
		uPs.value = "";
		var aa = document.getElementById("loginForm");
		var bb = document.getElementById("errMsg");
		//function setDivToNone(){
			aa.style.display = "none";
	        document.getElementById("videoBox").style.display="";
			//document.getElementById("vPlayer").Play();
			if(bb)
			document.body.removeChild(bb);
		//}
		//setDivToNone();
	}

function chkSignin()
  {
	  
	 var uId=document.getElementById("UserId");
	 var uPs=document.getElementById("PassWord");
	if(uId.value=="")
	  {
		alert("Please add your member ID.");
		uId.focus();
		return false;
	  }
	if(uPs.value=="")
	  {
		alert("Please add your password.");
		uPs.focus();
		return false;
	  }
	  
	 window.frames["signin"].document.Gforms.UserId.value=uId.value;
	 window.frames["signin"].document.Gforms.PassWord.value=uPs.value;
	 window.frames["signin"].document.Gforms.submit();
  }
  
function setNoteMsg(html)
  {
	document.getElementById("noteMsg").innerHTML="<font color=red>"+html+"</font>";  
  }

// change online state
function changeOnlineValue(v)
{
	online=v;
}
// change online state


function setControl(n)
 {
	 
	window.frames["signin"].document.Gforms.sControl.value=n;
 }
 
// check login return ok
function setOnline(v,s)
{
  var o=document.getElementById("oState");
  o.innerHTML='<a href="SignOut.asp" style="color:#ff0000"><u>Sign Out</u></a>&nbsp;<span class="blue">Fireworkstown.com</span>';
  setNoteMsg("");
  changeOnlineValue(v);
  hiddenLoginWindow();
  eval(s);
}
// check login return ok
