/*
by JulienCD - 30/03/2006
edited by PhilippeCD - 16/06/2009

Example :

	var player1 = {
		"format":"56kb",
		"theme":"purple",
		"synergie":"hetero",
		"langue":"fr",
		"url":"http://www.pornattitude.com/media/hetero/56kb/vid1.wmv",
		"thumb":"http://www.pornattitude.com/media/hetero/320x240/vid1_img1.jpg"
	}

	<span id="player1">
		<script>
			display_video("player1",true);
		</script>
	</span>
*/

var noteaser;
var noteaserHTML;

function display_video(player,fake)	{
	var txt; var h; var w;
	var theID		= player;
	player 			= eval(player);
	var AutoStart	= "yes";
	var url_video	= player['url'];
	
	
	if (player['format']=="56kb")  { 
		w=190; h=160;
	}	else if (player['format']=="256kb") { 
		w=330; h=240;
	}	else if (player['format']=="500kb") { 
		w=490; h=384;
	} 	else if (player['format']=="800kb") { 
		w=640; h=540;
	} 	else { 
		player['format']="256kb";  w=330; h=240;
	}
	
	if (typeof(player['thumb'])=="undefined") 	var img = "http://www.pornattitude.com/media/players/"+player['langue']+"/"+player['theme']+"/player-"+player['format']+".gif";
	else										var img = player['thumb'];

	if (noteaser=='1') 	fake	= false;
	if (fake) 			{
		player['fake']			= false;
		txt						=  "<a href=\"javascript:display_video('"+theID+"',false);\">";
		if (typeof(player['thumb'])!="undefined")		txt += "<img src=\"http://www.pornattitude.com/media/players/img/play.png\" style=\"-behavior: url(/media/players/img/iepngfix.htc);\" border=0 id=\""+theID+"_img\" width=\"" + w + "\" height=\"" + h + "\">";
		else											txt += "<img src=\"" + img + "\" border=0 id=\""+theID+"_img\" width=\"" + w + "\" height=\"" + h + "\">";
		txt						+= "		</a>";
		document.getElementById(theID).innerHTML					= txt;
		document.getElementById(theID).style.background 			= 'url(' + img + ') center no-repeat';
		document.getElementById(theID).style.width 					= w +'px';
		document.getElementById(theID).style.height 				= h +'px';
		document.getElementById(theID).style.display 				= 'block';
		
		/*@cc_on
			@if (@_jscript_version <= 5.6)
			document.getElementById(theID + '_img').style.behavior 		= 'url(/media/players/img/iepngfix.htc)';

		/*@end @*/
		
		return;
	}

	var WMP7; 
	txt = "";
	
	var isIE = /*@cc_on!@*/false;
	var codebase = '';
	var url_param = 'url';
	
	if (isIE) {

		try  {
			WMP7 = new ActiveXObject('WMPlayer.OCX');
		} catch(e) {}

		if(!WMP7) {
			codebase  = 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"';
			url_param = 'FileName';
		}

		txt += '<object id="MediaPlayer" ' + codebase + ' standby="Loading Microsoft Windows Media Player components..." classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" type="application/x-oleobject" width="'+ w +'" height="'+ h +'">';
		txt += '<param name="'+ url_param +'" value="'+ url_video +'">';

		if (AutoStart=="yes") txt += '<PARAM NAME="AutoStart" VALUE="true">';
		else  txt += '<PARAM NAME="AutoStart" VALUE="false">';

		txt += '<param name="ShowControls" value="1">';

		if (WMP7) {
			txt += '<param name="uiMode" value="full">';
		}

		txt += '<\/object>';

	}	else {
		txt += '<embed id="MediaPlayer" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/" src="'+ url_video +'" ShowControls="1" ShowDisplay="0" ShowStatusBar="0" width="'+ w +'" height="'+ h +'"><\/embed>';
	}
	
	if (noteaser=='1') {
		document.getElementById(theID).innerHTML=noteaserHTML;
	} else {
		document.getElementById(theID + '_img').style.display='none';
		document.getElementById(theID).style.background	= '';
		document.getElementById(theID).innerHTML=txt;
	}
	
}

