
function ValidateEmail(theinput){
	s=theinput.value
	if(s.search)
	{
		return (s.search(new RegExp("^([-!#$%&'*+./0-9=?A-Z^_`a-z{|}~])+@([-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+\\.)+[a-zA-Z]{2,4}$","gi"))>=0)
	}
	if(s.indexOf)
	{
		at_character=s.indexOf('@')
		if(at_character<=0 || at_character+4>s.length)
			return false
	}
	if(s.length<6)
		return false
	else
		return true
}
function chkRegister(theform){

 if(theform.rctvor.value>0){
 return true;
 } else {

		if(theform.rnavn.value <= 0){
			alert("{insert name='globals' var='_l.js.rnavn_empty'}");
			theform.rnavn.focus()
			return false;
		}
		if(theform.retternavn.value <= 0){
			alert("{insert name='globals' var='_l.js.retternavn_empty'}");
			theform.retternavn.focus()
			return false;
		}
		if(theform.radr.value <= 0){
			if (!confirm("{insert name='globals' var='_l.js.radr_empty_confirm'}")) {
			theform.radr.focus()
			return false;
				}
		}
		if(theform.rpnr.value <= 0){
			alert("{insert name='globals' var='_l.js.rpnr_empty'}");
			theform.rpnr.focus()
			return false;
		}
		if(theform.rpadr.value <= 0){
			alert("{insert name='globals' var='_l.js.rpadr_empty'}");
			theform.rpadr.focus()
			return false;
		}


	if((theform.rtlf.value.length <= 1) && (theform.rmob.value.length <= 1)){
		alert("{insert name='globals' var='_l.js.rtlf_rmob_required'}");
			theform.rtlf.focus()
			return false;
	}

		if(theform.rusr.value <= 0){
			alert("{insert name='globals' var='_l.js.rusr_empty'}");
			theform.rusr.focus()
			return false;
		}

		if(ValidateEmail(theform.rusr)==false) {
			alert("{insert name='globals' var='_l.js.rusr_invalid_email'}");
			theform.rusr.focus()
			return false;
		}

		if(theform.rpas.value <= 0){
			alert("{insert name='globals' var='_l.js.rpas_empty'}");
			theform.rpas.focus()
			return false;
		}

		if(theform.rpas.value.length <= 3){
			alert("{insert name='globals' var='_l.js.rpas_short'}");
			theform.rpas.focus()
			return false;
		}

		if(theform.rpas.value != theform.rpasc.value){
			alert("{insert name='globals' var='_l.js.rpas_retype_error'}");
			theform.rpas.value="";
			theform.rpasc.value="";
			theform.rpas.focus()
			return false;
		}

  }
}