/*
	PureDOM explorer
	written by Christian Heilmann (http://icant.co.uk)
	Please refer to the pde homepage for updates: http://www.onlinetools.org/tools/puredom/
	Free for non-commercial use. Changes welcome, but no distribution without 
	the consent of the author.
	
		
	This particular Javascript file was written by Alex Jones and can be found at
	http://www.silverspider.com/includes/pde.js
*/
function pde_init() {

/* CSS class names, change if needed */
	var mp='pde_nav';
	var hp='pde_hide';
	var sp='pde_show';
	var pp='pde_parent';
	var pa='pde_active';
	var cu='current';
	var mk='marked';
	
	var d,uls,i;
	if(!document.getElementById && !document.createTextNode){return;}

	popupcode();
	
/* navigation ID, change if needed */
	d = document.getElementById('nav');

	if (!d){return;}
	pde_addclass(d,mp)
	uls=d.getElementsByTagName('ul');
	for (i=0;i<uls.length;i++) {
	
		if(pde_checkcurrent(uls[i])) {
			pde_addclass(uls[i].parentNode.firstChild,pa);
		} else { /* Make sure all the list items are links or else you will generate Javascript errors */
			pde_addclass(uls[i],hp);
			pde_addclass(uls[i].parentNode.firstChild,pp);
			uls[i].parentNode.firstChild.onclick=function()
			{
				pde_swapclass(this,pp,pa);
				pde_swapclass(this.parentNode.getElementsByTagName('ul')[0],hp,sp);
				return false;
			}
		}
	}
	function pde_checkcurrent(o) {
		if(pde_check(o.parentNode,cu)){return true;}
		if(pde_check(o.parentNode,mk)){return true;}
		for(var i=0;i<o.getElementsByTagName('li').length;i++) {
			if(pde_check(o.getElementsByTagName('li')[i],cu)){return true;}
			if(pde_check(o.getElementsByTagName('li')[i],mk)){return true;}
		}
		return false;
	}
	function pde_swapclass(o,c1,c2) {
		var cn=o.className
		o.className=!pde_check(o,c1)?cn.replace(c2,c1):cn.replace(c1,c2);
	}
	function pde_addclass(o,c) {
		if(!pde_check(o,c)){o.className+=o.className==''?c:' '+c;}
	}
	function pde_check(o,c) {
	 	return new RegExp('\\b'+c+'\\b').test(o.className);
	}
	
	
	function popupcode() {
		var x = document.getElementsByTagName('a');
		for (var i = 0; i < x.length; i++) {
			if (x[i].className == 'popupNewSite') {
				strWidth = screen.availWidth - 10;
				strHeight = screen.availHeight - 160;
				x[i].onclick = function () {
					return popup1(this.href, strWidth, strHeight);
				}
				x[i].title += ' (Popup1)';
			} else if (x[i].className == 'popupHelp') {
				x[i].onclick = function () {
					return popup2(this.href, 430, 430);
				}
				x[i].title += ' (Popup2)';
			}
		}
	}

	
	function popup1(url, strWidth, strHeight) {		newwindow=window.open(url,'name','resizable=yes,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width='+strWidth+',height='+strHeight+',top=0,left=0');
		if (window.focus) { newwindow.focus(); }
		return false;
	}

	function popup2(url, strWidth, strHeight) {		newwindow=window.open(url,'name',"resizable,toolbar=no,location=no,scrollbars=yes,width="+strWidth+",height="+strHeight+",left=0,top=0");
		if (window.focus) { newwindow.focus(); }
		return false;
	}	
	
}
window.onload=function(e){
	pde_init();
	// add other functions here.
	setStyle();	
}