var _ModuleContainer;
// Init Global Variable in pageLoad handler procedure
function pageLoad()
{
    if( typeof(_ModuleContainer) == 'undefined' )  _ModuleContainer = dnn.getVar('Container_ID');
}

function onPopup(type)
{
    dnn.setVar('GType',type);
    $find('PopupChallenge').show();
    $get( _ModuleContainer + 'DisplayName').focus(); 
}

function onPopOk(){
    if(Page_ClientValidate("PlayerInfo")){
        var displayName = $get( _ModuleContainer + 'DisplayName').value;
        var age = parseInt($get( _ModuleContainer + 'Age').value,10);
        EIS.Modules.GameSelection.ManageService.NavigateWithPlayerInfo(displayName, age,onSucceedBack,onFailed);
        
        //RL 07152009: hide the following two to make sure the next page will show - TODO: more test to make sure it is correct!
        //$find('PopupChallenge').hide();
       // $find('PopupProgress').show();
    } 
    //e.preventDefault();
    return false;   
}

function justWait()
{}

function onCancel()
{
    $find('PopupChallenge').hide(); 
    return false;
}

function onSucceedBack(result)
{ 
alert("Go to the game!");
    // Fire the Hidden Event Handler to redirect  the Criteris Page
    RedirectToCriteria();
}

function onFailed(exception)
{
debugger; //testdel
    if (exception.get_timedOut())   
    {   
        //Timeout
        alert("The request is timeout, please try again.");   
    }   
    else
    {   
        //Exception occurred   
        alert('Error is here!');
    }  
}