// JavaScript Document
ns4 = (document.layers) ? true:false 
ie4 = (document.all) ? true:false 
ng5 = (document.getElementById) ? true:false 

function validateEmail(frm,db) {
	if(frm.txtEmail.value == ""){
		alert("Error! There is no E-Mail address entered.");
		return false;
	}

	var atPos = frm.txtEmail.value.indexOf('@',0);
	if (atPos == -1) {
	   if (db) alert('Error! E-Mail address must contain an @');
	   return false;
	}
	if (atPos == 0) {
	   if (db) alert('Error! E-Mail address must not start with @');
	   return false;
	}
	if (frm.txtEmail.value.indexOf('@', atPos + 1) > - 1) {
	   if (db) alert('Error! E-Mail address must contain only one @');
	   return false;
	}
	if (frm.txtEmail.value.indexOf('.', atPos) == -1) {
	   if (db) alert('Error! E-Mail address must contain a period in the domain name');
	   return false;
	}
	if (frm.txtEmail.value.indexOf('@.',0) != -1) {
	   if (db) alert('Error! Period must not immediately follow @ in E-Mail address');
	   return false;
	}
	if (frm.txtEmail.value.indexOf('.@',0) != -1){
	   if (db) alert('Error! Period must not immediately precede @ in E-Mail address');
	   return false;
	}
	if (frm.txtEmail.value.indexOf('..',0) != -1) {
	   if (db) alert('Error! Two periods must not be adjacent in E-Mail address');
	   return false;
	}
	return true;
}

function validateTrialJoin(thisform){
	if(thisform.txtName.value == ""){
	   alert('Error! There is no Full Name entered.');
	   thisform.txtName.focus();
	   return false;
	}
	if(thisform.txtCompany.value == ""){
	   alert('Error! There is no Company entered.');
	   thisform.txtCompany.focus();
	   return false;
	}
	if(thisform.txtNature.value == ""){
	   alert('Error! There is no Business Nature entered.');
	   thisform.txtNature.focus();
	   return false;
	}
	if(thisform.txtAddress.value == ""){
	   alert('Error! There is no Address entered.');
	   thisform.txtAddress.focus();
	   return false;
	}
	if(thisform.txtEmail.value == ""){
	   alert('Error! There is no Email Address entered.');
	   thisform.txtEmail.focus();
	   return false;
	}else{
		return validateEmail(thisform,true);
	}
	if(thisform.txtTelNum.value == ""){
	   alert('Error! There is no Telephone Number entered.');
	   thisform.txtTelNum.focus();
	   return false;
	}
	return true;
}

function DoHideShow(servDiv,servImg) { 
	if (ng5){ 
		var obj = document.getElementById(servDiv).style;
		var objimg = document.getElementById(servImg);
		if(obj.visibility == "visible"){
			obj.visibility = "hidden"; 
			obj.position = "absolute";
			objimg.src = "images/plus.jpg";			
		}else{
			obj.visibility = "visible"; 
			obj.position = "relative";
			objimg.src = "images/minus.jpg";	
		}
	}else if (ns4){
		var obj = document.layers[servDiv];
		var objimg = document.layers[servImg];
		if(obj.visibility == "show"){
			obj.visibility = "hide"; 
			obj.position = "absolute"
			objimg.src = "images/plus.jpg";	
		}else{
			obj.visibility = "show"; 
			obj.position = "relative"
			objimg.src = "images/minus.jpg";	
		}
	}else if (ie4){ 
		var obj = document.all[servDiv].style;
		var objimg = document.all[servImg];
		if(obj.visibility == "visible"){
			obj.visibility  = "hidden"; 
			obj.position = "absolute"
			objimg.src = "images/plus.jpg";	
		}else{
			obj.visibility  = "visible"; 
			obj.position = "relative"
			objimg.src = "images/minus.jpg";	
		}
	}
}

