// Blank out inputs on focus, and change text color to black
// Used for Keyword Search inputs, enews signup fields...
// Code finds and applies the code to any text inputs with pre-populated text/values
function blankInputsOnFocus() {
	if (!document.getElementsByTagName) return false;
	var inps = document.getElementsByTagName('input');
	for (var i=0;i<inps.length;i++) {
    // find any text inputs with pre-populated text/values
		if ((inps[i].type == 'text') && (inps[i].value != "")) {
			inps[i].onclick = function () {
        if (this.style.color!="#000") {
          this.value="";
          this.style.color="#000";
          }
				return false;
			}
		}
	}
}

// Blank out keywords search text box on clicking search submit, IF it is still grey 
// (i.e. it still contains the pre-populated text, and hasn't been clicked on)
function blankKeywordsOnSubmitIfDefault() {
	if (!document.getElementById('itinerary_submit')) return false;
	if (!document.getElementById('keywords')) return false;
	var submitElement = document.getElementById('itinerary_submit');
	submitElement.onclick=function () {
    var keywordsElement = document.getElementById('keywords');
    if (keywordsElement.value=="enter keywords or trip code...") {
      keywordsElement.value="";
    }
	}
}


addLoadEvent(blankInputsOnFocus);
addLoadEvent(blankKeywordsOnSubmitIfDefault);
