
//Niels 'That Guy' Groot Obbink
//Stijlkiezer voor defuten website.


function stijlKiezer(who)
{

   var stijlIndex = who.selectedIndex;

   if(stijlIndex == '0')
   {
      createCookie('stijl','nieuw',31);
   }else
   if(stijlIndex == '1')
   {
      createCookie('stijl','oud',31);
   }


   stijlWisselaar();

}


function stijlWisselaar()
{
   if(readCookie('stijl') == 'nieuw')
   {
      document.getElementById('stijl').href = 'nieuw.css';
      document.getElementById('stijl-nieuw').selected = 'selected';
   }else
   if(readCookie('stijl') == 'oud')
   {
      document.getElementById('stijl').href = 'oud.css';
      document.getElementById('stijl-oud').selected = 'selected';
   }
}


function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*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;
}






//ohja, tijdens het laden willen we natuurlijk graag de stijl wisselen
//anders wordt het na verversen weer de default stijl:

stijlWisselaar();





function drop(that)
{
   /* force dropdown display... crappy handhelds :D */
   var s = that.parentNode.childNodes[3].style;

   s.display = (s.display == 'none') ? 'block' : 'none';

}










