// JavaScript Document
function switchTab(whichCase) {
if (whichCase=="offline") {
document.getElementById('offline').style.display = "block";
document.getElementById('online').style.display = "none";
} else if (whichCase=="online") {
document.getElementById('offline').style.display = "none";
document.getElementById('online').style.display = "block";
}
return false;
}

function unblurit(whichone,whatsays) {
if (whichone.value == whatsays) {
whichone.value = "";
whichone.style.color = "#000000"; 
}
}

function blurit(whichone,whatsays) {
if (!whichone.value) {
whichone.value = whatsays;
whichone.style.color = "#999999";
}
}


var listlist;
var menulist = new Array();
var partlist;
var contentlist = new Array();

function discover(whichtag,whichclass,xception) {
//	alert("starting process");
// sets base state of menu according to exception
if (xception) {cx = "c" + xception;}
// build array of selected elements with selected class
listlist = document.getElementsByTagName(whichtag);
// alert('length of listlist: ' + listlist.length);
for (i=0;i<listlist.length;i++) {
if (listlist[i].className.match(whichclass)) {
menulist.push(listlist[i]);
}
}
// alert('length of menulist: ' + menulist.length);
// toggles display according to whether or not there is an exception
// if no exceptions, turn them all off and hide the close buttons
for (i=0;i<menulist.length;i++) {
if (menulist[i].id.indexOf(xception) == -1) {
// not exception
// alert('not an exception');
// alert('hiding item: ' + menulist[i]);
menulist[i].style.display = 'none';
stewie = "o" + menulist[i].id;
ron = "c" + menulist[i].id;
// alert('open button is ' + stewie + ' close button is ' + ron);
document.getElementById(stewie).style.display = 'block';
document.getElementById(ron).style.display = 'none';
} else {
// exception
// alert('exception is ' + xception);
menulist[i].style.display = 'block';
stewie = "o" + menulist[i].id;
ron = "c" + menulist[i].id;
// alert('open button is ' + stewie + ' close button is ' + ron);
document.getElementById(stewie).style.display = 'none';
document.getElementById(ron).style.display = 'block';
}
}
}

function setup(whichtag,whichclass,xception) {
// sets base state of menu according to exception
if (xception) {cx = "c" + xception;}
// build array of selected elements with selected class
partlist = document.getElementsByTagName(whichtag);
for (i=0;i<partlist.length;i++) {
if (partlist[i].className.match(whichclass)) {
contentlist.push(partlist[i]);
}
}
// toggles display according to whether or not there is an exception
// if no exceptions, turn them all off and hide the close buttons
for (i=0;i<contentlist.length;i++) {
if (contentlist[i].id.indexOf(xception) == -1) {
// not exception
// alert('not an exception');
contentlist[i].style.display = 'none';
stewie = "o" + contentlist[i].id;
ron = "c" + contentlist[i].id;
// alert('open button is ' + stewie + ' close button is ' + ron);
document.getElementById(stewie).style.display = 'block';
document.getElementById(ron).style.display = 'none';
} else {
// exception
// alert('exception is ' + xception);
contentlist[i].style.display = 'block';
stewie = "o" + contentlist[i].id;
ron = "c" + contentlist[i].id;
// alert('open button is ' + stewie + ' close button is ' + ron);
document.getElementById(stewie).style.display = 'none';
document.getElementById(ron).style.display = 'block';
}
}
}	
	

function dirtywork(whichone) {
// toggles visibility
// alert('opening item: ' + whichone);
oswitch = "o" + whichone;
cswitch = "c" + whichone;
if (document.getElementById(whichone).style.display != 'none') {
document.getElementById(whichone).style.display = 'none';
document.getElementById(oswitch).style.display = 'block';
document.getElementById(cswitch).style.display = 'none';
} else {
document.getElementById(whichone).style.display = 'block';
document.getElementById(oswitch).style.display = 'none';
document.getElementById(cswitch).style.display = 'block';
}
}

function turnoffs(whichone) {
// sets visibility to none
oswitch = "o" + whichone;
cswitch = "c" + whichone;
document.getElementById(whichone).style.display = 'none';
document.getElementById(oswitch).style.display = 'block';
document.getElementById(cswitch).style.display = 'none';
}

function hstatus(whichone) {
stewie = "o" + whichone;
document.getElementById(stewie).style.display = 'block';
document.getElementById(whichone).style.display = 'none';	
}

function oc(whichone) {
for (i=0;i<menulist.length;i++) {
if (menulist[i].id == whichone) {
// toggle selected
dirtywork(whichone);
} else {
// close others
// turnoffs(menulist[i].id);
}

}
}

function openWindow(param, w, h) {
	newWindow = window.open(param,'events','width='+w+',height=150px,scrollbars=yes, resizable=yes');
	if(newWindow.top != top) {newWindow.focus(); }
}
