// JavaScript Document
//CONTACT US 
//
function sendfeed()
{
if(document.getElementById('name').value=='')
{
document.getElementById('error').innerHTML='Error : Please enter your name .. !';
document.getElementById('name').focus();
return false;
}
else if(document.getElementById('email').value=='')
{
document.getElementById('error').innerHTML='Error : Please enter your email ID .. !';
document.getElementById('email').focus();
return false;
}
else if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('email').value))
{
document.getElementById('error').innerHTML='Error : Please enter valid email ID .. !';
document.getElementById('email').focus();
return false;	
}
else if(document.getElementById('phoneno').value=='')
{
document.getElementById('error').innerHTML='Error : Please enter your phone number .. !';
document.getElementById('phoneno').focus();
return false;
}
else if(isNaN(document.getElementById('phoneno').value) || document.getElementById('phoneno').value.length<10)
{
document.getElementById('error').innerHTML='Error : Please enter valid phone number .. !';
document.getElementById('phoneno').focus();
return false;
}
else if(document.getElementById('comments').value.length<=10)
{
document.getElementById('error').innerHTML='Error : Please enter your comments .. !';
document.getElementById('comments').focus();
return false;
}
 
return true;
}

//
function sendfeedvalue()
{
if(window.XMLHttpRequest)
{
oRequestfeed = new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
oRequestfeed = new ActiveXObject("Microsoft.XMLHTTP");
}
AID='contactus'; 
Aregarding=document.getElementById('regarding').value;
Aname=document.getElementById('name').value;
Aemail=document.getElementById('email').value;
Aphoneno=document.getElementById('phoneno').value;
Acomments=document.getElementById('comments').value;
document.getElementById('loading').innerHTML='<img src="images/loading.gif" /> &nbsp;<b>Sending .. Please wait..</b>';
oRequestfeed.open("POST","ajax-functions.php", true);
oRequestfeed.onreadystatechange = showstatus;
oRequestfeed.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
oRequestfeed.send("AID="+AID+"&Aregarding="+Aregarding+"&Aname="+Aname+"&Aemail="+Aemail+"&Aphoneno="+Aphoneno+"&Acomments="+Acomments);
}
function showstatus()
{
if(oRequestfeed.readyState == 4)
{	
if(oRequestfeed.status == 200)
{
document.getElementById("loading").innerHTML = oRequestfeed.responseText;
window.location.href='contactus.php';
}
else
{
document.getElementById("loading").innerHTML = oRequestfeed.responseText;
}
}
}