    function trim(str) {
      return str.replace(/^\s*|\s*$/g,"");
    }

    function focusElement(targ, strval) {
      targ.className = "tboxover";
      if (trim(targ.value) == strval) {
        targ.value = "";
      }
    }

    function blurElement(targ, strval) {
      if (trim(targ.value) == "") {
      	targ.className = "tboxdull";
        targ.value = strval;
      } else {
        targ.className = "tbox";
	  }
    }

    function checktnc() {
      if (document.register.ro_attendance.checked == true) {
      	document.register.submitbtn.disabled = false;
      } else {
      	document.register.submitbtn.disabled = true;
	  }
    }
	
	var fl, msg, sendto
    function checkElement(cb, cbs, listing){
    alert(cbs);
      if (trim(cb.value) == "" || trim(cb.value) == "< First Name >" || trim(cb.value) == "< Last Name >" || trim(cb.value) == "< Email Address >" || trim(cb.value) == "< Medical Practice Name >" || trim(cb.value) == "< Medical Practice Street >" || trim(cb.value) == "< Medical Practice Suburb >" || trim(cb.value) == "< Medical Practice State >" || trim(cb.value) == "< Medical Practice Postcode >" || trim(cb.value) == "< Postal Street >" || trim(cb.value) == "< Postal Suburb >" || trim(cb.value) == "< Postal State >" || trim(cb.value) == "< Postal Postcode >" || trim(cb.value) == "< Telephone >" || trim(cb.value) == "< Mobile >" || trim(cb.value) == "< How you heard about us? >" || trim(cb.value) == "< Confirm Email >") {
        fl = 1;
        msg += "       -  "+listing+"\n";
        sendto += ","+cbs;
      }
    }
    function checkregistration(targ){
      fl = 0;
      msg = "";
      sendto = "";
      checkElement(targ.ro_firstname, "ro_firstname", "First Name");
      checkElement(targ.ro_lastname, "ro_lastname", "Last Name");
      checkElement(targ.ro_email, "ro_email", "Email Address");
      checkElement(targ.ro_emailconfirm, "ro_emailconfirm", "Email Address");
      checkElement(targ.ro_mpname, "ro_mpname", "Medical Practice Name");
      checkElement(targ.ro_mpstreet, "ro_mpstreet", "Medical Practice Street");
      checkElement(targ.ro_mpsuburb, "ro_mpsuburb", "Medical Practice Suburb");
      checkElement(targ.ro_mpstate, "ro_mpstate", "Medical Practice State");
      checkElement(targ.ro_mppcode, "ro_mppcode", "Medical Practice Postcode");
      checkElement(targ.ro_postreet, "ro_postreet", "Postal Street");
      checkElement(targ.ro_posuburb, "ro_posuburb", "Postal Suburb");
      checkElement(targ.ro_postate, "ro_postate", "Postal State");
      checkElement(targ.ro_popcode, "ro_popcode", "Postal Postcode");
      checkElement(targ.ro_telephone, "ro_telephone", "Telephone Number");
      checkElement(targ.ro_mobile, "ro_mobile", "Mobile");
     
          if (targ.ro_emailconfirm.value != targ.ro_email.value) {
              fl = 1;
              msg += "\nYour email addresses do not match..     \n";
              sendto += ",ro_emailconfirm";
          }
          
           if ((targ.ro_telephone.value).length < 4) {
              fl = 1;
              msg += "\nPlease check your telephone number     \n";
              sendto += ",ro_telephone";
          } 
     
     
     
	  if (targ.ro_ref.selectedIndex == 0) {
		checkElement(targ.ro_refother, "ro_refother", "How you heard about us?");
	  }
      if (fl == 1) {
        msg = "Please enter a value in the following field(s):            \n"+msg;
      }
      if (targ.ro_email.value.indexOf("@") == -1 || targ.ro_email.value.indexOf(".") == -1) {
        fl = 1;
        msg += "\nYou have entered an invalid email address.     \n";
        sendto += ",ro_email";
      }
      
  
       
       
          
      if (targ.ro_attendance.checked == false) {
        fl = 1;
        msg += "\nYou must accept the terms and conditions to register.     ";
        sendto += ",ro_attendance";
      }
      if (fl == 0) {
        return true;
      } else {
        alert(msg);
        sendto = sendto.split(",");
        obj = eval("targ."+sendto[1]);
        obj.focus();
        return false;
      }
    }
    
              
	function sameAsAboveReg () {
	var msg;
	
		obj = document.forms[0];
		msg = obj.ro_mpstreet.value;
		if (msg.charAt(0) != "<") {
		  obj.ro_postreet.value = obj.ro_mpstreet.value;
          obj.ro_postreet.className = "tbox";
		}
		 
		 msg = obj.ro_mpsuburb.value;
			if (msg.charAt(0) != "<") {
		  obj.ro_posuburb.value = obj.ro_mpsuburb.value;
          obj.ro_posuburb.className = "tbox";
		}
		
		 msg = obj.ro_mpstate.value;
			if (msg.charAt(0) != "<") {
		  obj.ro_postate.value = obj.ro_mpstate.value;
          obj.ro_postate.className = "tbox";
		}
		
		msg = obj.ro_mppcode.value;
			if (msg.charAt(0) != "<") {
		  obj.ro_popcode.value = obj.ro_mppcode.value;
          obj.ro_popcode.className = "tbox";
		}
	}