// Ces fonctions permettent d'aligner les onglets avec la fiche détaillée du produit

function findPosX(obj) {
    var curleft = 0;
    if (obj.offsetParent) {
        while (1) {
            curleft+=obj.offsetLeft;
            if (!obj.offsetParent) {
                break;
            }
            obj=obj.offsetParent;
        }
    } else if (obj.x) {
        curleft+=obj.x;
    }
    return curleft;
}

function checkWidth(obj, w)
{
	if (obj.width > w)
	{
		obj.height	= Math.round(obj.height/(obj.width/w));
		obj.width 	= w;
	}
}

function getMargin(obj)
{
	p1 = findPosX(document.getElementById("position1"));
	p2 = findPosX(document.getElementById("position2"));
	obj.style.marginRight = p1 - p2 - 8 + "px";
}