<!--
// Behavior for search box

function clearDefault(){ 

	var dbg='#F3F7FB'; // Background color, Default
	var fbg='#FFFFFF'; // Background color, onFocus 

		var tI = document.getElementsByTagName('input'); var tT = document.getElementsByTagName('textarea');

		for (var i = 0; i < tI.length; i++) { 
			if (tI[i] && tI[i].getAttribute('type') != '' && tI[i].getAttribute('type').toLowerCase() == 'text' || tI[i].getAttribute('type').toLowerCase() == 'password') 
			{tI[i].style.backgroundColor = dbg; thisValue = tI[i].getAttribute("title");
				if (thisValue){	tI[i].value = thisValue;} 
				tI[i].onfocus = function(){this.style.backgroundColor = fbg; if (this.value != this.getAttribute("title") && this.value != '') {return;} 
				else {this.value = '';}};
				tI[i].onblur = function(){this.style.backgroundColor = dbg; if (this.value == ''){this.value = this.getAttribute("title");}};}} 
		for (var i = 0; i < tT.length; i++){if (tT[i]){tT[i].style.backgroundColor = dbg; thisValue = tT[i].getAttribute("title");if (thisValue){tT[i].value = thisValue;} 
				tT[i].onfocus = function(){this.style.backgroundColor = fbg; if (this.value != this.getAttribute("title") && this.value != ''){return;}
				else {this.value = '';}};
				tT[i].onblur = function(){this.style.backgroundColor = dbg;if (this.value == ''){this.value =  this.getAttribute("title");}};}} 
}

function cleanup(f) {
	if (f.query0.value == "keyword") {
		f.query0.value = "";
	}
f.action = 'http://search.ipfw.edu/NSearch/SearchServlet';
}

// intelliResponse

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='/results.jsp';
  d.requestType.value='NormalRequest';
  return true;
}
 
function topTen(){
  var d = document.questionForm;
  d.action='/topQuestions.jsp';
  d.submit();
}
 
function clearForm(){
  var d = document.questionForm;
  d.id.value=-1;
  d.reset();
  d.question.focus();
  d.question.value='';
}

window.onload=function(){
	clearDefault();
}

//-->
