// JavaScript Document

var idTimeOut;

function getElementPosition(elemID) {
// Devuelve el Left y Top de un elemento dado
    var offsetTrail = document.getElementById(elemID);
    var offsetLeft = 0;
    var offsetTop = 0;
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTop += offsetTrail.offsetTop;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && 
        typeof document.body.leftMargin != "undefined") {
        offsetLeft += document.body.leftMargin;
        offsetTop += document.body.topMargin;
    }
     return {left:offsetLeft, top:offsetTop};
}


function getElementStyle(elemID, IEStyleProp, CSSStyleProp) {
// devuelve el Styel definido para un elemento dado
    var elem = document.getElementById(elemID);
    if (elem.currentStyle) {
        return elem.currentStyle[IEStyleProp];
   } else if (window.getComputedStyle) {
        var compStyle = window.getComputedStyle(elem, "");
        return compStyle.getPropertyValue(CSSStyleProp);
   }
    return "";
}
function Mostrar(){
	        clearTimeout(idTimeOut);
		document.getElementById("SubMenu").style.top= getElementPosition("Celda").top + 1;
		document.getElementById("SubMenu").style.left= getElementPosition("Celda").left + parseInt(document.getElementById("menu").currentStyle["width"]);
		document.getElementById("SubMenu").style.display = "block";

}

function Ocultar(){
	
	idTimeOut = setTimeout('document.getElementById("SubMenu").style.display = "none"',300) ;
  
	
}


function Dia(date){
var weekDays = new Array (
   'Domingo',
   'Lunes',
   'Martes',
   'Miércoles',
   'Jueves',
   'Viernes',
   'Sábado'
);
return weekDays[date.getDay()];

}

function Mes(date){
var nomMes = new Array (
   'Enero',
   'Febrero',
   'Marzo',
   'Abril',
   'Mayo',
   'Junio',
   'Julio',
   'Agosto',
   'Setiembre',
   'Octubre',
   'Noviembre',
   'Diciembre'
);
return nomMes[date.getMonth()];
}

function FechaHoy(){
	now = new Date();
    ldate =  Dia(now);
	ndate= now.getDate();
	lmonth= Mes(now);
	nyear= now.getYear();
  	dateString = ldate + ' ' + ndate + ' de ' + lmonth + ' de '+ nyear;
	return dateString;
}


function openWindow(URL, windowName, width, height, center) { 
xposition=0; 
yposition=0; 


// Center new popup window on screen 
if ((parseInt(navigator.appVersion) >= 4 ) && (center)) { 
    xposition = (screen.width - width) / 2; 
    yposition = (screen.height - height) / 2; 
        } 


// Setting params to '0' = off, setting to '1' = on. 


params = "width=" + width + "," // Set the popup window's width 
    + "height=" + height + ","  // Set the popup window's height 
    + "location=0,"           // Location entry field off 
    + "menubar=0,"            // Menu bar off 
    + "resizable=0,"          // Resizeable off 
    + "scrollbars=0,"         // Scroll bars on 
    + "status=0,"             // Status bar off 
    + "titlebar=0,"           // Requires 'UniversalBrowserWrite' privileges. 
                                // Set this feature in a signed script. 
    + "toolbar=0,"            // Tool bars off 
    + "hotkeys=0,"            // Hot keys off (except Security and Quit) 


    + "screenx=" + xposition + ","   // Set window left position (NN) 
    + "screeny=" + yposition + ","   // Set window top position (NN) 
    + "left=" + xposition + ","      // Set window left position (IE) 
    + "top=" + yposition;            // Set window top position (IE) 


    window.open(URL, windowName, params); 



} 
