function checkEmail( text ) {
	return /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test( text );
}

function validateContact( na , em , ms ) {
	if( ! document.getElementById( na ).value.length ) {
		window.alert( "Va rugam sa introduceti numele dvs!" );
		document.getElementById( na ).focus();
		return false;
	}
	
	if( ! checkEmail( document.getElementById( em ).value ) ) {
		window.alert( "Va rugam sa intoduceti adresa dvs. de e-mail!" );
		document.getElementById( em ).focus();
		return false;
	}
	
	if( ! document.getElementById( ms ).value.length ) {
		window.alert( "Va rugam sa 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 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 validateContact( \""+na+"\" , \""+em+"\" , \""+ms+"\" );'><input name='"+dc+"' value='1' type='hidden'><table style='color: #050; 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%'>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%'>Subiect &nbsp;</td><td width='50%'>&nbsp; <select name='"+ty+"'><option>Comanda produse</option><option>Schimb de banere</option><option>Altceva</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 value=' Trimite ' type='submit'><br></td></tr></tbody></table></form>");
}