//Google Site Search Thing
addEvent(window,"load",function() { var f = document.getElementById('searchbox_010129986397852049302:pok-t4eloua'); if (!f) { f = document.getElementById('searchbox_demo'); } if (f && f.q) { var q = f.q; var n = navigator; var l = location; if (n.platform == 'Win32') { q.style.cssText = 'border: 1px solid #7e9db9; padding: 2px;'; } var b = function() { if (q.value == '') { q.style.background = '#FFFFFF url(http://google.com/coop/images/google_custom_search_watermark.gif) left no-repeat'; } }; var f = function() { q.style.background = '#ffffff'; }; q.onfocus = f; q.onblur = b; if (!/[&?]q=[^&]/.test(l.search)) { b(); } } },false);

//Use this to call all cross borwser functions
function addEvent(toElement,verb,funct,tf){
	if(navigator.userAgent.match(/MSIE [0-8]/))//Internet explorer
		toElement.attachEvent("on"+verb, funct);
	else //EVERYONE else. Stoopid IE...  You have to be special
		toElement.addEventListener(verb,funct,tf);
}

function getCookieValue(name){
	var pos = document.cookie.indexOf(name);
	if(pos != -1){
		var start = document.cookie.indexOf("=",pos) + 1 ;
		var end = document.cookie.indexOf(";",start);
		if(end == -1)end = document.cookie.length;
		return unescape(document.cookie.substring(start,end));
	} else return null;//to not return "undefined"
}

function findEvent(e){
	//This function is based on a function found on quirksmode.com
	var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;
	return targ;
}

//Load a script into the document dynamically!
function loadScript(uri){
	var newScript = document.createElement("script")
	newScript.setAttribute("src",uri);
	document.getElementsByTagName("head")[0].appendChild(newScript);
}

function removeAllChildren(e){while(e.childNodes.length >= 1)e.removeChild(e.firstChild);}

function togglePopUp(which){
	var pu = document.getElementById(which);
	pu.style.display = (pu.style.display == 'none') ? 'block' : 'none';
	}

function toggleElement(toggleLink) {
	var closedElement = document.getElementById('closedElement');
	var openElement = document.getElementById('openElement');	
	if(toggleLink.value.substr(0,5) == '[show' || closedElement.style.display == 'block'){
		closedElement.style.display = 'none';
		openElement.style.display = 'block';
		toggleLink.value = '[hide'+toggleLink.value.substr(5);
	} else {
		openElement.style.display = 'none';
		closedElement.style.display = 'block';
		toggleLink.value = '[show'+toggleLink.value.substr(5);
	}}

function toggleview(vname,nr,nrviews){
	for(n=1; n<=nrviews; n++) document.getElementById(vname+n).style.display = (n == nr) ? 'block' : 'none';
	}

function checkOther(src,other){
	document.getElementById(other).checked = src.checked;
	}
	
function setValue(which,txt,ok){
	if(ok) document.getElementById(which).value = txt;
	}

function checkNset(which,txt){
	var el = document.getElementById(which);
	if(el.value == '') el.value = txt;
	}
	
function focusNclear(c){
	var d=c.getAttribute("hasBeenFocused");
	var b=(d==""||d==null);
	if(b){
		c.setAttribute("hasBeenFocused","true");
		c.style.color="#000000";
		c.value="";
		var a=c.form;
		for(ii=0;ii<a.elements.length;ii++){
			if(a.elements[ii].type=="submit"){
				a.elements[ii].disabled=false 
	}}}}

function verify(what){
	return confirm('Are you sure that you want to delete ' + what + '?');
	}
	
