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

function analOut(s) {
  var WANAL = window.open('','ANALYZE','height=400,width=400')
  WANAL.focus();
  WANAL.document.open();
  WANAL.document.write('<pre>' + s + '</pre>');
  WANAL.document.close();
  this.focus;
}

// 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));	// Supports getElementById
  }
}

// Position DOM object:  obj = DOM object handle;  x = left coord;  y = top coord.
function setPos(obj,x,y) {
  switch(DOMS) {
    case 1:  obj.moveTo(x,y);			    break;	// NS 4
    default: obj.style.left = x; obj.style.top = y; break;	// IE4+,NS6+
  }
}

// Set DOM object visibility:  obj = DOM object handle;  s = visibility option
function setVis(obj,s) {
  switch(DOMS) {
    case 1:  obj.visibility       = s; break;		// layers
    default: obj.style.visibility = s; break;		// IE4+ and NS6+
  }
}

// Set DOM object text clor:  obj = DOM object handle;  s = color
function setColor(obj,s) {
  switch(DOMS) {
    case 1:  obj.color       = s; break;		// layers
    default: obj.style.color = s; break;		// IE4+ and NS6+
  }
}

// Set DOM object text clor:  obj = DOM object handle;  s = color
function swZ(obj1,obj2) {
  switch(DOMS) {
    case 1:  { obj1.zindex       = 6; obj2.zindex       = 5; break; }	// layers
    default: { obj1.style.zindex = 6; obj2.style.zindex = 5; break; }	// IE4+ and NS6+
  }
}

function aniBanner(s) { var obj1 = getObj('SWAPT1'); var obj2 = getObj('SWAPT2');
  switch(s) {
    case 2:  { setVis(obj2,'visible'); setColor(obj1,'#0bcced'); setColor(obj2,'#1d6acb'); swZ(obj2,obj1); setTimeout('aniBanner(3)' ,100);  break; }
    case 3:  {                         setColor(obj1,'#149bdc'); setColor(obj2,'#149bdc');                 setTimeout('aniBanner(4)' ,100);  break; }
    case 4:  {                         setColor(obj1,'#1d6acb'); setColor(obj2,'#0bcced');                 setTimeout('aniBanner(5)' ,100);  break; }
    case 5:  { setVis(obj1,'hidden' ); setColor(obj1,'#2639ba'); setColor(obj2,'#00ffcc');                 setTimeout('aniBanner(6)' ,2000); break; }
    case 6:  { setVis(obj1,'visible'); setColor(obj1,'#1d6acb'); setColor(obj2,'#0bcced'); swZ(obj1,obj2); setTimeout('aniBanner(7)' ,100);  break; }
    case 7:  {                         setColor(obj1,'#149bdc'); setColor(obj2,'#149bdc');                 setTimeout('aniBanner(8)' ,100);  break; }
    case 8:  {                         setColor(obj1,'#0bcced'); setColor(obj2,'#1d6acb');                 setTimeout('aniBanner(1)' ,100);  break; }
    default: { setVis(obj2,'hidden' ); setColor(obj1,'#00ffcc'); setColor(obj2,'#2639ba');                 setTimeout('aniBanner(2)' ,2000); break; }
  }                                                                                   
}                                                                                     

function aniIndex(s,tc) { 
  switch(s) {
    case 0:  { setVis(getObj('SB0'),'hidden'); setVis(getObj('SB1'),'visible'); setTimeout('aniIndex(1)',3000); break; }
    case 1:  { setVis(getObj('SB1'),'hidden'); setVis(getObj('SB2'),'visible'); setTimeout('aniIndex(2)',3000); break; }
    case 2:  { setVis(getObj('SB2'),'hidden'); setVis(getObj('SB3'),'visible'); setTimeout('aniIndex(3)',3000); break; }
    case 3:  { setVis(getObj('SB3'),'hidden'); setVis(getObj('SB4'),'visible'); setTimeout('aniIndex(4)',3000); break; }
    case 4:  { setVis(getObj('SB4'),'hidden'); setVis(getObj('SB0'),'visible'); setTimeout('aniIndex(0)',3000); break; }
    default: { break; }
  }                                                                                   
}                                                                                     

function imgRot(s,pt) {
  document.images[s].src = ROT1[pt].src;
  ++pt;  if ( !s[pt] ) { pt = 1 };
  setTimeout('imgRot("' + s + '",' + pt+ ')',3000);
}

// 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) {
  f.onchange = fldReset;
  f.style.backgroundColor="#ff9";
  f.style.borderColor="#f00"; 
  f.focus();
  return false;
}

// Check mailto form field(s) for required input, When a field is found with missing input,
// alert user, set field pink, and set focus to it.
function chkMailform(s) {
   if (s.Name.value=='')		return setErm(s['Name'],		'You must enter your name to continue.')
   if (s.Address1.value=='')		return setErm(s['Address1'],		'You must enter your Street address to continue.')
   if (s.City.value=='')		return setErm(s['City'],		'You must enter your City to continue.')
   if (s.State.value=='')		return setErm(s['State'],		'You must enter your State to continue.')
   if (s.ZipCode.value=='')		return setErm(s['ZipCode'],		'You must enter your zipcode to continue.')
   if (s.Telephone.value=='')		return setErm(s['Telephone'],		'You must enter your day time phone number to continue.')
   if (s.EveTelephone.value=='')	return setErm(s['EveTelephone'],	'You must enter your eveining phone number to continue.')
   if (s['MM_EMAILTO[]'][1].value=='')	return setErm(s['MM_EMAILTO[]'][1],	'You must enter your email address to continue.')
   s.Email.value = s['MM_EMAILTO[]'][1].value;
   return true;
}

function editLink(lcatid,lid)	{ window.open('admin_edit_link.php?lcatid='+lcatid+'&lid='+lid,'link','height=550,width=500,scrollbars,resizable'); return false; }
function editLinkCat(lcatid)	{ window.open('admin_edit_lcat.php?lcatid='+lcatid,'lcat','height=500,width=500,scrollbars,resizable'); return false; }
function editLinkmode()	{ window.open('admin_edit_linkmode.php','lmode','height=200,width=300,scrollbars,resizable'); return false; }
