
// URLs of slides
var chemin= "../img_fam/";
//var chemin= "";
// Ajouter images ici entre guillemets , separées par des virgules .


var slideurl=new Array( 
	"ph_prod_277/ph_prod_999_v.jpg", 
	"ph_prod_109/ph_prod_1000_v.jpg", 
	"ph_prod_259/ph_prod_1001_v.jpg", 
	"ph_prod_259/ph_prod_1002_v.jpg", 
	"ph_prod_220/ph_prod_1003_v.jpg", 
	"ph_prod_149/ph_prod_1005_v.jpg", 
	"ph_prod_248/ph_prod_978_v.jpg", 
	"ph_prod_220/ph_prod_998_v.jpg", 
	"ph_prod_252/ph_prod_996_v.png" 
)


var slideurl_g=new Array( 
	"ph_prod_277/ph_prod_999_g.jpg", 
	"ph_prod_109/ph_prod_1000_g.jpg", 
	"ph_prod_259/ph_prod_1001_g.jpg", 
	"ph_prod_259/ph_prod_1002_g.jpg", 
	"ph_prod_220/ph_prod_1003_g.jpg", 
	"ph_prod_149/ph_prod_1005_g.jpg", 
	"ph_prod_248/ph_prod_978_g.jpg", 
	"ph_prod_220/ph_prod_998_g.jpg", 
	"ph_prod_252/ph_prod_996_g.png" 
)
	



					
					   
// Ajouter les commentaire pour chaque vignette entre guillemets , separées par des virgules .

var slidealt=new Array( 
	"Cervélo Test Team 2010 Castelli\n15.9 \u20AC", 
	"Core Mesh Sleeveless Castelli\n34.0 \u20AC", 
	"Cervélo Test Team Casual Castelli\n23.0 \u20AC", 
	"Cervélo Test Team Noir Casual Castelli\n23.0 \u20AC", 
	"Guidoline Vélo Tape Easton \n8.5 \u20AC", 
	"Podio Jersey Castelli\n89.0 \u20AC", 
	"Pantalon Spotlight Maloja \n159.0 \u20AC", 
	"Manivelles 3D Rotor Version Route 110 Compact  \n279.0 \u20AC", 
	"Cayo Triple Shimano 105 Focus \n1699.0 \u20AC" 

)

					

var prod_id = new Array( 
	"277,999", 
	"109,1000", 
	"259,1001", 
	"259,1002", 
	"220,1003", 
	"149,1005", 
	"248,978", 
	"220,998", 
	"252,996" 

)


// comments displayed below the slides
//var slidecomment=new Array("ali1","ali2","ali0")

// the width of the slideshow (pixels)
//var scrollerwidth=900  // mettre la largeur voulue
var scrollerwidth=680  // mettre la largeur voulue

// the height of the slideshow (pixels)
var scrollerheight=100 // mettre la hauteur des images.

// font-attributes for the comments
var slidefont="Arial"
var slidefontcolor="blue"
var slidefontsize="2"

// do not edit below this line
var allpicturewidth
var distancepictopic=0
var scrollerleft=0
var scrollertop=0
var pause=1
var step=1
var newstep=step
var clipleft,clipright,cliptop,clipbottom
var i_picture=0
var timer
var picturecontent=""
var ns4=document.layers?1:0
var ns6=document.getElementById&&!document.all?1:0
var ie=document.all?1:0

var preloadedimages=new Array()
for (i=0;i<slideurl.length;i++){
	preloadedimages[i]=new Image()
	preloadedimages[i].src=slideurl[i]
}

