function checkOccasions() {
	var obj = document.FRM_Occasions;
	var checkEmpty = checkTextEmpty(obj.a, obj.b, obj.marque, obj.modele, obj.annee, obj.prix);
	if (checkEmpty != -1) alert(ErrMessage);
	else obj.submit();
}

function checkPicture() {
	var obj = document.FRM_Picture;
	if (isEmpty(obj.image)) alert(ErrPhoto);
	else document.FRM_Picture.submit();
}

//config
astartColor = "#FFFFFF"; // MouseOut link color for <a>
aendColor = "#FFA500"; // MouseOver link color for <a>

trstartColor = "#FFFFFF"; // MouseOut link color for <tr>
trendColor = "#CCCCFF"; // MouseOver link color for <tr>

stepIn = 25; // delay when fading in
stepOut = 25; // delay when fading out

// set to true or false; true will 
// cause all links to fade automatically 
autoFade = false; 

// set to true or false; true will cause all CSS 
// classes with "fade" in them to fade onmouseover 
sloppyClass = true; 
//


hexa = new makearray(16); 
for(var i = 0; i < 10; i++) 
	hexa[i] = i; 
hexa[10]="a"; hexa[11]="b"; hexa[12]="c"; 
hexa[13]="d"; hexa[14]="e"; hexa[15]="f"; 

document.onmouseover = domouseover; 
document.onmouseout = domouseout; 

astartColor = dehexize(astartColor.toLowerCase()); 
aendColor = dehexize(aendColor.toLowerCase()); 

trstartColor = dehexize(trstartColor.toLowerCase());
trendColor = dehexize(trendColor.toLowerCase()); 

var afadeId = new Array(); 

var trfadeId = new Array();

function dehexize(Color)
{ 
	var colorArr = new makearray(3); 
	for (i=1; i<7; i++)
	{ 
		for (j=0; j<16; j++)
		{ 
			if (Color.charAt(i) == hexa[j])
			{ 
				if (i%2 !=0) 
					colorArr[Math.floor((i-1)/2)]=eval(j)*16; 
				else 
					colorArr[Math.floor((i-1)/2)]+=eval(j); 
			}
		} 
	} 
	return colorArr; 
}

function domouseover()
{
	if(document.all)
	{
		var srcElement = event.srcElement;
		if ((srcElement.tagName == "A" && autoFade) || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1)) 
			afade(astartColor,aendColor,srcElement.uniqueID,stepIn); 
	} 
} 

function domouseout()
{ 
	if (document.all)
	{ 
		var srcElement = event.srcElement; 
		if ((srcElement.tagName == "A" && autoFade) || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1)) 
			afade(aendColor,astartColor,srcElement.uniqueID,stepOut); 
	} 
}

function makearray(n)
{ 
	this.length = n; 
	for(var i = 1; i <= n; i++) 
		this[i] = 0; 
	return this; 
} 

function hex(i)
{ 
	if (i < 0) 
		return "00"; 
	else if (i > 255) 
		return "ff"; 
	else 
		return "" + hexa[Math.floor(i/16)] + hexa[i%16];} 

function setColor(r, g, b, element)
{ 
	var hr = hex(r); var hg = hex(g); var hb = hex(b); 
	element.style.color = "#"+hr+hg+hb; 
} 

function settrColor(r, g, b, element)
{ 
	var hr = hex(r); var hg = hex(g); var hb = hex(b); 
	element.style.background = "#"+hr+hg+hb; 
} 

function afade(s,e, element,step)
{ 
	var sr = s[0]; var sg = s[1]; var sb = s[2]; 
	var er = e[0]; var eg = e[1]; var eb = e[2]; 

	if (afadeId[0] != null && afade[0] != element)
	{ 
		setColor(sr,sg,sb,eval(afadeId[0])); 
		var i = 1; 
		while(i < afadeId.length)
		{ 
			clearTimeout(afadeId[i]); 
			i++; 
		} 
	} 
	for(var i = 0; i <= step; i++)
	{ 
		afadeId[i+1] = setTimeout("setColor(Math.floor(" +sr+ " *(( " +step+ " - " +i+ " )/ " +step+ " ) + " +er+ " * (" +i+ "/" + 
		step+ ")),Math.floor(" +sg+ " * (( " +step+ " - " +i+ " )/ " +step+ " ) + " +eg+ " * (" +i+ "/" +step+ 
		")),Math.floor(" +sb+ " * ((" +step+ "-" +i+ ")/" +step+ ") + " +eb+ " * (" +i+ "/" +step+ ")),"+element+");",i*step); 
	} 
	afadeId[0] = element; 
}

function trfade(s,e, element,step)
{ 
	var sr = s[0]; var sg = s[1]; var sb = s[2]; 
	var er = e[0]; var eg = e[1]; var eb = e[2]; 
	
	if (trfadeId[0] != null)
	{
		settrColor(sr,sg,sb,eval(trfadeId[0])); 
		var i = 1; 
		while(i < trfadeId.length)
		{
			clearTimeout(trfadeId[i]);
			i++;
		}
	}
	for(var i = 0; i <= step; i++)
	{
		trfadeId[i+1] = setTimeout("settrColor(Math.floor(" +sr+ " *(( " +step+ " - " +i+ " )/ " +step+ " ) + " +er+ " * (" +i+ "/" + 
		step+ ")),Math.floor(" +sg+ " * (( " +step+ " - " +i+ " )/ " +step+ " ) + " +eg+ " * (" +i+ "/" +step+ 
		")),Math.floor(" +sb+ " * ((" +step+ "-" +i+ ")/" +step+ ") + " +eb+ " * (" +i+ "/" +step+ ")),"+element+");",i*step); 
	}
	trfadeId[0] = element;
}
function myRoll(path, etat, nomsrc, nomimg, type) {
	document.images[nomsrc].src = path + nomimg + etat + "." + type;
	if (etat == "off") return myDisplay("");
}

function TROver(obj) { obj.style.cursor = "pointer";obj.style.cursor = "hand"; }

function TRRoll(obj, etat)
{
	if (etat == "on")
		trfade(trstartColor,trendColor, obj.uniqueID,stepIn);obj.style.cursor = "pointer";obj.style.cursor = "hand";
	if (etat == "off") trfade(trendColor,trstartColor, obj.uniqueID,stepOut);
}

function TDRoll(status)
{
	window.status=status;
}

function myDisplay(txt) {
	window.status = txt;
	return true;
}


var popwindow
var tisurl
var tiswidth
var tisheight
var tistopposition
var tisleftposition
var pause=0
var step=20
var marginright
var endposition
var timer

function movewindow() {
	if (tisleftposition<=endposition) {
		popwindow.moveTo(tisleftposition,tistopposition)
		tisleftposition+=step
		timer= setTimeout("movewindow()",pause)
	}
	else {
		clearTimeout(timer)
	}
}