
      var queryPrompt = "Enter your question here...";
      var path_prefix = "http://directline.metafaq.com/clients/directline/resources/";


var nlpq;


// Initialise the page once it is loaded

function initEvents(){

  nlpq = document.getElementById('nlpq');

  if (nlpq){
  nlpq.onfocus = clearText;
  nlpq.onblur = doNothing;
  }
  
  changeLinks();

}

window.onload = initEvents;



// Actions

function printPage(){

  window.print();

  return false;

}



function goBack(){

  window.history.go(-1);

  return false;

}



// Remove default question text from search box

// var queryPrompt should be provided in handFoot


function doNothing(){

}

 function clearText(){

 if (nlpq.value == queryPrompt){

	nlpq.value = "";

  }

 }



// Change non-metafaq links to open in a new window

function changeLinks(){

	for(var e=0; e<document.links.length; e++){

		var linkRef = document.links[e];

		if (linkRef.href.indexOf("mailto") == -1 && linkRef.hostname.indexOf("metafaq.com") == -1){

			linkRef.target = "_blank";

		}

	}

}

function clearForm(formId){
	var theForm	= document.getElementById(formId);
	for(var i=0; i<theForm.elements.length; i++){
		if(theForm.elements[i].type.indexOf("text")>=0){
			theForm.elements[i].value	= "";
		} else if (theForm.elements[i].type.indexOf("select")>=0){
			theForm.elements[i].options[0].selected = "selected";
		} else {
			continue;
		}
	}
	return false;
}

function skipBlankOptions(selectId) {
	var selectIndex	= document.getElementById(selectId).selectedIndex;
	for(var i=selectIndex; i>=0; i--){
		if(document.getElementById(selectId).options[i].value!=""){
			document.getElementById(selectId).options[i].selected = true;
			break;
		}
	}
}

function writeBlankOptions(){
   document.write('<option value="">&nbsp;</option>');
}

ie = document.all;
if(ie)
{
try {
document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
}



