function DivSetVisible(divid, divshimid) {
   if(document.all && (navigator.userAgent.indexOf("Opera") == -1)) {
      var DivRef = document.getElementById(divid);
      var IfrRef = document.getElementById(divshimid);
      DivRef.style.display = "block";
      IfrRef.style.width = DivRef.offsetWidth;
      IfrRef.style.height = DivRef.offsetHeight;
      IfrRef.style.top = DivRef.style.top;
      IfrRef.style.left = DivRef.style.left;
      IfrRef.style.zIndex = DivRef.style.zIndex - 1;
      IfrRef.style.display = "block";
   }
}
function DivSetInvisible(divid, divshimid) {
   if(document.all && (navigator.userAgent.indexOf("Opera") == -1)) {
      var DivRef = document.getElementById(divid);
      var IfrRef = document.getElementById(divshimid);
      DivRef.style.display = "none";
      IfrRef.style.display = "none";
   }
}

function writeLink(dom, ext) {
	document.write("<a target='_blank' href='" + "http://www." + dom + "." + ext + "'>www." + dom + "." + ext + "</a>"); }

function writeEmail(handle, dom, ext, txt1, txt2) {
	document.write("<a href='mail" + "to:" + handle + "&#064;" + dom + "." + ext + "?subject=Website Contact Address " + document.URL + "'>" + txt1 + txt2 + "</a>");
}

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function setNav(page) {
	document.getElementById(page).className="subnav_page";
}

function resetErrors() {
	for (i=1;i<4;i++) {
		var cur = "error" + i;
		document.getElementById(cur).style.display = "none";
	}
}

function checkEmail(string) {
    var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
    if (!string.match(re)) {
        return false;
    } else {
        return true;
    }
} 

function validate(obj) {
	var error = false;
	if (obj.name.value == "") {
		resetErrors(); 
		document.getElementById('error1').style.display = "inline";
		obj.name.select();
		obj.name.focus();
		return false;			
	} else if (obj.email.value == "") { 
		resetErrors();
		document.getElementById('error2').style.display = "inline";
		obj.email.select();
		obj.email.focus();
		return false;		
	} else if (!checkEmail(obj.email.value)) {
		resetErrors();
		document.getElementById('error3').style.display = "inline";
		obj.email.select();
		obj.email.focus();
		return false;		
	} else {
		document.form1.key.value='teton';
		return true;
	}

}
