ns = (document.layers)? true:false 
ie = (document.all)? true:false 

function expandAll() {
	document.forms[0].expandAll.value="true";
	document.forms[0].submit();
}

function collapseAll() {
	document.forms[0].collapseAll.value="true";
	document.forms[0].submit();
}

function switchExpandState(index) {
	document.forms[0].switchExpandState.value=index;
	document.forms[0].submit();
}

function action(action) {
	document.forms[0].action.value=action;
	document.forms[0].submit();
}

function openLabWindow(url, windowName) {
	var win = window.open(url, windowName, "top=10,left=10,width=600,height=600,scrollbars=yes,resizable=yes,menubar=no,toolbar=no,location=no,status=yes");
	win.focus();
}

function openCalendar(dateField) {
	window.open("calendar.html?"+dateField,"SWCCalendar","width=200,height=230,scrollbars=no,resizable=no,menubar=no,toolbar=no,location=no,status=no,dependent=no");
}

function scrollToAnchor(anchorname, expandAll, collapseAll) {
	if (expandAll || collapseAll) {
		anchorname = 'allAnchor';
	}
	var y = 0;
 	if(document.getElementById) {
		y=AnchorPosition_getPageOffsetTop(document.getElementById(anchorname));
	} else if (document.all) {
		y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
	} else if (document.layers) {
		var found=0;
		var i=0;
		for (i; i<document.anchors.length; i++) {
			if (document.anchors[i].name==anchorname) {
				found=1;
				break;
			}
		}
		y = document.anchors[i].y;
	}
	window.scrollTo(0, y);
}

function AnchorPosition_getPageOffsetTop(el) {
	if (el != null) {
		var ot = el.offsetTop;
		while((el=el.offsetParent) != null) {
			ot += el.offsetTop;
		}
		return ot;
	} else {
		return 0;
	}
}

