//all fields check function
function checkform(){
if (document.submitEntry.custname.value.length < 6){
	alert("Please enter your full name!");
	document.submitEntry.custname.focus();
	return false;
	}
	var evalue,svalue,lvalue,upvalue;
	evalue= document.submitEntry.custemail.value
if (!evalue)
	{
		alert("Please enter your Email address!");
		document.submitEntry.custemail.focus();
		return false;
	}
if ((evalue.indexOf('@') == -1) || (evalue.indexOf('.') == -1) || (evalue.indexOf(';') > -1) || (evalue.length < 6))
	{
		alert("Please enter the right Email format! \neg: user@utas.edu.au");
		document.submitEntry.custemail.focus();
		return false;
	}
if (document.submitEntry.Level.value.length==0){
	alert("Please choose your level!");
	document.submitEntry.Level.focus();
	return false;
	}
if (document.submitEntry.ModeID.value.length==0){
	alert("Please choose your Mode!");
	document.submitEntry.ModeID.focus();
	return false;
	}
if (document.submitEntry.KLAID.value.length==0){
	alert("Please choose your learning area!");
	document.submitEntry.KLAID.focus();
	return false;
	}
if (document.submitEntry.title.value.length==0){
	alert("Please enter a title!");
	document.submitEntry.title.focus();
	return false;
		}
if( !(document.submitEntry.AddressType[0].checked || submitEntry.AddressType[1].checked) ) {
alert("Please choose a software review page display method!")
return false;
}	
if (document.submitEntry.AddressType[1].checked){
svalue= document.submitEntry.srurl.value
	if (!svalue)
	{
		alert("Please enter a software review Internet address!");
		document.submitEntry.srurl.focus();
		return false;
	}
    if ((svalue.indexOf('http://') > -1) || (svalue.indexOf('//') > -1) || (svalue.indexOf('\\\\') > -1) || (svalue.indexOf('.')== -1) || (svalue.length < 6))
	{
		alert("Please enter the right http format without 'http://' or '//' or '\\'!\neg: www.utas.edu.au");
		document.submitEntry.srurl.focus();
		return false;
	}}
if (document.submitEntry.AddressType[0].checked){	
if (document.submitEntry.down2.value.length==0){
	alert("Please choose a file to upload!");
	document.submitEntry.down2.focus();
	return false;
		}
		}	
if( !(document.submitEntry.lp[0].checked || submitEntry.lp[1].checked) ) {
alert("Please choose a lesson plan display method!")
return false;
}
if (document.submitEntry.lp[1].checked){	
lvalue= document.submitEntry.lpurl.value
	if (!lvalue)
	{
		alert("Please enter a lesson plan Internet address!");
		document.submitEntry.lpurl.focus();
		return false;
	}
	if ((lvalue.indexOf('http://') > -1) || (lvalue.indexOf('//') > -1) || (lvalue.indexOf('\\\\') > -1) || (lvalue.indexOf('.')== -1)|| (lvalue.length < 6))
	{
		alert("Please enter the right http format without 'http://' or '//' or '\\'!\neg: www.utas.edu.au");
		document.submitEntry.lpurl.focus();
		return false;
	}}
if (document.submitEntry.lp[0].checked){	
if (document.submitEntry.down3.value.length==0){
	alert("Please choose a file to upload!");
	document.submitEntry.down3.focus();
	return false;
		}
		}
   return true
	}
	
function chkfrm(){
      	if (document.checkcodeform.checkcode.value.length!=6)
      {
        alert("Check Number Must Be 6 Number!");
	document.checkcodeform.checkcode.focus();
        return false;
      } 
	return true
	}
function chkfrm2(){
      	if (document.checkcodeform2.checkcode2.value.length!=6)
      {
        alert("Check Number Must Be 6 Number!");
	document.checkcodeform2.checkcode2.focus();
        return false;
      } 
	return true
	}

	
	//upload file check function
function format1(){
  var x = document.getElementById("down21");
  if(!x || !x.value) return;
  var patn = /\.htm$|\.html$|\.rar$|\.zip$/i;
  if(patn.test(x.value)){
    }else{
   alert("Software Review: Only can upload HTM & HTML page or Zip & Rar file!");
  }
 }
function format2(){
  var x = document.getElementById("down31");
  if(!x || !x.value) return;
  var patn = /\.htm$|\.html$|\.rar$|\.zip$/i;
  if(patn.test(x.value)){
    }else{
   alert("Lesson Plan: Only can upload HTM & HTML page or Zip & Rar file!");
  }
 }
 function format3(){
  var x = document.getElementById("down3");
  if(!x || !x.value) return;
  var patn = /\.htm$|\.html$|\.rar$|\.zip$/i;
  if(patn.test(x.value)){
    }else{
   alert("Lesson Plan: Only can upload HTM & HTML page or Zip & Rar file!");
  }
 }
function format(){
  var x = document.getElementById("down2");
  if(!x || !x.value) return;
  var patn = /\.htm$|\.html$|\.rar$|\.zip$/i;
  if(patn.test(x.value)){
    }else{
   alert("Software Review: Only can upload HTM & HTML page or Zip & Rar file!");
  }
 }
 
 //hide and show the hits 
function sl(tx){
document.all[tx].style.border='1px #22ADCE solid';
document.all[tx].style.color='#006982';
document.all[tx].style.paddingLeft='8px';
document.all[tx].style.paddingRight='5px';
document.all[tx].style.backgroundColor='#EEFAFD';
document.all[tx].style.display='inline';
}	
function slo(tx){
document.all[tx].style.border='1px #ffffff solid';
document.all[tx].style.color='#ffffff';
document.all[tx].style.paddingLeft='8px';
document.all[tx].style.paddingRight='5px';
document.all[tx].style.backgroundColor='#ffffff';
document.all[tx].style.display='none';
}
//del spare space in textfields 
function trimtext(text){
	var str = text.value;
	str = str.replace(/^[\s¡¡]+|[\s¡¡]+$/g, "");
	str = str.replace(/[\s¡¡]+/g, " ");
	text.value = str;
}
function openHelpWindow(theURL) {
	var helpWindow = null;
	// check if the help window is already displayed
	if (helpWindow != null)
	{
	// if it is closed open a new one, otherwise change the page
	if (helpWindow.closed)
	{
	if (document.layers)
	helpWindow = window.open(theURL,"Help","toolbars=no,menubars=no,location=no,scrollbars=yes,resizable=no,width=350,height=150,screenX=0,screeny=0");
	else
	helpWindow = window.open(theURL,"Help","toolbars=no,menubars=no,location=no,scrollbars=yes,resizable=no,width=350,height=150,top=0,left=0");
	}
	else
	{
	helpWindow.location.href = theURL;
	}
	}
	else
	{
	if (document.layers)
	helpWindow = window.open(theURL,"Help","toolbars=no,menubars=no,location=no,scrollbars=yes,resizable=no,width=350,height=150,screenX=0,screeny=0");
	else
	helpWindow = window.open(theURL,"Help","toolbars=no,menubars=no,location=no,scrollbars=yes,resizable=no,width=350,height=150,top=0,left=0");
	}
	helpWindow.focus();
}