// detecta el plugin de flash y escribe el objeto en html o la imagen segun el resultado dela comprobacion
function detectarEscribirFlash(rutaSWF, rutaImagen, flashVersion, ancho, altura, enlace, target, parametros) {//v1.1
	var splitRuta= rutaSWF.split("/");
	var archivo = splitRuta[splitRuta.length-1].split(".");
	var nombre = archivo[0];
	var requiredVersion = eval(flashVersion);

	var flash2Installed = false;
	var flash3Installed = false;
	var flash4Installed = false;
	var flash5Installed = false;
	var flash6Installed = false;
	var flash7Installed = false;
	var maxVersion = 7;
	var actualVersion = 0;
	var hasRightVersion = false;
	var jsVersion = 1.0;
	var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true if we're on ie
	var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // true if we're on windows

	jsVersion = 1.1;


	if(isIE && isWin){
	  try{
		flash2Installed = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.2");
		if (flash2Installed != null) flash2Installed =true;
	  }
	  catch(e){
		flash2Installed=false;
	  }
	  try{
		flash3Installed = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
		if (flash3Installed != null) flash3Installed =true;
	  }
	  catch(e){
		flash3Installed=false;
	  }

	  try{
		flash4Installed = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.4");
		if (flash4Installed != null) flash4Installed =true;
	  }
	  catch(e){
		flash4Installed=false;
	  }

	  try{
		flash5Installed = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.5");
		if (flash5Installed != null) flash5Installed =true;
	  }
	  catch(e){
		flash5Installed=false;
	  }

	  try{
		flash6Installed = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
		if (flash6Installed != null) flash6Installed =true;
	  }
	  catch(e){
		flash6Installed=false;
	  }

	  try{
		flash7Installed = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		if (flash7Installed != null) flash7Installed =true;
	  }
	  catch(e){
		flash7Installed=false;
	  }
	}else{

		  if (navigator.plugins) {
		if (navigator.plugins["Shockwave Flash 2.0"]
			|| navigator.plugins["Shockwave Flash"]) {

		  var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
		  var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;

		  var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
		  flash2Installed = flashVersion == 2;
		  flash3Installed = flashVersion == 3;
		  flash4Installed = flashVersion == 4;
		  flash5Installed = flashVersion == 5;
		  flash6Installed = flashVersion == 6;
		  flash6Installed = flashVersion >= 7;
		}
	  }
	}
  for (var i = 2; i <= maxVersion; i++) {
    if (eval("flash" + i + "Installed") == true) actualVersion = i;
  }

	var newParameter=parametros !='' && parametros != null ? '?' + parametros : ''
	var newFlashVars=parametros !='' && parametros != null ? 'FLASHVARS="' + parametros +'"' : ''
	var objetoFlash='';

	objetoFlash+='<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" NAME="'+nombre+'" WIDTH="'+ancho+'" HEIGHT="'+altura+'" ID="'+nombre+'">\n';
	objetoFlash+='<PARAM NAME="movie" VALUE="'+ rutaSWF + newParameter +'">\n';
	objetoFlash+='<PARAM NAME=quality VALUE=high>\n';
	objetoFlash+='<PARAM NAME="wmode" VALUE="transparent">\n';
	objetoFlash+='<PARAM NAME="menu" VALUE="false">\n';
	objetoFlash+=parametros!='' && parametros != null?'<PARAM NAME="FlashVars" VALUE="'+parametros+'">\n':'';
	objetoFlash+='<EMBED SRC="'+ rutaSWF + newParameter +'" WIDTH="'+ancho+'" HEIGHT="'+ancho+'" QUALITY=high PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" TYPE="application/x-shockwave-flash" WMODE="transparent" MENU="false" '+ newFlashVars +' NAME="'+nombre+'"></EMBED>\n';
	objetoFlash+='</OBJECT>\n';

  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 3;
	if (actualVersion >= requiredVersion && rutaSWF != ''){
			document.write(objetoFlash);
	  }else{
		  if (target != '' && target != null){
			document.write('<a href="'+ enlace +'" target="' + target + '"><IMG SRC="'+ rutaImagen +'" BORDER=0 ID="'+ nombre +'"></a>');
		  }else{
			document.write('<a href="'+ enlace +'"><IMG SRC="'+ rutaImagen +'" BORDER=0 ID="'+ nombre +'"></a>');
		}
  }
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function changeWindowSize(x,y){
	anchoAltura = new Array(x,y)
	var _xSize=x+10;
	var _ySize=y+29;
	window.resizeTo(_xSize,_ySize);
	w = screen.availWidth;
	h = screen.availHeight;
	window.moveTo((w-x)/2, (h-y)/2);
	window.focus();
	return anchoAltura;
}
function changeWindowSize2(x,y){
	anchoAltura = new Array(x,y)
	var _xSize=x+10;
	var _ySize=y+29;
	window.resizeTo(_xSize,_ySize);
	w = screen.availWidth;
	h = screen.availHeight;
	window.moveTo((w-x)/2, (h-y)/2);
	window.focus();
}
function mostrarReloj() {
	MM_showHideLayers('capaEspera','','show');
	funcionaReloj();
}
function mostrarRejoj() {
	MM_showHideLayers('capaEspera','','show');
	funcionaReloj();
}
function funcionaReloj(){
	imagen=MM_findObj('reloj');
	imagen.src='/img/capaEspera.gif';
}
function MM_swapImage() { //v3.0
  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];}
}
function MM_swapImgRestore() { //v3.0
  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_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_preloadImages() { //v3.0
 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];}}
}
//Begin dHTML Toolltip Timer
var tipTimer;
//End dHTML Toolltip Timer