function init_ins() {
    if (ie) {
		allpicturewidth=document.all.picturediv.offsetWidth
		document.all.picturediv.style.posTop=scrollertop
        document.all.picturediv.style.posLeft=scrollerleft+scrollerwidth
		clipleft=0
		clipright=0
		cliptop=0
		clipbottom=scrollerheight
		document.all.picturediv.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
		document.all.picturediv.style.visibility="visible"
		scrollpicture()

    }
	if (ns6) {
		allpicturewidth=document.getElementById('emptypicturediv').offsetWidth
		document.getElementById('picturediv').style.top=scrollertop
        document.getElementById('picturediv').style.left=scrollerleft+scrollerwidth
		clipleft=0
		clipright=0
		cliptop=0
		clipbottom=scrollerheight
		document.getElementById('picturediv').style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
		document.getElementById('picturediv').style.visibility="visible"
		scrollpicture()
    }
	if (ns4) {
		allpicturewidth=document.roof.document.picturediv.document.width
		document.roof.document.picturediv.top=scrollertop
		document.roof.document.picturediv.left=scrollerleft+scrollerwidth
		document.roof.document.picturediv.clip.left=0
		document.roof.document.picturediv.clip.right=0
		document.roof.document.picturediv.clip.top=0
		document.roof.document.picturediv.clip.bottom=scrollerheight
		document.roof.document.picturediv.visibility="visible"
        scrollpicture()
    }
}

function scrollpicture() {
    if (ie) {
		if (document.all.picturediv.style.posLeft>=scrollerleft-allpicturewidth) {
			document.all.picturediv.style.posLeft-=step
			clipright+=step
			if (clipright>scrollerwidth) {
				clipleft+=step
			}
			document.all.picturediv.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
			var timer=setTimeout("scrollpicture()",pause)
		}
		else {
			//resetposition()
			setTimeout('scrollpicture_reverse()',3000)
		}
	}
	if (ns6) {
		if (parseInt(document.getElementById('picturediv').style.left)>=scrollerleft-allpicturewidth) {
	document.getElementById('picturediv').style.left=parseInt(document.getElementById('picturediv').style.left)-step
			clipright+=step
			if (clipright>scrollerwidth) {
				clipleft+=step
			}
			document.getElementById('picturediv').style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
			var timer=setTimeout("scrollpicture()",pause)
		}
		else {
			resetposition()
		}
	}
   if (ns4) {
		if (document.roof.document.picturediv.left>=scrollerleft-allpicturewidth) {
			document.roof.document.picturediv.left-=step
			document.roof.document.picturediv.clip.right+=step
			if (document.roof.document.picturediv.clip.right>scrollerwidth) {
				document.roof.document.picturediv.clip.left+=step
			}
			var timer=setTimeout("scrollpicture()",pause)
		}
		else {
			resetposition()
		}
	}
}

function scrollpicture_reverse() {
    if (ie) {
		if (document.all.picturediv.style.posLeft<=scrollerwidth) {
			document.all.picturediv.style.posLeft+=step
			clipleft-=step
			if (clipright>scrollerwidth) {
				clipright+=step
			}
			//document.all.picturediv.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
			var timer=setTimeout("scrollpicture_reverse()",pause)
		}
		else {
			resetposition()
		}
	}
	if (ns6) {
		if (parseInt(document.getElementById('picturediv').style.left)>=scrollerleft-allpicturewidth) {
	document.getElementById('picturediv').style.left=parseInt(document.getElementById('picturediv').style.left)-step
			clipright+=step
			if (clipright>scrollerwidth) {
				clipleft+=step
			}
			document.getElementById('picturediv').style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
			var timer=setTimeout("scrollpicture()",pause)
		}
		else {
			resetposition()
		}
	}
   if (ns4) {
		if (document.roof.document.picturediv.left>=scrollerleft-allpicturewidth) {
			document.roof.document.picturediv.left-=step
			document.roof.document.picturediv.clip.right+=step
			if (document.roof.document.picturediv.clip.right>scrollerwidth) {
				document.roof.document.picturediv.clip.left+=step
			}
			var timer=setTimeout("scrollpicture()",pause)
		}
		else {
			resetposition()
		}
	}
}

function onmsover(val) {
	step=0
}
function onmsout() {
	step=newstep
}

function resetposition() {
	if (ie) {
        document.all.picturediv.style.posLeft=scrollerleft+scrollerwidth
		clipleft=0
		clipright=0
		document.all.picturediv.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
        scrollpicture()
	}
	if (ns6) {
		allpicturewidth=document.getElementById('emptypicturediv').offsetWidth
        document.getElementById('picturediv').style.left=scrollerleft+scrollerwidth
		clipleft=0
		clipright=0
		document.getElementById('picturediv').style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
        scrollpicture()
	}
	if (ns4) {
		document.roof.document.picturediv.left=scrollerleft+scrollerwidth
		document.roof.document.picturediv.clip.left=0
		document.roof.document.picturediv.clip.right=0
        scrollpicture()
	}
}

