function PopupImage(img) {
	titre="ZOOM";
	w=open("",'image','width=400,height=400,toolbar=no,scrollbars=no,resizable=no');	
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+12,document.images[0].height+30); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><IMG src='"+img+"' border=0 onClick='javascript:window.close();' style='cursor:hand'>");
	w.document.write("");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


function affCalendar(chps)
{
	urlCalendar = "";
	document.getElementById("calendardu").style.visibility = 'hidden';
	document.getElementById("calendardu").innerHTML = "";
	document.getElementById("calendarau").style.visibility = 'hidden';
	document.getElementById("calendarau").innerHTML = "";
	if(document.getElementById("du"))
	{
		if(document.getElementById("du").value != " jj/mm/aaaa" && document.getElementById("du").value != "")
		{
			urlCalendar = "/_includes/asp/calendar.asp?chps="+chps+"&dateLimite="+document.getElementById("du").value;
		}else{
			urlCalendar = "/_includes/asp/calendar.asp?chps="+chps;
		}
	}else{
		urlCalendar = "/_includes/asp/calendar.asp?chps="+chps;
	}
	//alert(urlCalendar);
	loadPage(urlCalendar,'calendar'+chps);
}

function select_date(dat,cible){
	document.getElementById(cible).value=dat;
	document.getElementById("calendar"+cible).style.visibility = 'hidden';
	document.getElementById("calendar"+cible).innerHTML = "";
}

function closeCalendar(cible)
{
	document.getElementById("calendar"+cible).style.visibility = 'hidden';
	document.getElementById("calendar"+cible).innerHTML = "";
}

function validFormCalendar(chps)
{
	loadPage("../_includes/asp/calendar.asp?chps="+chps+"&START_MONTH="+document.getElementById("START_MONTH").options[document.getElementById("START_MONTH").selectedIndex].value+"&START_YEAR="+document.getElementById("START_YEAR").options[document.getElementById("START_YEAR").selectedIndex].value,"calendar"+chps);
}

function loadAjax(url,cible,src)
{
	//Changement du contenu
	var xhr_object = null; 
	document.getElementById(cible).innerHTML = "Chargement ...";
 
	if(window.XMLHttpRequest) // Firefox 
	   xhr_object = new XMLHttpRequest(); 
	else if(window.ActiveXObject) // Internet Explorer 
	   xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
	else { // XMLHttpRequest non supporté par le navigateur 
	   alert("Votre navigateur ne supporte pas l'ajax ..."); 
	   return; 
	} 
	//xhr_object.open("GET", url+'&cible='+cible, true); 
	xhr_object.open("GET", url, true); 
	xhr_object.onreadystatechange = function() 
	{ 
	   if(xhr_object.readyState == 4)
	   {
			document.getElementById(cible).innerHTML = xhr_object.responseText;
		}
	} 
	xhr_object.send(null); 
}

function loadPage(url,cible)
{
	//Changement du contenu
	var xhr_object = null; 
	document.getElementById(cible).innerHTML = '';
	document.getElementById(cible).style.visibility = 'visible';
	//document.getElementById(cible).innerHTML = "";
 
	if(window.XMLHttpRequest) // Firefox 
	   xhr_object = new XMLHttpRequest(); 
	else if(window.ActiveXObject) // Internet Explorer 
	   xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
	else { // XMLHttpRequest non supporté par le navigateur 
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
	   return; 
	} 
 
	xhr_object.open("GET", url, true);
	
	xhr_object.onreadystatechange = function() 
	{ 
	   if(xhr_object.readyState == 4)
	   {
	   		document.getElementById(cible).innerHTML = xhr_object.responseText;
			document.getElementById(cible).style.visibility = 'visible';
		}
	} 
	 
	xhr_object.send(null); 
}
