<link rel="shortcut icon" href="favicon.ico">
<asp:PlaceHolder runat="server">

<% 
    Seven.Front.Objects.Cache casj;
    try
    {
        casj = Seven.Front.Objects.MainCache.GetCache(int.Parse(Enigma.Desencriptar(Request.Cookies[Parametros.COOKIE_USR].Value)));
    }
    catch(Exception)
    {
        casj = Seven.Front.Objects.MainCache.GetCache(0);
    } 
%>

<link rel="stylesheet" href="css/Themes/<%=casj.Theme %>/Estilo.css" type="text/css" media="all" />
<link rel="stylesheet" type="text/css" href="css/Themes/<%=casj.Theme %>/jquery-ui.custom.css" />
<link rel="stylesheet" type="text/css" href="css/msdropdown/dd.css" />
<link rel="stylesheet" type="text/css" href="css/jqGrid/ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.treeview.css" />

<script src="js/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="css/Themes/<%=casj.Theme %>/jquery-ui.custom.min.js" type="text/javascript"></script>
<%=Seven.Front.L.LBL("LblGENJQueryUIDatePickerI18N") %>
<script src="js/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
<script src="js/jquery.validate.min.js" type="text/javascript"></script>

<script src="js/jquery.dd.min.js" type="text/javascript"></script>

<script src="js/jqGrid/i18n/grid.locale-<%=LangCodeMaster.Remove(2) %>.js" type="text/javascript"></script>
<script src="js/jqGrid/jquery.jqGrid.min.js" type="text/javascript"></script>

<script src="js/jquery.cookie.js" type="text/javascript"></script>

<script src="js/jquery.treeview.js" type="text/javascript"></script>

<style type="text/css">
    .no-close .ui-dialog-titlebar-close { display: none }
</style>

