// espace de nom  realisée par lazaar sami pour la gestion des appel asynchrones utilisant la bib yahoo
if (typeof LAZAAR.UTILS.AsynchDBOp == "undefined") {
    /**
     * The LAZAAR.UTILS.AsynchDBOp global namespace object.  If LAZAAR.UTILS.AsynchDBOp is already defined, the
     * existing LAZAAR.UTILS.AsynchDBOp object will not be overwritten so that defined
     * namespaces are preserved.
     * @class AsynchDBOp
     * @static
     */
   LAZAAR.UTILS.AsynchDBOp={};
}


			
//classe static pour la gestion des oeuvres du space name LAZAAR.UTILS.AsynchDBOp
LAZAAR.UTILS.AsynchDBOp.KANVASArchive=
{
		PROXY:function() 
		{ 
			//pour eliminer que ie mettre la page en cache
			var rand=parseInt(777*Math.random(0,1));
			return "index.asp?Random="+rand;
		}
		,
		currentPage:""
		,
		currentDate:0
		,
		WAITDLG:new YAHOO.widget.Panel("wait",  
			{ width:"65px", 
			  fixedcenter:true, 
			  close:false, 
			  draggable:false, 
			  zindex:4,
			  modal:true,
			  visible:false,
			 constraintoviewport: true 
			} 
		),
		MENU : new YAHOO.widget.Panel('widget_menu', { 
	            visible:false, 
	            width: '420px',
	            zIndex: 9999, 
	            close: false, 
	            fixedcenter: true, 
	            modal: true, 
	            draggable: true, 
	            constraintoviewport: true 
	          
	        })
		,
		Init:function()
		{
			this.WAITDLG.setHeader("");
			this.WAITDLG.setBody('<img src="DESIGN/wait.gif" />');
			this.WAITDLG.render(document.body);
			this.MENU.setHeader("Bienvenue dans l'espace client"); 
			//this.MENU.setBody('Veuillez séléctionner une tache<br>'+document.getElementById("mm").innerHTML); 
	   // this.MENU.setFooter('<span id="buttonSpan" class="button-group"></span>'); 
	   		this.MENU.render(document.body);
			
		}
		,
		callback : 
		{
			cache:false ,
			customevents:
			{
				onStart:function(eventType, args)
				{
					LAZAAR.UTILS.AsynchDBOp.KANVASArchive.WAITDLG.show();
				// eventType has a string value of "startEvent". 
          		// args[0].tId is the integer transaction ID. 
	          	// args[1] contains the value of <code>callback.argument</code>, if callback.argument is defined.
				//alert('ghjgjhg');
				}//fin onstart,
				,
				onComplete:function(eventType, args)
				{
					
					LAZAAR.UTILS.AsynchDBOp.KANVASArchive.WAITDLG.hide();
				
					// eventType has a string value of "completeEvent". 
	          // args[0].tId is the integer transaction ID. 
	          // args[1] contains the value of <code>callback.argument</code>, if callback.argument is defined.
				}//fin onComplete
				,
				onSuccess:function(eventType, args)
				{
					/*
					* eventType has a string value of "successEvent".
					* args[0] is the response object, which has the
					* following properties:
					*
					* args[0].tId
					* args[0].status
					* args[0].statusText
					* args[0].getResponseHeader[ ]
					 * args[0].getAllResponseHeaders
					* args[0].responseText
					* args[0].responseXML
					* args[0].argument
					 */
					 /*alert(args[0].responseText);*/
					location.href="index.asp?Date="+args[0].responseText;
					/*
					if((args[0].responseXML !== undefined)&&(args[0].responseXML !== null))
					 {
						
						var REPXML=args[0].responseXML;
						var response=REPXML.documentElement;
						
						//alert();
						//var statue=response.selectSingleNode("@statue").value;
						var statue=response.attributes[0].value;
						
						switch (statue)
						{
						
						case 'OK':
						    alert("la reponse est:"+args[0].responseText);
						   
							break;	
						case 'CONNECT-NOTOK':
						   // alert("la reponse est:"+args[0].responseText);
						   var error=response.firstChild.firstChild.nodeValue;
							try
							{
								var div_tag=document.getElementById("currentState");
								div_tag.style.display="block";
								var msg_tag=document.getElementById("alert_message");
								msg_tag.innerHTML=error.replace('\\n','<br>');
							}
							catch(erreur1){}
							alert(error.replace('\\n','\n'));
							break;	
						
						default:
							alert ('Cotunace Clients Management\n\nErreur serveur! ');			
							break;
							
						}
					}
					else
					alert ('Cotunace clients Management \n\nune erreur est survenue,impossible de recevoir une reponse depuis le serveur');*/
				
				}//fin onSuccess
				,
				
				onFailure:function(eventType, args)
				{
					// eventType has a string value of "failureEvent". 
	          		// args[0] is the response object.
			 		 alert('Cotunace Contents Management System\n\nImpossible de communiquer avec le serveur!');
				}//fin onFailure
				,
				// Define this event handler for file upload transactions *only*. 
        		// This handler will not be used for any other transaction cases. 
	       	 	onUpload:function(eventType, args)
				{ 
          			// eventType has a string value of "uploadEvent". 
	          		// args[0] is the response object. 
        		}//fin onUpload
				, 
				onAbort:function(eventType, args)
				{
					 // eventType has a string value of "abortEvent". 
		 			 // args[0].tId is the integer transaction ID. 
			  		// args[1] contains the value of <code>callback.argument</code>, if callback.argument is defined. 
				}//fin onAbort
		}//fincustomevents
	}//fin callback
	,
	exist_numero:function(val_date,page)
	{
		
		try
		{
		var val_date_tag = document.getElementById("Date");
		val_date_tag.value=val_date;
		var oForm = document.getElementById("form_archive_test");
		if (oForm!='undefined')
		{
			LAZAAR.UTILS.AsynchDBOp.KANVASArchive.currentPage=page;
			LAZAAR.UTILS.AsynchDBOp.KANVASArchive.currentDate=val_date;
			//YAHOO.util.Connect.setForm(oForm,false,true);
			//alert(val_date_tag.value);
			YAHOO.util.Connect.asyncRequest("post",'index.asp?Date='+val_date, this.callback);
		}
		}
		catch(ee)
		{
		}
	}
	
};
var KANVASArchive;
YAHOO.util.Event.onDOMReady(function(p_sType) 
									 {
										LAZAAR.UTILS.XML.ENLEVEBUGS_pour_F_FOX();
										LAZAAR.UTILS.AsynchDBOp.KANVASArchive.Init();
										KANVASArchive=LAZAAR.UTILS.AsynchDBOp.KANVASArchive;
									}
							);	
	

