// JavaScript Document

var origWidth, origHeight;
if (document.layers) {
        origWidth = window.innerWidth; origHeight = window.innerHeight;
        window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

var cur_lyr;    // holds id of currently visible layer

function loadLyr(lyr) {
        if (cur_lyr) {
                var curcss = get_lyr_css(cur_lyr);
                if (curcss) curcss.visibility="hidden";
        }
  cur_lyr = lyr;
        var curcss = get_lyr_css(cur_lyr);
        if (curcss) {
                curcss.visibility = "visible";
                curcss.zIndex = 1000;   // some browsers need z-index set
        }
}


function get_lyr_css(id) {
        var lyr, lyrcss;
        lyr = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? getLyrRef(id,document): null;
        if (lyr) lyrcss = (lyr.style)? lyr.style: lyr;
        return lyrcss;
}


function getLyrRef(lyr,doc) {
        if (document.layers) {
                var theLyr;
                for (var i=0; i < doc.layers.length ; i++) {
                theLyr = doc.layers[i];
                        if (theLyr.name == lyr) return theLyr;
                        else if (theLyr.document.layers.length > 0) 
                if ((theLyr = getLyrRef(lyr,theLyr.document)) != null)
                                        return theLyr;
          }
                return null;
  }
}



 function validateForm(theForm)
  {
	
    if (!validRequired(document.frmcontact.fname,"First Name"))
		return false;
    
    if (!validRequired(document.frmcontact.lname,"Last Name"))
		return false;

		
	if (!validEmail(document.frmcontact.email,"Email Address",true))
		return false;
	    
	if (!validRequired(document.frmcontact.phone,"Phone Number"))
		return false;
		
	if (!validRequired(document.frmcontact.message,"Comment"))
		return false;		
								
	return true;
	}
