function slide_init(img_name,img_url,img_h,img_w) {
 var slide_tempo;
 slide_url_image = img_name;
 slide_url_click = img_url;
 //slide_x = -260;
 slide_ismoving = false;
 slide_first = true;
 // on passe les dimensions de l'image par php; 
//slide_width=284+5;
//slide_height=257+5;
slide_width=img_w+5;
slide_height=img_h+5;
slide_x = (-slide_width);
slide_depart=slide_x;
 //if(!document.all && document.getElementById)
 //if (!document.all) ancienne version
// {
 //        ejs_hauteur = 2*(window.innerHeight-slide_height)/3;}
 //else
 
 //{ ejs_hauteur = 2*(document.body.clientHeight-slide_height)/3;
 
// } fin ancienne version
//	HautEcran=window.screen.height	 
 //ejs_hauteur=(window.screen.height-slide_height)/2;
 
 if( typeof( window.innerHeight ) == 'number' ) {
   ejs_hauteur = 2*(window.innerHeight-slide_height)/3;
  } 
else if( document.documentElement && (  document.documentElement.clientHeight ) ) {
  
  ejs_hauteur = 2*(document.documentElement.clientHeight-slide_height)/3;
  
  } 
else if( document.body && (  document.body.clientHeight ) ) {
     ejs_hauteur = 2*(document.body.clientHeight-slide_height)/3;
  }
else {
    ejs_hauteur = 2*(500-slide_height)/3;
  }
 
 
 
 document.write('<style type="text/css">\n');
 document.write('#ejs_slide_box ');
 document.write('	{');
 document.write('	position:absolute;');
 document.write('	-moz-border-radius: 20px;');
 document.write('	width:'+slide_width+'px;');
 document.write('	height:'+slide_height+'px;');
 
// document.write('	height:270px;');
 /*document.write('	top:600px;');*/
 //ejs_hauteur=0;
 document.write('	top:'+ejs_hauteur+'px;');
document.write('	left:'+slide_depart+'px;');
 
 document.write('	background-color:#8B8B8B;');
 document.write('	border-color:green;');
 document.write('	border-width:3px;');
 document.write('	border-style:solid;');
 document.write('	}\n');
 
 document.write('#ejs_slide_bouton ');
 document.write('	{');
 document.write('	position:absolute;');
 document.write('   color:#FFFFFF;');
 document.write('	-moz-border-radius: 20px;');
 document.write('	top:20px;');
 document.write('	left:'+(slide_width-0)+'px;');
 document.write('	background-color:red;');
 document.write('	font-family:arial;');
 document.write('	font-weight:bold;');
 document.write('	font-size:15px;');
 document.write('	}\n');
 
 document.write('#ejs_slide_image ');
 document.write('	{');
 document.write('	position:relative;');
 document.write('	-moz-border-radius: 20px;');
 document.write('	top:0px;');
 document.write('	left:0px;');
 document.write('	}\n');
 
 document.write('.ejs_slide_blanc\n');
 document.write('	{\n');
 document.write('	color:#FFFFFF;');
 document.write('	font-family:arial;');
 document.write('	font-weight:bold;');
 document.write('	font-size:15px;');
 document.write('	text-decoration:none;');
 document.write('	}');
 document.write('</style>');
 document.write('<div id="ejs_slide_box">');
 document.write('<div id="ejs_slide_image">');
if (slide_url_click.length==0){
document.write('<a><img src="'+slide_url_image+'" border="0" title="Désolé pas de site !" /></a>');
 }else{
 document.write('<a href="'+slide_url_click+'" target="_blank"><img src="'+slide_url_image+'" border="0" alt="" /></a>');}
 document.write('</div>');
 document.write('<div id="ejs_slide_bouton"><a href="#" onclick="slide_start();this.blur();return(false)" class="ejs_slide_blanc">><br /><</a><br /><a class="ejs_slide_blanc" href="#" onclick="slide_close()" >x</a></div>');
 document.write('</div>');
  slide_start();
}

 
 
 function slide_start()
 	{
	
 	if(slide_x == slide_depart && !slide_ismoving)
 		slide_deballe();
 	else if(!slide_ismoving)
 		slide_remballe();
 	}
 
 function slide_deballe()
 	{
 	slide_ismoving = true;
 	if(slide_x < 10)
 		{
 		slide_x += 5;
 		slide_move();
 		setTimeout("slide_deballe()", 10);
 		}
 	else
 		{
 		slide_ismoving = false;
 		if(slide_first)
 			slide_tempo = setTimeout("slide_start()", 5000);
 		slide_first = false;
 		}	
 	}
 
 function slide_remballe()
 	{
 	clearTimeout(slide_tempo);
 	slide_ismoving = true;
 	if(slide_x >= (slide_depart+5))
 		{
 		slide_x -= 5;
 		slide_move();
 		setTimeout("slide_remballe()", 10);
 		}
 	else
 		slide_ismoving = false;
 	}
 
 function slide_move()
 	{
 	if(document.getElementById)
 		{
 		document.getElementById("ejs_slide_box").style.left=slide_x+'px';
 		}
 	}
 
 function slide_close()
 	{
 	if(document.getElementById)
 		{
 		document.getElementById("ejs_slide_box").style.top = -100;
 		document.getElementById("ejs_slide_box").style.left = (slide_depart-10)+'px';
 		document.getElementById("ejs_slide_box").style.width = 1;
 		document.getElementById("ejs_slide_box").style.height = 1;
		document.getElementById("ejs_slide_box").innerHTML = 'la tour en jarez';
 		}
 	}
 

