if 	(document.getElementById)	var DOMS = 3	// Supports Web Standard (getElementById)
else if	(document.all)		 	var DOMS = 2	// Supports MS document.all
else if	(document.layers)	 	var DOMS = 1	// Supports NS layers
else				 	var DOMS = 0;	// No DOM gateway support

// Return DOM Handle for specified DOM object ID
function getObj(oid) {
  switch(DOMS) {					// Check for various browsers
    case 1: return(document[oid]);			// Supports Layers (NS4)
    case 2: return(document.all[oid]);			// Supports document.all (ie4)
    case 3: return( ((document.getElementById(oid))?document.getElementById(oid):'') );	// Supports getElementById
  }
}

// Reset input field color when changed
function fldReset() { this.style.backgroundColor=''; this.style.borderColor='#bbbbbb'; }

// display error message, color error field, set 
function setErm(f,m) {
  alert(m);
  f.onchange = fldReset;
  f.style.backgroundColor="#ff9"; 
  f.style.borderColor="#f00"; 
  f.focus(); 
  return false;
}

// Check common address and contact information on contact forms
function chkContact(s) {
  if (s.Username.value=='')		return setErm(s['Username'],		'You must enter your name to continue.');
  if (s.UserTel.value=='')		return setErm(s['UserTel'],		'You must enter your telephone number to continue.');
  if (s['MM_EMAILTO[]'][1].value=='')	return setErm(s['MM_EMAILTO[]'][1],	'You must enter your email address to continue.');
  s.Useremail.value = s['MM_EMAILTO[]'][1].value;
  return true;
}

// Check common address and contact information on contact forms
function chkCat(s) {
  if ((s.ctitle.value=='') && (s.ADM_FUNC.value=='save')) return setErm(s['ctitle'],'You must enter a Category title to continue.');
  return true;
}

function chkItem(s) {
  if (s.ititle.value=='') return setErm(s['ititle'],'You must enter an Item title to continue.');
  return true;
}

function catedit(cid) {
  window.open('admin_cat.php?cid='+cid,'category','height=600,width=600,scrollbars,resizable');
  return false;
}

function itemedit(cid,itemid) {
  window.open('admin_item.php?cid='+cid+'&itemid='+itemid,'item','height=340,width=440,scrollbars,resizable');
  return false;
}

function itemopedit(itemid,oid) {
  window.open('admin_itemop.php?itemid='+itemid+'&oid='+oid,'itemop','height=340,width=440,scrollbars,resizable');
  return false;
}

function verifyDelete(s)	{ return(confirm("Are you sure you want to delete " + s + "?")); }
