//ABCversionCBA
//version=20060118115742#Z:/VOB_ODPPUB/ODPPUB/Web Content/ODPPUB/docs/ODP/comun.js@@/main/RSUidamr2005122602/1;
//XYZversionZYX

<!--
//Direcciones a personalizar para cada entorno.
//PRODUCCION
var urlbase='https://clientes.oficinadirecta.com/form/';
var url_prog_cgi="http://www.oficinadirecta.com/cgi/";
var urlbaseclientes='https://clientes.oficinadirecta.com';
//var urlbase='http://localhost:9080/ODPPUB/ODPPUB/docs/ODP/';
// ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡

var parentWin=parent;

var xnuidsifr;
var xnuidprfr;

var tamanioWidth;
var tamanioHeight;

var retardoPopUp;

function descubre_nuidorfr(cadena)
{
         regular=/.*nuidorfr=(.*)&/;

         if (regular.test(cadena)) {
             resultado=regular.exec(cadena);
//		alert('cadena encontrada '+resultado[1].substring(0,4));
             return(resultado[1].substring(0,4));
         }
         else {
               return -1;
         }
}

function descubre_nuidsifr(cadena)
{
         regular=/.*nuidsifr=(.*)&/;
         if (regular.test(cadena)) {
             resultado=regular.exec(cadena);
//		alert('cadena encontrada '+resultado[1].substring(0,3));
             return(resultado[1].substring(0,3));
         }
         else {
               return -1;
         }
}

function descubre_nuidprfr(cadena)
{
         regular=/.*nuidprfr=(.*)&/;
         if (regular.test(cadena)) {
             resultado=regular.exec(cadena);
//		alert('cadena encontrada '+resultado[1].substring(0,3));
             return(resultado[1].substring(0,3));
         }
         else {
               return -1;
         }
}

function asignarvalores()
{
//if ( (window.parent.opener.name == 'Cuerpo') ||
//     (window.parent.opener.name == 'Menu') )
//    nuidorfr=window.parent.opener.top.of;
// else
nuidorfr=descubre_nuidorfr(window.location.href);
//nuidorfr=nuidorfr.substring(0,4);
if (nuidorfr == -1)
	alert('Error paso parametro origen producto');
nuidsifr=descubre_nuidsifr(window.location.href);
if (nuidsifr == -1)
	alert('Error paso parametro situacion producto');

nuidprfr=descubre_nuidprfr(window.location.href);
if (nuidprfr == -1)
	alert('Error paso parametro tipo producto');
//alert("Oficina Virtual:"+nuidorfr+nuidsifr+nuidprfr);
}

function MM_showHideLayers() { //v3.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 MM_openBrWindowJSP(theURL,winName,features) { //v2.0

        regular=/.*nuidorfr=(.*)&/;

// Si la URL contiene el parametro nuidorfr.
        if (regular.test(theURL))
	{
            resultado=regular.exec(theURL);
// Si el nombre de la ventana es Cuerpo o Menu se busca la variable of en el parent.top.
  	    if ( (window.name == 'Cuerpo') ||
	         (window.name == 'Menu') )
	          nuidorfr=window.parent.top.of;
	     else nuidorfr='0001';

// Si el parametro nuidorfr es 0001 no se necesita cambiar.
            if (nuidorfr != '0001') 
	      {
// Se genera una nueva URL con el parametro nuidorfr cambiado.
	        x = theURL.length;
                y = resultado[1].length;
                nuevaURL = theURL.substring(0,x-y-1)+nuidorfr+resultado[1].substring(4)+'&';
	      }
             else nuevaURL = theURL;
	}
       else nuevaURL = theURL;

//       if (nuevaURL.substring(0,5) == 'ODPFR')
//	{
//	       alert('URL: '+ urlbase +nuevaURL);
	       window.open(urlbase+nuevaURL,winName,features+",resizable=yes");
//	}
//	else {
//	        alert('URL: '+ nuevaURL);
//		window.open(nuevaURL,winName,features+",resizable=yes");
//	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_findObj(n, w) { //v4.0

  var p,i,x, d;  
  if(!w)
    w=window ;

  d= w.document;
  
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; 
    n=n.substring(0,p);
  }

  x=d.getElementById(n); 
  
  for (i=0;!x&&i< w.frames.length;i++) {
      x=MM_findObj(n, w.frames[i]);   
  }

   return x;



}

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];}}
}

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_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_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_checkBrowser(NSvers,NSpass,NSnoPass,IEvers,IEpass,IEnoPass,OBpass,URL,altURL) { //v3.0
  var newURL='', verStr=navigator.appVersion, app=navigator.appName, version = parseFloat(verStr);
  if (app.indexOf('Netscape') != -1) {
    if (version >= NSvers) {if (NSpass>0) newURL=(NSpass==1)?URL:altURL;}
    else {if (NSnoPass>0) newURL=(NSnoPass==1)?URL:altURL;}
  } else if (app.indexOf('Microsoft') != -1) {
    if (version >= IEvers || verStr.indexOf(IEvers) != -1)
     {if (IEpass>0) newURL=(IEpass==1)?URL:altURL;}
    else {if (IEnoPass>0) newURL=(IEnoPass==1)?URL:altURL;}
  } else if (OBpass>0) newURL=(OBpass==1)?URL:altURL;
  if (newURL) { window.location=unescape(newURL); document.MM_returnValue=false; }
}

