    /******************** VARIABLES DE CONTROL GENERAL *****************************************/
    var arrImg = new Array();
    var arrimgon = new Array();
    var arrimgoff = new Array();
    var arrimgid = new Array();
    var arrimgDiv = new Array();
    var isin;
    var acStockId;
    var nCod;
    var tx;
    var ind;
    /********************************************************************************************/

    function recargar(){
     if(nn4)
      document.location = document.location.href;
    }

    function popup(pag,nombre,height,width){
     x= (screen.height-height)/2;
     y= (screen.width-width)/2;
     eval("window.open('"+pag+"','"+nombre+"','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width="+width+",height="+height+",top="+x+",left="+y+"')");
    }

    function popup(pag,nombre,height,width,top,left){
     eval("window.open('"+pag+"','"+nombre+"','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width="+width+",height="+height+",top="+top+",left="+left+"')");
    }

   // Abre el popup de recibimiento para usuario externos
   function registropopup() {
    ancho=499;
    alto=392;
    x= (screen.height-alto)/2;
    y= (screen.width-ancho)/2;
    eval("window.open('/acnet/home/popup/onload_popup.html','vent','toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width="+ancho+",height="+alto+",top="+x+",left="+y+"')");
   }

   function wipeGetOffset(obj, coord) {
		 if(obj!=null){
		 var val = obj["offset"+coord];
		 while ((obj = obj.offsetParent )!=null) {
		  val += obj["offset"+coord];
		  if (obj.border && obj.border != 0)
		   val++;
		 }
		 return val;
		}
		return null
	}

     function Imagenes(){
      var imagen;
      imagen = new Image()
      for(i=0;i<arrimgid.length;i++){
       imagen = document.images[arrimgid[i]];
       arrImg[arrimgid[i]] = imagen;
       arrImg[arrimgid[i]].over = arrimgon[i];
       arrImg[arrimgid[i]].out = arrimgoff[i];
      }
      cargadas = true;
     }

    function generadorCapas(){
       pospiealtura1=null;
       if (document.all)
         pospiealtura1 = wipeGetOffset(document.all("posTopLine"),"Top");
       else if(document.getElementById("posTopLine")!=null){
        	pospiealtura1 = document.getElementById("posTopLine").y;
			if(pospiealtura1==null) pospiealtura1 = wipeGetOffset(document.getElementById("posTopLine"),"Top");
       }
      if(pospiealtura1!=null){
	      pospiealtura2 = pospiealtura1 + 1;
	      document.write('<div id="divbusca" style="position:absolute;top:' + pospiealtura2 + 'px;left:0px;width:0px;z-index:100"></div>');
	      document.write('<div id="divmenu" style="position:absolute;top:' + pospiealtura1 + 'px;left:0px;width:0px;height:150px;z-index:100" onmouseover="javascript:showhide(\'1\', \'all\')" onmouseout="javascript:oculta();">');
	      document.write('<div id="divmenu1" style="position:absolute;top:0px;left:0px;width:74px;"></div>');
	      document.write('<div id="divmenu2" style="position:absolute;top:0px;left:220px;width:70px;"></div>');
	      document.write('</div>');
      }
    }
    //
    function noDisponible(){
      alert("Funcionalidad disponible proximamente.");
    }


/********************** ANTERIOR G_VENTANA.JS ***************************************************/
function abreTitular(f,car) {
 var caracteristicas = "width=510,height=250,top=50,left=150,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=yes";
 ventana_buscador = window.open("/acnet/carteras/consultas/titulares.jsp?cartera="+car,"acventana",caracteristicas);
 ventana_buscador.focus();
}

function abre(sCual,iAncho,iAlto,sScroll,sTp,sLft) {
 window.open(sCual,'imprime','toolbar=no,location=no,directories=no,status=no,scrollbars='
  + sScroll + ',resizable=yes,copyhistory=yes,width=' + iAncho + ',height='
  + iAlto + ',top=' + sTp + ',left='+sLft);
}

