/* contact_test.js */

function test_input()
{

if(document.input.name.value=="")
{
document.input.error.value="הכנס שם !";
return false;
}

if(document.input.institution.value=="")
{
document.input.error.value="הכנס מוסד!";
return false;
}

if(document.input.phone.value=="")
{
document.input.error.value="הכנס טלפון!";
return false;
}

if(document.input.mail.value=="")
{
document.input.error.value="הכנס דאור אלקטרוני!";
return false;
}

// Test validity of email address
var emailRegExp=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/

if(!emailRegExp.test(document.input.mail.value) && document.input.mail.value!="")
{
document.input.error.value="כתובת דואר לא חוקית!";
return false;
}

document.input.error.value="";
return true;
}

function Trim(STRING){
STRING = LTrim(STRING);
return RTrim(STRING);
}

function RTrim(STRING){
while(STRING.charAt((STRING.length -1))==" "){
STRING = STRING.substring(0,STRING.length-1);
}
return STRING;
}


function LTrim(STRING){
while(STRING.charAt(0)==" "){
STRING = STRING.replace(STRING.charAt(0),"");
}
return STRING;
}