	function MM_preloadImages()
	{
		var d=document;
		if(d.images)
		{
			if(!d.MM_p)
				d.MM_p=new Array();
			var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
			for(i=0; i<a.length; i++)
				if (a[i].indexOf("#")!=0)
				{
					d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];
				}
		}
	}
	
	function MM_swapImgRestore()
	{
		var i,x,a=document.MM_sr;
		for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)
			x.src=x.oSrc;
	}
	
	function MM_findObj(n, d)
	{
		var p,i,x;
		if(!d) d=document;
		if((p=n.indexOf("?"))>0&&parent.frames.length)
		{
			d=parent.frames[n.substring(p+1)].document;
			n=n.substring(0,p);
		}
		if(!(x=d[n])&&d.all)
			x=d.all[n];
		for (i=0;!x&&i<d.forms.length;i++)
			x=d.forms[i][n];
		for(i=0;!x&&d.layers&&i<d.layers.length;i++)
			x=MM_findObj(n,d.layers[i].document);
		if(!x && d.getElementById)
			x=d.getElementById(n);
		return x;
	}
	
	function MM_swapImage()
	{
		var i,j=0,x,a=MM_swapImage.arguments;
		document.MM_sr=new Array;
		for(i=0;i<(a.length-2);i+=3)
			if ((x=MM_findObj(a[i]))!=null)
			{
				document.MM_sr[j++]=x;
				if(!x.oSrc) x.oSrc=x.src;
					x.src=a[i+2];
			}
	}
	
	var FlashObject=function(swf,id,w,h,ver,c)
	{
	this.swf=swf;
	this.id=id;
	this.width=w;
	this.height=h;
	this.version=ver;
	this.align="middle";
	this.params=new Object();
	this.variables=new Object();
	this.redirect="";
	this.sq=document.location.search.split("?")[1] || "";
	this.bypassTxt="<p>Already have Macromedia Flash Player? <a href='?detectflash=false&"+ this.sq +"'>Click here if you have Flash Player "+ this.version +" installed</a>.</p>";
	if(c)
		this.color=this.addParam('bgcolor',c);
	this.addParam('quality','high');
	this.doDetect=getQueryParamValue('detectflash');
	}
	
	var FOP=FlashObject.prototype;
	FOP.addParam=function(name, value){this.params[name]=value;}
	FOP.getParams=function(){return this.params;}
	FOP.getParam=function(name){return this.params[name];}
	FOP.addVariable=function(name,value){this.variables[name]=value;}
	FOP.getVariable=function(name){return this.variables[name];}
	FOP.getVariables=function(){return this.variables;}
	
	FOP.getParamTags=function()
	{
		var paramTags="";
		for(var param in this.getParams())
		{
			paramTags +='<param name="' + param + '" value="' + this.getParam(param) + '" />';
		}
		return(paramTags=="")?false:paramTags;
	}
	
	FOP.getHTML=function()
	{
		var flashHTML = "";
		if (navigator.plugins && navigator.mimeTypes.length)
		{
			flashHTML += '<embed type="application/x-shockwave-flash" src="' + this.swf + '" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '" align="' + this.align + '"';
			for (var param in this.getParams())
			{
				flashHTML += ' ' + param + '="' + this.getParam(param) + '"';
			}
			if (this.getVariablePairs())
			{
				flashHTML += ' flashVars="' + this.getVariablePairs() + '"';
			}
			flashHTML += '></embed>';
		}
		else
		{
			flashHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '" align="' + this.align + '">';
			flashHTML += '<param name="movie" value="' + this.swf + '" />';
			if (this.getParamTags())
			{
				flashHTML += this.getParamTags();
			}
			if (this.getVariablePairs() != null)
			{
				flashHTML += '<param name="flashVars" value="' + this.getVariablePairs() + '" />';
			}
			flashHTML += '</object>';
		}
		return flashHTML;
	}
	
	FOP.getVariablePairs=function()
	{
		var variablePairs=new Array();
		for (var name in this.getVariables())
		{
			variablePairs.push(name + "=" + escape(this.getVariable(name)));
		}
		return (variablePairs.length > 0) ? variablePairs.join("&"):false;
	}
	
	FOP.write = function(elementId)
	{
		if(detectFlash(this.version) || this.doDetect=='false')
		{
			if(elementId)
			{
				document.getElementById(elementId).innerHTML = this.getHTML();
			}
			else
			{
				document.write(this.getHTML());
			}
		}
		else
		{
			if (this.redirect !="")
			{
				document.location.replace(this.redirect);
			}
			else if (this.altTxt)
			{
				if (elementId)
				{
					document.getElementById(elementId).innerHTML = this.altTxt +""+ this.bypassTxt;
				}
				else
				{
					document.write(this.altTxt +""+ this.bypassTxt);
				}
			}
		}
	}
	
	function getFlashVersion()
	{
		var flashversion = 0;
		if(navigator.plugins && navigator.mimeTypes.length)
		{
			var x = navigator.plugins["Shockwave Flash"];
			if(x && x.description)
			{
				var y = x.description;
				var dotpos = y.indexOf('.');
				var minusdot = dotpos - 1;
				
				while(y.charAt(minusdot) != ' ')
				{
					minusdot--;
				}
				
				flashversion = y.substring(minusdot, dotpos);
			}
		}
		else
		{
			result = false;
			for(var i = 15; i >= 3 && result != true; i--)
			{
				execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
				flashversion = i;
			}
		}
		return Number(flashversion);
	}
	
	function detectFlash(ver)
	{
		return(getFlashVersion() >= ver) ? true:false;
	}
	
	function getQueryParamValue(param)
	{
		var q = document.location.search || document.location.href.split("#")[1];
		if(q)
		{
			var detectIndex = q.indexOf(param +"=");
			var endIndex = (q.indexOf("&", detectIndex) > -1) ? q.indexOf("&", detectIndex) : q.length;
			if (q.length > 1 && detectIndex > -1)
			{
				return q.substring(q.indexOf("=", detectIndex)+1, endIndex);
			}
			else
			{
				return "";
			}
		}
	}
	
	if(Array.prototype.push == null)
	{
		Array.prototype.push = function(item)
		{
			this[this.length] = item;
			return this.length;
		}
	}
	
	function confirmLink(theLink, theSqlQuery)
	{
		var confirmMsg  = 'Desea realmente  ';
		if (confirmMsg == '')
		{
			return true;
		}
		var is_confirmed = confirm(confirmMsg + ' :\n' + theSqlQuery);
		if (is_confirmed)
		{
			theLink.href;
		}
		return is_confirmed;
	}
	
	function explain(msg)
	{
		newwin = window.open('','','top=150,left=150,width=600,height=500,scrollbars=yes,resizable=yes');
		if (!newwin.opener)
			newwin.opener = self;
		with (newwin.document)
		{
			open();
			write('<html>');
			write('<body bgcolor=#CCFFCC><font face="verdana"><form name=form>' + msg + '<br>');
			write('<p><center><input type=button value="Cerrar" onClick=window.close()>');
			write('</center></form></font></body></html>');
			close();
		}
	}
	
	var windowW=400
	var windowH=550
	var windowX = 300
	var windowY = 150
	//var windowX = (screen.width/2)-(windowW/2);
	//var windowY = (screen.height/2)-(windowH/2);

	/**
	 * Herramienta "Cuentele a un amigo"
	 */
	var urlPop = "tools/cuentele.php"
	var title =  "Cuéntele a un amigo"
	var autoclose = true
	s = "width="+windowW+",height="+windowH;
	var beIE = document.all?true:false

	function openFrameless(url2) 
	{
		if (url2 > 0)
		{
			urlPop = urlPop + "?idcategoria=" + url2;
		}
		NFW=window.open(urlPop,"popFrameless","scrollbars,"+s)
		NFW.blur()
		window.focus()
		NFW.resizeTo(windowW,windowH)
		NFW.moveTo(windowX,windowY)
		NFW.focus()
		if (autoclose)
		{
			window.onunload=function(){NFW.close()}
		}
	}