/*
Written for DougWeb by srp501 (Silas)
Please do not hot link to this file
You may copy and modify this file as long as you include a comment (similar to this one),
    that states you got it from www.yusu.org/dougsoc
*/

function makeCookie(param, value)
{
 if (document.cookie)
 {
  k = document.cookie;
  k = k.split(",");
  for (f = k.length; f > 0; f--)
  {
   l = k[f-1].split("=");
   if (param == l[0])
   {
    k[f-1] = param + "=" + value;
    document.cookie = k.join(",");
    return;
   }
  }
  k[k.length] = param + "=" + value;
  document.cookie = k.join(",");
 }
 else
     document.cookie = param + "=" + value;
}

function getCookie(param, def)
{
 if (document.cookie)
 {
  k = document.cookie;
  k = k.split(",");
  for (f = k.length; f > 0; f--)
  {
   l = k[f-1].split("=");
   if (param == l[0])
   {
    return l[1];
   }
  }
  return def;
 }
 else
     return def;
}



var x = 0 /*parseInt(getCookie("fade", 0));*/

var y = 1 /*parseInt(getCookie("fadedir", 1));*/

function nextColour() {
if (x <= 0)
{
   y = 1;
   makeCookie("fadedir",1);
}
if (x >= 50)
{
   y = -1;
   makeCookie("fadedir",-1);
}
x = x + y;

document.getElementsByTagName('body')[0].style.backgroundColor = "rgb(" + parseInt(255 - (2*x)) + "," + parseInt(255 - x) + ",255)";
}

if (navigator.appName.indexOf("Microsoft") == -1)
   window.setInterval("nextColour();",100);



var i = 100;

function movediv() {
    document.getElementsByTagName('div')[1].style.margin = i.toString() + "px 2em 0 2em";
    i = i - 5;
    if (i < 30)
    {
     clearInterval(timermove);
    document.getElementsByTagName('div')[1].style.margin = "2em";
    }
}
timermove = window.setInterval("movediv();",1);
