event_handlers_loaded=true;

ExternalInterface=function(params,value,callback){
    nc.send('action='+params+'&arg='+value+'&callback='+callback)
}
postFrm=function (post){
   if(document.frm.user.value!=''){
      document.frm.btn.disabled=true;
      ExternalInterface('login',document.frm.user.value,'loginResult');
   }
   else {
      alert("The field can't be empty");
   }
}
loginResult=function(result){
    if(result=='denied'){
        document.frm.btn.disabled=false;
        document.frm.user.value='';
        displayPopup('Error','Login denied');     
    }
    else {
        document.write(result);
    }
}
onStatus=function(e){
    switch(e['code']){
        case "NetConnection.Status.InProgress" : 
            break;
        case "NetConnection.Status.Sending":
            break;
        case "NetConnection.Status.Success":
            //trace('OnStatus > Success'+e['result']);
            if(json=e['result'].parseJSON()){ 
                method=eval(json.callback);
                method(json.data);
                //trace(json.callback);
            }
            else {
                trace('Réponse inconnue '+e[result]);
            }
            break;
        default :
            trace("OnStatus > DEFAULT : "+e['code']);
            break;
    }
}
onSend=function(e){
    trace_comment('Sending datas on '+e["uri"]);
}
onSuccess=function(e){
    trace_comment('Operation Success');
}
onFailed=function(e){
    trace_comment('Operation Failure');
}
