
//checks the valability of the code in image
function checkCode(){
	var code=document.getElementById('cod').value;
	var encrCode='';
	for(var i=0;i<code.length;i++){
		if(i)
			encrCode+='.';
		encrCode+=code.charCodeAt(i)
	}	
	if(document.getElementById('encrcode').value==encrCode)
		return true;
	alert('codul introdus nu este corect!');
	return false;
}

//checks that the contact message fields are filled
function checkContact(){
	var fields=new Array('cod','nume','telefon','email','mesaj');
	for(var i=0;i<fields.length;i++)
		if(document.getElementById(fields[i]).value==''){
			alert('Va rugam sa completati toate campurile formularului');
			return false;
		}
	return checkCode();		
}


function checkCommand(){
	var fields=new Array('cod','nume','telefon','email','address','location','type','surface');
	for(var i=0;i<fields.length;i++)
		if((document.getElementById(fields[i]).value=='')){
			alert('Va rugam sa completati toate campurile formularului!');
			return false;
		}
		return checkCode();
}

