
function chkinput(){
	if (document.forms[0].searchinput.value==''){
		document.getElementById('searchmsg').style.visibility='visible';
		document.forms[0].searchinput.focus();
		return false;	
	}
}
	
function doSendFreind() {
	if (IsEmail(document.frmContact.myemail.value)){
		if (document.frmContact.myfname.value!=""){
			if (IsEmail(document.frmContact.uremail.value)){
				if (document.frmContact.urfname.value!=""){
					document.frmContact.submit();
				}else{
					alert('חובה להזין שם מלא');
					document.frmContact.urfname.focus();
				}
			} else {
				alert('חובה להזין כתובת דואר אלקטרוני');
				document.frmContact.uremail.focus();
			}
		}else{
			alert('חובה להזין שם מלא');
			document.frmContact.myfname.focus();
		}
	} else {
		alert('חובה להזין כתובת דואר אלקטרוני');
		document.frmContact.myemail.focus();
	}
}

function IsPhone(sText){
	return (ChkStrBy(sText,"0123456789-"));
}

function ClearForm(form){
	var vars = form.elements;
	for(i=0; i < vars.length; i++){
		switch(vars[i].type){
			case 'textarea'   :
			case 'text'       : vars[i].value = ''; break;
			case 'select-multiple':
			case 'select-one' : vars[i].selectedIndex = 0; break;
			case 'checkbox'   :
			case 'radio'      : vars[i].checked = false; break;  			
  		}
	}
}

function ValidateForm(frm){
	for (i=0 ; i<frm.elements.length ; i++){
		elm = frm.elements[i];
		attr = elm.getAttribute("required");
		if ((attr != null) && (attr != "")){
			if (elm.type == "select-one"){ // single selection box
				if ((elm.value == "") || (elm.value == 0)){
					alert(attr);
					elm.focus();
					return false;
				}
			}else if (elm.type == "select-multiple"){ // multiple selection box
				return true;
			}else if ((elm.type != "button") && (elm.type != "submit")){
				if (elm.value == ""){
					alert(attr);
					elm.focus();
					return false;
				}
			}
		} 
	}
	return true;
}

function doSend() {
	if (IsEmail(document.frmContact.email.value)) {
		document.frmContact.submit();
		
	} else {
		alert("כתובת האימייל אינה נכונה");
		document.frmContact.email.focus();
		return false;
	}
}

