
var actual_Page;
var footer_style="absolute";
var maxH
jQuery("document").ready(function(){
    //Executes whe ready.
    
    //actual_Page=jQuery(".page-content");
    jQuery("#map").width(jQuery("#page").width()-jQuery("#content").width());
    pagesMenu();
    maxH=jQuery("#map").height();
    maxH-=(jQuery("#footer").height()+10);
    jQuery("#slide-down").click(function(){
        jQuery("#slide-up-img").toggle();
        jQuery("#slide-down-img").toggle();
        jQuery("#slide-content").toggle();
        positionOfFooter();
    });
    positionOfFooter();
    jQuery(window).resize(function(){
        maxH=jQuery("#map").height();
        maxH-=(jQuery("#footer").height()+10);
        jQuery("#map").width(jQuery("#page").width()-jQuery("#content").width());
    });


    jQuery(".slide-entry-link").click(function(){

        var postid=this.id;
        var marker_found=-1;
  
        for ( var i=0; i<marker.length;i=i+1){
            if (marker[i].value==postid){
                marker_found=i;
            }
        }
        if (marker_found!=-1){
            GEvent.trigger(marker[marker_found], 'click');
        }
    });
});

function positionOfFooter(){
    jQuery("#footer").css("position","relative");
    var t=jQuery("#footer").offset();
    if (t!=undefined){
        if (t.top<maxH){
            jQuery("#footer").css("position","absolute");
        }
    }


}
function pagesMenu(){



    jQuery('ul.menu-pop > li').mouseover(muestraMenu);
    jQuery('ul.menu-pop > li').mouseout(ocultaMenu);

    jQuery(".pagenav>ul>li>a").each(function(i) {
        this.href="#";
        jQuery(this).click(select_Page);
    // console.log(numberPage);
  		
    });
    jQuery('ul.submenu-pop > li').mouseover(muestraMenu);
    jQuery('ul.submenu-pop > li').mouseout(ocultaMenu);

};

function select_Page(elemento){



    var sel_Page=jQuery(this.parentNode).attr("class");

    sel_Page=sel_Page.split(" ");
    var numberPage=sel_Page[1];
    numberPage=numberPage.split("-");
    var idPage=numberPage[2];
  
    if (actual_Page!=undefined){
        jQuery(actual_Page).attr("class","page-content-hidden");
    };

    jQuery("#page-"+idPage).attr("class","page-content");
    actual_Page=jQuery("#page-"+idPage);
    positionOfFooter();

//alert("I am an alert box!");


};
function muestraMenu(elemento){
    if (jQuery(this).attr("id")!="search-menu"){
        jQuery(this).children().addClass('menu-hover').show();
    }

}
function ocultaMenu(elemento){
    if (jQuery(this).attr("id")!="search-menu"){
        jQuery(this).children().removeClass('menu-hover').hide();
    }
}
