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;
}

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
  }
}

// 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 imgRot(s,pt) {
  document.images[s].src = ROT1[pt].src;
  ++pt;  if ( !s[pt] ) { pt = 1 };
  setTimeout('imgRot("' + s + '",' + pt+ ')',3000);
}

// Set DOM object visibility:  obj = DOM object handle;  s = visibility option
function setBor(obj,bs,bc) {
  switch(DOMS) {
    case 0:  break;									// no DOM, do nothing
    case 1:  break;									// layers, do nothing
    default: obj.style.borderColor = bc;	obj.style.borderStyle = bs;	break;	// IE4+ and NS6+
  }
}

function molnk(s,oid) {
  obj = getObj(oid);
  switch(s) {
    case 1:  setBor(obj,'outset','#00f'); break;
    case 2:  setBor(obj,'inset', '#00f'); break;
    default: setBor(obj,'solid', '#fff'); break;
  }
}

var winHome = '';
function showHome(s) { 
  if (winHome!="") winHome.close();
  winHome = window.open(s,'HOMEVIEW','height=389,width=514');
}

// 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 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.Firstname.value=='')		return setErm(s['Firstname'],	'You must enter your first name to continue.')
   if (s.Lastname.value=='')		return setErm(s['Lastname'],	'You must enter your last name to continue.')
   if (s.Street.value=='')		return setErm(s['Street'],	'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.Country.value=='')		return setErm(s['Country'],	'You must enter your country to continue.')
   if (s.Zipcode.value=='')		return setErm(s['Zipcode'],	'You must enter your zipcode to continue.')
   if (s.Dayphone.value=='')		return setErm(s['Dayphone'],	'You must enter your day time phone number to continue.')
   if (s.email.value=='')		return setErm(s['email'],	'You must enter your email address to continue.');
   if (s.email.value.indexOf('@')==-1)	return setErm(s['email'],	'Your E-mail address appears to be invalid. Please check!');
   if (s.email.value.indexOf('.')==-1)	return setErm(s['email'],	'Your E-mail address appears to be invalid. Please check!');
   return true;
}

// 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 chkMarket(s) {
   if (chkMailform(s)==false) return false;
   if (s.PropStreet.value=='')		return setErm(s['PropStreet'],		'You must enter the property street address to continue.')
   if (s.PropCity.value=='')		return setErm(s['PropCity'],		'You must enter the property city to continue.')
   if (s.PropState.value=='')		return setErm(s['PropState'],		'You must enter the property state to continue.')
   if (s.PropCountry.value=='')		return setErm(s['PropCountry'],		'You must enter the property country to continue.')
   if (s.PropZipcode.value=='')		return setErm(s['PropZipcode'],		'You must enter the property zipcode to continue.')
   return true;
}

function showPic(s,purl,caption) {
  document.images[s].src = purl;
  var dobj = getObj(s);
  return false;
}
