
/*------------------
class CollImages
--------------------*/
function CollImages() {
	this.CollImages=[];	
	//-------------------
	// AddImage
	//-------------------
	this.Add = function AddImage(objImage) {
		this.CollImages[this.CollImages.length] = objImage;
	}
			
	//-------------------
	//Search
	//-------------------
	this.GetElement = function m_GetElement(lngImageId) {
		var i=0;
		var objImage;
				
		for (i=0;i<=this.CollImages.length-1;i++) {
					
			objImage = this.CollImages[i];
			if (parseInt(objImage.ImageId) == parseInt(lngImageId)) {
				return(objImage);
			}
		}
		return(null);
	}			
}
//*************************************
//	Class : Images
//*************************************
function Image(ImageId,
				ImagePetite,
				ImageGrande) {
	
	this.ImageId = ImageId;
	this.ImagePetite = ImagePetite;
	this.ImageGrande= ImageGrande;	
}
//*************************************
//*************************************
				 
//*************************************
//	Class : ScrollImages
//*************************************
function ScrollImages(collImages, 
						indexCourant,
						indexMiniature,
						divScroll,
						divEntete,
						PrefixeId
						) {			
	this.collImages= collImages;
	this.Id = lngId;			
	this.indexCourant = indexCourant;			
	this.indexMiniature = indexMiniature;			
	this.strSuffixe = strSuffixe;
	
	//---------------------------------
	//	MoveImg 
	//----------------------------------
	this.MoveImg = function m_MoveImg(strSens) {
		//alert(PrefixeId);
		var i=1, strImage;
	
		if (strSens == "+") {
			this.indexCourant++;
			g_lngIndexMiniature++;
		}
		else if (strSens == "-") { 
			if (this.indexMiniature == this.indexCourant) {
				this.indexMiniature--;
			}
			this.indexCourant--;
		}
		
		if  (this.indexCourant <0) {
			this.indexCourant = 0;
			this.indexMiniature=0;
			
		}
		
		if  (this.indexMiniature > arrImages.length-3) {
			this.indexMiniature--;
		}
		
		if (this.indexCourant > arrImages.length-1) {
			this.indexCourant--;
		}
		
		strImage = "";
		
		for (i=this.indexMiniature; i < Math.min( this.indexMiniature+3, arrImages.length);i++) {
			if (this.indexMiniature == i) {
				strImage = strImage +" <td><a href=\"javascript:void(AffImageDansEntete("+i+",\'"+this.PrefixeId+"\'))\"><img onmouseover=\"javascript:void(AffImageDansEntete("+i+",\'"+this.PrefixeId+"\'))\" style='display:inline' src='"+arrImages[i]+"' style='border-color:red' width='49' height='37' border='0'/></a></td>";
			}
			else {
				strImage = strImage +" <td><a href=\"javascript:void(AffImageDansEntete("+i+",\'"+this.PrefixeId+"\'))\"><img onmouseover=\"javascript:void(AffImageDansEntete("+i+",\'"+this.PrefixeId+"\'))\" style='display:inline' src='"+arrImages[i]+"' width='49' height='37' border='0'/></a></td>";
			}
			
		}
		
		if ($(this.PrefixeId+"_bloc_images") != null ) {
			$(this.PrefixeId+"_bloc_images").innerHTML = "<table border='0' cellspacing='0' width='155' cellpadding='0'><tr>"+strImage+"</tr></table>";
		}
		
		if ($(this.PrefixeId+"_bloc_imagecourante") != null ) {
			$(this.PrefixeId+"_bloc_imagecourante").innerHTML = " <a href='javascript:popOpen("+arrImagesId[this.indexCourant]+",strListeIMG_ID,strFlagVideo)'><img class='photo_offre' src='"+arrImages[this.indexCourant]+"' width='139' border='0'/></a>";
		}
		
		//alert($("bloc_imagecourante").innerHTML);
	}
}
//*************************************
//*************************************

//---------------------------------
//	AffImageDansEntete
//---------------------------------
function AffImageDansEntete(lngIndex,PrefixeId) {
	$(PrefixeId+"_bloc_imagecourante").innerHTML = " <a href='javascript:popOpen("+arrImagesId[lngIndex]+",strListeIMG_ID,strFlagVideo)'><img class='photo_offre' src='"+arrImages[lngIndex]+"' width='139' border='0'/></a>";
	//alert(arrImages[lngIndex]);
}	

//********************************
//	popOpen
//********************************		
function popOpen(IMG_ID,IMG_IDs,IMG_FLAGVIDEOs) {
	var left = (screen.width/2) - 800/2;
	var top = (screen.height/2) - 700/2;
	//var strUrl = "../detail/AffGrandeImage.asp?img_id="+IMG_ID+"&img_ids="+IMG_IDs;
	// modif Bernard pour videos 
	var strUrl = "../detail/AffGrandeImage.asp?ancien=vrai&img_id="+IMG_ID+"&img_ids="+IMG_IDs+"&img_flagvideos="+IMG_FLAGVIDEOs;	
	popUpWindow(strUrl, left, top, 800, 700 , "Windows"+IMG_ID);
}


