
var Ajax={getXHR:function(relPath,command,args){var xhr_object=null;if(window.XMLHttpRequest)
xhr_object=new XMLHttpRequest();else
if(window.ActiveXObject)
xhr_object=new ActiveXObject("Microsoft.XMLHTTP");if(/^get.*Contact$/.test(command))
{xhr_object.open("GET",relPath+"ajax/webmail/ajax.php?cmd="+args,true);}
else
{xhr_object.open("GET",relPath+"ajax/ajax.php?cmd="+command+"&"+args,true);}
return xhr_object;},executeCommand:function(relPath,command,args,callback){var xhr=this.getXHR(relPath,command,args);xhr.onreadystatechange=function(){if(xhr.readyState!=4)return;var r=xhr.responseText;callback(r);};xhr.send(null);},addToFavorites:function(relPath,partner){callback=function(t){alert(t);};this.executeCommand(relPath,"add","partner="+partner,callback);},subToFavorites:function(relPath,partner){callback=function(t){var arr=t.split("|");var reload=false;if(arr.length>0&&arr[0]=="reload"){t=arr[1];reload=true;}
alert(t);if(reload){window.location.href=window.location.href;}};this.executeCommand(relPath,"sub","partner="+escape(partner),callback);},ajaxCheckEmail:function(relPath,email){this.executeCommand(relPath,"checkEmail","email="+(escape(email)).replace("+","%2B"),check_email_callback);},ajaxCheckLogin:function(relPath,login){this.executeCommand(relPath,"checkUserId","userid="+escape(login),check_login_callback);},ajaxCheckParrain:function(relPath,login){this.executeCommand(relPath,"checkParrain","parrain="+escape(login),check_parrain_callback);},ajaxCheckCode:function(relPath,code){this.executeCommand(relPath,"checkCapcha","capcha="+escape(code),check_code_callback);},ajaxGetMsnContact:function(relPath){this.executeCommand(relPath,"getMsnContact",'hotmail&'+Math.random(),function(r){filllines(r);statusRemove('Msn');});},ajaxGetGmailContact:function(relPath){this.executeCommand(relPath,"getGmailContact",'gmail&'+Math.random(),function(r){filllines(r);statusRemove('Gmail');});},ajaxGetYahooContact:function(relPath){this.executeCommand(relPath,"getYahooContact",'yahoo&'+Math.random(),function(r){filllines(r);statusRemove('Yahoo');});},ajaxGetContact:function(relPath,name,openInviterName){this.executeCommand(relPath,"getXXXContact",openInviterName+'&'+Math.random(),function(r){filllines(r);statusRemove(name);});}}
