function paging(sAction){
	document.control_form.pageaction.value = sAction
	submitform(eval("document.control_form"))
}

function validatePaging(sAction){
	/* 	New function Sept 27 04 - GLB
		in-place editing of lists was not
		gettting validated when paging link clicked
		as 'paging(sAction) by-passes validateForm.
		This function sh be used for paging wherever there is in-place
		list editing requiring validation */
		
	document.control_form.pageaction.value = sAction
	return validateForm(eval("document.control_form"))
}


/* 
function validateForm(oForm){
		use try/catch in case there is no validatrion on the parent page
		in which case function sq_submit will not be defined
	try{
		if(sq_submit(oForm.name)){
			oForm.submit();
			return true;
  		}
		return false;
	}
	catch(errorObject){
       oForm.submit();
       return true;
    }
}

 */


function validateForm(oForm){
	if(window.sq_submit){				// if validation scripts present
		if(sq_submit(oForm.name)){		// if OK
			oForm.submit();				// submit the form
			return true;					// and tell the caller OK
  		}
		return false;						// failed, so no submit
	}else{									
   		oForm.submit();					// no validation script present
      	return true;						// so just do it
   }
}

function submitform(oForm){
	oForm.submit()
}

function openWindow(URL,name,args) {
  window.open(URL,name,args);
}

function statusChange(sEntity,sFormName,sID,sStatus){
	var oForm = eval("document." +sFormName)
	oForm.action = "admin_" +sEntity +"_01.asp?act=STATUS&id=" +sID +"&status=" +sStatus
	oForm.submit()
}

function setMenuValues(sList){
	// sList contains comma separated fieldName pairs separated by :
	var aPair = ""
	var oSource,oMenu,sTemp
	var aItems = sList.split(",")
	for (var ix=0;ix<aItems.length;ix++){
		aPair 		= aItems[ix].split(":")
		if(eval("document.control_form." +aPair[0])){		// make sure it exists
			oMenu 		= eval("document.control_form." + aPair[0])
			oSource 	= eval("document.control_form." + aPair[1])
			for(var i = 0; i<oMenu.length;i++){
				if(oMenu[i].value == oSource.value) {
					oMenu.selectedIndex = i
					break;
				}
			}
		}
	}
}

function setMenuValues2(sList){
	// sList contains comma separated fieldName/value pairs separated by :
	// this version 2 has the value as a litteral rather than a form field
	var aPair = ""
	var sValue,oMenu,sTemp
	var aItems = sList.split(",")
//alert(aItems.length)	
	for (var ix=0;ix<aItems.length;ix++){
		aPair 		= aItems[ix].split(":")
//alert(aPair[0])
		if(eval("document.control_form." +aPair[0])){		// make sure it exists
			oMenu 		= eval("document.control_form." + aPair[0])
//alert(oMenu.name)			
			for(var i = 0; i<oMenu.length;i++){
				if(oMenu[i].value == aPair[1]) {
					oMenu.selectedIndex = i
					break;
				}
			}
		}
	}
}


