function findObj(theObj, theDoc){
  var p, i, foundObj;
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length){
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  return foundObj;
}

function doaction(myaction,mytitle){
	var thelayer = findObj("actionlayer");
	var theframe = findObj("actionframe");
	var thetitle = findObj("actionlabel");
	thetitle.innerHTML = mytitle;
	frames['actionframe'].location.href=myaction;
	thelayer.style.visibility = "visible";
}
function hideaction(){
	var thelayer = findObj("actionlayer");
	thelayer.style.visibility = "hidden";
}
function gotomeeting(theid){
	top.location.href='/index.php?action=meeting&mid=' + theid;
}

function sliderToDB(e,id,corr,minval,maxval){
	var MouseX,OffsetX,Width,TheValue,TheUnit;
	var theBar = findObj("SliderBar" + id.toString());
	var theSlider = findObj("Slider" + id.toString());
	var thePos = findObj("FormQ" + id.toString());
	//var TheValIndicator = findObj("SliderVal" + id.toString());
	if(!e) e = window.event;
	MouseX = e.clientX - 10;
	Width = parseInt(theBar.style.width);
	TheUnit = Width/(maxval-minval);
	TheValue = 0;
	if (is_ie5up){
		OffsetX = parseInt(theBar.style.pixelLeft);
		if(MouseX-OffsetX > Width){
			TheValue = Width;
		}else{
			TheValue = MouseX-OffsetX;
		}
		TheValue = parseInt(TheValue/TheUnit)*TheUnit;
		if(TheValue < 0){TheValue = 0}
		else if(TheValue > Width){TheValue = Width}
		theSlider.style.pixelLeft = TheValue-corr;
	}
	if (is_nav6up || is_moz || is_gecko) {
		OffsetX = parseInt(theBar.style.left);
		if(MouseX-OffsetX > Width){
			TheValue = Width;
		}else{
			TheValue = MouseX-OffsetX;
		}
		TheValue = parseInt(TheValue/TheUnit)*TheUnit;
		if(TheValue < 0){TheValue = 0}
		else if(TheValue > Width){TheValue = Width}
		theSlider.style.left = TheValue-corr;
	}
	//TheValIndicator.innerHTML = '' + (TheValue/TheUnit+minval).toString();
	thePos.value = (TheValue/TheUnit+minval).toString();
}

function updateMulti(id){
	var thePos = findObj("FormQ" + id.toString());
	var counter = 0;
	var theVal = "";
	while(findObj("FormQ" + id.toString() + "-" + counter.toString())){
		if(theVal != "") theVal = theVal + ",";
		theVal = theVal + findObj("FormQ" + id.toString() + "-" + counter.toString()).value;
		counter = counter + 1;
	}
	if(theVal != "") findObj("FormQ" + id.toString()).value = theVal;
	//alert(theVal);
}

function NotSaved(BTN){
	if(findObj(BTN).value.charAt(findObj(BTN).value.length-1) != "*"){
		findObj(BTN).value = findObj(BTN).value + "*";
	}
}

function HideDivs(theDiv){
	i = 0;
	while(findObj(theDiv + i)){
		findObj(theDiv + i).className = 'invisible';
		findObj(theDiv + 'link' + i).className = '';
		i = i + 1;
	}
	if(findObj(theDiv + 'last')) findObj(theDiv + 'last').className = 'invisible';
}

function ShowDiv(theDiv, theSub){
	HideDivs(theDiv);
	if(!findObj(theDiv + theSub)) theSub = 'last';
	findObj(theDiv + theSub).className = '';
	findObj(theDiv + 'link' + theSub).className = 'here';
}