function abreConNombre(sCual, sNombre, iAncho, iAlto, sScroll, sTp, sLft, sResizable) {
 window.open(sCual.replace(/ /gi, '+'),sNombre,'toolbar=no,location=no,directories=no,status=no,scrollbars='
  + sScroll + ',resizable=' + sResizable + ',copyhistory=yes,width=' + iAncho + ',height='
  + iAlto + ',top=' + sTp + ',left='+sLft);
}

function abreConNombreDir(sCual, sNombre, iAncho, iAlto, sScroll, sTp, sLft, sResizable) {
 window.open(sCual.replace(/ /gi, '+'),sNombre,'toolbar=no,location=yes,directories=no,status=yes,scrollbars='
  + sScroll + ',resizable=' + sResizable + ',copyhistory=yes,width=' + iAncho + ',height='
  + iAlto + ',top=' + sTp + ',left='+sLft);
}
function abreVentana(f,c) {
 w1=window.open(f,"acventana",c);
 w1.focus();
}

var w1=null;
function abreVentana2(f,c){
 if(navigator.appName=="Microsoft Internet Explorer"){
  var caracteristicas = c;
  if(w1==null){
   w1=window.open(f,"acventana",caracteristicas);
   window.name='oldWindow'; // probably was the empty string..
   w1.opener = window; // no change in 1.1, useful in 1.0
  }else{
   w1.close();
   w1=window.open(f,"acventana",caracteristicas);
   window.name='oldWindow'; // probably was the empty string..
   w1.opener = window; // no change in 1.1, useful in 1.0
  }
  w1.focus();}else if(navigator.appName=="Netscape"){
  var caracteristicas = c;
  if(w1==null)
   w1=window.open(f,"acventana",caracteristicas);
  else
   if(w1.window==null)
    w1=window.open(f,"acventana",caracteristicas);
   else {
    w1.window.close();
    w1=window.open(f,"acventana",caracteristicas); }
    w1.focus();
 }
}

/*********************** ANTIGUO FUNCIONES.JS **********************************************/
function f_submit(f)
{
	f.submit();
}

function f_submit_action(f, a)
{
	f.action = a;
	f.submit();
}

// Funcion para la obtención de la descripción de un elemento (sValor) del array (cTipo)
// Esta basado en la función g_combos
function f_ObtValor(cTipo,sValor) {
	var sTipo = "";
	var lArr;
	var lVal;
	lArr = eval(cTipo);
	eval("sTipo = typeof("+ cTipo + "_val)");

	if (typeof(sValor) == "undefined")
		return "";

	if (sTipo=="undefined")
		lVal = lArr;
	else
		lVal = eval(cTipo+"_val");

	for (var z=0;z<lArr.length;z++) {
		if (sValor == lVal[z]) {
			document.write(lArr[z]) ;
			return ;
		}
	}
}
//funciones para mostrar/ocultar capas
function MM_findObj(n, d) { //v4.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=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

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; }
}
//función para mostrar mensaje
function MM_popupMsg(msg) { //v1.0
  alert(msg);
}


 function clearText(input) {
  if (input.value=="buscar")
	input.value = "";
 }

 // Se encarga de la validacion cliente del buscador simple
 function validarBuscadorSimple(formName) {
   var ok = true;
   var msg;
   var formBusca;
   formBusca = document.forms[formName];
   // Texto introducido por el usuario es vacio
   var valTxt = trim(formBusca.strText.value);
   if(valTxt==null) {
     msg = "Debe introducir al menos un caracter válido en el buscador.";
     ok = false;
   }
   if (ok) {
     // Comprobamos si aparece algun caracter no válido o búsqueda en blanco
     var carOk  = true;
     var nBlkOk = false;
     for(var i=0;i<valTxt.length;i++) {
       if( (valTxt.charAt(i)=="%") || (valTxt.charAt(i)=="?") ||
           (valTxt.charAt(i)=="[") || (valTxt.charAt(i)=="]") ) {
         carOk = false;
         break;
       }
       if( (valTxt.charAt(i)!=' ') && (valTxt.charAt(i)!="\t") &&
           (valTxt.charAt(i)!="\n") && (valTxt.charAt(i)!="\r") ) {
         nBlkOk = true;
       }
     }
     // Eliminamos los espacios del final
     while( (valTxt.lastIndexOf(' ') == (valTxt.length -1)) && (valTxt.length>0) ) {
       valTxt = valTxt.substring(0,valTxt.length-1);
     }
     formBusca.strText.value = valTxt;
     if (!carOk) {
       msg = "No está permitida la búsqueda mediante caracteres no válidos: '%', '?', '[' ó ']'";
       ok = false;
     }
     if (carOk) {
       if (!nBlkOk) {
         msg = "Debe introducir al menos un caracter válido en el buscador.";
         ok = false;
       }
     }
   }
   // Validar un mínimo de 3 caracteres válidos
   if (ok) {
     if (formBusca.strText.value.length<3) {
       msg = "La búsqueda exige al menos tres caracteres válidos.";
       ok = false;
     }
   }
   // Enviamos la respuesta al navegador
   if (ok) {
     formBusca.submit();
   } else {
     alert(msg);
     formBusca.strText.focus();
     return;
   }
 }

