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 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 popup_until(popup_id, year, month, day, top, left, width, height) {
    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('/toxsoc/popup/'+popup_id+'/','version'+popup_id);  
	    window.open('/toxsoc/popup/'+popup_id+'/','version'+popup_id, 'top='+top+',left='+left+',width='+width+',height='+height);
        }
    };
}

/*
popup_until(ÆË¾÷ id, ³â, ¿ù, ÀÏ, top À§Ä¡, left À§Ä¡, width, height)
*/
popup_until(8, 2011, 07, 09, 100, 100, 410, 105)

