function init() {

	if(document.cookie.match("blue"))       document.documentElement.className += " blue";
	else if(document.cookie.match("green")) document.documentElement.className += " green";
	document.documentElement.style.visibility = "visible";

	if(document.body.id == "home"){
		document.documentElement.style.backgroundImage = "url(images/home_html_bg.gif)";
		document.getElementById("content").insertBefore(document.getElementById("quote"), document.getElementById("features"));
		document.getElementById("features").firstChild.nextSibling.id = "fi-2";
	}
	else if(document.body.id.match(/about|approach/)){
		if(document.body.id == "about") try { insertHr('features',2) } catch(e) {}
		else insertHr('procedure',3);
	}
	else if(document.body.id == "start"){
		var q = document.getElementsByTagName("ol")[0].getElementsByTagName("label");
		for(var i=0; i<q.length; i++){ 
			q[i].innerHTML = '<div class="number">' + (i+1) + '</div> ' + q[i].innerHTML;
			var qLine = q[i].getElementsByTagName("span");
			if(qLine.length < 2) qLine[0].style.top = "12px";
		}
	}
	else {
		var inquiry = document.getElementById("inquiry");
		inquiry.onfocus = function() { if(this.value == this.defaultValue) this.value = ""; }
		inquiry.onblur  = function() { if(this.value == "") this.value = this.defaultValue; }
		if(/MSIE/.test(navigator.userAgent)) document.body.insertBefore(document.createElement("hr"), document.getElementById("siteinfo"));
	}

	var inputs = document.getElementsByTagName("input");
	for(var j=0; j<inputs.length; j++){
		if(inputs[j].type == "text"){
			inputs[j].onfocus = function() { if(this.value == this.defaultValue) this.value = ""; }
			inputs[j].onblur  = function() { if(this.value == "") this.value = this.defaultValue; }
		}
	}

	var switchLinks = document.getElementById("color").getElementsByTagName("a");
	for(var c=0; c<switchLinks.length; c++){
		switchLinks[c].id = "sl-" + (c+1);
		switchLinks[c].href = "javascript:colorSwitch(\'" + switchLinks[c].innerHTML + "\')";
		switchLinks[c].onmousedown = function() {
			this.hideFocus = true;
			this.style.outline = "none";
		}
		switchLinks[c].onmouseup = switchLinks[c].onmouseout = function() {
			this.blur();
			this.hideFocus = false;
			this.style.outline = "";
		}
	}

}
// enhanced onload function modified from http://dean.edwards.name/weblog/2006/06/again/
if(/MSIE/.test(navigator.userAgent)){          // for Internet Explorer
	document.write('<script id="ie_onload" src="javascript:void(0)" defer><\/script>');
	document.getElementById("ie_onload").onreadystatechange = function(){
		if(this.readyState == "complete") init();
	}
}
else if(document.addEventListener){            // for Mozilla and Opera 9
	document.addEventListener("DOMContentLoaded", init, false);
}
else if(/WebKit/.test(navigator.userAgent)){   // for WebKit
	var _timer = setInterval(function(){
		if(/loaded|complete/.test(document.readyState)){
			init();
		}
	}, 10);
}
else window.onload = init;                     // for other browsers



function insertHr(listId,liNum) {
	var list = document.getElementById(listId);
	var headings = list.getElementsByTagName("h3");
	for(var i=0; i<headings.length; i++){
		headings[i].innerHTML = '<span>' + (i+1) + '</span> ' + headings[i].innerHTML;
		if(!((i+1)%liNum)) list.insertBefore(document.createElement("hr"), headings[i].parentNode.nextSibling);
	}
}



if(/MSIE 6/.test(navigator.userAgent)) try{ document.execCommand("BackgroundImageCache", false, true); } catch(e){};
if(/Firefox\/2/.test(navigator.userAgent)) document.styleSheets[0].insertRule("#color ul li a { display: -moz-inline-box; }", 0)