window.onload=function(){if (window.windowOnload) window.windowOnload();}

window.onerror = reportError;
function reportError() {
	return true;
}

function xGetElementById(obj) {
	if(typeof(obj)!='string') return obj;
	if(document.getElementById) obj=document.getElementById(obj);
	else if(document.all) obj=document.all[obj];
	else obj=null;
	return obj;
}

function xGetCS(ele,sP) {
	return parseInt(document.defaultView.getComputedStyle(ele,'').getPropertyValue(sP));
}

function xDef() {
	for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=='undefined') return false;}
	return true;
}

function xNum(n) {
	return typeof(n)=='number';
}

function xStr(s) {
	return typeof(s)=='string';
}

function xHeight(obj,newH) {
	if(!(obj=xGetElementById(obj))) return 0;
	if (xNum(newH)) {
		if (newH<0) newH = 0;
		else newH=Math.round(newH);
	}
	else newH=0;
	var css=xDef(obj.style);
	if(css && xDef(obj.offsetHeight) && xStr(obj.style.height)) {
		if(newH) xSetCH(obj, newH);
		newH=obj.offsetHeight;
	}
	else if(css && xDef(obj.style.pixelHeight)) {
		if(newH) obj.style.pixelHeight=newH;
		newH=obj.style.pixelHeight;
	}
	return newH;
}

function xSetCH(obj,newH) {
	var pt=0,pb=0,bt=0,bb=0;
	if(xDef(document.defaultView) && xDef(document.defaultView.getComputedStyle)){
		pt=xGetCS(obj,'padding-top');
		pb=xGetCS(obj,'padding-bottom');
		bt=xGetCS(obj,'border-top-width');
		bb=xGetCS(obj,'border-bottom-width');
	}
	else if(xDef(obj.currentStyle,document.compatMode)){
		if(document.compatMode=='CSS1Compat'){
			pt=parseInt(obj.currentStyle.paddingTop);
			pb=parseInt(obj.currentStyle.paddingBottom);
			bt=parseInt(obj.currentStyle.borderTopWidth);
			bb=parseInt(obj.currentStyle.borderBottomWidth);
		}
	}
	else if(xDef(obj.offsetHeight,obj.style.height)){
		obj.style.height=newH+'px';
		pt=obj.offsetHeight-newH;
	}
	if(isNaN(pt)) pt=0; if(isNaN(pb)) pb=0; if(isNaN(bt)) bt=0; if(isNaN(bb)) bb=0;
	var cssH=newH-(pt+pb+bt+bb);
	if(isNaN(cssH)||cssH<0) return;
	else obj.style.height=cssH+'px';
}

function changeState(objID, objProp, propVal) {
	var a = changeState.arguments;
	var oState = xGetElementById(objID);
	
	if (oState) {
		switch(objProp) {
			case "submitBut":
				if (propVal == 1) {
					oState.style.backgroundImage = "url(images/arrow_g.gif)";
				} else {
					oState.style.backgroundImage = "url(images/arrow_r.gif)";
				}
			case "submenuSwitch":
				if (propVal == 1) {
					if (oState.className != "current") {
						oState.style.backgroundImage = "url(images/arrow_g.gif)";
					}
				} else {
					if (oState.className != "current") {
						oState.style.backgroundImage = "url(images/arrow_r.gif)";
					}
				}
				break;
			case "subsubmenuSwitch":
				if (propVal == 1) {
					if (oState.className != "current") {
						oState.style.backgroundImage = "url(images/dash_g.gif)";
					}
				} else {
					if (oState.className != "current") {
						oState.style.backgroundImage = "url(images/dash_r.gif)";
					}
				}
				break;
			default:
				break;
		}
	}
}
