function openw(url, width, height)
{
	var fenetre = window.open(url, "owSubmit","width="+width+",height="+height+",status=0,toolbar=0,location=0");
	f.target = "owSubmit";
	return true;
}
//------------------------------------------------------------------------------
// fonction de mise à jour du panier flash
function majpanier(panierprix,panierprds)
{
	if(document.getElementById("eglueheader") && document.getElementById("eglueheader").majpanier)
		document.getElementById("eglueheader").majpanier(panierprix, panierprds);
}

//------------------------------------------------------------------------------
// fonctino pour affichage homepage en rollover
function showhomelabel(elm)
{
	var elms = Array('labo', 'blog', 'stickers', 'defaut');
	for(cpt=0; cpt<elms.length; cpt++)
		if(document.getElementById('home'+elms[cpt]) && document.getElementById('home'+elms[cpt]))
			document.getElementById('home'+elms[cpt]).style.display = 'none';
	if(document.getElementById('home'+elm));
		document.getElementById('home'+elm).style.display = '';
}
//------------------------------------------------------------------------------
// fonction permettant de rajouter un element en panier
function addpanier(id, color, demikit)
{
	var param = 'products_id='+id+'&cart_quantity=1&addfromflash=1&id[txt_4]='+escape(demikit)+'&id[txt_color]='+color;
	makeXMLRequest('index.php?action=add_product', 'POST', param, 'addpanier_back');
}
function addpanier2(id)
{
	var param = 'products_id='+id+'&cart_quantity=1&addfromflash=1';
	makeXMLRequest('index.php?action=add_product', 'POST', param, 'addpanier_back');
}
function addpanier_back(response)
{
	var regresults = /result="(OK|KO)" prix="([0-9.,]+)" prds="([0-9.,]+)"/ig;
	var results = regresults.exec(response);
	if(results[1]=='OK')
		majpanier(results[2],results[3]);
	regresults.lastIndex = 0;
}
function makeXMLRequest(url, sendmethod, params, callbackfunc) 
{
    var http_request = false;
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
            // Voir la note ci-dessous à propos de cette ligne
        }
    } else if (window.ActiveXObject) { // IE
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }
    if (!http_request)
	{
        alert('Abandon :( Impossible de créer une instance XMLHTTP');
        return false;
    }
    
    http_request.onreadystatechange = function() 
	{ 
	    if (http_request.readyState == 4) {
			tmp = http_request.responseText;
			eval(callbackfunc+'(tmp)');
		}
	};
	if(sendmethod=='POST' || sendmethod=='post')
	{
	    http_request.open(sendmethod, url, true);
		http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		http_request.setRequestHeader("Content-length", params.length);
		http_request.setRequestHeader("Connection", "close");
		http_request.send(params);
    }
    else
    {
	    http_request.open(sendmethod, url+"?"+params, true);
		http_request.send(null);
	}
}
function showhide(which)
{
	if(document.getElementById('homenews'+which).style.display=='')
		which = which==3 ? 1 : which+1; 
	for(cpt=1;cpt<=3;cpt++)
	{
		document.getElementById('homenewsbtn'+cpt).className = 'expand';
		document.getElementById('homenews'+cpt).style.display = 'none';
	}
	document.getElementById('homenewsbtn'+which).className = 'collapse';
	document.getElementById('homenews'+which).style.display = '';
}
var speed = 5;
function scrolldown(elm, elmContainer)
{
	crossobj = document.getElementById? document.getElementById(elm) : eval('document.all.' + elm);
	crossobjParent = document.getElementById? document.getElementById(elmContainer) : eval('document.all.' + elmContainer);
	if (parseInt(crossobj.style.top)>=(crossobj.offsetHeight*(-1) + parseInt(crossobjParent.style.height)))
		crossobj.style.top = parseInt(crossobj.style.top)-speed+"px";
	scrolldownvar = setTimeout("scrolldown('"+elm+"', '"+elmContainer+"')", 20);
}

function scrollup(elm)
{
	crossobj = document.getElementById ? document.getElementById(elm) : eval('document.all.' + elm);
	if (parseInt(crossobj.style.top)<=0)
		crossobj.style.top=parseInt(crossobj.style.top)+speed+"px";
	scrollupvar=setTimeout("scrollup('"+elm+"')",20);
}

function scrollright(elm, elmContainer)
{
	crossobj = document.getElementById? document.getElementById(elm) : eval('document.all.' + elm);
	crossobjParent = document.getElementById? document.getElementById(elmContainer) : eval('document.all.' + elmContainer);
	
	if (parseInt(crossobj.style.left)>=(crossobj.offsetWidth*(-1)+ parseInt(crossobjParent.style.width) ))
		crossobj.style.left = parseInt(crossobj.style.left)-speed+"px";
	scrollrightvar = setTimeout("scrollright('"+elm+"', '"+elmContainer+"')", 20);
}
function scrollleft(elm)
{
	crossobj = document.getElementById? document.getElementById(elm) : eval('document.all.' + elm);
	if (parseInt(crossobj.style.left)<=0)
		crossobj.style.left=parseInt(crossobj.style.left)+speed+"px";
	scrollleftvar = setTimeout("scrollleft('"+elm+"')",20);
}
function html2js(chaine)
{
	aRemplacer = /&eacute;/g;
	chaine = chaine.replace(aRemplacer, 'é')
	aRemplacer = /&egrave;/g;
	chaine = chaine.replace(aRemplacer, 'è')
	aRemplacer = /&agrave;/g;
	chaine = chaine.replace(aRemplacer, 'à')
	return chaine;
}

