DomainUrl = "http://www.mesvip.com/lxplayer2/"; /* url ou se trouve le dossier de vidéo. */
//DomainUrl = "http://localhost/lxplayer2/"; /* url ou se trouve le dossier de vidéo. */


function exportPlayerFunc(videoURL,idMovie)
{
	//alert("exportPlayerFunc : " + videoURL + " idMovie : " + idMovie);
	var hauteur = 200;
	var largeur = 600;
	var haut=(screen.height-hauteur)/2;
	var Gauche=(screen.width-largeur)/2;
	
	window.open ('export.php?video='+videoURL+"&idMovie="+idMovie, 'export', config='height='+hauteur+', width='+largeur+', top='+haut+', left='+Gauche+' toolbar=no, menubar=no, scrollbars=no, resizable=yes, location=no, directories=no, status=no')
	//alert("Je suis en train de vous le faire, c'est 0 très bientôt :-)");
}



function parseUrlVideo(url) 
{
	/* 
		cette fonction modifie les url de download de la vidéo pour pouvoir répartir la charge.
		exemple : download1.mesvip.com/ ==> download[Rand 0 - 9].mesvip.com/
	*/
	var Uurl = url;
	var splitUrl = Uurl.split("http://download1");
	var firstBlock = splitUrl[1];
	var regenerateNewUrl = "http://download";
	if(firstBlock != undefined)
	{
		alert("generate");
		var lower = 1;
		var higher = 9;
		
		var Nrandom = (Math.random() * (higher+1-lower)) + lower;
		replace(".","P",Nrandom);
		
		url = regenerateNewUrl += Nrandom + firstBlock;
		alert("regenerateNewUrl="+regenerateNewUrl);
	}
	else 
	{
		alert("url concervé");
	}
	
	return(url);
}


function shPlayer(video,width,height,idMovie,domain)
{
	if(domain == undefined) domain = 'export';
	document.write('<iframe id="frameVideo" src="'+DomainUrl+'videoFrame.php?video='+video+'&width='+width+'&height='+height+'&idMovie='+idMovie+'&domain='+domain+'" width="'+width+'" height="'+height+'" allowtransparency="true" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" style="border:1px solid #000;"></iframe>');
}

function shPlayerExport(video,width,height,idMovie)
{
	document.write('<iframe id="frameVideo" src="'+DomainUrl+'videoFrame.php?video='+video+'&width='+width+'&height='+height+'&idMovie='+idMovie+'&exportPlayer=true&domain=export" width="'+width+'" height="'+height+'" allowtransparency="true" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" style="border:1px solid #000;"></iframe>');
}

function videoIsOpened(videoURL,idMovie)
{
	//alert("videoIsOpened : " + videoURL + " idMovie : " + idMovie);
}


function videoIsFinish(videoURL,idMovie,width,height)
{
	window.parent.document.getElementById("frameVideo").src = DomainUrl + 'videoFrame.php?videoIsFinish=true&video='+videoURL+'&width='+width+'&height='+height+'&idMovie='+idMovie;
}


function reloadPlayer(videoURL,idMovie,width,height)
{
	//dans le cas ou on veut juste recharger le player sans recharger la page
	
	//window.parent.document.getElementById("frameVideo").src = DomainUrl + 'videoFrame.php?video='+videoURL+'&width='+width+'&height='+height+'&idMovie='+idMovie;
	
	//dans le cas ou l'on souhaite recharger la page
	//alert(idMovie);
	window.parent.document.location = 'http://www.mesvip.com/mesvip,video,'+idMovie+'.html';
	
	
}


