/* function checks to see if the island data window is open if not it opens a new 
	one if yes it focuses and reloads the existing one. */

function newWindow(url){
	if (!islandData || islandData.closed){ 	
		var islandData = window.open(url,"islandData","width=500,height=500,screenX=15,screenY=15,top=15,left=15,status=yes,resizable=yes,scrollbars=yes");
	}		
	if (window.focus) {	
		islandData.focus();
		islandData.location.href = url;
	}
}

/* these next two functions are island data functions that perform form validation */

function CheckForm(){
	var strInput = document.form1.search_input.value;
	if(strInput == "" || strInput.charAt(0) == ' ' || strInput.charAt(0) == ',' || strInput.charAt(0) == '*' || strInput.charAt(0) == '!' || strInput.charAt(0) == '%' || strInput.charAt(0) == '#' || strInput.charAt(0) == '$' || strInput.charAt(0) == '^' || strInput.charAt(0) == '&' || strInput.charAt(0) == '(' || strInput.charAt(0) == ')'){
		alert("Please enter a keyword, or natural language question into the form.");
		return false;
	}
	return true;
}

function processForm(f){
	var strInput = document.form1.search_input.value;
	var url = "http://expressresponse.com/cgi-bin/progsnp/align/srchjnnp?search_type=rw2&sesid=982285300.7205.2&search_input=" + strInput;
	
	if(CheckForm() && document.images){
		var expdate = new Date ();
		expdate.setTime (expdate.getTime() + ((86400 * 1000 * 7) * 4));		
		newWindow(url);
	} else {
		document.form1.search_input.focus();
		return false;
	}		
}