function MM_timelinePlay(tmLnName, myID) { //v1.2
  //Copyright 1997 Macromedia, Inc. All rights reserved.
  var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,propNum,theObj,firstTime=false;
  if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time

  if (document.MM_Time == null) return; //no se inicializó, o no hay popup para esa página

  tmLn = document.MM_Time[tmLnName];
  if (myID == null) { myID = ++tmLn.ID; firstTime=true;}//if new call, incr ID
  if (myID == tmLn.ID) { //if Im newest
    setTimeout('MM_timelinePlay("'+tmLnName+'",'+myID+')',tmLn.delay);
    fNew = ++tmLn.curFrame;
    for (i=0; i<tmLn.length; i++) {
      sprite = tmLn[i];
      if (sprite.charAt(0) == 's') {
        if (sprite.obj) {
          numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0];
          if (fNew >= firstKeyFr && fNew <= sprite.keyFrames[numKeyFr-1]) {//in range
            keyFrm=1;
            for (j=0; j<sprite.values.length; j++) {
              props = sprite.values[j]; 
              if (numKeyFr != props.length) {
                if (props.prop2 == null) sprite.obj[props.prop] = props[fNew-firstKeyFr];
                else        sprite.obj[props.prop2][props.prop] = props[fNew-firstKeyFr];
              } else {
                while (keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]) keyFrm++;
                if (firstTime || fNew==sprite.keyFrames[keyFrm-1]) {
                  if (props.prop2 == null) sprite.obj[props.prop] = props[keyFrm-1];
                  else        sprite.obj[props.prop2][props.prop] = props[keyFrm-1];
        } } } } }
      } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);
      if (fNew > tmLn.lastFrame) tmLn.ID = 0;
  } }
}

function MM_timelineGoto(tmLnName, fNew, numGotos) { //v2.0
  //Copyright 1997 Macromedia, Inc. All rights reserved.
  var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,lastKeyFr,propNum,theObj;
  if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time

  if (document.MM_Time == null) return; //no se inicializó, o no hay popup para esa página

  tmLn = document.MM_Time[tmLnName];
  if (numGotos != null)
    if (tmLn.gotoCount == null) tmLn.gotoCount = 1;
    else if (tmLn.gotoCount++ >= numGotos) {tmLn.gotoCount=0; return}
  jmpFwd = (fNew > tmLn.curFrame);
  for (i = 0; i < tmLn.length; i++) {
    sprite = (jmpFwd)? tmLn[i] : tmLn[(tmLn.length-1)-i]; //count bkwds if jumping back
    if (sprite.charAt(0) == "s") {
      numKeyFr = sprite.keyFrames.length;
      firstKeyFr = sprite.keyFrames[0];
      lastKeyFr = sprite.keyFrames[numKeyFr - 1];
      if ((jmpFwd && fNew<firstKeyFr) || (!jmpFwd && lastKeyFr<fNew)) continue; //skip if untouchd
      for (keyFrm=1; keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]; keyFrm++);
      for (j=0; j<sprite.values.length; j++) {
        props = sprite.values[j];
        if (numKeyFr == props.length) propNum = keyFrm-1 //keyframes only
        else propNum = Math.min(Math.max(0,fNew-firstKeyFr),props.length-1); //or keep in legal range
        if (sprite.obj != null) {
          if (props.prop2 == null) sprite.obj[props.prop] = props[propNum];
          else        sprite.obj[props.prop2][props.prop] = props[propNum];
      } }
    } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);
  }
  tmLn.curFrame = fNew;
  if (tmLn.ID == 0) eval('MM_timelinePlay(tmLnName)');
}

