1+ var today = new Date ( ) ;
2+ var expiryyear = new Date ( today . getTime ( ) + 365 * 24 * 60 * 60 * 1000 ) ;
3+ var expirymonth = new Date ( today . getTime ( ) + 30 * 24 * 60 * 60 * 1000 ) ;
4+ var expiryday = new Date ( today . getTime ( ) + 24 * 60 * 60 * 1000 ) ;
5+
6+ function getCookie ( name )
7+ {
8+ var reg = new RegExp ( "; " + name + ";|; " + name + "=([^;]*)" ) ;
9+ var matches = reg . exec ( '; ' + document . cookie + ';' ) ;
10+ if ( matches ) return ( ( matches [ 1 ] ) ?unescape ( matches [ 1 ] ) :'' ) ;
11+ return null ;
12+ }
13+
14+ function setCookie ( name , value , expires , path , domain , secure )
15+ {
16+ document . cookie = name + "=" + escape ( value ) +
17+ ( ( expires ) ? "; expires=" + expires . toGMTString ( ) : "" ) +
18+ ( ( path ) ? "; path=" + path : "" ) +
19+ ( ( domain ) ? "; domain=" + domain : "" ) +
20+ ( ( secure ) ? "; secure" : "" ) ;
21+
22+ return getCookie ( name ) != null ?true :false ;
23+ }
24+
25+ function deleteCookie ( name , path , domain )
26+ {
27+ if ( getCookie ( name ) != null )
28+ {
29+ document . cookie = name + "=" +
30+ ( ( path ) ? "; path=" + path : "" ) +
31+ ( ( domain ) ? "; domain=" + domain : "" ) +
32+ "; expires=Thu, 01-Jan-1970 00:00:01 GMT" ;
33+ }
34+ }
35+
36+ function cookieEnabled ( )
37+ {
38+ testCookieName = "_testCookie_" ;
39+ if ( setCookie ( testCookieName , 1 ) )
40+ {
41+ deleteCookie ( testCookieName ) ;
42+ return true ;
43+ }
44+ else return false ;
45+ }
0 commit comments