var largeurImage, hauteurImage;
var largeurVue, hauteurVue;
var largeurFenetre, hauteurFenetre;
var opSouris=0;
var largeurMin, largeurMax, largeurInit, hauteurInit;
var oldX, oldY;
var n= navigator.userAgent.toLowerCase();
var db= (document.comptaMode && document.comptaMode.tolowerCase() != "backcompat")?document.documentElement:(document.body||null);
var op= (window.opera && document.getElementById);
var op6= (op && !(db && db.innerHTML));
if (op && !op6)
	document.onmousedown= new Function('e','if (((e= e || window.event).target || e.srcElement).tagName=="IMAGE") return false;');
var ie= this.n.indexOf("msie")!=-1 && document.all && db && !op;
var iemac= ie && n.indexOf("mac")!=-1;
var ie4= ie && !document.getElementById;
var n4= (document.layers && typeof document.classes != "undefined");
var sfr= n.indexOf("safari")>-1;
var n6= !op && !sfr && !ie && document.defaultView && typeof document.defaultView.getComputedStyle != "undefined";
var ce= document.captureEvents && document.releaseEvents;
var px= n4 || op6;
var ie6= false;



function ValInt(pVal)
{
	return isNaN(r=parseInt(pVal))?0:r;
}

function getLeft(o)
{
	if (o==null) return 0;
	if (n4) return ValInt(o.pageX);
	var y=0;
	while (o)
	{
		y+= ValInt(o.offsetLeft);
		o= o.offsetParent;
	}
	if (iemac) y+= ValInt(db.currentStyle.marginLeft)+ValInt(db.currentStyle.paddingLeft);
	return y;
}

function getTop(o)
{
	if (o==null) return 0;
	if (n4) return ValInt(o.pageY);
	var y=0;
	while (o)
	{
		y+= ValInt(o.offsetTop);
		o= o.offsetParent;
	}
	if (iemac) y+= ValInt(db.currentStyle.marginTop)+ValInt(db.currentStyle.paddingTop);
	return y;
}

function getWidth(o)
{
	if (o==null) return 0;
	return ValInt(o.width || (n6?window.getComputedStyle(o, "").getPropertyValue("width") : 0));
}

function getHeight(o)
{
	if (o==null) return 0;
	return ValInt(o.height || (n6?window.getComputedStyle(o, "").getPropertyValue("height") : 0));
}

function getCookieVal(offset)
{
	var endstr= document.cookie.indexOf(";",offset);
	if (endstr==-1) endstr= document.cookie.length;
	return unescape(document.cookie.substring(offset,endstr));
}

function getCookie(name)
{
	var arg= name+"=";
	var alen= arg.length;
	var clen= document.cookie.length;
	var i=0;
	while (i<clen)
	{
		var j=i+alen;
		if (document.cookie.substring(i,j)==arg) return getCookieVal(j);
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;
	}
	return null;
}

function setCookie(name,value)
{
	var argv= setCookie.arguments;
	var argc= setCookie.arguments.length;
	document.cookie= name+"="+escape(value);
}


function camelize(stringToCamelize)
{
    var oStringList = stringToCamelize.split('-');
	var isFirstEntry = true;
	var camelizedString = '';

	for(var i=0; i < oStringList.length; i++)
	{
		if(oStringList[i].length>0)
		{
			if(isFirstEntry)
			{
				camelizedString = oStringList[i];
				isFirstEntry = false;
			}
			else
			{
				var s = oStringList[i];
      			camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
			}
		}
	}

	return camelizedString;
}

function getStyleProp(element,prop)
{
	var value;

	try
	{
		value = element.style[camelize(prop)];
		if (!value)
		{
		    // Removed because call of 'getComputedStyle' causes problems
		    // on safari and opera (mac only). The function returns the
		    // correct value but it seems that there occurs a timing issue.

			if (document.defaultView && document.defaultView.getComputedStyle) {
				var css = document.defaultView.getComputedStyle(element, null);
				value = css ? css.getPropertyValue(prop) : null;
			} else
				if (element.currentStyle) {
					value = element.currentStyle[camelize(prop)];
				}
		}
	}
	catch (e) {alert('getStyleProp: ' + e);}

	return value == 'auto' ? null : value;
}

// Définit l'opactité d'un élément
// theValue coef réel entre 0.0 et 1.0
function setOpacity(theElement,theValue)
{
		theElement.style.opacity= theValue;
		theElement.style.filter = "alpha(opacity=" + Math.floor(theValue * 100.0) + ")";
}

function getOpacity(theElement)
{
		var o = getStyleProp(theElement, "opacity");
  		if (o == undefined || o == null)
    		o = 1.0;
  		return o;
}
