// Script Library for warddesigngroup.us


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function showHide() { //mab: use wrapper className to preserve current section's menu's visibility
  var i,p,v,obj,objs,args=showHide.arguments;
  for (i=0; i<(args.length-1); i+=2) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+1];
    if (obj.style) { objs=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    if (obj.id != 'nav-'+MM_findObj('wrapper').className) { objs.visibility=v; } }
}

function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function loadPage(topSection,topSection2,topSection3)
{
	if (document.getElementById) {
		highlightTop(topSection);
		highlightSub(topSection);
		highlightTop(topSection2);
		highlightSub(topSection2);
		highlightTop(topSection3);
		highlightSub(topSection3);
		document.getElementById('wrapper').className = topSection; // capture topSection for use elsewhere
	}
	
}

function highlightTop(topSection)
{
	if (document.getElementById) {
		var topAnchorLi = document.getElementById(topSection);
		if (topAnchorLi) {
			var topAnchor = topAnchorLi.getElementsByTagName('a')[0];
			if (topAnchor) {
				topAnchor.className = 'here';
				topAnchor.style.color = '#fff';
			}
		}
	}
}

function highlightSub(topSection)
{
	var thispath = window.location.toString().split('#')[0].split('?')[0];
	if (document.getElementById) {
		var navul = document.getElementById('nav-' + topSection);
		if (navul) {
			navul.style.visibility = 'visible';
			navul.style.classname = 'topsection';
			var navanchors = navul.getElementsByTagName('a');
			if (navanchors) {
				for(var i = 0; i <= navanchors.length-1; i++) {
					if (navanchors[i].href == thispath) {
						navanchors[i].className = 'select';
						break;
					}
				}
			}
		}
	}
}

function highlightThisProject() 
{
	var thispath = window.location.toString().split('#')[0].split('?')[0];
	thispath = thispath.replace(/http:\/\/(.+?)\//,'/');
	thispath = thispath.replace('index.shtml','');
	
	if (document.getElementById) {

		var switcher = document.getElementById("switcher");
		if (switcher) {
			var switcherlinks = switcher.getElementsByTagName('option');
			if (switcherlinks) {
				for(var i = 0; i <= switcherlinks.length-1; i++) {
					if (switcherlinks[i].value == thispath) {
						switcherlinks[i].selected = 'selected';
					}
				}
			}
		}
	}

}