<script type="text/javascript">

    $(document).ready(function () {

        SetBodyRes();
        SetAccordionRes();

        $.ajaxSetup({ cache: false });

        $("#SevenMenuAccordionTabs" ).tabs();

        $("#dlgCargando").dialog({
            autoOpen: false,
            show: "fade",
            hide: "curtain",
            resizable: false,
            height: 100,
            width: 270,
            modal: true,
            dialogClass: 'no-close'
        });

        $("#SevenMenu").accordion({ collapsible: true, active: false, autoHeight: false });
        $("#SevenMenuUsr").accordion({ collapsible: true, autoHeight: false });
        jQueryUIOtraVez();
        Clock();

        checkPinMenu();

        var pinned = localStorage["AccPin"];
        if(pinned != 1){
            localStorage["AccPin"] = 0;
            $('#NeoAccordion').stop().animate({'marginLeft': ($('#NeoAccordion').width() - 30) * -1}, 0);
        }
        else
        {
            $('#cuerpo').stop().animate({'width': $('#cuerpo').width() + 30 - $('#NeoAccordion').width(), 'marginLeft': $('#NeoAccordion').width() - 30}, 200);
        }

        try 
        {
            $("#LanguageCombo").msDropDown({ event : 'click' });
        } 
        catch(e) 
        { }

        ShowUserMenu();

    });

    $(window).load(function(){
        var pinned = localStorage["AccPin"];
        if(pinned != 1){
            $('#NeoAccordion').stop().animate({'marginLeft': ($('#NeoAccordion').width() - 30) * -1}, 0);
        }
        RelocateMenu();
    });

    $.datepicker.setDefaults($.datepicker.regional["es"]);

    function jQueryUIOtraVez() {
        $(":submit").button();
        $(":text").addClass("ui-widget-content");
        $(":text").focusin(function() { $(this).select(); } );
        //$(":text").mouseup(function() { $(this).select(); } );
        $(":button").button();
        $(".eligeFecha").datepicker({
            showOn: "button",
            buttonImage: "css/Themes/<%=casj.Theme %>/calendar.png",
            buttonImageOnly: true,
            firstDay: 0,
            changeYear: true, 
            changeMonth: true,
            yearRange: "c-100:c+100"
        });

        $(".eligeHora").timepicker({
            showSecond: true,
            timeOnly: true,
            timeFormat: 'hh:mm:ss'
        });

        $(".eligeFechaHora").datetimepicker({
            showOn: "button",
            buttonImage: "css/Themes/<%=casj.Theme %>/calendar.png",
            buttonImageOnly: true,
            firstDay: 0,
            showSecond: true,
            timeFormat: 'hh:mm:ss',
            changeYear: true, 
            changeMonth: true,
            yearRange: "c-100:c+100"
        });

        $("#Tabs").tabs();
    }

    function Clock()
    {
        // Create two variable with the names of the months and days in an array
        var monthNames = <%=Seven.Front.L.LBL("LblGENMonths") %>; 
        var dayNames= <%=Seven.Front.L.LBL("LblGENDays") %>;

        // Create a newDate() object
        var newDate = new Date();
        // Extract the current date from Date object
        newDate.setDate(newDate.getDate());

        // Output the day, date, month and year   
        <%=Seven.Front.L.LBL("LblGENDateCode") %>

        var DH = new Date(<%=FechaHotelera.Year %>, <%=FechaHotelera.Month - 1 %>, <%=FechaHotelera.Day %>, 0, 0, 0, 0);
        <%=Seven.Front.L.LBL("LblGENDateCodeHotel") %>

        setInterval( function() {
	        // Create a newDate() object and extract the seconds of the current time on the visitor's
	        var seconds = new Date().getSeconds();
            var hours = new Date().getHours();
            var meridiano = " a.m."
            if(hours > 12){hours -= 12; meridiano = " p.m."}
	        // Add a leading zero to seconds value
	        $("#sec").html(( seconds < 10 ? "0" : "" ) + seconds + meridiano);
	        },1000);
	
        setInterval( function() {
	        // Create a newDate() object and extract the minutes of the current time on the visitor's
	        var minutes = new Date().getMinutes();
	        // Add a leading zero to the minutes value
	        $("#min").html(( minutes < 10 ? "0" : "" ) + minutes);
            },1000);
	
        setInterval( function() {
	        // Create a newDate() object and extract the hours of the current time on the visitor's
	        var hours = new Date().getHours();
            if(hours == 0)
            {
                hours = 12;
            }
            if(hours > 12){
                hours = hours - 12;
            }
	        // Add a leading zero to the hours value
	        $("#hours").html(( hours < 10 ? "0" : "" ) + hours);
            }, 1000);	
    }

    function SetBodyRes()
    {
        var h = window.innerHeight;

        $("#SevenPrincipal").css("height", h - 85 + "px");
    }

    function SetAccordionRes()
    {
        var h = window.innerHeight;

        $(".SevenMenuAccordionPrimer").css("max-height", h - 400 + "px");
        $(".SevenMenuAccordionPrimerUser").css("max-height", h - 280 + "px");
    }

    $(function() {
        //$('#NeoAccordion').stop().animate({'marginLeft':'-250px'},1000);

        $('#NeoAccordion').mouseenter(
            function () {
                //alert("a");
                if((!$('#cuerpo').is(':animated'))){
                    $('#NeoAccordion').stop().animate({'marginLeft':'0px'}, 200);
                    var pinned = localStorage["AccPin"];
                    var accload = localStorage["AccLoad"];
                    if((pinned != 1) && (accload != 1)){
                        $('#cuerpo').stop().animate({'width': $('#cuerpo').width() + 30 - $('#NeoAccordion').width(), 'marginLeft': $('#NeoAccordion').width() - 30}, 200);
                    }
                }
                
            }
        );

        $('#NeoAccordion').mouseleave(
            function () {
                var pinned = localStorage["AccPin"];
                if(pinned != 1){
                    localStorage["AccLoad"] = 0;
                    $('#NeoAccordion').stop().animate({'marginLeft': ($('#NeoAccordion').width() - 30) * -1}, 200);
                    $('#cuerpo').stop().animate({'width':  /*'100%'*/ $(window).width() - 30, 'marginLeft':'0px'}, 200);
                }
            }
        );

        $(window).resize(
            function () {
                RelocateMenu();
                SetBodyRes();
            }
        );
    });

    function RelocateMenu()
    {
        var pinned = localStorage["AccPin"];
        localStorage["AccPin"] = 0;
        checkPinMenu();
        $('#NeoAccordion').stop().animate({'marginLeft': ($('#NeoAccordion').width() - 30) * -1}, 0);
        $('#cuerpo').stop().animate({'width':  /*'100%'*/ $(window).width() - 30, 'marginLeft':'0px'}, 0);
        if(pinned == 1)
        {
            localStorage["AccPin"] = 1;
            checkPinMenu();
            $('#NeoAccordion').stop().animate({'marginLeft':'0px'}, 200);
            $('#cuerpo').stop().animate({'width': $('#cuerpo').width() + 30 - $('#NeoAccordion').width(), 'marginLeft': $('#NeoAccordion').width() - 30}, 200);
        }
    }

    function pinUnPinMenu()
    {
        var pinned = localStorage["AccPin"];
        if(pinned == 0)
        {
            $('#PinButton').removeClass('ui-widget-content');
            $('#PinButton').addClass('ui-state-default');
            localStorage["AccPin"] = 1;
        }
        else
        {
            $('#PinButton').removeClass('ui-state-default');
            $('#PinButton').addClass('ui-widget-content');
            localStorage["AccPin"] = 0;
        }
    }

    function checkPinMenu()
    {
        var pinned = localStorage["AccPin"];
        if(pinned == 0)
        {
            $('#PinButton').removeClass('ui-state-default');
            $('#PinButton').addClass('ui-widget-content');
        }
        else
        {
            $('#PinButton').removeClass('ui-widget-content');
            $('#PinButton').addClass('ui-state-default');
        }
    }

</script>

</asp:PlaceHolder>
