function fixPage() {
	var myWindows = document.getElementsByTagName('div');
	for(var idx = 0 ; idx < myWindows.length ; idx++) {
		if(myWindows[idx].className == 'windowtitle') {
			//alert(myWindows[idx].innerHTML);
			tmpVar = myWindows[idx].innerHTML;
			myWindows[idx].innerHTML = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' +
			'<tr><td width="10" height="18" bgcolor="white">' +
			'<img src="/img/main/tabCornerLeft.gif" />' + 
			'</td><td style="height: 15px;padding-top: 3px; border-bottom: 0px solid #b7b7b7;background-image:url(/img/main/tabBG.gif)">' + tmpVar + '</td>' +
			'<td align="right" width="10" bgcolor="white">' +
			'<img src="/img/main/tabCornerRight.gif" />' + 
			'</td></tr></table>'
			;
		}
		
		if(myWindows[idx].className == 'windowfoot') {
			//alert(myWindows[idx].innerHTML);
			tmpVar = myWindows[idx].innerHTML;
			myWindows[idx].innerHTML = '<table border="0" cellspacing="0" cellpadding="0" width="100%" style="height: 13px;margin: 0;padding: 0;" align="center">' +
			'<tr><td width="13" height="12" bgcolor="white" valign="top" align="left">' +
			'<img src="/img/main/grayCornerBtmLeft.gif" style="position: relative;" />' + 
			'</td><td bgcolor="white"><div style="border-bottom: 1px solid #b7b7b7;height: 13px;font-size: 1px; line-height: 0;margin-top:-1px;" bgcolor="white">&nbsp;</div></td>' +
			'<td align="right" width="13" bgcolor="white" valign="top" height="13">' +
			'<img src="/img/main/grayCornerBtmRight.gif" style="position: relative;" />' + 
			'</td></tr></table>';
		}
		
		if(myWindows[idx].className == 'tabbuttoncontainer') {
			myLabels = myWindows[idx].getElementsByTagName('img');
			for(var odx = 0 ; odx < myLabels.length ; odx++) {
				myLabels[odx].onclick = function() {
					raisePane(this);
				}
			}
		}
	}
	setAISTimeouts();
}

function toggleLeftMenu() {
	var myButton = document.getElementById('menutabbutton');
	var myMenu = document.getElementById('leftmenu');
	if(myMenu.style.display == null || myMenu.style.display == 'none') {
		myMenu.style.display = 'block';
		myButton.style.marginLeft = '130px';
		document.getElementById('xclose').style.display = 'block';
	} else {
		myMenu.style.display = 'none';
		myButton.style.marginLeft = '0px';
		document.getElementById('xclose').style.display = 'none';
	}
}

function raisePane(obj) {
	var myPaneContainer = obj.parentNode;
	myOtherPanes = myPaneContainer.getElementsByTagName('img');
	for(var idx = 0 ; idx < myOtherPanes.length ; idx++) {
		myOtherPanes[idx].className = 'tmp';
		myOtherPanes[idx].src = myOtherPanes[idx].src.replace('2', '1');
		myFriend = document.getElementById(myOtherPanes[idx]["for"] || myOtherPanes[idx].htmlFor);
		
		myFriend = document.getElementById(myOtherPanes[idx].getAttribute("for") || myOtherPanes[idx].htmlFor);
		myFriend.style.display = 'none';
	}
	obj2 = document.getElementById(obj.getAttribute("for") || obj.htmlFor);
	obj2.style.display = 'block';
	obj.className = 'active';
	obj.src = obj.src.indexOf('1') > 0 ? obj.src.replace('1' , '2') : obj.src.replace('2', '1');
}


function expandCategory(cat_id) {
	document.getElementById('cat_' + cat_id).style.display = 'block';
}

function hide(cat_id) {
	timeout_id = setTimeout("document.getElementById('cat_"  + cat_id + "').style.display = 'none';" , 10);
}

