var dispVideoWidth = 600;
var dispVideoHeight = 490;
var lastX, lastY, lastW, lastH, firstX, firstY, firstW, firstH;
var x,y,w,h;
var currentUrl;
var n = 0, nMax=7;
var tim;
function getPageDim(){
 var myWidth = 0, myHeight = 0, myScrollTop=0, myScrollLeft=0;
 if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myWidth = window.innerWidth;
	myHeight = window.innerHeight;
	myScrollLeft = window.pageXOffset;
 	myScrollTop = window.pageYOffset;
 } 
 else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
 	myWidth = document.documentElement.clientWidth;
 	myHeight = document.documentElement.clientHeight;
	myScrollLeft = document.documentElement.scrollLeft;
 	myScrollTop = document.documentElement.scrollTop;	
 } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
 	//IE 4 compatible
 	myWidth = document.body.clientWidth;
 	myHeight = document.body.clientHeight;
	myScrollLeft = document.body.scrollLeft;
 	myScrollTop = document.body.scrollTop;
 }
 return new Array(myWidth, myHeight, myScrollLeft, myScrollTop);
}
function displayVideo(img, url){
 var dim = getPageDim();
 var disp = document.getElementById("dispVideo");
 lastX=((dim[0]-dispVideoWidth)/2+dim[2]);
 lastY=((dim[1]-dispVideoHeight)/2+dim[3]);
 lastW=dispVideoWidth;
 lastH=dispVideoHeight;
 firstX = getPositionLeft(img);
 firstY = getPositionTop(img);
 firstW = img.offsetWidth;
 firstH = img.offsetHeight;
 x = firstX;
 y = firstY;
 w = firstW;
 h = firstH;
 currentUrl = url;
 redimDisp(disp, x, y, w, h);
 disp.innerHTML = "&nbsp;";
 disp.style.display="inline";
 n=0;
 tim = setInterval("displayMove()", 40);
}
function displayMove(){
 if (n>nMax){
	clearInterval(tim);
	tim=null;
	return;
 }
 var disp = document.getElementById("dispVideo");
 redimDisp(disp, x, y, w, h);
 if (n==nMax){
	disp.innerHTML = "<table width=\"100%\" style=\"border-collapse:collapse;background-color:#000000\"><tr><td align=\"right\"><a href=\"javascript:closeDispVideo()\" style=\"color:#ffffff\">Fermer</a></td></tr>"
		+"<tr><td><object width=\""+lastW+"\" height=\""+lastH+"\">"
		+"<embed width=\""+lastW+"\" height=\""+lastH+"\""
		+" src=\"http://www.chauffeurdebuzz.com/OttoFLVPlayer.swf\""
		+" allowscriptaccess=\"always\" allowfullscreen=\"true\""
		+" flashvars=\"vidIntroUrl=http://www.chauffeurdebuzz.com/intro.flv&splashUrl=http://www.chauffeurdebuzz.com/splash.jpg&vidMainUrl="+currentUrl+"\">"
		+"</embed></object>"
		+"</td></tr></table>";
 }
 else{
	disp.innerHTML = "&nbsp;";
 }
 x+=(lastX-firstX)/nMax;
 y+=(lastY-firstY)/nMax;
 w+=(lastW-firstW)/nMax;
 h+=(lastH-firstH)/nMax;
 n++;
}
function redimDisp(elt, x0, y0, w0, h0){
 elt.style.left=x0+"px";
 elt.style.top=y0+"px";
 elt.style.width=w0+"px";
 elt.style.height=h0+"px";
}
function closeDispVideo(){
 document.getElementById("dispVideo").style.display="none";
}
function getPositionLeft (obj) {
 var curleft = 0;
 if (obj.offsetParent) {
 	curleft = obj.offsetLeft;
 	while (obj = obj.offsetParent) {curleft += obj.offsetLeft;}
 }
 return curleft;
}
function getPositionTop (obj) {
 var curtop = 0;
 if (obj.offsetParent) {
 	curtop = obj.offsetTop;
 	while (obj = obj.offsetParent) {curtop += obj.offsetTop;}
 }
 return curtop;
}

