function checkform_email(){

	if (document.forms[0].elements[1].value == "") {
		alert( "Please enter your Name.");
		document.forms[0].elements[1].focus();
		return false ;
	  }
	  // Email
	if (document.forms[0].elements[9].value == "") {
		alert( "Please enter an Email.");
		document.forms[0].elements[9].focus();
		return false ;
	  }
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.forms[0].elements[9].value))){
		alert("Invalid E-mail Address. Please re-enter.");
		document.forms[0].elements[9].focus();
		return false;
	}

	if (document.forms[0].elements[12].value == "") {
		alert( "Please enter 'captcha' Code.");
		document.forms[0].elements[12].focus();
		return false ;
	  }
}

var isNN = (navigator.appName.indexOf("Netscape")!=-1);

function autoTab(input,len, e) {
	var keyCode = (isNN) ? e.which : e.keyCode; 
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
	if(input.value.length >= len && !containsElement(filter,keyCode)) {
		input.value = input.value.slice(0, len);
		input.form[(getIndex(input)+1) % input.form.length].focus();
	}

	function containsElement(arr, ele) {
	var found = false, index = 0;
	while(!found && index < arr.length)
	if(arr[index] == ele)
		found = true;
	else
		index++;
	return found;
	}
	function getIndex(input) {
		var index = -1, i = 0, found = false;
		while (i < input.form.length && index == -1)
		if (input.form[i] == input)index = i;
		else 
			i++;
		return index;
	}
	return true;
}

 function toggleResultsDiv(divid){
	 linkid =  "link_" + divid;
	 divid = "results_" + divid;
    if(document.getElementById(divid).style.display == 'none'){
      document.getElementById(divid).style.display = 'block';
		document.getElementById(linkid).innerHTML="[-]";
    }else{
      document.getElementById(divid).style.display = 'none';
	  document.getElementById(linkid).innerHTML="[+]";
    }
  }

function writeInnerHTML(year, html_string){
	linkid =  "html_" + year;	
	document.getElementById(linkid).innerHTML= html_string;
}

function NewWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

 function toggleDiv(divid){
    if(document.getElementById(divid).style.display == 'none'){
      document.getElementById(divid).style.display = 'block';
    }else{
      document.getElementById(divid).style.display = 'none';
    }
  }