/**
 * @author Jeff
 */
  var location_shown =0;
  
  function show_faq(sFaqtext, oElem) {
    var ie7=document.all && window.XMLHttpRequest && !window.opera;
    // Split the string into part [0] and part [1]
    var temp=navigator.appVersion.split('MSIE');

    // Parse the string for the "6" in 6.0
    var ieVer=parseInt(temp[1]);

    // Is it greater than 6?
    var isIE6up=(ieVer >= 6)?1:0;
    var iTop = 0;
    if( isIE6up || ie7 ){
      iTop = oElem.offsetTop + oElem.offsetParent.offsetTop - 170;
    } else {
      iTop = oElem.offsetTop - 100;
    }  
  	var oFaqdiv = document.getElementById('comment_faq_bottom')
	
	//Added variable
  	var oClose = document.getElementById('closeBtn')
	
  	if (sFaqtext.length > 0) {
		//Added the close button variable to attach to the FAQ text
  	  oFaqdiv.innerHTML = oClose + sFaqtext;
	  
	  //Commented out this style because it was throwing an error
  	  //oFaqdiv.style.top = iTop;
  	  oFaqdiv.style.display = 'block';
	  
	  //Added show style for close button
  	  oClose.style.display = 'block';
  	} else {
  	  oFaqdiv.style.display = 'none';
	  
	  //Added hide style for close button
  	  oClose.style.display = 'none';
  	}  
  }
  
  function show_locations(iShow) {
    if (iShow == 1) {
      document.getElementById('dChooseLocation').style.display = 'block';
	  location_shown = 1;
    }
    else {
      document.getElementById('dChooseLocation').style.display = 'none';
	  location_shown = 0;
    }
  }
  
  function contactInfoChange() {
    f = document.getElementById('contact_form');
    if (f.contactMe[0].checked) {
      document.getElementById('em_req').innerHTML = "*EMail:";
      document.getElementById('name_req').innerHTML = "*Name:";
    } else { 
      document.getElementById('em_req').innerHTML = "EMail:";
      document.getElementById('name_req').innerHTML = "Name:";
    }    
  }
  
  function validate(f){
	var aError = new Array();
	if (f.contactMe[0].checked) {
		if (f.EmailFrom.value.length == 0) {
			aError[aError.length] = "Please Enter an Email Address so that we may contact you.";
		} else if (!checkEmail(f.EmailFrom)) {
			aError[aError.length] = "Please Enter a VALID Email Address so that we may contact you.";
		}
    	if (f.Name.value.length < 2) {
			aError[aError.length] = "Please Enter your Name, so we know who to contact!";
    	}
	}
	if (f.Comments.value.length < 1) {
				aError[aError.length] = "Please enter a comment or question in the area provided.";
				f.Comments.focus();
		}
    if ((location_shown == 1) && (f.sel_location.value < 0)) {
		aError[aError.length] = "Your comment requires a location to be selected!";
    }
	if (aError.length > 0) {
		document.getElementById('dError').innerHTML = aError.join("<br />");
		window.scrollTo(0, 700);
		return false;
	} else {
		return true;
	}
  }

  function checkEmail(email) {
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(email.value)) {
		return false;
	}
	return true;	
  }
