// JavaScript Document
var defaultStr = 'Type a complete question here';
 
function isBlank(q) {
  var whitespace = new String(" \t\n\r");
 
  for (var i = 0; i<q.length; i++) {
    if (whitespace.indexOf(q.charAt(i)) == -1) {
      return false;
    }
  }
 
  return true;
}
 
function submitForm(){
  if (!isValidForm())
    return;
 
  document.questionForm.submit();
}
 
function isValidForm(){
  if (document.questionForm.question.value==defaultStr  ||  isBlank(document.questionForm.question.value)) {
    return false;
  }
 
  document.questionForm.action='http://mohawk.intelliresponse.com/ps/index.jsp';
  document.questionForm.requestType.value='NormalRequest';
  return true;
}
 
function topTen(){
  document.questionForm.action='http://mohawk.intelliresponse.com/ps/index.jsp';
  document.questionForm.requestType.value='TopQuestionsRequest';
  document.questionForm.submit();
}
 
function clearForm(){
  document.questionForm.id.value=-1;
  document.questionForm.reset();
  document.questionForm.question.focus();
  document.questionForm.question.value='';
}

function submitFormCE(){
  if (!isValidFormCE())
    return;
 
  document.questionFormCE.submit();
}
 
function isValidFormCE(){
  if (document.questionFormCE.question.value==defaultStr  ||  isBlank(document.questionFormCE.question.value)) {
    return false;
  }
 
  document.questionFormCE.action='http://mohawk.intelliresponse.com';
  document.questionFormCE.requestType.value='NormalRequest';
  return true;
}
 
function topTenCE(){
  document.questionFormCE.action='http://mohawk.intelliresponse.com';
  document.questionFormCE.requestType.value='TopQuestionsRequest';
  document.questionFormCE.submit();
}
 
function clearFormCE(){
  document.questionFormCE.id.value=-1;
  document.questionFormCE.reset();
  document.questionFormCE.question.focus();
  document.questionFormCE.question.value='';
}

