// barra de menus
iBCARon = new Image(70,23)
iBCARon.src = "images/new/ir_nosel.jpg"
iBCARoff = new Image(70,23)
iBCARoff.src = "images/new/ir_sel.jpg"

iTIT1on = new Image(70,23)
iTIT1on.src = "images/new/m_tit_ini_sel.gif"
iTIT1off = new Image(70,23)
iTIT1off.src = "images/new/m_tit_ini_nosel.gif"

iTIT2on = new Image(70,23)
iTIT2on.src = "images/new/m_tit_emp_sel.gif"
iTIT2off = new Image(70,23)
iTIT2off.src = "images/new/m_tit_emp_nosel.gif"

iTIT3on = new Image(70,23)
iTIT3on.src = "images/new/m_tit_ser_sel.gif"
iTIT3off = new Image(70,23)
iTIT3off.src = "images/new/m_tit_ser_nosel.gif"

iTIT4on = new Image(70,23)
iTIT4on.src = "images/new/m_tit_cli_sel.gif"
iTIT4off = new Image(70,23)
iTIT4off.src = "images/new/m_tit_cli_nosel.gif"

iTIT5on = new Image(70,23)
iTIT5on.src = "images/new/m_tit_empleo_sel.gif"
iTIT5off = new Image(70,23)
iTIT5off.src = "images/new/m_tit_empleo_nosel.gif"



function daRollOver(elemento,varEl){
 
 whichEl = eval("window.document['"+elemento+"']");
 whichEl.src = varEl.src

}


function popup(pag, nombre, alto, largo) {
//Abrir popup window
	var y = ((screen.width - alto) / 2) - alto;
	var x = ((screen.height - largo) / 2)-largo;
	espe = 'width='+largo+',height='+alto+',top='+y+',left='+x+',scrollbars=yes,resizable';
	winpop = window.open(pag, nombre, espe);
	if (parseInt(navigator.appVersion) >= 4) { 
		winpop.window.focus(); 
	}
}

function subCalendario(s) { 
addWindow = window.open(s,"calendario","width=275,height=200,resizable=0,status=1,menubar=0,scrollbars=0,fullscreen=0,left=200,top=150"); 
addWindow.focus() 
} 


function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return null;
}

function DeleteCookie (name,path,sitedomain) {
  if (GetCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((sitedomain) ? "; domain=" + sitedomain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function SetCookie (name,value,expires,path,sitedomain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((sitedomain) ? "; domain=" + sitedomain : "") +
    ((secure) ? "; secure" : "");
}

function daCookie(){
	f=document.frmlogin;
	if(GetCookie('loginCookie')){
		if(f.login.value==""){
			f.login.value=GetCookie('loginCookie')
			f.pass.focus();
		}
	}
}

function guardaLoginCookie(){
	f=document.frmlogin;
	var expdate = new Date ();
	expdate.setTime (expdate.getTime() + (365 * 24 * 60 * 60 * 1000)); // 24 hrs from now
	SetCookie('loginCookie', f.login.value, expdate);
	return true;
}


// <!-- Menu -->
NS4 = (document.layers) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
ver4 = (NS4 || IE4) ? 1 : 0;

if (ver4) {
    with (document) {
        write("<STYLE TYPE='text/css'>");
        if (NS4) {
            write(".parent {position:absolute; visibility:visible}");
            write(".child {position:absolute; visibility:visible}");
            write(".regular {position:absolute; visibility:visible}")
        }
        else {
            write(".child {display:none}")
        }
        write("</STYLE>");
    }
}

isExpanded = false;

function getIndex(el) {
    ind = null;
    for (i=0; i<document.layers.length; i++) {
        whichEl = document.layers[i];
        if (whichEl.id == el) {
            ind = i;
            break;
        }
    }
    return ind;
}

function arrange() {
    alert("arrange ")
    nextY = document.layers[firstInd].pageY + document.layers[firstInd].document.height;
    for (i=firstInd+1; i<document.layers.length; i++) {
        whichEl = document.layers[i];
        if (whichEl.visibility != "hide") {
            whichEl.pageY = nextY;
            nextY += whichEl.document.height;
        }
    }
}

function initIt(){
	if (!ver4) return;
    if (NS4) {
        for (i=0; i<document.layers.length; i++) {
            whichEl = document.layers[i];
            if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";
        }
        arrange();
    }
    else {
        divColl = document.all.tags("DIV");
        for (i=0; i<divColl.length; i++) {
            whichEl = divColl(i);
            if (whichEl.className == "child") {
					whichEl.style.display = "none";
			}
        }
    }
}

function expandIt(el,nIM) {
	if (!ver4) return;
    if (IE4) {
        whichEl = eval(el + "Child");
		whichIm = eval("document.formMenu."+nIM);
		if (whichEl.style.display == "none") {
            whichEl.style.display = "block";
            whichIm.src = "images/triUp.gif";
			document.formMenu.noExpandir.value=0;
        }
        else {
            whichEl.style.display = "none";
            whichIm.src = "images/triDown.gif";
			document.formMenu.noExpandir.value=1;
        }
    }
    else {
        whichEl = eval("document.formMenu." + el + "Child");
        whichIm = eval("document.formMenu." + el + "Parent.document.images['imEx']");
        if (whichEl.visibility == "hide") {
            whichEl.visibility = "show";
            whichIm.src = "images/triUp.gif";
			document.formMenu.noExpandir.value=0;
        }
        else {
            whichEl.visibility = "hide";
            whichIm.src = "images/triDown.gif";
			document.formMenu.noExpandir.value=1;
        }
        arrange();
    }
}

function expandAll() {
    if (!ver4) return;
    newSrc = (isExpanded) ? "images/triDown.gif" : "images/triUp.gif";

    if (NS4) {
        document.images["imEx"].src = newSrc;
        for (i=firstInd; i<document.layers.length; i++) {
            whichEl = document.layers[i];
            if (whichEl.id.indexOf("Parent") != -1) {
                whichEl.document.images["imEx"].src = newSrc;
            }
            if (whichEl.id.indexOf("Child") != -1) {
                whichEl.visibility = (isExpanded) ? "hide" : "show";
            }
        }

        arrange();
        if (isExpanded) scrollTo(0,document.layers[firstInd].pageY);
    }
    else {
        divColl = document.all.tags("DIV");
        for (i=0; i<divColl.length; i++) {
            if (divColl(i).className == "child") {
                divColl(i).style.display = (isExpanded) ? "none" : "block";
            }
        }
        imColl = document.images.item("imEx");
        for (i=0; i<imColl.length; i++) {
            imColl(i).src = newSrc;
        }
    }
    
    isExpanded = !isExpanded;
}



ns4 = document.layers && true;
msie = document.all && true;
function init() {
 initIt();
}
// <!-- / Menu -->