function checkField(oField) {
    return !(oField.value.length == 0)
}

function verifyEmail(checkEmail)
{
    if ((checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.'))) {
        return false;
    } else {
        return true;
    }
}


function ForceNumericInput(This, oEvent)
{
        var AllowDot = false;
        var AllowMinus = false;
        var code = oEvent.keyCode;
        
        switch(code)
        {
            case 8:     // backspace
            case 37:    // left arrow
            case 39:    // right arrow
            case 46:    // delete
            case 116:   // F5
            case 9:	// TAB
                oEvent.returnValue=true;
                return oEvent.returnValue;
        }
        
        
        // allow character of between 0 and 9
        if(code >= 48 && code <= 57)
        {
            oEvent.returnValue=true;
            return oEvent.returnValue;
        }
        
        // allow character of between 0 and 9 (Numlock side)
        if(code >= 96 && code <= 105)
        {
            oEvent.returnValue=true;
            return oEvent.returnValue;
        }
        
        oEvent.returnValue=false;
        return oEvent.returnValue; 
}

function sendForm() {
    var oForm = document.ContactForm;
	var Fill = '';
    var Fields = new Array(oForm.name, oForm.phone, oForm.email);
    for(i = 0; i < Fields.length; i++) {
        if ( false == checkField(Fields[i]) ) {
			if (Fields[i].name == oForm.name.name) {
				Fill = 'שמך המלא';
			} else if  (Fields[i] == oForm.phone) {
				Fill = 'מספר הטלפון שלך';
			} else if (Fields[i] == oForm.email) {
				Fill = 'כתובת האימייל שלך';
			}
            alert('אתה חייב למלאות את ' + Fill);
            return false;
        }
    }
    
	if (oForm.phone.value.length < 9) {
		alert('מספר הטלפון אינו תקין');
		return false;
	}
	
    if ( false == verifyEmail(oForm.email.value) ) {
        alert('כתובת המייל אינה תיקנית');
        return false;
    }
    
    oForm.submit();
    return true;
}
