﻿$(document).ready(function () {
    //    $('.languagesplash').simpleDialog({
    //        opacity: 0.3,
    //        duration: 500,
    //        title: 'Simple Dialog',
    //        open: function (event) {
    //            //console.log('open!');
    //        },
    //        close: function (event, target) {
    //            //console.log('close!');
    //        }
    //    });

    var popup = $(".languagesplash");
    var windowHeight = $(window).height(); //$('html').innerHeight();
    var windowWidth = $(window).width(); //$('html').innerWidth();
    if ($.browser.safari) { scrollTopBodyElem = $("body") } else { scrollTopBodyElem = $("html") }
    var scrollTop = scrollTopBodyElem.scrollTop();
    var docCenterY = windowHeight / 2; //scrollTop + (windowHeight / 2);
    var docCenterX = windowWidth / 2;
    var popupY = docCenterY - (popup.height() / 2); //(popup.height() > windowHeight) ? scrollTop + 50 : docCenterY - (popup.height() / 2);
    popup.css({ display: 'block', top: popupY, left: (docCenterX - popup.width() / 2) });

    $('.sd_overlay').css({ width: $('html').innerWidth() + 'px', height: $('html').innerHeight() + "px" });
    $('.sd_overlay').fadeTo(0, 0.5);
});

function setSplashCookie(c_name, value, exdays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + exdays);
    var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
    document.cookie = c_name + "=" + c_value;
}
