BoutonAppViewer=function(texte , type  , adresse , imgSource )
{
	/*========================================================
						variables  :
	=========================================================*/
		var moi=this;
		var height=40;
		var widthImg=60;
		
		var adresseFullScreen;

		if (!BoutonAppViewer.tabLangue)
		{
			BoutonAppViewer.tabLangue=new Array();
			BoutonAppViewer.tabLangue['fr']='+ plein &eacute;cran';
			BoutonAppViewer.tabLangue['en']='+ fullscreen';
			BoutonAppViewer.tabLangue['jp']='+ fullscreen';
		}
		
	/*========================================================
						me :
	=========================================================*/
		this.me=$('<div/>');
		this.me.addClass('BoutonAppViewer');
		
		// image aperçu: 
			this.image=$('<div/>');
			this.image.addClass('BoutonAppViewerImage');
			this.me.append(this.image);
			
			var img=$('<img/>');
			img.attr('src' , imgSource);
			
			if (navigator.appName=="Netscape") 
			{
				img.load(function()
				{ 
					if ((img.height()/img.width())>(height/widthImg))
					{
						img.attr('height' , height);
						img.attr('width' , img.height()*widthImg/height);
						
					}
					else
					{
						img.attr('width', widthImg);
						img.attr('height' , img.width()*height/widthImg);
						
					}
						
					
					img.css('margin-top' , (height-img.height())/2);
					
					
				})
			}
			else
			{
				img.attr('height' , '40');
				img.attr('width' , '60');
			}
			this.image.append(img);
			
			
		
		// partie texte :
			this.texte=$('<div/>');
			this.texte.addClass('BoutonAppViewerTexte');
			this.me.append(this.texte);
			
			// Titre : 
				this.info=$('<div/>');
				this.info.html(texte);
				this.texte.append(this.info);
				
			// fullscreen
				this.fullscreen=$('<div/>');
				this.fullscreen.addClass('BoutonAppViewerFullScreen');
				this.fullscreen.html(BoutonAppViewer.tabLangue[ModeleInteraction.getLangue()]);
				
				this.fullscreen.mouseover(function()
				{
					$(this).addClass('BoutonAppViewerFullScreenHover');
				})
				this.fullscreen.mouseout(function()
				{
					$(this).removeClass('BoutonAppViewerFullScreenHover');
				})
				this.fullscreen.click(function()
				{
					window.open( adresseFullScreen, texte);
				})
				
				this.texte.append(this.fullscreen);
	
	/*========================================================
						App :
	=========================================================*/
		this.app=$('<div/>');
		
		switch (type)
		{
			case 'video' :
		//		this.app.addClass('AppViewerVideo');
				
		//		this.app.html('<object width="'+430+'" height="'+340+'" wmode="transparent" bgcolor="#ffffff" data="'+ModeleInteraction.video+'?file='+adresse+'&amp;showFs=true&amp;autoStart=autostart'" type="application/x-shockwave-flash">  <param width="'+430+'" value="'+ModeleInteraction.video+'?file='+adresse+'&amp;autoStart=autostart&amp;showFs=true" name="movie"/><param value="#ffffff" name="bgcolor"/><param value="transparent" name="wmode"/></object>');
				
				var animation = { movie:ModeleInteraction.video+'?file='+adresse+'&amp;showFs=true&amp;autoStart=autostart', width:430, height:340,
     								majorversion:"6", build:"40" , wmode:"transparent", allowScreenAccess:"always"};
				this.app.attr('id',adresse);
				UFO.create(animation, adresse);
				this.app.css("visibility","hidden");
				
				adresseFullScreen=ModeleInteraction.video+'?file='+adresse+'&amp;showFs=true&amp;autoStart=autostart';
			break;
			case 'animation' :
				var animation = { movie:adresse+'&langue='+ModeleInteraction.getLangue(), width:430, height:340,
     								majorversion:"6", build:"40" , wmode:"transparent", allowScreenAccess:"always"};
				this.app.attr('id',adresse);
				UFO.create(animation, adresse);
				this.app.css("visibility","hidden");
				
				adresseFullScreen=adresse;				
			break;
			case 'photoviewer' : 
				this.app.append(new PhotoViewer(430).me);
				this.fullscreen.remove();
				break;
		}
	
	/*========================================================
						Interaction :  
	=========================================================*/
		this.me.mouseover(function()
			{
				$(this).addClass('BoutonAppViewerHover');
			});
		
		this.me.mouseout(function()
			{
				$(this).removeClass('BoutonAppViewerHover');
			});
		
		this.me.click(function()
			{
				$('.BoutonAppViewerSelected').removeClass('BoutonAppViewerSelected');
				$(this).addClass('BoutonAppViewerSelected');
				
				AppViewer.viewer.empty();
				AppViewer.viewer.append(moi.app);
			//	alert(moi.app.html());
			});
		
		this.selectBouton=function()
		{
				$('.BoutonAppViewerSelected').removeClass('BoutonAppViewerSelected');
				this.me.addClass('BoutonAppViewerSelected');
				
				AppViewer.viewer.empty();
				AppViewer.viewer.append(moi.app);
		}
	
}