/*
    *****************************************
    javascript Gestion Residuos - 2009
    *****************************************
*/

function unPocoDeTodo() {
    /* llamar a las siguientes funciones: */
    arreglarAlturasColumnas();
}


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

/* FECHA */
function getCalendarDate()
{
   var months = new Array(13);
   months[0]  = "Enero";
   months[1]  = "Febrero";
   months[2]  = "Marzo";
   months[3]  = "Abril";
   months[4]  = "Mayo";
   months[5]  = "Junio";
   months[6]  = "Julio";
   months[7]  = "Agosto";
   months[8]  = "Septiembre";
   months[9]  = "Octubre";
   months[10] = "Noviembre";
   months[11] = "Diciembre";
   var now         = new Date();
   var monthnumber = now.getMonth();
   var monthname   = months[monthnumber];
   var monthday    = now.getDate();
   var year        = now.getYear();
   if(year < 2000) { year = year + 1900; }
   var dateString = monthday +
                    ' de ' +
                    monthname +
                    ', ' +
                    year;
   return dateString;
} // function getCalendarDate()



/* ARREGLAR ALTURAS: */
function arreglarAlturasColumnas(){
    /* variables */
    var col_main;
    var col_right;
    var col_left;
    var col_main_height;
    var col_right_height;
    var col_left_height;
    
    /* objetos */
    col_main = document.getElementById("col_central");
    col_right = document.getElementById("novedades");
    col_left = document.getElementById("col_izq");
    
    /* chequear si existen */
    if((col_main != null)&&(col_right != null)&&(col_left != null)){
        /* alturas */
        col_main_height = col_main.offsetHeight;
        col_right_height = col_right.offsetHeight;
        col_left_height = col_left.offsetHeight;
        
        /* si es muy corto */
        if( col_main_height < 400 ){
            col_main.style.height = 400 + "px";
        }
        
        /* columna mas alta */
        if( (col_left_height > col_main_height)&&(col_left_height > col_right_height) ){
        	/* LEFT mas alta */
            col_right.style.height = (col_left_height - 5) + "px";
			
		}else if( (col_main_height > col_left_height)&&(col_main_height > col_right_height) ){
        	/* MAIN mas alta */
            col_right.style.height = (col_main_height - 0) + "px";
            col_left.style.height = (col_main_height + 32) + "px";
		}
		else{
        	/* RIGHT mas alta */
            col_left.style.height = (col_right_height + 25) + "px";
		}
		
    } else if ((col_main != null)&&(col_left != null)){
        /* alturas */
        col_main_height = col_main.offsetHeight;
        col_left_height = col_left.offsetHeight;
        
        /* si es muy corto */
        if( col_main_height < 400 ){
            col_main.style.height = 400 + "px";
        }
        
        /* columna mas alta */
		 if( (col_main_height > col_left_height) ){
        	/* MAIN mas alta */
            col_left.style.height = (col_main_height + 32) + "px";
		}
			
	}
}



/* hacer todo cuando se cargue el HTML: */
window.onload = unPocoDeTodo;