// Se encarga de la validacion cliente del buscador de valores
 function validateStockSearcher(formName) {
   var ok = true;
   var msg;
   var formBusca;
   formBusca = document.forms[formName];
   // Texto introducido por el usuario es vacio
   var valTxt = trim(formBusca.strSearch.value);
   if(valTxt==null) {
     msg = "Debe introducir al menos un caracter válido en el buscador.";
     ok = false;
   }
   if (ok) {
     // Comprobamos si aparece algun caracter no válido o búsqueda en blanco
     var carOk  = true;
     var nBlkOk = false;
     for(var i=0;i<valTxt.length;i++){
       if( (valTxt.charAt(i)=="%") || (valTxt.charAt(i)=="?") ||
           (valTxt.charAt(i)=="[") || (valTxt.charAt(i)=="]") ) {
         carOk = false;
         break;
       }
       if( (valTxt.charAt(i)!=' ') && (valTxt.charAt(i)!="\t") &&
           (valTxt.charAt(i)!="\n") && (valTxt.charAt(i)!="\r") ) {
         nBlkOk = true;
       }
     }
     // Eliminamos los espacios del final
     while( (valTxt.lastIndexOf(' ') == (valTxt.length -1)) && (valTxt.length>0) ) {
       valTxt = valTxt.substring(0,valTxt.length-1);
     }
     formBusca.strSearch.value = valTxt;
     if (!carOk) {
       msg = "No está permitida la búsqueda mediante caracteres no válidos: '%', '?', '[' ó ']'";
       ok = false;
     }
     if (carOk) {
       if (!nBlkOk) {
         msg = "Debe introducir al menos un caracter válido en el buscador.";
         ok = false;
       }
     }
   }
   // Tipo de busqueda a realizar: 1-->Por nombre, 2--> Por símbolo
   if (ok) {
     if (formBusca.searchType[0].checked && formBusca.strSearch.value.length<3) {
       msg = "La búsqueda por nombre exige al menos tres caracteres válidos.";
       ok = false;
     }
   }
   // Enviamos la respuesta al navegador
   if (ok) {
     formBusca.submit();
   } else {
     alert(msg);
     formBusca.strSearch.focus();
     return;
   }

 }
 function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
 } // Ends the "trim" function
 
 function formatNumber(numero, decimal){
	var auxNum = new Number(numero);
    var auxNum1 = auxNum.toFixed(decimal); 
	var num = auxNum1.toString();
	var splitStr = num.split('.');
	var splitLeft = splitStr[0];
	var splitRight = splitStr.length > 1 ? ',' + splitStr[1] : '';
	var regx = /(\d+)(\d{3})/;
	while (regx.test(splitLeft)) {
		splitLeft = splitLeft.replace(regx, '$1' + '.' + '$2');
	}
	return splitLeft + splitRight;
}

function isDefined( variable) { return (typeof(window[variable]) != "undefined");}



