document.write("<script type=\"text/javascript\" src=\"http://progressive01.codistream.net/generalFiles/swfjs/swfobject.js\"></script>");
document.write("<script type=\"text/javascript\" src=\"http://progressive01.codistream.net/generalFiles/swfjs/swfaddress.js\"></script>");
document.write("<script type=\"text/javascript\" src=\"http://progressive01.codistream.net/generalFiles/swfjs/swfsize.js\"></script>");
document.write("<script type=\"text/javascript\" src=\"http://progressive01.codistream.net/generalFiles/swfjs/prototype.js\"></script>");
document.write("<script type=\"text/javascript\" src=\"http://progressive01.codistream.net/generalFiles/swfjs/effects.js\"></script>");
document.write("<script type=\"text/javascript\" src=\"http://progressive01.codistream.net/generalFiles/swfjs/lightwindow.js\"></script>");
document.write("<script type=\"text/javascript\" src=\"http://connect.facebook.net/es_ES/all.js\"></script>");

var user	 = "";
var pathData = "";
var videoId = "";

this.createEmbed = function(__user, __pathData, __videoId){
	//document.write('<div id="loadertext" style="color:#FFF; text-align:center; line-height: 300px; height:600px;">Loading...</div>');
	
	/*document.write('<div id="fb-root"></div>');
	document.write('<table border="0" cellpadding="0" cellspacing="0" vspace="0" hspace="0" width="100%" height="800px" ><td><div align="center" id="flashContentmultistream"><a href="http://www.adobe.com/go/getflash"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Obtener Adobe Flash Player" /></a> <p style="color:#FFF">Esta p&aacute;gina necesita la versi&oacute;n 10.1.0 de Flash Player o superior.</p> </div></td></table>');*/
	
	var body = document.getElementsByTagName('body')[0];
		body.setAttribute('marginwidth', '0');
		body.setAttribute('marginheight', '0');
		
	/*var divLoading = document.createElement('div');
		divLoading.setAttribute('id', 'loadertext');
		divLoading.setAttribute('style', 'color:#FFF');
		divLoading.setAttribute('style', 'text-align:center');
		divLoading.setAttribute('style', 'line-height: 300px');
		divLoading.setAttribute('style', 'height:600px');
		body.appendChild(divLoading);*/
		
	/*window.onload = function(){
		var loading = document.getElementById('loadertext');
		loading.setAttribute('style', 'visibility:hidden');
		loading.setAttribute('style', 'display:none');
	}; */


	var divFacebook = document.createElement('div');
		divFacebook.setAttribute('id', 'fb-root');
		body.appendChild(divFacebook);
		
	var divFlashContentmultistream = document.createElement('div');
		divFlashContentmultistream.setAttribute('id', 'flashContentmultistream');
		divFlashContentmultistream.setAttribute('align', 'center');
		body.appendChild(divFlashContentmultistream);
				
	var a = document.createElement('a');
		a.setAttribute('href', 'http://www.adobe.com/go/getflash');
		divFlashContentmultistream.appendChild(a);
		
	var p = document.createElement('p');
		p.setAttribute('style', 'color:#FFF');
		p.innerHTML = 'Esta p&aacute;gina necesita la versi&oacute;n 10.1.0 de Flash Player o superior.';
		divFlashContentmultistream.appendChild(p);
	
	var img = document.createElement('img');
		img.setAttribute('src', 'http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif');
		img.setAttribute('alt', 'Obtener Adobe Flash Player');
		a.appendChild(img);
						
								
	var urldomain	= document.URL.substring(0, document.URL.indexOf("?", 0));
	var videoId		= parsevar( 'videoId' );
	var startPoint	= Boolean(parsevar( 'startPoint' )) ? '&startPoint=' + parsevar( 'startPoint' ) : '';
	var endPoint	= Boolean(parsevar( 'endPoint' ))   ? '&endPoint='   + parsevar( 'endPoint' ) : '';
	
	if(Boolean(videoId)) document.location.href = urldomain + "#/?videoId=" + parsevar( 'videoId' ) + startPoint + endPoint;
	
	var vars		= { userId:			__user,
						pathData:		__pathData,
						videoId:		videoId,
						startPoint:		startPoint,
						endPoint:		endPoint };
	var params		= {	scale:		"noScale",
						menu:		"false",
						allowFullScreen:  "true",
						wmode: "opaque",
						bgcolor: "#000000",
						quality: "high",
						allowScriptAccess: "always" };
	var attributes	= {	id:			"swfID",
						name:		"swfID" };
	
	swfobject.switchOffAutoHideShow();
	swfobject.embedSWF("http://progressive01.codistream.net/generalFiles/webTvPlatform.swf", "flashContentmultistream", "100%", "1480", "10.1", "http://progressive01.codistream.net/generalFiles/swfjs/expressInstall.swf", vars, params, attributes);		
	swfsize.id = "swfID";
	
	user 		= __user;
	pathData	= __pathData;
	videoId		= __videoId;
}

this.loadWidget = function (applicationPath, msgOk){
	myLightWindow.activateWindow({href: 'http://progressive01.codistream.net/generalFiles/loaderWidget.swf?applicationPath=' + applicationPath + '&userId=' + user + '&pathData=' + pathData + '&msgOk=' + msgOk, classNames: 'lightwindow page-options', width: 900, height: 610, title:"WIDGET"});
}

this.loadAdmin = function (l){
	myLightWindow.activateWindow({href: 'http://progressive01.codistream.net/generalFiles/moduleAdmin.swf?userId=' + user + '&l=' + l, classNames: 'lightwindow page-options', width: 800, height: 700, title:"MÓDULO ADMINISTRADOR"});
}

this.checkClose = function (){
	return myLightWindow.closeEvent();
}

this.parsevar = function ( name ){
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp ( regexS );
	var tmpURL = window.location.href;
	var results = regex.exec( tmpURL );
	if( results == null )
		return"";
	else
		return results[1];
}

this.createSwfMovie = function(varSwf){
		var vars		= { userId:			varSwf.userId,
							pathData:		varSwf.pathData,
							videoId:		videoId,
							startPoint:		startPoint,
							endPoint:		endPoint };
		var params		= {	scale:		"noScale",
							menu:		"false",
							allowFullScreen:  "true",
							wmode: "transparent",
							allowScriptAccess: "always" };
		var attributes	= {	};
		
		swfobject.switchOffAutoHideShow();
		swfobject.embedSWF(varSwf.movie, varSwf.id, varSwf.width, varSwf.height, "10.1", "http://progressive01.codistream.net/generalFiles/swfjs/expressInstall.swf", vars, params, attributes);
}

this.cancelFunction = function() {
	alert("Express Install was cancelled");
}

