 
                

var execute = {
load:function(pageSend,action,script,value){
page = "";
load_script(pageSend,action,script,value);      
},
SendAJAXForClass:function(page,value,action,funct){
	var xhr = getXhr();
	xhr.onreadystatechange = function()
	{
		if(xhr.readyState == 4 && xhr.status == 200)
		{
			
			res= xhr.responseText;
		
			funct.loadAction(res,action);
 
	         }
                else {
		 	 
                this.result ="petit pepin";
                }
	}
	xhr.open("POST",page,true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send("AJAX="+value);
	},
SendAJAXwhithReturn:function(pageSend,action,page,value){
res ="";
var xhr = getXhr();
 
	xhr.onreadystatechange = function()
	{
                        if(xhr.readyState == 4 && xhr.status == 200)
                        {
                        res= extract_DATA(xhr.responseText);
                        page.refreshWithRetourn(action,page,res);
                        }
                        else {
                        this.result ="petit pepin";
                        }
              
	}
	xhr.open("POST","modules/"+pageSend,true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send("AJAX="+value);
	} 
 
}

function getXhr()
{
var xhr = null;

	if(window.XMLHttpRequest) // Firefox et autres
		xhr = new XMLHttpRequest(); 
	else if(window.ActiveXObject){ // Internet Explorer 
		try {
		xhr = new ActiveXObject("Msxml2.XMLHTTP");
		
			} catch (e) {
		 xhr = new ActiveXObject("Microsoft.XMLHTTP");
		 
			 }
		 }
	else { 
				// XMLHttpRequest non supporté par le navigateur 
					A= new non();
					
					xhr = false;
					
		} 
return xhr;
}

 
 
function loader(script){
if($("#"+script)){
$("#"+script).remove();
}  
     var script_src = document.createElement("script");
     script_src.type = "text/javascript";
     script_src.id=script;
     script_src.src="modules/"+script+"/"+script+".js";
     document.getElementsByTagName("head")[0].appendChild(script_src);
        
}



function load_pluggin(pageSend,action,script,value){
     if(typeof(plugginLoad)!='object'  ){
     loader (script);
     to =   setTimeout( "load_pluggin('"+pageSend+"','"+action+"','"+script+"','"+value+"')",20);
     }
     else {
     clearTimeout(to);
     execute.SendAJAXwhithReturn(pageSend,action,page,value);
     }
}

function load_script(pageSend,action,script,value){
     if(typeof(page)!='object'  ){
     loader (script);
     to =   setTimeout( "load_script('"+pageSend+"','"+action+"','"+script+"','"+value+"')",20);
     }
     else {
     clearTimeout(to);
     execute.SendAJAXwhithReturn(pageSend,action,page,value);
     }
}

   function extract_DATA(data_string)
    {
    var _DataStore=[];
    var DataStores=[];

    
    //var myData =   String(data_string); 
  var myData =  data_string; 
 
    myData = myData.replace(/<\/coll>/ig, "");
    myData = myData.replace(/<\/line>/ig, "");
    myData = myData.replace(/<\/cell>/ig, "");
    
            enter = myData.split('<coll>');
            enter.shift();
            for ( u = 0 ; u < enter.length  ; u ++)
            {
            _DataStore[u]=[];
            DataStores[u] = enter[u].split ('<line>');
            DataStores[u].shift();
                        for ( i = 0 ; i< DataStores[u].length ; i ++)
                        {
                        DataStores[u][i] = DataStores[u][i].split('<cell>');
                        DataStores[u][i].shift();
                        _DataStore[u][i] = DataStores[u][i]; 
                        }
                        }
 
        return (_DataStore);
    }
    
function ajouteEvent(objet, typeEvent, nomFunction, typePropagation)
{
		 if (objet.addEventListener) {
				  objet.addEventListener(typeEvent, nomFunction, typePropagation);
		 }
		 else if (objet.attachEvent) {
				 objet.attachEvent('on' + typeEvent, nomFunction);
		 }
}



Timers = {
	start : function (time) {		
			this.time = time;
	          if(this.time < 1 ){
			this.time++;
               this.timer =   setTimeout( "Timers.start("+this.time+")",50);
	          }
               else {
			this.time = 0;
               Timers.stop();
			Timers.end();
               }
  	},
	stop : function () {
	this.time = 0 ;
	if ( this.timer ){
     clearTimeout(this.timer);
	}
	}	
}

Waiter = {
	start : function () {
 	dom =  new domHTML();
     PageSize = getPageSize();
    // alert(PageSize[1]+" "+ PageSize[2]+" "+PageSize[3]+" "+ PageSize[4]);
    if ( $("#waiter") ) {$("#waiter").remove();}
 	_layout = dom.create({idParent : "body", id : "waiter" , top:0+"px" ,alpha : 30 , left : 0+"px" , height : PageSize[1]+"px",width : PageSize[2]+"px",background : "#000", zIndex : 10 , position : "absolute"  });    
	},
	stop : function () {
     if ( $("#waiter") ) {$("#waiter").remove();}
	}	
}







function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}
 
	arrayPageScroll = new Array('',yScroll) ;
	return arrayPageScroll;
}



//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}






 
