function $(id) {
	return document.getElementById(id);
}

var enlarge_visible=false; 
var enlarge_position=false;

function enlarge_move(e) {
	var cursX, cursY, pos_top, pos_left, large_doc, haut_doc;
	if(enlarge_visible) {
		if (navigator.appName!="Microsoft Internet Explorer") {
			pos_left  = e.pageX + 5;
			pos_top   = e.pageY + 10;
			cursY     = e.pageY ;
			cursX     = e.pageX ;
			large_doc = document.width;
			haut_doc  = document.height;
		}else{
			cursX = event.x;
			cursY = event.y;
			
			pos_left = 20 + event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
			pos_top  = 10 + event.clientY + document.body.scrollTop + document.documentElement.scrollTop;
			
			large_doc = document.body.clientWidth;
			haut_doc  = document.body.clientHeight;
		}
		
		eske=pos_left + $("enlarge_img").width;
		if(eske>large_doc-10){
				pos_left = large_doc - $("enlarge_img").width-10;}
		
		eske=pos_top + $("enlarge_img").height;
		if(eske>haut_doc-10){
				if (navigator.appName!="Microsoft Internet Explorer") {
					pos_top = cursY - $("enlarge_img").height-10; 
				}else{
					pos_top = pos_top - $("enlarge_img").height-30;
					
				}
			}
		
		$("enlarge_div").style.left = pos_left + "px";
		$("enlarge_div").style.top  = pos_top + "px";
		enlarge_position = true;
	}
	if(enlarge_position){	$("enlarge_div").style.display="block";}
	
}

function enlarge_show(text) {
	if(enlarge_visible==false) {
		if(text!=''){
			enlarge_visible=true;
			$("enlarge_img").src = text;
			$("enlarge_div").style.width = $("enlarge_img").width;
			$("enlarge_div").style.height =$("enlarge_img").height;
		}
	}
}

function enlarge_hide() {
	if(enlarge_visible==true) {
		$("enlarge_div").style.display="none";
		$("enlarge_img").src = "";
		$("enlarge_div").style.width = 0;
		$("enlarge_div").style.height = 0;
		enlarge_visible=false;
		enlarge_position=false;
	}
}

document.onmousemove=enlarge_move; 