picturecontent=""
picturecontent+="<table cellpadding=1 cellspacing=1 border=0 bgcolor=f0e0d0>"
picturecontent+="<tr>"
for (i=0;i<=slideurl.length-1;i++) {
	picturecontent+="<td bgcolor=ffffff>"
	picturecontent+="<a href='javascript:sh_g_img(\""+chemin+slideurl_g[i]+"\","+prod_id[i]+")' onMouseOver=\"javascript:onmsover(this)\" onMouseOut=\"javascript:onmsout()\" >"
	picturecontent+="<img src=\""+chemin+slideurl[i]+"\" border=0 hspace=10 vspace=10 title='"+slidealt[i]+"'></a>"
	picturecontent+="</td>"
}

picturecontent+="</tr></table>"

if (ie || ns6) {
	document.write('<div style="position:relative;width:'+scrollerwidth+'px;height:'+scrollerheight+'px;overflow:hidden">')
	document.write('<div id="picturediv" style="position:absolute;top:0px;left:0px;height:'+scrollerheight+'px;visibility:hidden">'+picturecontent+'</div>')
	document.write('</div>')
	document.write('<div id="emptypicturediv" style="position:absolute;top:0px;left:0px;height:'+scrollerheight+'px;visibility:hidden">'+picturecontent+'</div>')
}
	
// mouse position functions
var tempX,tempY,x,y
function getMouseXY(e) {  
	var IE = document.all?true:false 
	// If NS -- that is, !IE -- then set up for mouse capture
	if (!IE) document.captureEvents(Event.MOUSEMOVE)
	if (IE) { 
	// grab the x-y pos.s if browser is IE    
	tempX = event.clientX + document.body.scrollLeft    
	tempY = event.clientY + document.body.scrollTop  
	} 
	else {  
	// grab the x-y pos.s if browser is NS    
	tempX = e.pageX    
	tempY = e.pageY  
	}    
	// catch possible negative values in NS4  
	if (tempX < 0){tempX = 0}  
	if (tempY < 0){tempY = 0}    
	return true
}

function sh_g_img(val,fam,prod) {

	url="../boutique/show_produit.cfm?fam_id="+fam+"&id_prod="+prod
	x=tempX
	y=tempY

	document.getElementById('grande_image_div').style.visibility='visible'
	document.getElementById('grande_image').src=val
	document.getElementById('href_img').href=url
	document.getElementById('href_img_2').href=url
	document.getElementById('grande_image_div').style.left=x
	document.getElementById('grande_image_div').style.top=y

	move_img()
}

var nb_step=30
var x_step,y_step
function move_img() {
	pos_x=(screen.width/2)-200
	if (pos_x <= x) x_gap=x-pos_x
	else x_gap=pos_x-x
	x_step=x_gap/nb_step
	x_step=parseInt(x_step,10)
	y_step=430/nb_step
	y_step=parseInt(y_step,10)
	setTimeout('move_img_step()',10)
}

function move_img_step() {
	if (nb_step >= 0) {
		current_x=document.getElementById('grande_image_div').style.left
		current_x=current_x.substring(0,current_x.length-2)
		current_y=document.getElementById('grande_image_div').style.top
		current_y=current_y.substring(0,current_y.length-2)
		if (pos_x <= x) {
			new_x=current_x-x_step
			document.getElementById('grande_image_div').style.left=new_x
		}
		else { 
			new_x=current_x+x_step
			document.getElementById('grande_image_div').style.left=new_x
		}
		new_y=current_y-y_step
		document.getElementById('grande_image_div').style.top=new_y
		nb_step=nb_step-1
		setTimeout('move_img_step()',10)
	}
	else nb_step=30
}

function hi_g_div_img() {
	document.getElementById('grande_image_div').style.visibility='hidden'
	document.getElementById('grande_image').src=''
}

	 //document.write(picturecontent) // this verify the display of images


