﻿window.onload = checkVisit;

function setCookie(name, value, expires, path, domain, secure) {
    document.cookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

function checkVisit() {
    // Check last viewed version
    var cookie = getCookie("javawin");

    if (cookie == null || parseFloat(cookie) < 1.31) {
        Windows.overlayHideEffectOptions = { duration: 0.3, delay: 0.3 },
        showModal();
        date = new Date;
         date.setDate(date.getDate() + 1);
         setCookie("javawin", "1.31", date);
     }
}


function showModal() {

     Dialog.alert({url: "pop_up.asp", options: {method: 'get'}},  
              {className: "bluelighting", width:600, top:120, okLabel: "Close", 
            showEffectOptions: {duration: 0.7}, hideEffectOptions: {duration: 0.3}});

}



