function notice_getCookie( name ) { 
    var nameOfCookie = name + "="; 
    var x = 0; 
    while ( x <= document.cookie.length ) { 
        var y = (x+nameOfCookie.length); 
        if ( document.cookie.substring( x, y ) == nameOfCookie ) { 
            if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 ) 
            endOfCookie = document.cookie.length; 
            return unescape( document.cookie.substring( y, endOfCookie ) ); 
        } 

        x = document.cookie.indexOf( " ", x ) + 1; 
        if ( x == 0 ) 
            break; 
    } 
    return ""; 
} 


function setCookie(name, value, expire) {
    var expire_date = new Date(expire);
    document.cookie = name + "=" + escape(value) + "; expires=" + expire_date.toGMTString();
}

function clearCookie(name) {
    var today = new Date();
    var expire_date = new Date(today.getTime() - 1);
    document.cookie = name + "= " + "; expires=" + expire_date.toGMTString();
}

function checkCookie() {
    if (document.form1.checkbox1.checked) {
        setCookie("noWin","true","January 1, 2010 00:00:00");
    }
    else {
        clearCookie("noWin");
    }
}

function popup_until(popup_id, year, month, day) {
    until=new Date(year, month-1, day, 0, 0, 0); 
    now=new Date();

    if(now.getTime()<until.getTime()) {
        //alert(now.getTime() + ' ' + until.getTime());
        if ( notice_getCookie( "Notice" ) != "done" ) { 
            window.open('/webapp/popup/'+popup_id+'/','version','width=572px,height=418px');
        }
    };
}

popup_until(1, 2012, 1, 27)

