// JavaScript Document

function cambiarEnlace(idselected){

    ids = document.getElementsByTagName("a");
    
                for (i = 0;i < ids.length; i++) {
                    if(ids[i].id.substring(0,10) == "id_seccion"){
                        //document.getElementById(ids[i].id).style.height = "40px"; //deselecciona todos

                        if(idselected == ids[i].id){
                               $(document).ready(function(){
                                 //alert(idselected);
                               
                                 $("#"+idselected).height(18)
                                     .css({cursor:"auto", backgroundColor:"green"});
                                 alert($("#"+idselected).height());
                              });
                             
                         l  // document.getElementById(idselected).style.height="18px"; //baja el alto del enlace
                           
                         }


                    }
                  }


		
}


function openPage(href){
  //  alert(href.indexOf("http"));
    window.location.href = href;

}


function cerrar() {
   $("#pop").fadeOut('slow');
} //checkHover

function loadPopup(){

$(document).ready(function (){
 var img_w=0;
 var img_h=0;

    var agent = navigator.appName;
    if (agent=="Microsoft Internet Explorer") {
        img = new Image();
        img.src = document.getElementById('imgpopup').src;
        img_w = img.width;
        img_h = img.height;
    }else{
       img_w= document.getElementById('imgpopup').width;
       img_h= document.getElementById('imgpopup').height;
    }


   //Darle el alto y ancho
   $("#pop").css('width', img_w + 'px');
   $("#pop").css('height', img_h + 'px');


    var w = document.documentElement.clientWidth;
    var h = document.documentElement.clientHeight;


   //alert('imag ancho'+img_w+' img alto'+img_h+' browser ancho '+w+' browser alto'+h);

   //Centra el popup
   w = (w/2) - (img_w/2);//160  190
   h = (h/2) - (img_h/2);
   $("#pop").css("left",w + "px");

   $("#pop").fadeIn('slow');

   $('#pop').animate({top:h,left: w}, 3000, function() {
    // Animation complete.
  });

   //temporizador, para que no aparezca de golpe
   //setTimeout("cerrar()",25800);
   //Función para cerrar el popup

     })
}





function loadSlider(){
$(document).ready(function(){
        $("#slider").easySlider({
                auto: true,
                pause:4000,
                continuous: true,
                numeric: true

        });
});
}

function abrirVentana(url, ancho, alto)
{
var sHeight, sWidth;
sHeight = screen.height;
sWidth = screen.width;
var sLeft, sTop;
sLeft=(screen.width - ancho) / 2;
sTop=(screen.height - alto) / 2;
window.open(url, '_blank','top='+sTop+', left='+sLeft+', height='+alto+', width='+ancho+', status=no, menubar=no, resizable=no, scrollbars=no, toolbar=no, location=no, directories=no');
}

