﻿// JScript File
  var _x;
  var _y;
  
var isIE = document.all?true:false;
if (!isIE) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = getMousePosition;
function getMousePosition(e) {

  if (!isIE) {
    _x = e.pageX;
    _y = e.pageY;
  }
  if (isIE) {
    _x = event.clientX + document.body.scrollLeft;
    _y = event.clientY + document.body.scrollTop;
  }
  return true;
}

function OpenWindow(location)
{
    window.open(location,'_blank','width=300,height=400,scrollbars=1,menubar=0,titlebar=1,toolbar=0,resizable=1');        
}
function CenterWindow(WindowName)
{
    xloc = 100;
    yloc = 100;
    
    screenW = screen.width;
    screenH = screen.height;
    xloc = (screenW - 640)/2;
    yloc = (screenH - 480)/2;
    WindowName.moveTo(xloc, yloc);
}
function ShowDescription(descid, windowevent)
{
    if (windowevent.pageX || windowevent.pageY)
    {
        curX = windowevent.pageX;
        curY = windowevent.pageY;
    }
    else if (windowevent.clientX || windowevent.clientY)
    {
        curX = windowevent.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
        curY = windowevent.clientY + document.body.scrollTop + document.documentElement.scrollTop;
    }
    var fdobj = document.getElementById("floatingdescription");
    if(descid == 'Username')
    {
        fdobj.innerHTML = "The “Username” you select lets you sign in to your E-games Account and will be used for verification purposes. If the “Username” you want is not available, try adding a word or number to make it unique.";
    }
    else if(descid == 'AgentID')
    {
        fdobj.innerHTML = "Enter AgentCode 'Test'";
    }
    else if(descid == 'Nickname')
    {
        fdobj.innerHTML = "The “Nickname” you select will be used for your casual game accounts. If the “Nickname” you want is not available, try adding a word or number to make it unique.";
    }
    else if(descid == 'Email')
    {
        fdobj.innerHTML = "The “Email Address” you input will be used for your account verification. Please enter a valid email address. ";
    }
    else if(descid == 'Mobile')
    {
        fdobj.innerHTML = "Please enter a valid mobile number. This will be used for account verification, password reset, and other account services. ";
    }
    else if(descid == 'PIN')
    {
        fdobj.innerHTML = "If you forget your password we will ask for your PIN. ";
    }
    else if(descid == 'QA')
    {
        fdobj.innerHTML = "Important: Please do not forget your secret question/answer. You will need this in order to access certain features of your account. ";
    }
    else if(descid == 'Password')
    {
        fdobj.innerHTML = "Make your password more secure by combining lower and uppercase letters (e.g., AWr) numbers and special characters (e.g. @$ %)";
    }
    else if(descid == 'APassword')
    {
        fdobj.innerHTML = "Please enter your Password.";
    }
    else if(descid == 'AEmail')
    {
        fdobj.innerHTML = "Please enter your valid Email Address.";
    }
    else if(descid == 'APIN')
    {
        fdobj.innerHTML = "Please enter your Account Pin.";
    }
    else if(descid == 'AQA')
    {
        fdobj.innerHTML = "Please enter your Secret Answer.";
    }
    else if(descid == 'Firstname')
    {
        fdobj.innerHTML = "Please enter your First Name..";
    }
    else if(descid == 'Lastname')
    {
        fdobj.innerHTML = "Please enter your Last Name.";
    }
    else if(descid == 'Address')
    {
        fdobj.innerHTML = "Please enter your Complete Address.";
    }
    else if(descid == 'Captcha')
    {
        fdobj.innerHTML = "Please enter the Image Code accurately as it appears in the image above.";
    }
    else
    {
        fdobj.innerHTML = "This is a default field description, please provide the Dev Team with a proper one. ";
    }
    fdobj.style.top =  curY - 5 + "px";
    //tbUserName
    if(isIE)
    {
        var obj = document.getElementById("divRuler").getBoundingClientRect();
        fdobj.style.left = obj.left + 320 + "px";
    }
    else
    {
        fdobj.style.left = document.getElementById("divRuler").offsetLeft + 320 + "px";
    }
    
    //fdobj.style.display = "block";
    opacity("floatingdescription", 0, 80, 300);
    
}
function HideDescription(descid)
{
    //document.getElementById("floatingdescription").style.display = "none";
    opacity("floatingdescription", 80, 0, 0);
}

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 

function ShowConfirmation(ConfirmMessage)
{
    var myTextField = document.getElementById("tbConfirmation");
    if(myTextField.value == "0")
    {
        var answer = confirm(ConfirmMessage)
        
	    if (answer){
            myTextField.value = "1";
            document.UpdateProfileForm.submit();
            //WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("btnValidate", "", true, "", "", false, false));
 	    }
	    else{
            myTextField.value = "0";
	    }
    }
}
