function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}

	}
	return xmlHttp;
}

function fullwin(where){
   //var newwin = top.open(where,"newwin", "width=" + screen.width + ",height=" + screen.height + "menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no,scrollbars=no,fullscreen=yes");
   //newwin.moveTo(0,0);
  
   var newwin = window.open(where+"---","newwindow","width=1000,height=750,top=0,left=0,menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no,scrollbars=no,copyhistory=no");
   newwin.focus();
 }
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 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 MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
function hidelayer(lay) {
	ns4 = (document.layers)? true:false;
	ie4 = (document.all)? true:false;
	nc6 = (typeof(window.controllers) != 'undefined' && typeof(window.locationbar) != 'undefined')? true:false;
	isW3C = (document.getElementById) ? true : false

if (ie4) {document.all[lay].style.visibility = 'hidden';}
if (ns4) {document.layers[lay].visibility = 'hidden';}
if (nc6) {document.getElementById([lay]).style.visibility = 'hidden';}
if (!ie4 && !nc6 && !ns4) {document.getElementById([lay]).style.visibility = 'hidden';}
}

function showlayer(lay) {

	ns4 = (document.layers)? true:false;
	ie4 = (document.all)? true:false;
	nc6 = (typeof(window.controllers) != 'undefined' && typeof(window.locationbar) != 'undefined')? true:false;
	isW3C = (document.getElementById) ? true : false
	
if (ie4) {document.all[lay].style.visibility = 'visible';}
if (ns4) {document.layers[lay].visibility = 'visible';}
if (nc6) {document.getElementById([lay]).style.visibility = 'visible';}
if (!ie4 && !nc6 && !ns4) {document.getElementById([lay]).style.visibility = 'visible';}
}

function writetolayer(lay,txt) {

	ns4 = (document.layers)? true:false;
	ie4 = (document.all)? true:false;
	nc6 = (typeof(window.controllers) != 'undefined' && typeof(window.locationbar) != 'undefined')? true:false;
	isW3C = (document.getElementById) ? true : false

if (ie4) {
document.all[lay].innerHTML ='';
document.all[lay].innerHTML = txt;
}
if (ns4) {
document[lay].document.write(txt);
document[lay].document.close();
}
if (nc6) {
over = document.getElementById([lay]);
range = document.createRange();
range.setStartBefore(over);
domfrag = range.createContextualFragment(txt);
while (over.hasChildNodes()) {
over.removeChild(over.lastChild);
}
over.appendChild(domfrag);
   }


if (!ie4 && !nc6 && !ns4) {
over = document.getElementById([lay]);
range = document.createRange();
range.setStartBefore(over);
domfrag = range.createContextualFragment(txt);
while (over.hasChildNodes()) {
over.removeChild(over.lastChild);
}
over.appendChild(domfrag);
   }
}
   

function open_panel() {
	document.chgframe.FRAMESETPARAM.value='*,160';
	document.chgframe.FRAMESETISOPEN.value='1';
	document.chgframe.main_href.value=parent.main.location.href;
	document.chgframe.panel_href.value=parent.panel.location.href;

}

function close_panel() {
	document.chgframe.FRAMESETPARAM.value='*,40';
	document.chgframe.FRAMESETISOPEN.value='0';
	document.chgframe.main_href.value=parent.main.location.href;
	document.chgframe.panel_href.value=parent.panel.location.href;
}

function newwin(url) {
window.open(url,"popuplinkeo",'width=360,height=360,top=5,left=5,toolbar=no,location=no, directories=no,status=no,scrollbars=no,resizable=1');
}
function newwincountry(url) {
window.open(url,"country",'width=320,height=320,top=100,left=100,toolbar=no,location=no, directories=no,status=no,scrollbars=no,resizable=1');
}

function FindImage(elementName)   // uses partial name
{
	with (document) 
		for (var i = 0; i < images.length; i++) { 
		        if (images[i].id != null)
				if (images[i].id.indexOf(elementName) != -1) 
						return images[i];
	}
	return null;
}

function closeWindow(inWindow)
{
	if (inWindow != null)
		if (!inWindow.closed) // old ns needs this
			inWindow.close();
	inWindow = null;		
}

