//document.write('<scr' + 'ipt type="text/javascript" src="2.js" ></scr' + 'ipt>');
$(document).ready(function () {
    $('.mainImageContainer').cycle({
        fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
    });


    // ***this goes on the global scope
    // get querystring as an array split on "&"
    var querystring = location.search.replace('?', '').split('&');
    // declare object
    var queryObj = {};
    // loop through each name-value pair and populate object
    for (var i = 0; i < querystring.length; i++) {
        // get name and value
        var name = querystring[i].split('=')[0];
        var value = querystring[i].split('=')[1];
        // populate object
        queryObj[name] = value;
    }


    // ***now you can use queryObj["<name>"] to get the value of a url
    // ***variable
    if (queryObj["ShowVideo"] === "true") {
        //window.location.href = "http://www.google.com";
        var dateNumber = parseInt(new Date().getDate());
        if ((dateNumber < 8) || ((dateNumber > 14) && (dateNumber < 22))) {
            //window.location.href = "http://www.google.com?id=1";
            $("#dialog #container1").show();
            //$("#dialog #container2").hide();
        }
        else {
            //window.location.href = "http://www.google.com?id=2";
            //$("#dialog #container1").hide();
            $("#dialog #container2").show();
        }

        $("#dialog").show();

        $('body').append('<div id="fadeOverlay" style="opacity:0.60;display:none;position:fixed;left:0;top:0;width:100%;height:100%;z-index:9999;background:#000;"></div>');
        $('#fadeOverlay').css({ 'filter': 'alpha(opacity=60)' }).fadeIn();


        //open_window('../Legals_EN.htm');
        //tab_crevents.show()
    }




    $('#close').hover(function () {
        $('#closeBtn', this).stop().animate({ "opacity": 0.6 }, { duration: 100 });
    }, function () {
        $('#closeBtn', this).stop().animate({ "opacity": 1 }, { duration: 200 });
    });

    $("#close").click(function () {
        CloseVideo();
    });

});


 function CloseVideo() {
     $("#dialog").hide();
     $("#fadeOverlay").fadeOut("slow", function () { $(this).remove(); });
     $("#dialog").remove();

 }
