/* http://www.evolt.org/article/Let_the_User_Skip_the_Splash_Page/20/416/index.html */

var cookieName = 'skipSplash';
var cookieValue = 'true';


function getCookieVal(offset) {
    var endstr = document.cookie.indexOf(';', offset);
    if (endstr == -1)
        endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}

function getCookie(name) {
    var arg = name + '=';
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen) {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
            return getCookieVal(j);
        i = document.cookie.indexOf(' ', i) + 1;
        if (i == 0) break;
    }
    return null;
}
/*
// Enter number of days the cookie should persist
var expDays = 30;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays * 24 * 60 * 60 * 1000));
expirationDate = exp.toGMTString();
*/

function SetCookie() {
    // Set cookie with name and value provided
    // in function call and date from above
    var exp = new Date();
    exp.setTime(exp.getTime() + (24 * 60 * 60 * 1000));

    //document.cookie = cookieName + '=' + escape(cookieValue)
    document.cookie = cookieName + '=' + escape(cookieValue) + '; expires=' + exp.toGMTString() + ';path=/';
    window.location = 'http://www.winthropeagles.com/default.asp';
}

function SetCookiePermanent() {
    // Set cookie with name and value provided
    // in function call and date from above
    var exp = new Date();
    exp.setTime(exp.getTime() + (365 * 24 * 60 * 60 * 1000));
    
    //document.cookie = cookieName + '=' + escape(cookieValue)
    document.cookie =cookieName + '=' + escape(cookieValue) +  '; expires=' + exp.toGMTString() + ';path=/';
    window.location = 'http://www.winthropeagles.com/default.asp';
}

if (getCookie(cookieName) != null) {
    window.location = 'http://www.winthropeagles.com/default.asp';
}
