function form_validation1()
{
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
//string.replace(/\s/g, "");
var nam= (document.getElementById("name").value); 
var email= (document.getElementById("email_id").value);
var ques_comm= (document.getElementById("ques_comm").value);
var comp_name= (document.getElementById("comp_name").value);
var address= (document.getElementById("address").value);
var phoneno= (document.getElementById("phoneno").value);


if(comp_name=='' || comp_name==null)	
{
	hideAllErrors();
	document.getElementById("company_error").style.display = "inline";
	return false;
}

else if(nam=='' || nam==null)
{
	hideAllErrors();
	document.getElementById("name_error").style.display = "inline";
	return false;
}

else if(address=='' || address==null)
{
	hideAllErrors();
document.getElementById("address_error").style.display = "inline";
	return false;
}


else if(reg.test(email)==false)
{
	hideAllErrors();
document.getElementById("email_error").style.display = "inline";
	return false;
}

 
 

else if(phoneno=='' || phoneno==null)
{
	hideAllErrors();
	document.getElementById("number_error").style.display = "inline";
	return false;
}

else if(isNaN(phoneno) || phoneno.length>10)
{
	hideAllErrors();
	document.getElementById("number_error").style.display = "inline";
	return false;
}

else if(ques_comm=='' || ques_comm==null)
{
	hideAllErrors();
	document.getElementById("qes_error").style.display = "inline";
	return false;
}
else
{
 	hideAllErrors();	
}
}

function hideAllErrors() {
document.getElementById("company_error").style.display = "none"
document.getElementById("name_error").style.display = "none"
document.getElementById("address_error").style.display = "none"
document.getElementById("email_error").style.display = "none"
document.getElementById("number_error").style.display = "none"
document.getElementById("qes_error").style.display = "none"
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 ;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return ""
}

function checkCookie()
{
var code=getCookie('tntcon');
var txt=document.getElementById('verif_box').value;
if (txt=="")
  {
	  alert('Please enter the code');
	  return false;
  }
  else if(code!=txt)
  {
  	alert('Invalid Code.Please try again');
	document.getElementById('verif_box').value="";
  	return false;
  }  
  else
  {
  	return true;
  }
}

function checkCookie2()
{
var code=getCookie('tntcon2');
var txt=document.getElementById('verif_box2').value;
if (txt=="")
  {
	  alert('Please enter the code');
	  return false;
  }
  else if(code!=txt)
  {
  	alert('Invalid Code.Please try again');
	document.getElementById('verif_box2').value="";
  	return false;
  }  
  else
  {
  	return true;
  }
}
