function showDiv(divid) {
//alert(divid);
if ((document.getElementById(divid).style.display=="block") || (document.getElementById(divid).style.display=="")) {
	document.getElementById(divid).style.display="none";
	} else {
	document.getElementById(divid).style.display="block";
	}
}

function showDiv2(divid) {
}


function showVis(divid) {
//alert(divid);
if ((document.getElementById(divid).style.visibility=="visible") || (document.getElementById(divid).style.visibility=="")) {
	document.getElementById(divid).style.visibility="hidden";
	} else {
	document.getElementById(divid).style.visibility="visible";
	}
}


var isIE6=false;
var browsername=navigator.appName;
var b_version=navigator.appVersion;
var browserversion=parseFloat(b_version);
//document.write("Browser name: "+ browsername);
//document.write("<br />");
//document.write("Browser version: "+ browserversion);
//document.write("<br />");
if ((browserversion<5)&&(browsername=='Microsoft Internet Explorer')) isIE6=true;
//if (isIE6) alert('You are using Internet Explorer Version 6 or less');





// Find Window Size
// Code found at: http://www.howtocreate.co.uk/tutorials/javascript/browserwindow
var winWidth = 0, winHeight = 0;

function winSize() {
  if(typeof(window.innerWidth) == 'number') {
    //Non-IE
    winWidth = window.innerWidth;
    winHeight = window.innerHeight;
  } else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
    //IE 6+ in 'standards compliant mode'
    winWidth = document.documentElement.clientWidth;
    winHeight = document.documentElement.clientHeight;
  } else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
    //IE 4 compatible
    winWidth = document.body.clientWidth;
    winHeight = document.body.clientHeight;
  }
}

function goLoc(loc) {
	window.location.href=(loc);
	return false;
}

function goConfirm(message,loc1,loc2) {
	var answer = confirm(message)
	if (answer){
		window.location = loc1;
	}
	else{
		window.location = loc2;
	}
}


function checkQuestion() {
var E = document.sendquestion.Email.value;
var N = document.sendquestion.Name.value;
var A = document.sendquestion.Address.value;
var P = document.sendquestion.Phone.value;
var ALL = E+N+Q+P;
ALL = ALL.toLowerCase()
var send = true;
	
if (ALL.indexOf("'") > -1) {
	alert('Sorry, apostrophes are not allowed in form submissions. Please remove all apostrophes and continue.');
	send = false;
	return false;
	}
	
if ((ALL.indexOf("<") > -1) || (ALL.indexOf(">") > -1) || (ALL.indexOf("href") > -1) || (ALL.indexOf("src=") > -1)) {
	alert('Sorry, we do not allow HTML tags to be submitted. Please remove all HTML tags and continue.');
	send = false;
	return false;
	}
		
if (ALL.indexOf("%") > -1) {
	alert('Sorry, the "%" character is not allowed in this form!');
	send = false;
	return false;
	}

if ((ALL.indexOf("varchar") > -1) || (ALL.indexOf("declare") > -1) || (ALL.indexOf("cast(") > -1)  || (ALL.indexOf("%3e") > -1) || (ALL.indexOf("%3c") > -1)){
	alert('Sorry, the information you have entered appears as an attempt to hack our system. Please reword your question!');
	send = false;
	return false;
	}	
	
if (ALL.indexOf("&") > -1) {
	alert('Sorry, the "&" character is not allowed in this form!');
	send = false;
	return false;
	}	

if (N=='') {
	alert('Please enter your name');
	send = false
	return false;
	}
	
if (E=='') {
	alert('Please enter your email address');
	send = false
	return false;
	}

if ((E.indexOf("@")==-1) ||  (E.indexOf("'")>-1) ||  (E.indexOf(",")>-1) || (E.indexOf(".")==-1)) {
	alert('Please correct your email address');
	send = false
	return false;
	}

if (A.length < 10) {
	alert('Please entery your home address');
	send = false
	return false;
	}
	
if (A.length > 200) {
	alert('Address length is limited to 200 characters!');
	send = false
	return false;
	}
	if (send) {
		//return true;
		submitQuestionForm()
		//document.sendquestion.submit() ;
		//return false;
	}
}