function FindElement(elementName)			// uses partial name
{
	if (document.getElementById) {
		var e1 = document.getElementById(elementName);
		if (e1 != null) return e1;
	}
	
	var frm = document.forms[0];
	var el = frm.elementName;
	if (el != null) return el;
	for (var i = 0; i < frm.elements.length; i++)   {
		if (frm.elements[i].name.indexOf(elementName) != -1) {
			return frm.elements[i];
		}
	}
	return null;
}

function OpenPriceCalcWindow(url) {	
	var url
	window.open(url,"Calculator","width=690,height=900,top=7,left=4,alwaysRaised=yes,status=0,resizable=0,scrollbars=1,toolbar=0,directories=0,menubar=0,location=0,copyhistory=0,titlebar=0");
}

function OpenMaqWindow(url) {	
	var url
	window.open(url,"","width=690,height=800,top=50,left=60,alwaysRaised=yes,status=0,resizable=0,scrollbars=1,toolbar=0,directories=0,menubar=0,location=0,copyhistory=0,titlebar=0");
}

function OpenPrevWindow(url) {	
	var url
	window.open(url,"Preview","width=430,height=430,top=50,left=60,alwaysRaised=yes,status=0,resizable=0,scrollbars=1,toolbar=0,directories=0,menubar=0,location=0,copyhistory=0,titlebar=0");
}

function OpenFlaWindow(url) {	
	var url
	window.open(url,"flashframe","width=740,height=600,top=60,left=50,alwaysRaised=yes,status=0,resizable=0,scrollbars=1,toolbar=0,directories=0,menubar=0,location=0,copyhistory=0,titlebar=0");
}

function OpenGameWindow(url) {	
	var url
	window.open(url,"flashframe","width=890,height=660,top=60,left=50,alwaysRaised=yes,status=0,resizable=0,scrollbars=1,toolbar=0,directories=0,menubar=0,location=0,copyhistory=0,titlebar=0");
}


function OpenTelWindow(url) {	
	var url
	window.open(url,"telpopup","width=280,height=170,top=500,left=500,alwaysRaised=yes,status=0,resizable=0,scrollbars=0,toolbar=0,directories=0,menubar=0,location=0,copyhistory=0,titlebar=0");
}

function OpenDownloadWindow(url) {	
	var url
	window.open(url,"Download","width=690,height=900,top=60,left=50,alwaysRaised=yes,status=0,resizable=1,scrollbars=1,toolbar=0,directories=0,menubar=0,location=0,copyhistory=0,titlebar=0");
}


function OpentxtWindow(url) {
	var url
	ns4 = (document.layers)? true:false;
	ie4 = (document.all)? true:false;
	nc6 = (typeof(window.controllers) != 'undefined' && typeof(window.locationbar) != 'undefined')? true:false;
	isW3C = (document.getElementById) ? true : false

	if (url != null)
	{
		if (url.indexOf("home/")==-1)
		{
		window.open(url,"Help","width=690,height=900,top=50,left=50,alwaysRaised=yes,status=0,resizable=0,scrollbars=1,toolbar=0,directories=0,menubar=0,location=0,copyhistory=0,titlebar=0");
		}
		if (url.indexOf("home/")!=-1)
		{
		url="home/default.asp?article="+url
		window.open(url,"Help","width=690,height=900,top=50,left=50,alwaysRaised=yes,status=0,resizable=0,scrollbars=1,toolbar=0,directories=0,menubar=0,location=0,copyhistory=0,titlebar=0");
		}
	}
}

function OpentxtWindow2(url,zone) {
	var url
	ns4 = (document.layers)? true:false;
	ie4 = (document.all)? true:false;
	nc6 = (typeof(window.controllers) != 'undefined' && typeof(window.locationbar) != 'undefined')? true:false;
	isW3C = (document.getElementById) ? true : false

	if (url != null)
	{
		if (url.indexOf("home_"+zone+"/")==-1)
		{
		window.open(url,"Help","width=600,height=600,top=50,left=50,alwaysRaised=yes,status=0,resizable=0,scrollbars=1,toolbar=0,directories=0,menubar=0,location=0,copyhistory=0,titlebar=0");
		}
		if (url.indexOf("home_"+zone+"/")!=-1)
		{
		url="home_"+zone+"/default.asp?article="+url
		window.open(url,"Help","width=600,height=600,top=50,left=50,alwaysRaised=yes,status=0,resizable=0,scrollbars=1,toolbar=0,directories=0,menubar=0,location=0,copyhistory=0,titlebar=0");
		}
	}
}

