// JavaScript Document

function popWin(URL) {
	window.open(URL, 'NoFear', 'toolbar=0, scrollbars=no, location=0, statusbar=0, menubar=0, resizable=1, width=518, height=402');
}

function popCloseUp(URL) {
	window.open(URL, 'Gear', 'toolbar=0, scrollbars=no, location=0, statusbar=0, menubar=0, resizable=1, width=520, height=555');
}

function popProfile() {
	window.open('pop_Profile.htm', 'MyProfile', 'toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1, width=520, height=620');
}


function loggedIn() {
	document.getElementById('loginEnter').style.display = 'none';
	document.getElementById('pointRedeem').style.display = 'block';
}

function flipBox(from, to) {
	document.getElementById(from).style.display = 'none';
	document.getElementById(to).style.display = 'block';
}

function loginText(){
    if ($F('lemail') == 'EMAIL ADDRESS') {$('lemail').value = '';}
    else if ($F('lemail') == '') {$('lemail').value = 'EMAIL ADDRESS';}
}
function passwordText(){
  if ($F('lpassword') == 'PASSWORD') { $('lpassword').value = ''; }
  else if ($F('lpassword') == '') {$('lpassword').value = 'PASSWORD';}
}

  function LogIn()
{
          var url = "loginAjax.asp"
          var formVals = Form.serialize($('frmlogin'))
          new Ajax.Request(url, {parameters: formVals,
          method: 'post',
          onSuccess: function(transport) {
            var status = transport.responseText.split("|")[0]
            var guid = transport.responseText.split("|")[2]
            if (status=="0") 
            {
                window.location=window.location.pathname+"?guid="+guid
            }
            else
            {
                alert(transport.responseText.split("|")[1]);
            }
          }  
        });
    
}

function checkCode(guid)
{
          var url = "codeAjax.asp"
          var formVals = Form.serialize($('frmCode'))
          new Ajax.Request(url, {parameters: formVals,
          method: 'post',
          onSuccess: function(transport) {
            var status = transport.responseText.split("|")[0]
            var msg = transport.responseText.split("|")[1]
            
            if (status=="0") 
            {
                var gameGuid = transport.responseText.split("|")[2]
                window.location="game.asp?guid="+guid+"&gGuid="+gameGuid
            }
            else
            {
                alert(msg)
            }
          }  
        });
    
}
  