﻿
/* Appel ajax get */
callAjax = function (url){
    var xhr; 
    try {  xhr = new ActiveXObject('Msxml2.XMLHTTP');   }
    catch (e) 
    {
        try {   xhr = new ActiveXObject('Microsoft.XMLHTTP');    }
        catch (e2) 
        {
          try {  xhr = new XMLHttpRequest();     }
          catch (e3) {  xhr = false;   }
        }
     }
   xhr.open( 'GET', url,  true); 
   xhr.send(null); 
}

/* Appel ajax post d'une url. */
callAjaxWithData = function (url, data){
    var xhr; 
    try {  xhr = new ActiveXObject('Msxml2.XMLHTTP');   }
    catch (e) 
    {
        try {   xhr = new ActiveXObject('Microsoft.XMLHTTP');    }
        catch (e2) 
        {
          try {  xhr = new XMLHttpRequest();     }
          catch (e3) {  xhr = false;   }
        }
     }
   xhr.open( 'POST', url,  true); 
   xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");  
   xhr.send(data); 
}

/* GrabIt :
    grabIt.init("31/10/2011 11:07:58-vl2gw3oz6kbKqcyjbZ80-");
    grabIt.grab("dataTypeAbr", "data");
    grabIt.sendDefault();
*/
grabIt = {
    "dataTab":[],
    "init":function(cv){
        this.dataTab = [];
        this.dataTab["CV"] = cv;
    },
    "grab":function(type, data){
        this.dataTab[type] = data;
    },
    "getDataTabAsParamStr":function(){
        var paramStr = "";
        
        for(key in this.dataTab)
        {
            paramStr += key+"="+this.dataTab[key]+"&";
        }
       
        return paramStr;
    },
    "sendDefault":function(){
        var host = "http://modzdata.modz.fr/";
        
        this.send(host + "CookieData.aspx");
    },
    "send":function(url){
        callAjaxWithData(url, this.getDataTabAsParamStr());
    }
};

/* */