function locateObject(n, d) { //v3.0
  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=locateObject(n,d.layers[i].document); return x;
}

function hideTooltip(object)
{
if (document.all)
{
	locateObject(object).style.visibility="hidden"
	locateObject(object).style.left = 1;
	locateObject(object).style.top = 1;
return false
}
else if (document.layers)
{
	locateObject(object).visibility="hide"
	locateObject(object).left = 1;
	locateObject(object).top = 1;
	return false
}
else
	return true
}

function showTooltip(object,e, tipContent, backcolor, bordercolor, textcolor, displaytime)
{
	window.clearTimeout(tipTimer)

	if (document.all)
		{
			locateObject(object).style.top=document.body.scrollTop+event.clientY+20

			locateObject(object).innerHTML='<table style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; border: '+bordercolor+'; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; background-color: '+backcolor+'" width="10" border="0" cellspacing="1" cellpadding="1"><tr><td nowrap><font style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; color: '+textcolor+'">'+unescape(tipContent)+'</font></td></tr></table> '

			if ((e.x + locateObject(object).clientWidth) > (document.body.clientWidth + document.body.scrollLeft))
				{
					locateObject(object).style.left = (document.body.clientWidth + document.body.scrollLeft) - locateObject(object).clientWidth-10;
				}
			else
			{
			locateObject(object).style.left=document.body.scrollLeft+event.clientX
			}
		locateObject(object).style.visibility="visible"
		tipTimer=window.setTimeout("hideTooltip('"+object+"')", displaytime);
		return true;
		}
	else if (document.layers)
		{
		locateObject(object).document.write('<table width="10" border="0" cellspacing="1" cellpadding="1"><tr bgcolor="'+bordercolor+'"><td><table width="10" border="0" cellspacing="0" cellpadding="2"><tr bgcolor="'+backcolor+'"><td nowrap><font style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; color: '+textcolor+'">'+unescape(tipContent)+'</font></td></tr></table></td></tr></table>')
		locateObject(object).document.close()
		locateObject(object).top=e.y+20

		if ((e.x + locateObject(object).clip.width) > (window.pageXOffset + window.innerWidth))
			{
				locateObject(object).left = window.innerWidth - locateObject(object).clip.width-10;
			}
		else
			{
			locateObject(object).left=e.x;
			}
		locateObject(object).visibility="show"
		tipTimer=window.setTimeout("hideTooltip('"+object+"')", displaytime);
		return true;
	}
	else
	{
		return true;
	}
}
/*_______________escribeDinamicamente__________________________*/
var ie4 = (document.all) ? true : false;
var ns4 = (document.layers) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;
function writetolayer(lay,txt) {
  if (txt.length != 0) {
	if (ie4) {
		document.all[lay].innerHTML = txt;
	}
	if (ns4) {
		document[lay].document.write(txt);
		document[lay].document.close();
	}
	if (ns6) {
		over = document.getElementById([lay]);
		range = document.createRange();
		range.setStartBefore(over);
		domfrag = range.createContextualFragment(txt);
		while (over.hasChildNodes()) {
			over.removeChild(over.lastChild);
		}
		over.appendChild(domfrag);
	}
  }
}
/*_______________finEscribeDinamicamente__________________________*/
function getParametro(paramName) {
	searchString = document.location.search;
	var parametrosValor = searchString.substring(1).split("&");
	for(i = 0; i < parametrosValor.length; i++) {
		parametroValor = parametrosValor[i].split("=");
		if(parametroValor[0] == paramName)
		return parametroValor[1];
	}
	return null;
}

/*__________________envia a un amigo -------------------------*/


/*
	envia a un amigo: estas son las direcciones para enviar los datos codificados a flash

*/

var direcciones = new Array();

direcciones[0] = "http://www.ola.com.co/secciones/OLAC/HOME/UT/ENV/doc_160_HTML.html?idDocumento=160&urlArticulo=http://www.ola.com.co%2Fsecciones%2FOLAC%2FHOME%2FPP%2FPER%2Fseccion_HTML.html%3FPioneros%3Dyes";//CALCULADORA DE PIONEROS
direcciones[1] = "http://www.ola.com.co/secciones/OLAC/HOME/UT/ENV/doc_160_HTML.html?idDocumento=160&urlArticulo=http://www.ola.com.co%2Fsecciones%2FOLAC%2FHOME%2FPP%2FPER%2Fseccion_HTML.html";//DESTACADO DEL HOME DE LA TIENDA PERSONAS
direcciones[2] = "http://www.ola.com.co/secciones/OLAC/HOME/UT/ENV/doc_160_HTML.html?idDocumento=160&urlArticulo=http://www.ola.com.co%2Fsecciones%2FOLAC%2FHOME%2FTSO%2FT06%2Fseccion_HTML.html";//FLASH DE DONDE ESTAMOS
direcciones[3] = "http://www.ola.com.co/secciones/OLAC/HOME/UT/ENV/doc_160_HTML.html?idDocumento=160&urlArticulo=http://www.ola.com.co%2Fsecciones%2FOLAC%2FHOME%2FTS%2FEMP%2Fseccion_HTML.html%3FFactura%3Dyes";//FLASH DE LA FACTURA COMPAŅIAS
direcciones[4] = "http://www.ola.com.co/secciones/OLAC/HOME/UT/ENV/doc_160_HTML.html?idDocumento=160&urlArticulo=http://www.ola.com.co%2Fsecciones%2FOLAC%2FHOME%2FTS%2FPER%2Fseccion_HTML.html%3FFactura%3Dyes";//FLASH DE LA FACTURA CLIENTES



function enviaAmigo(documento){
	MM_openBrWindow(direcciones[documento],'ContarFriend','width=320,height=320');
}
