function CheckForm( theForm ) {
	if( !isValidType( theForm.email, 'email' ) ) {
		window.alert( 'Adresa de e-mail nu este valida.' );
		return false;
	}
	if( !isValidType( theForm.name, 'name' ) ) {
		window.alert( 'Nu ati introdus numele dumneavoastra.' );
		return false;
	}
	if( !isValidType( theForm.phone, 'phone' ) ) {
		window.alert( 'Numarul de telefon nu este valid.' );
		return false;
	}
	return true; //don't forget this line
}

function isValidType( oInput, oType ) {
	switch( oType.toLowerCase() ) {
		case 'select':
			return oInput.selectedIndex;
		case 'phone':
			if( !oInput.value ) { return false; }
			for( var mXi = 0; mXi < oInput.value.length; mXi++ ) {
				if( oInput.value.charAt( mXi ) != '' + parseInt( oInput.value.charAt( mXi ) ) + '' ) { return false; }
			} return true;
		case 'name':
			return ( oInput.value && !oInput.value.replace( /[a-z??????]+( ?[-']?[a-z??????]+)*/i, "" ) );
		case 'email':
			return ( oInput.value && !oInput.value.replace( /[\w\-\+]+(\.[\w\-\+]+)*@([\w\-??????]+\.)+[a-z]+/i, "" ) );
	}
}
