Code: Select all
<script>
function fade() {
var c = readCookie('thw_fade41');
if(c == null){
c = 1;
}
if (c > .005 ){
for (i = c; i >= 0; i -= .005) {
setTimeout("setOpacity(" + i + ")", (c-i) * 150000);
}
}
}
function setOpacity(level) {
document.body.style.opacity = level;
document.body.style.MozOpacity = level;
document.body.style.KhtmlOpacity = level;
document.body.style.filter = "alpha(opacity=" + (level * 100) + ");";
createCookie('thw_fade41',level,1.5);
}
function createCookie(name,value,hours) {
if (hours) {
var date = new Date();
date.setTime(date.getTime()+(hours*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name) {
createCookie(name,"",-1);
}
fade();