function DaFoco() { setTimeout("self.focus()",100); }

function getVar(nomb)
{
    var url = document.location.href;
    if ( url.indexOf(nomb) != -1 ) {
        posiBeg = url.indexOf("=", url.indexOf(nomb));
        barre = url.indexOf("&", posiBeg);
        posiEnd = (barre != -1 ? barre : url.length);
        return url.substring(posiBeg+1,posiEnd);
    } else {	
    	return 'Parámetro no encontrado.';
    }
}

function calendario(formulario,campo)
	{
        var the_date= new Date();
        var the_month=the_date.getMonth();
        var the_year=the_date.getFullYear();
	new_window=window.open("./../fijos/calendar.htm?" + the_month + "," + the_year + "&uno=" + formulario + "&dos=" + campo  ,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=175,height=198");
        }

function elegir_valor(TABLA,CAMPO1,CAMPO2,FORMULARIO,CAMP1,CAMP2)
{
  msWindow = window.open("./../fijos/elegir.asp?TABLA=" + TABLA + "&CAMPO1=" + CAMPO1 + "&CAMPO2=" + CAMPO2 + "&FORM_NAME=" + FORMULARIO + "&FIELD_NAME1=" + CAMP1 + "&FIELD_NAME2=" + CAMP2 ,"Elegir","menubar=0,location=0,toolbar=0,personalbar=0,status=0,scrollbars=1,width=400,height=300"); 
  msWindow.opener = self;
}

function replace(string,text,by) {

    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

 function entrar(SR)
  {
    SR.style.backgroundColor= "D6DFF7";
    SR.style.borderBottom= "#0083d7 1px solid";
    SR.style.borderLeft= "#0083d7 1px solid";
    SR.style.borderRight= "#0083d7 1px solid";
    SR.style.borderTop="#0083d7 1px solid";
    SR.style.paddingLeft="4px";
    SR.style.color="#000000";
    
  }
 
 function salir(SR) 
  {
    SR.style.backgroundColor= "#2366a2";
    SR.style.borderBottom= "#e8f7ff 1px solid";
    SR.style.borderLeft= "#e8f7ff 1px solid";
    SR.style.borderRight= "#e8f7ff 1px solid";
    SR.style.borderTop="#e8f7ff 1px solid";
    SR.style.paddingLeft="3px";
    
 }

 function salir2(SR) 
  {
    SR.style.backgroundColor= "#D7DFE0";
    SR.style.borderBottom= "#D7DFE0 1px solid";
    SR.style.borderLeft= "#D7DFE0 1px solid";
    SR.style.borderRight= "#D7DFE0 1px solid";
    SR.style.borderTop="#D7DFE0 1px solid";
    SR.style.paddingLeft="3px";
    
 }

 function entrarlistado (SR)
  {
    SR.style.backgroundColor= "#399ade";
    SR.style.color="white";

  }
 
 function salirlistado (SR,fondo) 
  {
    SR.style.backgroundColor= fondo;
    SR.style.color= "#3c2b80"; 
}


 function ResaltarLetra (SR,colo,mous) 
{

    SR.style.color= colo ; 
    SR.style.cursor = mous;
}

function subWin(loc, titulo, ancho, alto)
  {
    options="toolbar=0,status=0,menubar=0,scrollbars=0,resizable=0,location=0,directories=0,width=" + ancho + ",height=" + alto;
    if (subvent) { subvent.close();}
    subvent=window.open(loc, titulo, options);
  }

function subWindos(loc, titulo, ancho, alto) 
  {
    options="toolbar=0,status=0,menubar=1,scrollbars=1,resizable=0,location=0,directories=0,width=" + ancho + ",height=" + alto;
    if (subvent) { subvent.close();}
    subvent=window.open(loc, titulo, options);
  }

function subWintres(loc, titulo, ancho, alto) 
  {
    options="toolbar=1,status=1,menubar=1,scrollbars=1,resizable=1,location=1,directories=1,width=" + ancho + ",height=" + alto;
    if (subvent) { subvent.close();}
    subvent=window.open(loc, titulo, options);
  }

function subWincuatro(loc, titulo, ancho, alto)
  {
    options="toolbar=0,status=0,menubar=0,scrollbars=1,resizable=0,location=0,left=110, top=50, directories=0,width=" + ancho + ",height=" + alto;
    if (subvent) { subvent.close();}
    subvent=window.open(loc, titulo, options);
  }

function subWinpdf(loc, titulo, ancho, alto)
  {
    options="toolbar=0,status=0,menubar=0,scrollbars=1,resizable=0,location=0,left=0, top=0, directories=0,width=" + ancho + ",height=" + alto;
    if (subvent) { subvent.close();}
    subvent=window.open(loc, titulo, options);
  }

function ir_a(loc) 
  {
    if (loc) { parent.location="./" + loc;  } 
    
  }

function cambiar(loc) 
  {
    if (loc) { parent.location="./" + loc + "/default.asp";  } 
    
  }


function envia_sms() 
  { 
    window.open("http://216.97.61.131/www/SMS/FREE/sendSMS1.asp?SiteName=www.xarcom.net&bgcolor=FFFFFF", "Envia_SMS", "toolbar=no, location=no, directories=no, menubar=no, status=no, resizable=yes, scrollbars=yes, width=505, height=395"); 
  } 

var subvent;