/*****************************/
//     Class cScrolling      //
/*****************************/
function scrollingBox(sTab, divId, divClass, delay, Name_Instance){
//----------------------------------> Variables d'environement <------------------------------------------------
	
	this.idMaindiv = divId;
	this.Class = divClass;
	this.delay = delay;
	this.Instance_Name = Name_Instance;
	
	this.hiddendivpointer = 1;
	this.mouseoverBol = 0;
	
	this.aScrollTab = new Array();
	var aTab = sTab.split("§§");
	for(i=0;i<aTab.length;i++){
		var aTmp = aTab[i].split("§");
		// aTmp[0] = product_id / [1] = img / [2] = link / [3] = name / [4] = price / [5] = price promo
		this.aScrollTab[i] = '<center><a href="' + aTmp[2] + '">' + aTmp[1] + '</a><br>'+
												 '<a href="' + aTmp[2] + '">' + aTmp[3] + '</a><br>' + aTmp[4] ;
		if(aTmp[5]!='false'){ this.aScrollTab[i] = this.aScrollTab[i] + ' - <span class="productSpecialPrice">'+aTmp[5]+'</span>';}
		this.aScrollTab[i] = this.aScrollTab[i] + '</center>';
	}
	
	if(this.aScrollTab.length>1){
		document.write('<div id="'+this.idMaindiv+'" class="'+this.Class+'" style="position: relative; display:block; overflow: hidden; height:260px;" onMouseOver="'+this.Instance_Name+'.mouseoverBol=1;" onMouseOut="'+this.Instance_Name+'.mouseoverBol=0;"><div class="innerDiv" style="position: absolute; width: 100%;" id="'+this.idMaindiv+'0">'+this.aScrollTab[0]+'<\/div><div class="innerDiv" style="position: relative; width: 100%; visibility: hidden" id="'+this.idMaindiv+'1">'+this.aScrollTab[1]+'<\/div><\/div>');
	}else{
		document.write('<div id="'+this.idMaindiv+'" class="'+this.Class+'" style="position: relative; display:block; overflow: hidden;" onMouseOver="'+this.Instance_Name+'.mouseoverBol=1;" onMouseOut="'+this.Instance_Name+'.mouseoverBol=0;"><div class="innerDiv" style="position: absolute; width: 100%;" id="'+this.idMaindiv+'0">'+this.aScrollTab[0]+'<\/div><div class="innerDiv" style="position: relative; width: 100%; visibility: hidden" id="'+this.idMaindiv+'1">'+this.aScrollTab[0]+'<\/div><\/div>');
	}
	
	
//----------------------------------> function addLoadEvent <------------------------------------------------	
	this.addLoadEvent = function addLoadEvent(func){
		var oldonload = window.onload;
		if (typeof window.onload != 'function') {
			window.onload = func;
		} else {
			window.onload = function(){
				oldonload();
				func();}
		}
	} 


//----------------------------------> function getCSSpadding <------------------------------------------------
	this.getCSSpadding = function getCSSpadding(Mainobj){
		if (Mainobj.currentStyle){
			return Mainobj.currentStyle["paddingTop"];
		}else if (window.getComputedStyle){ //if DOM2
			return window.getComputedStyle(Mainobj, "").getPropertyValue("padding-top");
		}else{
			return 0;
		}
	}
	
	
//----------------------------------> function getinline <------------------------------------------------
	this.getinline = function getinline(div1, div2){
		div1.style.top = (this.visibledivtop) + ( ( this.Maindiv.offsetHeight/2) - (div1.offsetHeight/2) ) +"px";
		if(div1.style.top<0){div1.style.top=this.visibledivtop + "px";}
		div2.style.top = Math.max( div1.parentNode.offsetHeight, div1.offsetHeight ) + ( ( this.Maindiv.offsetHeight/2) - (div1.offsetHeight/2) ) + "px";
		if(div2.style.top<0){div2.style.top=Math.max( div1.parentNode.offsetHeight, div1.offsetHeight )+"px";}
	}
	
	
//----------------------------------> function setmessage <------------------------------------------------
	this.setmessage = function(){
		if (this.mouseoverBol==1){
			setTimeout(this.Instance_Name+'.setmessage()', 100);
		}else{
			var i=this.hiddendivpointer;
			var ceiling=this.aScrollTab.length;
			this.hiddendivpointer = (i+1>ceiling-1)? 0 : i+1;
			this.hiddendiv.innerHTML=this.aScrollTab[this.hiddendivpointer];
			this.animateup();
		}
	}	
	
	
//----------------------------------> function animateup <------------------------------------------------
	this.animateup = function animateup(){
		if( ( parseInt(this.hiddendiv.style.top) > ( this.visibledivtop+( ( this.Maindiv.offsetHeight/2) - (this.hiddendiv.offsetHeight/2) ) + 5 ) )&&(true==true) ){
			this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px";
			this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px";
			setTimeout(this.Instance_Name+'.animateup()', 50);
		}else{
			this.getinline(this.hiddendiv, this.visiblediv);
			this.swapdivs();
			setTimeout(this.Instance_Name+'.setmessage()', this.delay);
		}
	}
	
	
//----------------------------------> function swapdivs <------------------------------------------------
	this.swapdivs=function swapdivs(){
		var tempcontainer=this.visiblediv;
		this.visiblediv=this.hiddendiv;
		this.hiddendiv=tempcontainer;
	}
	

//----------------------------------> function initialize <------------------------------------------------
	this.initialize = function initialize(){
		this.Maindiv  = $(this.idMaindiv);
		this.visiblediv = $(this.idMaindiv+"0");
		this.hiddendiv  = $(this.idMaindiv+"1");
		
		this.visibledivtop = parseInt(this.getCSSpadding(this.Maindiv));
		
		this.visiblediv.style.width=this.hiddendiv.style.width=this.Maindiv.offsetWidth-(this.visibledivtop*2)+"px";
		this.getinline(this.visiblediv, this.hiddendiv)
		this.hiddendiv.style.visibility="visible"
		
		setTimeout(this.Instance_Name+'.animateup()', this.delay)
	}
	
}
/********************************/
//     END Class cScrolling     //
/********************************/
