<!--

function isEmail(adresa){
    var pat=/^(.+)@(.+)\.[a-zA-Z]{2,3}$/;
    var k=adresa.match(pat);
	if(k==null){
		return 0;
	}else{
		return 1;
	}
}

function isAlphaNum(str){
	var pat=/^[a-z\sA-Z]*$/;
	var k=str.match(pat);
	if(k==null){
 		return 0;
	}else{
		return 1;
	}
}

function isEmpty(str){
	if(str) {
    var pat=/^\s+$/;
    var k=str.match(pat);
	if(k==null){
		return 1;
	}else{
        return 0;
	}
    }else{
        return 0;
}
}

function isTelefon(numar){
	var pat=/^\+?\(?\+?[0-9]*\)?[0-9+\s\.\-]*[0-9]$/;
	var k=numar.match(pat);
	if(k==null){
		return 0;
	}else{
		return 1;
	}
}

function ceckFields(theForm,theList){
	var ok=0;
	var msg="de completat";
	var msg1="incorect";
	var elements=theList.split(",");
	for(var i=0;i<elements.length;i++){
		type=elements[i].substring(0,1);//alert(type);
		element=elements[i].substr(1);//alert(element);
 		path=eval('document.'+theForm+'.'+element);
		val=path.value;//alert(val);
 		if(val=="" || val==null || val==msg){
 			path.value=msg;//alert(path.value);
			path.focus();
            path.select();
            ok=0;
            break;
		}else{
        switch(type){
                case "0":
                //alphanumeric
                 if(!isAlphaNum(path.value)){
					 //path.value=msg1;//alert(path.value);
                     path.focus();
                     path.select();
                     ok=0;
                 }else{
                      ok=1;
                 }
                break;
				case "1":
 				//email
                 if(!isEmail(path.value)){
					 //path.value=msg1;//alert(path.value);
                     path.focus();
                     path.select();
                     ok=0;
                 }else{
                      ok=1;
                 }
				break;
				case "2":
				//telefon
                 if(!isTelefon(path.value)){
					 //path.value=msg1;//alert(path.value);
                     path.focus();
                     path.select();
                     ok=0;
                 }else{
                      ok=1;
                 }
                break;
                case "3":
				//noncecking
                ok=1;
                break;
				case "4":
				//non-empty
                 if(!isEmpty(path.value)){
					 //path.value=msg1;//alert(path.value);
                     path.focus();
                     path.select();
                     ok=0;
                 }else{
                      ok=1;
                 }
                break;
            }
         }if(ok==0) break;
	}
 if(ok==0){
 return false;
}else{
  return true;
}
}
//-->