function OpentxtWindowpara(url,para) {
	var url
	ns4 = (document.layers)? true:false;
	ie4 = (document.all)? true:false;
	nc6 = (typeof(window.controllers) != 'undefined' && typeof(window.locationbar) != 'undefined')? true:false;
	isW3C = (document.getElementById) ? true : false

	if (url != null)
	{
		if (url.indexOf("home/")==-1)
		{
		window.open(url,"Help","width=600,height=600,top=50,left=50,alwaysRaised=yes,status=0,resizable=0,scrollbars=1,toolbar=0,directories=0,menubar=0,location=0,copyhistory=0,titlebar=0");
		}
		if (url.indexOf("home/")!=-1)
		{
		url="home/default.asp?article="+url+para
		window.open(url,"Help","width=600,height=600,top=50,left=50,alwaysRaised=yes,status=0,resizable=0,scrollbars=1,toolbar=0,directories=0,menubar=0,location=0,copyhistory=0,titlebar=0");
		}
	}
}

function OpentxtWindowpara2(url,para,zone) {
	var url
	ns4 = (document.layers)? true:false;
	ie4 = (document.all)? true:false;
	nc6 = (typeof(window.controllers) != 'undefined' && typeof(window.locationbar) != 'undefined')? true:false;
	isW3C = (document.getElementById) ? true : false

	if (url != null)
	{
		if (url.indexOf("home_"+zone+"/")==-1)
		{
		window.open(url,"Help","width=600,height=600,top=50,left=50,alwaysRaised=yes,status=0,resizable=0,scrollbars=1,toolbar=0,directories=0,menubar=0,location=0,copyhistory=0,titlebar=0");
		}
		if (url.indexOf("home_"+zone+"/")!=-1)
		{
		url="home_"+zone+"/default.asp?article="+url+para
		window.open(url,"Help","width=600,height=600,top=50,left=50,alwaysRaised=yes,status=0,resizable=0,scrollbars=1,toolbar=0,directories=0,menubar=0,location=0,copyhistory=0,titlebar=0");
		}
	}
}
///
function CheckList(elCheckBox, elSelectList)
{
	var elBox = FindElement(elCheckBox);
	var elList = FindElement(elSelectList);

	for (var i = 0; i < elList.length; i++)
	{
		elList.options[i].selected = elBox.checked;
	}
}
function CheckRFList(elCheckBox1, elCheckBox2, elSelectList)
{
	var elBox1 = FindElement(elCheckBox1);
	var elBox2 = FindElement(elCheckBox2);
	var elList = FindElement(elSelectList);

	if (elBox1.checked) elBox2.checked = false;
	for (var i = 0; i < elList.length; i++)
	{
		elList.options[i].selected = elBox1.checked;
	}
	
}
function CheckValueList(elCheckBox1, elCheckBox2, elSelectList, strValueBrands)
{
	var elBox1 = FindElement(elCheckBox1);
	var elBox2 = FindElement(elCheckBox2);
	var elList = FindElement(elSelectList);
	var match = false;
	var brandList;

	if (elBox2.checked)
	{
		elBox1.checked = false;
		CheckList(elCheckBox1, elSelectList);
	}
	if (strValueBrands != null && strValueBrands.length > 0)
	{
		brandList = strValueBrands.split(",");
		for (var j = 0; j < brandList.length; j++)
		{
			for (var i = 0; i < elList.length; i++)
			{
				if (elList.options[i].value == brandList[j])
				{
					elList.options[i].selected = elBox2.checked;
					break;
				}
			}
		}
	}
	
}

