var saveContent = '';
function swapContent( newContent )  {
	var cur = document.getElementById('contentArea');
	//var hiddenDiv = document.getElementById( newContent + "Content");
	var hiddenDiv = document.getElementById( newContent + 'Content');

	if (cur && hiddenDiv)
	{
		saveContent =  cur.innerHTML;
		cur.innerHTML  = hiddenDiv.innerHTML;
		
	}

	return;
}
function contentMessage( message )  {
	var cur = document.getElementById('contentArea');
	if (cur) {
		cur.innerHTML = message
		 + "<br><BR><BR>"
		 + "<input type='button' onClick = 'replaceContent()' value='Submit'> "
		;
	}


}

function replaceContent( )  {

	var cur = document.getElementById('contentArea');

	if (cur)
		cur.innerHTML = saveContent;
}

function checkField(fieldName, prettyText, badValue)
{
	if (fieldName.value == badValue) {
		alert ("You must provide  "  + prettyText + ".");
		fieldName.focus();
		return (false);
	}

	return (true);
}

function checkField2(fieldName, prettyText, badValue)
{

  var f1 = document.getElementById(fieldName);
  if (! f1)
     return (true);

alert ("the field " + fieldName + " = " + f1.value);

  if (badValue != "expzip")
  {
    if (f1.value === badValue) {
      alert ("You must provide a "  + prettyText + ".");
      f1.focus();
      return (false);
    }
  }
  else // if an expression was sent in...
  {

     if (!/\d\d\d\d\d/.test(f1.value))
     {
       alert ("The field " + fieldName + prettyText);
       f1.focus();
       return (false);
    }
  }


  return (true);
}

function validate_search_words(f1) {

   parms = "";

   // first ... check for a specific item


        if (f1.searchword) {
                if (f1.searchword.value == '') {
                        alert ("You must enter at least one word to search for...");
                        f1.focus();
			return (false);
                }
		return (true);
        }
        else {
		return (false);
        }
}

function showOrHideLayer(whichLayer, on) // 1 visible, 0 hidden
{
  if(document.getElementById)     //gecko(NN6) + IE 5+
  {
    var elem = document.getElementById (whichLayer);

  }
  var vis = elem.style;

  if (on == 1) 
    vis.display="block";
  else 
    vis.display="none";
  return;

}


function changeStatus( status ) {
	var  f1 = document.getElementById ('updatingDiv');
	if (f1) {
		f1.innerHTML = "<img src='/img/loader.gif' border=0>" + status;
	}

	showOrHideLayer('updatingDiv',1);
}
