var defaultStr = "What's your question?";
 
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(){
  var d = document.questionForm;
  if (!isValidForm())
    return;
 
  d.submit();
}
 
function isValidForm(){
  var d = document.questionForm;
  if (d.question.value==defaultStr  ||  isBlank(d.question.value)) {
    return false;
  }
 
  d.action=' http://ipfw.intelliresponse.com/results.jsp';
  d.requestType.value='NormalRequest';
  return true;
}
 
function topTen(){
  var d = document.questionForm;
  d.action=' http://ipfw.intelliresponse.com/topQuestions.jsp';
  d.submit();
}
 
function clearForm(){
  var d = document.questionForm;
  d.id.value=-1;
  d.reset();
  d.question.focus();
  d.question.value='';
}


	var theurl = document.location.href;
	var theurl = theurl;
	//alert(theurl);
	if(theurl.indexOf("theQuestionAsked") != -1) {
		//alert("it's there");
		var theQuestion = theurl.split("?");
		//alert(theQuestion[1]);
		var theQuestion = theQuestion[1];
		//document.writeln(theQuestion[1]);
		var theQuestion = theQuestion.split("=");
		//alert(theQuestion[1]);
		var shownQuestion = theQuestion[1];
		var newstring = "";
		
		var somearray = shownQuestion.split("+");
		//alert(somearray[0]);
		for(i=0;i<somearray.length;i++) {
			newstring = newstring + " " + somearray[i];
			//alert (somearray[i]);
		}
		
		//alert (newstring);
		
		newstring = unescape(newstring);
		
		shownQuestion.replace(/"+"/g, " ");
		var entireiframe = "<iframe src=\"http://ipfw.intelliresponse.com/results.jsp?question=" + theQuestion[1] + "\" width=\"700\" height=\"500\" frameborder=\"0\" scrolling=\"auto\" name=\"asker\" id=\"asker\"></iframe>";
		//alert(entireiframe);
		var askerBox = "<input type=\"text\" name=\"question\" value=\"" + newstring + "\"size=\"30\" maxlength=\"250\" onFocus=\"this.value='';\" onBlur=\"if(this.value=='')this.value=defaultStr;\">";
	}
	else {
		//alert("it's not there");
		var entireiframe = "<iframe src=\"asker.html\" width=\"700\" height=\"500\" frameborder=\"0\" scrolling=\"auto\" name=\"asker\" id=\"asker\">";
		var askerBox = "<input type=\"text\" name=\"question\" value=\"Type your question here\" size=\"30\" maxlength=\"250\" onFocus=\"this.value='';\" onBlur=\"if(this.value=='')this.value=defaultStr;\">";
	}