function ManageCheckBox(elCheckBox, elSelectList)
{ 
	var elBox = FindElement(elCheckBox);
	var elList = FindElement(elSelectList);

	if (elBox != null && elList != null)
		for (var i = 0; i < elList.options.length; i++)
			if (!elList.options[i].selected)
			{
				elBox.checked = false;
				return;
			}
	elBox.checked = true; 
}
function SyncRFandValueCheckbox(elCheckBox1, elCheckBox2)
{ 
	var elBox1 = FindElement(elCheckBox1);
	var elBox2 = FindElement(elCheckBox2);
	if (elBox1 != null && elBox2 != null)
	{
		if(elBox1.checked && elBox2.checked)
		{
				elBox2.checked = false;
		}
	}
}
function ManageRFCheckBoxs(elCheckBox1, elCheckBox2, elSelectList, strValueBrands)
{ 
	var elBox1 = FindElement(elCheckBox1);
	var elBox2 = FindElement(elCheckBox2);
	var elList = FindElement(elSelectList);
	var brandList = strValueBrands.split(",");

	elBox1.checked = true;
	if (elBox1 != null && elList != null)
	{
		for (var i = 0; i < elList.options.length; i++)
		{
			if (!elList.options[i].selected)
			{
				elBox1.checked = false;
				break;
			}
		}
	}
	elBox2.checked = false;
	var shouldCheck = true;
	var selectedCount = 0;
	if (elBox2 != null && brandList != null && elList != null)
	{
		
		for (var j = 0; j < elList.options.length; j++)
		{
			if (elList.options[j].selected)
			{
				//check if the selected item is in the value collection list
				var isInList = false;
				for (var i = 0; i < brandList.length; i++)
				{
					if (elList.options[j].value == brandList[i])
					{
						isInList = true;
						selectedCount++;
						break;
					}
				}
				if (!isInList)
				{
					shouldCheck = false;
					break;
				}	
			}
		}
		
		if (shouldCheck && selectedCount == brandList.length)
			elBox2.checked = true;
	}
	
}

function cacheOff()
{

	var nava = (document.layers);
	var dom = (document.getElementById);
	var iex = (document.all);

	if (nava) { cach = document.cache }
	else if (dom) { cach = document.getElementById('cache').style }
	else if (iex) { cach = cache.style }

	largeur = screen.width;
	cach.left = Math.round((largeur/2)-200);
	cach.visibility = 'hidden';

	var content ='';
	content +='<TABLE cellSpacing=0 cellPadding=1 width=400 bgColor=#000000 border=0>';
	content +='<TR>';
	content +='<TD vAlign=center class=verdana10>';
	content +='<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0 class=v10_6>';
	content +='<TR>';
	content +='<TD Align=center class=v11><BR><B>'+'Merci de patienter'+'</B><BR>';
	content +='<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ID="detect" WIDTH=200 HEIGHT=100 ALIGN="">';
	content +='<PARAM NAME=movie VALUE="home/flash/loading.swf">';
	content +='<PARAM NAME=loop VALUE=true>';
	content +='<PARAM NAME=menu VALUE=false>';
	content +='<PARAM NAME=quality VALUE=high>';
	content +='<PARAM NAME=bgcolor VALUE=#ffffff>';
	content +='<EMBED src="home/flash/loading.swf" loop=true menu=false quality=high bgcolor=#ffffff swLiveConnect=FALSE WIDTH=200 HEIGHT=100 NAME="detect" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">';
	content +='</EMBED>';
	content +='</OBJECT>';
	content +='</TD>';
	content +='</TR>';
	content +='</TABLE>';
	content +='</TD>';
	content +='</TR>';
	content +='</TABLE>';

	if (nava)
 	{
    		cach.document.write(content);
	 	cach.document.close();
	  	cach.visibility = 'visible';
  	}
    		else if (dom)
  	{
	 	document.getElementById('cache').innerHTML = content;
		cach.visibility = 'visible';
  	}
  	else if (iex)
	{
	  		document.all('cache').innerHTML = content;
	  		cach.visibility = 'visible';
  	}

}

function cacheOffgif()
{

	var nava = (document.layers);
	var dom = (document.getElementById);
	var iex = (document.all);

	if (nava) { cach = document.cache; }
	else if (dom) { cach = document.getElementById('cache').style; }
	else if (iex) { cach = cache.style; }

	largeur = screen.width;
	cach.left = Math.round((largeur/2)-300);
	cach.visibility = 'hidden';

	if (nava)
 	{
	 	cach.document.close();
	  	cach.visibility = 'visible';
  	}
    	else if (dom)
  	{
		cach.visibility = 'visible';
  	}
  	else if (iex)
	{
	  	cach.visibility = 'visible';
  	}

}



