<!--

// Style Switcher

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

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 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;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);

// Random hp image

function randomImg() {
	var thePics = new Array()

	thePics[1] = "nantucket.jpg"
	thePics[2] = "robot.jpg"
	thePics[3] = "fl_beach.jpg"
	thePics[4] = "az_road.jpg"
	thePics[5] = "train_ride.jpg"
	thePics[6] = "wheat_field.jpg"
	thePics[7] = "birch.jpg"
	thePics[8] = "cactus.jpg"
	thePics[9] = "finish_line.jpg"
	thePics[10] = "fender.jpg"
	
	var rn = Math.floor(Math.random() * thePics.length)
	if (rn == 0) {
	  rn = 1
	}
	document.write("<img src=\"/photos/hp/"+thePics[rn]+"\" width=\"194\" height=\"146\" border=\"0\" />")
}

// MT functions

function OpenTrackback (c) {
    window.open(c,
                    'trackback',
                    'width=480,height=480,scrollbars=yes,status=yes');
}

var HOST = 'www.simplebits.com';

// Copyright (c) 1996-1997 Athenia Associates.
// http://www.webreference.com/js/
// License is granted if and only if this entire
// copyright notice is included. By Tomer Shiran.

function setCookie (name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "/") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
    document.cookie = curCookie;
}

function getCookie (name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1)
        return nullstring;
    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1)
        cookieEndIndex = c.length;
    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

function deleteCookie (name, path, domain) {
    if (getCookie(name))
        document.cookie = name + "=" + ((path) ? "; path=" + path : "/") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}

function fixDate (date) {
    var base = new Date(0);
    var skew = base.getTime();
    if (skew > 0)
        date.setTime(date.getTime() - skew);
}

function rememberMe (f) {
    var now = new Date();
    fixDate(now);
    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
    setCookie('mtcmtauth', f.author.value, now, '', HOST, '');
    setCookie('mtcmtmail', f.email.value, now, '', HOST, '');
    setCookie('mtcmthome', f.url.value, now, '', HOST, '');
}

function forgetMe (f) {
    deleteCookie('mtcmtmail', '', HOST);
    deleteCookie('mtcmthome', '', HOST);
    deleteCookie('mtcmtauth', '', HOST);
    f.email.value = '';
    f.author.value = '';
    f.url.value = '';
}

// Stripes

		// this function is need to work around 
		// a bug in IE related to element attributes
		function hasClass(obj) {
		var result = false;
		if (obj.getAttributeNode("class") != null) {
		   result = obj.getAttributeNode("class").value;
		}
		return result;
		}   
		
		function stripe(id) {
		
		// the flag we'll use to keep track of 
		// whether the current row is odd or even
		var even = false;
		
		// if arguments are provided to specify the colours
		// of the even & odd rows, then use the them;
		// otherwise use the following defaults:
		var evenColor = arguments[1] ? arguments[1] : "#fff";
		var oddColor = arguments[2] ? arguments[2] : "#eee";
		
		// obtain a reference to the desired table
		// if no such table exists, abort
		var table = document.getElementById(id);
		if (! table) { return; }
		
		// by definition, tables can have more than one tbody
		// element, so we'll have to get the list of child
		// &lt;tbody&gt;s 
		var tbodies = table.getElementsByTagName("tbody");
		
		// and iterate through them...
		for (var h = 0; h < tbodies.length; h++) {
		
		// find all the &lt;tr&gt; elements... 
		var trs = tbodies[h].getElementsByTagName("tr");
		
		// ... and iterate through them
		for (var i = 0; i < trs.length; i++) {
		
		// avoid rows that have a class attribute
		  // or backgroundColor style
		if (!hasClass(trs[i]) && ! trs[i].style.backgroundColor) {
		
		   // get all the cells in this row...
			var tds = trs[i].getElementsByTagName("td");
		  
			// and iterate through them...
			for (var j = 0; j < tds.length; j++) {
		  
			  var mytd = tds[j];
		
			  // avoid cells that have a class attribute
			  // or backgroundColor style
			if (! hasClass(mytd) && ! mytd.style.backgroundColor) {
		  
			mytd.style.backgroundColor = even ? evenColor : oddColor;
			
			  }
			}
		  }
		  // flip from odd to even, or vice-versa
		  even =  ! even;
		}
		}
		}

// DDS - Dood De Spam-script

		// Deze functie wordt gebruikt om spambots om de tuin te leiden. 
		// dds.js staat voor Dood De Spam en wordt via index.php in elke
		// pagina-layout geladen. Een e-mailadres kan je maken door
		// <a href="javascript:redir('vijfje.nl' , 'USER');"> te
		// gebruiken.
		// N.B. Deze hele poespas heeft natuurlijk geen zin als dan
		// <a href="...">EMAILADRES</a> wordt geplaatst. De bedoeling is
		// dat de apestaartjes verdwenen zijn zodat spambots dit niet
		// als een e-mailadres zien. Gebruik dus een link in de zin van
		// <a href="...">E-Mail</a> of iets dergelijks.
		//
		// © Sebastiaan Landers, 2008.
		
		function redir(d, u)
		{
			ml = 'm'+'a'+'i'+'l'+'t'+'o';
			window.location=ml+":"+u+"@"+d;
		}

// Onzichtbare DIVs zichtbaar maken

function toggle(obj) {
	var obj=document.getElementById(obj);
	if (obj.style.display == "block") obj.style.display = "none";
	else obj.style.display = "block";
}

// Sponsoren

var slideimages=new Array()
var slidelinks=new Array()

function slideshowimages(){
  for (i=0;i<slideshowimages.arguments.length;i++){
  slideimages[i]=new Image()
  slideimages[i].src=slideshowimages.arguments[i]
  }
}

function slideshowlinks(){
  for (i=0;i<slideshowlinks.arguments.length;i++)
  slidelinks[i]=slideshowlinks.arguments[i]
}

function gotoshow(){
  if (!window.winslide||winslide.closed)
    winslide=window.open(slidelinks[whichlink])
  else
    winslide.location=slidelinks[whichlink]
    winslide.focus()
}

//-->
