// JavaScript Document
// Custom
var _imgHost = "http:\/\/fsi.dmmotion.com\/10091\/img\/";
//var _imgHost = "http:\/\/desarrollo-cstv.nspmotion.com\/10091\/img\/";
//var _imgHost = "img\/";

/*Funciones para el Permalink*/

function queryToObj (query) {
	var args=new Object(), pairs=query.split("&");
	var i = pairs.length;
	while (i--) {
		var pos=pairs[i].indexOf("=");
		if (pos==-1) continue;
		var argname=pairs[i].substring(0,pos), value=pairs[i].substring(pos+1);
		args[argname]=unescape(value);
	}
	return args;
}

var obj = queryToObj(location.search.substring(1));

// Player
function Player() {
	this._plDivId = "ADMPlayer";
	this._plFile = _imgHost+"tv_flash.swf";
	
	this.show = function () {
		var oE = document.getElementById(this._plDivId);
		oE.innerHTML = this.generateSwf("adm_pl", 620, 866, this._plFile, "PermalinkV="+obj.v, "opaque", "#ffffff");
	}
	this.generateSwf = function(id, width, height, file, fv, wmode, bgcolor) {
		if (typeof(fv)=="undefined") fv="";
		if (typeof(wmode)=="undefined") wmode="window";
		var h = '';
		h+= '<object id="'+id+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'"><param name=movie value="'+file+'" \/><param name=quality value=high \/><param name=menu value=false \/>';
		if (typeof(bgcolor)!="undefined") h+= '<param name="bgcolor" value="'+bgcolor+'" \/>';
		h+= '<param name="wmode" value="'+wmode+'" \/>';
		h+= '<param name=FlashVars value="'+fv+'" \/>';
		h+= '<param name="allowScriptAccess" value="always" \/><param name="allowFullScreen" value="true" \/>';
		h+= '<embed name="'+id+'" src="'+file+'" menu=false quality=high width="'+width+'" height="'+height+'" type="application\/x-shockwave-flash" pluginspace="http:\/\/www.macromedia.com\/go\/getflashplayer" wmode="'+wmode+'"';
		if (typeof(bgcolor)!="undefined") h+= ' bgcolor="'+bgcolor+'"';
		h+= ' FlashVars="'+fv+'"';
		h+= ' allowScriptAccess="always" allowFullScreen="true"><\/embed>';
		h+= '<\/object>';
		return h;
	}
	
	
	this.show();
}

var to = new Player();