function VE( email ) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   return reg.test( email );
}

function FV() {
	if( ! document.getElementById("na").value.length ) {
		window.alert( "Va rugam introduceti numele dvs." );
		document.getElementById("na").focus();
		return false;
	}
	
	if( ! VE( document.getElementById("em").value )  ) {
		window.alert( "Va rugam introduceti o adresa de email valida" );
		document.getElementById("em").focus();
		return false;
	}
	
	if( ! document.getElementById("ph").value.length ) {
		window.alert( "Va rugam introduceti telefonul dvs." );
		document.getElementById("ph").focus();
		return false;
	}
	
	if( ! document.getElementById("ms").value.length ) {
		window.alert( "Va rugam introduceti mesajul dvs." );
		document.getElementById("ms").focus();
		return false;
	}
	
	return true;
}

function Contact() {
	var dc = "dc" + Math.floor( Math.random() * 1001 );
	var na = "na" + Math.floor( Math.random() * 1001 );
	var em = "em" + Math.floor( Math.random() * 1001 );
	var ph = "ph" + Math.floor( Math.random() * 1001 );
	var ty = "ty" + Math.floor( Math.random() * 1001 );
	var ms = "ms" + Math.floor( Math.random() * 1001 );

	document.write("<form action='contact.php' method='post' onSubmit='return FV();'><input name='"+dc+"' value='1' type='hidden'><table style='color: #333; font-size: 11px;'><tbody><tr><td style='text-align: right;' width='50%'>Nume &nbsp;</td><td width='50%'>&nbsp; <input id='na' name='"+na+"' type='text'></td></tr><tr><td style='text-align: right;' width='50%'>Adresa e-mail &nbsp;</td><td width='50%'>&nbsp; <input id='em' name='"+em+"' type='text'></td></tr><tr><td style='text-align: right;' width='50%'>Telefonul tau &nbsp;</td><td width='50%'>&nbsp; <input id='ph' name='"+ph+"' type='text'></td></tr><tr><td style='text-align: right;' width='50%'>Subiectul mesajului &nbsp;</td><td width='50%'>&nbsp; <select name='"+ty+"'><option>1. Reclama</option><option>2. Redactia</option><option>3. Distributie</option><option>4. Website</option></select></td></tr><tr><td colspan='2'>Mesaj:<br><textarea id='ms' name='"+ms+"' style='width: 450px; height: 100px; font-family: Arial,Helvetica;'></textarea></td></tr><tr><td colspan='2' style='text-align: center;'><input src='img/buton_trimite.jpg' type='image'><br></td></tr></tbody></table></form>");
}