function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function sendsearch(frm) {
 frm.submit();
}

function openPopup(imageName,imageWidth,imageHeight,alt,posLeft,posTop) {
	newWindow = window.open("popup.htm","newWindow","width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
	newWindow.focus();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_controlShockwave(objStr,x,cmdName,frameNum) { //v3.0
  var obj=MM_findObj(objStr);
  if (obj) eval('obj.'+cmdName+'('+((cmdName=='GotoFrame')?frameNum:'')+')');
}

function Min (a, b) {
	if (a < b) {return a;}
	else {return b;}
}	
function autoSize() {
	self.resizeTo(Min((document.images[0].width+20), screen.width-50), Min((document.images[0].height+70), screen.height-25));
	document.body.style.overflow='hidden';
} 
function autoSizebyWH(w,h) {
	self.resizeTo(Min((w+20), screen.width-50), Min((h+70), screen.height-25));
	document.body.style.overflow='hidden';
}
function autoSizebyWH2(w,h) {
	self.resizeTo(Min((w+5), screen.width-50), Min((h+54), screen.height-25));
	document.body.style.overflow='hidden';
} 

function hauteur_fenetre(webH)
{
 if (window.innerHeight) return ((window.innerHeight-webH)/2)  ;
 else if (document.body && document.body.offsetHeight) return ((document.body.offsetHeight-webH)/2);
 else return 0;
}


function InsertSampleSWFMovie(data,width,height,WM)
{
	if (WM!="opaque" && WM!="transparent") { WM="opaque"; }	
	document.write('<object type="application/x-shockwave-flash" data="'+data+'" width="'+width+'" height="'+height+'" />\n');
	document.write('<param name="play" value="true" />\n');
	document.write('<param name="movie" value="'+data+'" />\n');
	document.write('<param name="menu" value="false" />\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<param name="scalemode" value="noborder" />\n');
	document.write('<param name="wmode" value="'+WM+'" />\n');
	document.write('<param name="type" value="application/x-shockwave-flash" />\n');
	document.write('<param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer"/>\n');
	document.write('<param name="pluginspage" value="http://www.macromedia.com/go/getflashplayer"/>\n');
  	document.write('</object>\n');
}

function checkSWFVersion()
{
	alert("OK");
	var flashinstalled = 0;
	var flashversion = 0;
	MSDetect = "false";
	if (navigator.plugins && navigator.plugins.length) {
		x = navigator.plugins["Shockwave Flash"];
		if (x) {
			flashinstalled = 2;
			if (x.description) {
				y = x.description;
				flashversion = y.charAt(y.indexOf('.')-1);
			}
		} else {
			flashinstalled = 1;
			if (navigator.plugins["Shockwave Flash 2.0"])
			{
				flashinstalled = 2;
				flashversion = 2;
			}
		}
	} else if (navigator.mimeTypes && navigator.mimeTypes.length) {
		x = navigator.mimeTypes['application/x-shockwave-flash'];
		if (x && x.enabledPlugin) {
			flashinstalled = 2;
		} else {
			flashinstalled = 1;
		}
	} else {
		MSDetect = "true";
	}
	return flashversion;
}
function changeMessage(txt1,txt2,txt3,txt4,lang)
{
	if (lang=="FR") {
		document.getElementById("file_frmt").innerHTML = "Format : "+txt1;
		if (txt2!="") {
			document.getElementById("file_weight").innerHTML = "Poids : "+txt2;
		}
		if (txt3!="") {
			document.getElementById("file_w").innerHTML = "Largeur : "+txt3+" pixels";
		}
		if (txt4!="") {
			document.getElementById("file_h").innerHTML = "Hauteur : "+txt4+" pixels";
		}
	} else {
		document.getElementById("file_frmt").innerHTML = "Format: "+txt1; 
		if (txt2!="") {
			document.getElementById("file_weight").innerHTML = "Weight: "+txt2;
		}
		if (txt3!="") {
			document.getElementById("file_w").innerHTML = "Width: "+txt3+" pixels";
		}
		if (txt4!="") {
			document.getElementById("file_h").innerHTML = "Height: "+txt4+" pixels";
		}
	}
}
function ResetMessage() {
	document.getElementById("file_frmt").innerHTML = "";
	document.getElementById("file_weight").innerHTML = "";
	document.getElementById("file_w").innerHTML = "";
	document.getElementById("file_h").innerHTML = "";
}
function envoieRequete(url,id)
{
	var xhr_object = null;
	var status = 0;
	if(window.ActiveXObject) {
		var xhr_object = new ActiveXObject("Microsoft.XMLHTTP") ;
	} else {
		var xhr_object = new XMLHttpRequest();
	}
	// On ouvre la requete vers la page désirée
	xhr_object.open("GET", url, true);
	xhr_object.onreadystatechange = function() {
		if (xhr_object.readyState==4 /*&& xhr_object.status==200*/)
		{
			// j'affiche dans la DIV spécifiées le contenu retourné par le fichier
			document.getElementById(id).innerHTML = xhr_object.responseText;	
		}
	}
	// dans le cas du get
	xhr_object.send(null);
}
function fixPNG(myImage) 
{
	var arVersion = navigator.appVersion.split("MSIE");
	var version = parseFloat(arVersion[1]);
	
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	   var imgTitle = (myImage.title) ? 
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	   var imgStyle = "display:inline-block;" + myImage.style.cssText
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
	   myImage.outerHTML = strNewHTML	  
    }
}
function CenterWebsite() {
	var WindowH = 0; 
	var FinalH = 0;
  	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		WindowH = window.innerHeight;
  	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		WindowH = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		WindowH = document.body.clientHeight;
	}
	
	if (WindowH>705) {
		FinalH = Math.round((WindowH-705)/2);
	}
	if (FinalH<0) {
		FinalH=0;	
	}
	document.getElementById('TopTable').style.height=FinalH-1;
	document.getElementById('BottomTable').style.height=FinalH;
}
