function newWindow(mypage,myname,w,h,scroll,pos){
//		location=yes,directories=yes,status=yes,menubar=yes,toolbar=yes,resizable=yes
	Window(mypage,myname,w,h,scroll,pos, 'no','no','no','no','no','yes')
}

function Window(mypage,myname,w,h,scroll,pos, locations, directories, status, menubar, toolbar, resizable){
	if(pos=="random"){
			LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
			TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}

	if(pos=="center"){
			LeftPosition=(screen.width)?(screen.width-w)/2:100;
			TopPosition=(screen.height)?(screen.height-h)/2:100;
	} else if((pos!="center" && pos!="random") || pos==null){
			LeftPosition=0;TopPosition=20;
	}

	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition + 
		',scrollbars='+scroll+
		',location='+locations+
		',directories='+directories+
		',status='+status+
		',menubar='+menubar+
		',toolbar='+toolbar+
		',resizable='+resizable;

	win=window.open(mypage,myname,settings);
	win.focus();
}


function checkall(theForm, thisElement, excludeElement) {
   var theElement;

   // loop through all elements on form
   for (var iElement = 0; iElement < theForm.length; iElement++) {
      theElement = theForm[iElement];

      if (theElement.type == "checkbox") {
      	if (excludeElement != theElement.name) {
			theElement.checked = thisElement.checked
		}
      }
   }
}

function findElement(theForm, name) {
   var theElement;

   // loop through all elements on form
   for (var iElement = 0; iElement < theForm.length; iElement++) {
      theElement = theForm[iElement];

      if (theElement.name == name) {
      	return theElement;
      }
   }

   return null;
}
