function checkMail(value)
{	var x = value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) 
  return false;
	else return true;
  }
  
function notempty(val){  if(val == ''){    return false;  }else{    return true;  }  }


function showbox(){
document.getElementById('hi').style.display = 'block';
}


function hidebox(){

//document.sendme.submit();
validate()
}



function validate(){
var errors = 0;

if(document.sendme.name){
  if(!notempty(document.sendme.name.value)){
    errors++;
    document.sendme.name.style.border = '1px solid red';
  }else{
    document.sendme.name.style.border = '1px solid green';
  }
}

if(document.sendme.phone){
  if(!notempty(document.sendme.phone.value)){
    errors++;
    document.sendme.phone.style.border = '1px solid red';
  }else{
    document.sendme.phone.style.border = '1px solid green';
  }
}

if(document.sendme.email){
  if(checkMail(document.sendme.email.value)){
    errors++;
    document.sendme.email.style.border = '1px solid red';
  }else{
    document.sendme.email.style.border = '1px solid green';
  }
}

if(errors == 0){
  //document.sendme.submit();
  document.getElementById('ty').style.display = 'none';
  document.getElementById('mes').style.display = 'block';
  var Sleep2 = setTimeout("document.getElementById('hi').style.display = 'none';document.sendme.submit();",3000);
//  alert('sent');
}else{
  alert('Please check data');
}

}





function validatecont(){
var errors = 0;

if(document.sendme.name){
  if(!notempty(document.sendme.name.value)){
    errors++;
    document.sendme.name.style.border = '1px solid red';
  }else{
    document.sendme.name.style.border = '1px solid green';
  }
}

if(document.sendme.number){
  if(!notempty(document.sendme.number.value)){
    errors++;
    document.sendme.number.style.border = '1px solid red';
  }else{
    document.sendme.number.style.border = '1px solid green';
  }
}

if(document.sendme.email){
  if(checkMail(document.sendme.email.value)){
    errors++;
    document.sendme.email.style.border = '1px solid red';
  }else{
    document.sendme.email.style.border = '1px solid green';
  }
}

if(errors == 0){
//document.getElementById('sendme').submit();
//return true;
  document.sendme.submit();
 // document.sendme.style.border = 'solid 2px #000';
}else{
alert('Please check data');
return false;
}

}

