                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                // JS-Kit site functions
function toggle(el) {
	var elem = document.getElementById(el);
	elem.style.visibility = elem.shown ? "hidden" : "visible";
	elem.shown = !elem.shown; 
}

function toggleD(el) {
	var elem = document.getElementById(el);
	elem.style.display = elem.shown ? "none" : "block";
	elem.shown = !elem.shown; 
}

function getPath()	{ return String(window.location.pathname).replace(/\/[^\/]*$/, "/"); }
function matchPaths(path1, path2) {	return (path1 == path2) ? true : false; }
function goTo(path)		{	window.location.href = path; }
function pointTo(path) {
	var fullURL = "";
	if (path) { 
		if ( path.match(/^(https|http|ftp):\/\//) )	{ 
			fullURL = path; 
		} else if ( path.match(/^\//) ) { 
			fullURL = window.location.protocol + "//" + document.domain + path; 
		} else if ( path.match(/^(\.\/|\.)/) ) { 
			fullURL = window.location.protocol + "//" + document.domain + getPath(); 
		} else {
			fullURL = window.location.protocol + "//" + document.domain + getPath() + path;
		}
	}
	window.status = fullURL;
	return fullURL;
}

function mkList(obj, cPlain, cSel) {
	var naviUL = document.getElementById(obj);
	var naviLI = naviUL.getElementsByTagName('li');
	var active = -1, matching = -1;
	
	var editLI = function(i) {
		if (cPlain) { naviLI[i].className = cPlain; }
		if (naviLI[i].hasChildNodes()) {
			var naviAs = naviLI[i].getElementsByTagName('a');
			if (naviAs.length < 1) return;
			var naviA = naviAs[0];
			var href = naviA.getAttribute('href');

			if (href) {
				naviLI[i].onclick = function() { goTo(href); return true; };
				naviLI[i].onmouseover = function() { pointTo(href); return true; };
				naviLI[i].onmouseout = function() { pointTo(); return true; };
				if (!naviA.getAttribute('onclick')) { naviA.onclick = function() { return false; }; }
			} 
			if ( matching < 0 && matchPaths(pointTo(href), window.location.href) ) { matching = i; active = i; }
			if ( active < 0 && naviA.getAttribute('rel') == "active") { active = i; }
		}
	}
	for (var i=0; i<naviLI.length; i++)	editLI(i); 
	if (cSel) {
		if ( active >= 0 ) { naviLI[active].className = cSel; }
		if ( matching >= 0 ) { naviLI[matching].className = cSel; }
	}
} 

function mkHref(obj, href) {
	var el = document.getElementById(obj);

	if (el) {
		el.onclick = function() { goTo(href); return true; };
		el.onmouseover = function() { pointTo(href); return true; };
		el.onmouseout = function() { pointTo(); return true; };
		el.style.cursor = 'pointer';
	}
}

function mkWindowHref(obj, href, target) {
	var el = document.getElementById(obj);

	if (el) {
		el.onclick = function() { return window.open(href, target); };
		el.onmouseover = function() { pointTo(href); return true; };
		el.onmouseout = function() { pointTo(); return true; };
		el.style.cursor = 'pointer';
	}
}

function parse_query(query_str) {
	var params = new Array();
	var pairs = query_str.split(/\&/);

	for (var i in pairs) {
		var next_pair = pairs[i].split(/\=/);
		params[next_pair[0]] = next_pair[1];
	}
	return params;
}