function interruptTimeout() {
	clearTimeout(timeout_id);
}

function continueTimeout(cat_id) {
	timeout_id = setTimeout("document.getElementById('cat_"  + cat_id + "').style.display = 'none';" , 10);
}

function showPane(pane_id) {
	document.getElementById(pane_id).style.display = 'block';
}

function hidePane(pane_id) {
	document.getElementById(pane_id).style.display = 'none';
}

function setAISTimeouts() {
	tmw = setTimeout('showTenMinuteWarning();',  1500000);
	fml = setTimeout('fifteenMinuteAutoLogout()',1800000);
}

function showTenMinuteWarning() {
	logoutwdw = window.open('', 'timeoutwdw', 'width=500, height=100');
	logoutwdw.document.write('<html><head><style>* {font: 11px tahoma;font-weight: bold;text-align: center;}</style></head><body>You have been idling for over 25 minutes. For your security, in 5 minutes, you will be logged out.  If you wish to continue, close this window and browse any of the Support Center pages to refresh your session.</body></html>');
}

function fifteenMinuteAutoLogout() {
	logoutwdw.close();
	document.location.href='/users/logout/';
}

function stopTimeouts() {
	clearTimeout(tmw);
	clearTimeout(fml);
}
function verifyForm(form_id) {
		var myForm = document.getElementById(form_id);
		var errorMessage = '';
		var logMessage = "";
		var inputs = myForm.getElementsByTagName('input');
		var selects = myForm.getElementsByTagName('select');
		var textareas = myForm.getElementsByTagName('textarea');
		var idx = 0;
		logMessage += "Found " + inputs.length + " inputs\n";
		logMessage += "Found " + selects.length + " selects\n";
		logMessage += "Found " + textareas.length + " textareas\n";
		
		for(idx=0; idx<inputs.length ; idx++) {
			if(inputs[idx].getAttribute('required') == 'required') {
				logMessage += "found a required field: " + idx + " with value = " + inputs[idx].value  + "\n";
				if(inputs[idx].value.length == 0) {
					var myName = inputs[idx]['name'];
					myName = myName.replace(/_/g, ' ');
					errorMessage += "The field '" + myName + "' must not be empty.\n";
				}
			}
			if(inputs[idx].getAttribute('required') == 'requiredemail') {
							logMessage += "found a required field: " + idx + " with value = " + inputs[idx].value  + "\n";
							if(inputs[idx].value.length == 0 || inputs[idx].value.indexOf('@') == -1) {
									var myName = inputs[idx]['name'];
									myName = myName.replace(/_/g, ' ');
									errorMessage += "The field '" + myName + "' must not be empty or must contain a valid email address.\n";
							}
					}
		}
		
		
			
		for(idx=0; idx<selects.length ; idx++) {
			if(selects[idx].getAttribute('required') == 'required') {
				logMessage += "found a required field: " + idx + " with value = " + selects[idx].selectedIndex + "\n";
				if(selects[idx].selectedIndex == 0) {
					var myName = selects[idx]['name'];
					myName = myName.replace(/_/g, ' ');
					errorMessage += "You must choose an option from the '" + myName + "' drop-down menu.\n";
				}
			}
		}
		
		
		for(idx=0; idx<textareas.length ; idx++) {
			if(textareas[idx].getAttribute('required') == 'required') {
				logMessage += "found a required field: " + idx + " with value = " + textareas[idx].value  + "\n";
				if(textareas[idx].value.length == 0) {
					var myName = textareas[idx]['name'];
					myName = myName.replace(/_/g, ' ');
					errorMessage += "The field '" + myName + "' must not be empty.\n";
				}
			}
		}
		
		if(errorMessage !='') {
			alert("The following errors were found:\n" + errorMessage);
			return false;
		} else {
			//alert(logMessage + "\n\nErrormessage: " + errorMessage);
			document.contact.submit();
		}
	}

