var REGISTER = 0;
var CONFIRM = 1;
var showButton = ["none","inline"];
var numberOfButtons = [5,0];
var idPrefix = ["cb","rb"];

//document.onselectstart=new Function('return false');
//function ds(e){return false;}
//function ra(){return true;}
//document.onmousedown=ds;
//document.onclick=ra;
  
function doMouseIn()   { this.className="hove";  }
function doMouseOut()  { this.className="norm"; }
function doMouseDown() { this.className="acton";  }
function doMouseUp()   { this.className="hove";  }

String.prototype.trim = function () { return this.replace(/^\s*/, "").replace(/\s*$/, ""); }

function validateFields (formNo) {
	return true;
     var form;
         switch (formNo) {
	       case 0: form = document.REG;
		   break;
	       case 1: form = document.ADD;
	}
    var strPerson = form.contactPerson.value.trim();
    var strBusiness = form.businessName.value.trim();
	var strEmail = form.email.value.trim();
	
	if (strBusiness == "") {
	  alert ("please enter your business name");
	  return false;
	} else { form.businessName.value = toCaps(strBusiness) ;}
	
	if (strPerson == "") {
	  alert ("please enter your own name");
	  return false;
	} else { form.contactPerson.value = toCaps(strPerson) ;}
	     
	m = strEmail.match(/(\w+\.)*\w+@(\w+\.)+\w+/);
	if ((strEmail != "") && (m == null)) {
	  alert ("Please enter a valid email address");
	  return false;
	}
	return true;
}

function toCaps (str) {
	     m = str.replace (/\sand\s|\sAnd\s/, " & ").replace(/\s+/g, " ").split(" ");	
	     reg=/(^\w|&)(.*)/; 
	     str = "";
	     for (i=0; i<m.length; i++) { 
	       b = reg.exec(m[i]); 
	       str += ((i==0)? "" : " ") + b[1].toUpperCase() + b[2].toLowerCase(); 
	    }
     return str;
}

function checkSelect() {
	 var n = $("x1").value;
  if ( n == -1) {
     alert ("please select a company from the list");
	 return false; } else { return true; }
}