function MM_initTimelines() { //v4.0
    //MM_initTimelines() Copyright 1997 Macromedia, Inc. All rights reserved.

    quePagina=pagDeAsesoramiento();
    if (quePagina=="") { return; }

    var ns = navigator.appName == "Netscape";
    var ns4 = (ns && parseInt(navigator.appVersion) == 4);
    var ns5 = (ns && parseInt(navigator.appVersion) > 4);
    document.MM_Time = new Array(1);
    document.MM_Time[0] = new Array(2);
    document.MM_Time["Timeline1"] = document.MM_Time[0];
    document.MM_Time[0].MM_Name = "Timeline1";
    document.MM_Time[0].fps = 5;
    document.MM_Time[0][0] = new String("sprite");
    document.MM_Time[0][0].slot = 1;
    if (ns4)
        document.MM_Time[0][0].obj = document["alta"];
    else if (ns5)
        document.MM_Time[0][0].obj = document.getElementById("alta");
    else
        document.MM_Time[0][0].obj = document.all ? document.all["alta"] : null;
    document.MM_Time[0][0].keyFrames = new Array(1, 80);
    document.MM_Time[0][0].values = new Array(0);
    document.MM_Time[0][1] = new String("behavior");
    document.MM_Time[0][1].frame = 80;

//    document.MM_Time[0][1].value = "MM_openBrWindowJSP(quePagina+'?nuidorfr=0001&nuidsifr=008&nuidprfr=540&','cb','width=600,height=250')";
//  document.MM_Time[0][1].value = "MM_openBrWindow('"+quePagina+"?nuidorfr=0001&nuidsifr="+xnuidsifr+"&nuidprfr="+xnuidprfr+"&','cb','width=600,height=250')";
    document.MM_Time[0][1].value = "MM_openBrWindow('"+quePagina+"?nuidorfr=0001&nuidsifr="+xnuidsifr+"&nuidprfr="+xnuidprfr+"&','cb','width="+tamanioWidth+",height="+tamanioHeight+"')";
    document.MM_Time[0].lastFrame = 80;
    for (i=0; i<document.MM_Time.length; i++) {
        document.MM_Time[i].ID = null;
        document.MM_Time[i].curFrame = 0;
//        document.MM_Time[i].delay = 1000/document.MM_Time[i].fps;
//        document.MM_Time[i].delay = 250/document.MM_Time[i].fps;
        document.MM_Time[i].delay = retardoPopUp/document.MM_Time[i].fps; 
    }
}
//-->


function pagDeAsesoramiento() {

	elPadre=document.URL;
	if (elPadre=="") return "";

	if ((elPadre.indexOf("bolsaplus")>=0) || (elPadre.indexOf("cerofloat")>=0) ) {
		pagina="";
		xnuidsifr="007";
		xnuidprfr="542";
		retardoPopUp=250;
		tamanioWidth="600";
		tamanioHeight="250";
	} else if ((elPadre.indexOf("condic")>=0) ) {
		pagina="";
		xnuidsifr="006";
		xnuidprfr="543";
		retardoPopUp=500;
		tamanioWidth="600";
		tamanioHeight="250";
	} else if ((elPadre.indexOf("cuentapre")>=0) ) {
		pagina="";
		xnuidsifr="008";
		xnuidprfr="540";
		retardoPopUp=250;
		tamanioWidth="600";
		tamanioHeight="250";
	} else {
		pagina="";
		xnuidsifr="";
		xnuidprfr="";
		retardoPopUp=250;
		tamanioWidth="600";
		tamanioHeight="250";
	}
	return pagina;
}



