var Flash = new Object();

Flash.hasVersion = function (requiredVersion) {
	requiredVersion = parseInt (requiredVersion);
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		var version = 0;
		var plugin = navigator.plugins["Shockwave Flash"];
		if (typeof plugin == "object") {
			var description = plugin.description;
			version = parseInt (description.charAt (description.indexOf (".") - 1));
		}
		return (version >= requiredVersion) ? true : false;
	} else if (navigator.appVersion.indexOf ("Mac") == -1 && window.execScript) {
		Flash.hasVersion_result = false;
		for (var i = requiredVersion; i <= requiredVersion + 5 && Flash.hasVersion_result != true; i ++) {
			execScript ('on error resume next: Flash.hasVersion_result=IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
		}
		return Flash.hasVersion_result;
	}
	return null;
}

Flash.redirect = function (version, noFlashPage) {
	if (document.referrer.indexOf (noFlashPage) != -1) return;
	if (!this.hasVersion (version)) {
		window.location.href = noFlashPage;
	}
}

Flash.write = function (movie, version, width, height, bgcolor, image, alt) {
	if (this.hasVersion (version)) {
		var swf = '<object';
		swf += ' width="' + width + '"';
		swf += ' height="' + height + '"';
		swf += ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
		swf += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + version + ',0,0,0">';
		swf += '<param name="movie" value="' + movie + '" />';
		if (bgcolor) swf += '<param name="bgcolor" value="' + bgcolor + '">';
		swf += '<param name="menu" value="false" />';
		swf += '<embed src="' + movie + '"';
		swf += ' width="' + width + '"';
		swf += ' height="' + height + '"';
		if (bgcolor) swf += ' bgcolor="' + bgcolor + '"';
		swf += ' type="application/x-shockwave-flash"';
		swf += ' pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">';
		swf += '<\/embed>';
		swf += '<\/object>';
		document.write (swf);
	} else {
		if (image) document.write ('<img src="' + image + '" width="' + width + '" height="' + height + '" alt="' + alt + '" />');
	}
}

// ============================================================

// Usage

// Flash.redirect (6, "/noflash.html");
// Flash.write ("/flash/movie.swf", 6, 300, 200, "#ffffff", "/images/noflash.jpg", "Image Description");

//lanzar ventana
var popUpWin=0;
function recomendarWin(){
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
	var width = 430;
	var height = 340;
	var left = (screen.availWidth-width)/2;
	var top = (screen.availHeight-height)/2;
  var popUpWin = open('recomendar/', 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
	popUpWin.focus();
}
