function swapform(x,y)
{
	x.style.display='none';
	//x.style.visibility='hidden';
	y.style.display='block';
	//y.style.visibility='visible';
}

function HideContent(d) {document.getElementById(d).style.display = "none";}function ShowContent(d) {document.getElementById(d).style.display = "block";}function ReverseDisplay(d) {if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }else { document.getElementById(d).style.display = "none"; }}

function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false;}
else {return true;}
}
}

function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
  {alert(alerttxt);return false;}
else {return true}
}
}

function validate_form(thisform)
{
with (thisform)
{

if (validate_required(fnamer,"First Name must be filled out.")==false)
  {fnamer.focus();return false;}
if (validate_required(lnamer,"Last name must be filled out.")==false)
  {lnamer.focus();return false;}
if (validate_required(addr,"Address must be filled out.")==false)
  {addr.focus();return false;}
if (validate_required(cityr,"City must be filled out.")==false)
  {cityr.focus();return false;}
if (validate_required(stater,"State must be filled out.")==false)
  {stater.focus();return false;}
if (validate_required(zipr,"Zip code must be filled out.")==false)
  {zipr.focus();return false;}
if (validate_required(emailr,"Email must be filled out.")==false)
  {emailr.focus();return false;}
if (validate_required(phoner,"Phone Number must be filled out.")==false)
  {phoner.focus();return false;}
if (validate_email(emailr,"Not a valid e-mail address!")==false)
  {emailr.focus();return false;}
}
}


function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE");
   var version = parseFloat(arVersion[1]);
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i];
         var imgName = img.src.toUpperCase();
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : "";
            var imgClass = (img.className) ? "class='" + img.className + "' " : "";
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
            var imgStyle = "display:inline-block;" + img.style.cssText ;
            if (img.align == "left") imgStyle = "float:left;" + imgStyle;
            if (img.align == "right") imgStyle = "float:right;" + imgStyle;
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" ;
            img.outerHTML = strNewHTML;
            i = i-1;
         }
      }
   }    
}

function contained(oNode, oCont) {
  if (!oNode) return; // in case alt-tab away while hovering (prevent error)
  while ( oNode = oNode.parentNode ) if ( oNode == oCont ) return true;
  return false;
}

function hideTip() {
  if ( typeof Tooltip == "undefined" || !Tooltip.ready ) return;
  Tooltip.timerId = setTimeout("Tooltip.hide()", 300);
}

function doTooltip(e, msg) {
  if ( typeof Tooltip == "undefined" || !Tooltip.ready ) return;
  Tooltip.clearTimer();
  var tip = document.getElementById? document.getElementById(Tooltip.tipID): null;
  if ( tip && tip.onmouseout == null ) {
      tip.onmouseout = Tooltip.tipOutCheck;
      tip.onmouseover = Tooltip.clearTimer;
  }
  Tooltip.show(e, msg);
}



