function loadAjax(MyUrl,DivContent){
document.getElementById(DivContent).innerHTML='<br/><div align="center"><img src="/images/anim_ajax1_big.gif" alt="" /><div id="contentLoading"><!--Loading...--></div></div><br/>';
$("#"+DivContent).load(MyUrl);
/*
jQuery(function($) {
$("#"+DivContent).load(MyUrl);
});
$("#"+DivContent).animate({
   left: 50, opacity: 'show'
 }, 500);
//$("#"+DivContent).slideDown("slow");

$().ajaxSend(function(r,s){
$("#contentLoading").show();
});

$().ajaxStop(function(r,s){
$("#contentLoading").fadeOut("fast");
});
*/
}



function getContent(url,divname){
	var xhr_object = null;
	var contentString ='NO CONTENT';
	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){
			//alert(xhr_object.responseText);
			contentString = xhr_object.responseText;
			document.getElementById(divname).innerHTML = contentString;
		}
	}
	xhr_object.send(null);
}
function OpenBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  neo=window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
  if(neo.window.focus){neo.window.focus();}
}
function changeUrlAjaxIframe(url,divname){
	//if(window.readyState==4){
	//document.getElementById(divname).innerHTML ='<img src="images/loading.gif" alt="" />';
	var xhr_object = null;
	var contentString ='NO CONTENT';
	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); //async
	//xhr_object.open("GET", url, false); //sync
	//http://www.xul.fr/XMLHttpRequest.html
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4){
			contentString = xhr_object.responseText;
			window.parent.document.getElementById(divname).innerHTML = contentString;
		}
		//while(xhr_object.readyState == 4){}// Utile pour forcer l'attente de fin de script (probleme asynchrone!!!)

	}
	xhr_object.send(null);
	//}
}

function toggleDiv(idDiv,idImg){
	if(document.getElementById(idDiv).style.display=='none'){
		document.getElementById(idDiv).style.display='block';
		if(document.getElementById(idImg)){
			document.getElementById(idImg).src="/images/icons/moins.gif";
		}
	}else{
		if(document.getElementById(idDiv).style.display=='block'){
			document.getElementById(idDiv).style.display='none';
			if(document.getElementById(idImg)){
				document.getElementById(idImg).src="/images/icons/plus.gif";
			}
		}else{

		}
	}
}
		function openDisplay(myId){
			if(document.getElementById('displayDiv'+myId)){//to prevent error if display doesn't exist
				if(document.getElementById('displayDiv'+myId).style.display=='none'){
					document.getElementById('displayIco'+myId).src='/images/icons/display_open.gif';
					document.getElementById('displayDiv'+myId).style.display='block';
				}else{
					document.getElementById('displayIco'+myId).src='/images/icons/display_close.gif';
					document.getElementById('displayDiv'+myId).style.display='none';
				}
			}
		}





//default function for IE bug with document.getElementById()
//http://www.sixteensmallstones.org/ie-javascript-bugs-overriding-internet-explorers-documentgetelementbyid-to-be-w3c-compliant-exposes-an-additional-bug-in-getattributes
if (/msie/i.test (navigator.userAgent)) //only override IE
{
	document.nativeGetElementById = document.getElementById;
	document.getElementById = function(id)
	{
		var elem = document.nativeGetElementById(id);
		if(elem)
		{
			//make sure that it is a valid match on id
			if(elem.id == id)
			{
				return elem;
			}
			else
			{
				//otherwise find the correct element
				for(var i=1;i<document.all[id].length;i++)
				{
					if(document.all[id][i].id == id)
					{
						return document.all[id][i];
					}
				}
			}
		}
		return null;
	};
}