function displayRotator(idMovie,width,height)
{
	var couleur = '#000';
	var nom = 'SexyMovie';
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="400" height="100" id="'+nom+'" align="middle" id="baliseObject">\n');
	document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<param name="movie" value="'+DomainUrl+'rotator/LX-rotator.swf?pw='+width+'&ph='+height+'&idMovie='+idMovie+'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="'+couleur+'" />');
	document.write('<param name="scalemode" value="noScale" />');	
	document.write('<embed src="'+DomainUrl+'rotator/LX-rotator.swf?pw='+width+'&ph='+height+'&idMovie='+idMovie+'" quality="high" bgcolor="'+couleur+'" scalemode="noScale" allowfullscreen="true" quality="high" width="400" height="100" name="'+nom+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" id="baliseParam" />\n');
	document.write('</object>\n');
}




function RunFoo(video, width, height,idMovie,exportPlayer)
{
	
	var concatExport;
	if(exportPlayer == undefined)concatExport = false;
	else concatExport = exportPlayer = true;

	var couleur = '#000';
	var nom = 'SexyMovie';
	navigatorName = navigator.appName;
	if (navigatorName == 'Microsoft Internet Explorer')
	{
		document.write('<span id="objectVideo"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ');
		document.write('codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ');
		document.write('width="'+width+'" height="'+height+'" id="fullscreen_flash" align="middle">');
		document.write('<param name="movie" value="'+DomainUrl+'LX-player.swf?ph='+height+'&pw='+width+'&idMovie='+idMovie+'&exportPlayer='+concatExport+'&mediaflv='+video+'" />');
		document.write('<param name="quality" value="high" /><param name="allowFullScreen" value="true" /> <param name="bgcolor" value="#000000" />');
		document.write('<embed src="'+DomainUrl+'LX-player.swf?ph='+height+'&pw='+width+'&idMovie='+idMovie+'&exportPlayer='+concatExport+'&mediaflv='+video+'" ');
		document.write(' allowfullscreen="true" quality="high" bgcolor="#000000" width="'+width+'" height="'+height+'" name="fullscreen_flash" align="middle" ');
		document.write(' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write(' </object></span>');	
	}
	else
	{
		document.write('<span id="objectVideo"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="100%" height="100%" id="'+nom+'" align="middle" id="baliseObject">\n');
		document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
		document.write('<param name="quality" value="high" />\n');
		document.write('<param name="movie" value="'+DomainUrl+'LX-player.swf?ph='+height+'&pw='+width+'&idMovie='+idMovie+'&exportPlayer='+concatExport+'&mediaflv='+video+'" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="bgcolor" value="'+couleur+'" />');
		document.write('<param name="scalemode" value="noScale" />');	
		document.write('<embed src="'+DomainUrl+'LX-player.swf?ph='+height+'&pw='+width+'&idMovie='+idMovie+'&exportPlayer='+concatExport+'&mediaflv='+video+'" quality="high" bgcolor="'+couleur+'" scalemode="noScale" allowfullscreen="true" quality="high" width="100%" height="100%" name="'+nom+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" id="baliseParam" />\n');
		document.write('</object></span>\n');
	}
}




function RunFoo2temp(video, width, height,idMovie,exportPlayer)
{
	var concatExport;
	if(exportPlayer == undefined)concatExport = false;
	else concatExport = exportPlayer = true;
	
	alert(''+DomainUrl+'LX-player.swf?ph='+height+'&pw='+width+'&idMovie='+idMovie+'&exportPlayer='+concatExport+'&mediaflv='+video);
}




function Set_Cookie( name, value, expires, path, domain, secure ) 
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct 
expires time, the current script below will set 
it for x number of days, to make it for hours, 
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}



// this fixes an issue with the old method, ambiguous values 
// with this test document.cookie.indexOf( name + "] =" );
// this fixes an issue with the old method, ambiguous values 
// with this test document.cookie.indexOf( name + "=" );
function Get_Cookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f
	
	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );
		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
		
		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}		
/*
// this function gets the cookie, if it exists
// don't use this, it's weak and does not handle some cases
// correctly, this is just to maintain legacy information
function Get_Cookie( name ) {
	
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) &&
( name != document.cookie.substring( 0, name.length ) ) )
{
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}
		
*/
						
				

// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}



