


//URL for the Ajax request
	var strURL1 = 'POLL_Response.asp';

function xmlhttpPost(strURL) {
	//alert(document.theForm.AnswerID.value);
	if (document.theForm.AnswerID.value==undefined||document.theForm.AnswerID.value=='0'){
		alert('Please select an answer');
	}
	else{
	    var xmlHttpReq = false;
	    var self = this;
	    // Mozilla/Safari
	    if (window.XMLHttpRequest) {
	        self.xmlHttpReq = new XMLHttpRequest();
	    }
	    // IE
	    else if (window.ActiveXObject) {
	        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
	    }
	    self.xmlHttpReq.open('POST', strURL, true);
	    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	    self.xmlHttpReq.onreadystatechange = function() {
	        if (self.xmlHttpReq.readyState == 4) {
	            updatepage(self.xmlHttpReq.responseText);
	        }
	    }
	    self.xmlHttpReq.send(getquerystring());
	}
}

function getquerystring() {
    //var form     = document.forms['f1'];
    var Q = document.theForm.QuestionID.value;
	var A = document.theForm.AnswerID.value;

	
    // NOTE: no '?' before querystring
	qstr = 'QID=' + Q + '&AID=' + A;   
	//alert(qstr);
    return qstr;
}

function updatepage(str){
    //alert(document.getElementById("PResult").innerHTML);
    document.getElementById("PResult").innerHTML = str;
    //document.getElementById("poll").innerHTML = str;
}

function checkEnter(e)
{ 
    // Prevents using Enter to trigger form submission
    // Call using the onkeypress attribute for single field forms
    // 10/7/09 SDJ
    var characterCode 

    if(e && e.which)
    { 
    e = e
    characterCode = e.which
    }
    else
    {
        e = event
        characterCode = e.keyCode 
    }

    if(characterCode == 13)
    { 
        return false 
    }
    else
    {
        return true 
    }
}


function gotoSubscribe() {
var email = document.theForm.SubscribeEmail.value;
if (email=="email address" || email==''){
  alert("Please enter your email address");
  }
else {
  location.href='/subscribe.asp?email='+email
  }
}

function gotoSignUp() {
var email = document.theForm.account_email.value;
   location.href='/signUp.asp?email='+email
}

function gotoForgotPassword() {
var email = document.theForm.account_email.value;
   location.href='/forgotPassword.asp?email='+email
}

function isThereAComment(tmp){
  if (tmp.length > 5) {
    document.theForm.postflag.value='comment';
  }
}

function autotab(original,destination){
if (original.getAttribute&&original.value.length==original.getAttribute("maxlength"))
destination.focus()
}

function ShowArticles(showID){
var showList = document.getElementById('ArticleList' + showID);

//this is a bit of a hack, but since I don't know how many lists there are or what their ID's are
//I'll just check the first 500 for existance and hide them if found
for (i=0;i<=500;i++){
  if (document.getElementById('ArticleList'+i)!=null) {document.getElementById('ArticleList'+i).style.display = 'none';}
}

showList.style.display = 'block';



}

function CheckCharCnt(o){
 var maxCnt = 1000
 var msg = o.value;
 var cnt = msg.length; 
 
if (cnt >= maxCnt){
  alert("Please limit comment to 1,000 characters"); 
  o.value = msg.substring(0, maxCnt-2)
  }
}

//this.value=this.value.substring(0, 1023)