var xmlHttp

function submitfeedbackPage(form,str1)
{ 

	var url=str1;
	
	
	var name = document.getElementById("name").value;
	var emailid = document.getElementById("emailid").value;
	var mobile= document.getElementById("mobile").value;
	var subject = document.getElementById("fb").value;
	
	
	
	if(name==""){
		showError("The Name cannot be left blank");
		document.getElementById("name").focus();
		changeError('name')
		return false;
	}else if(isNum(name)){
			//alert("name " + name);
			showError("Numbers are not allowed in the name");
			document.getElementById("name").focus();
			changeError('name')
			return false;
	}
	else if(isSpchar(name)){
			showError("Special characters not allowed in the name");
			document.getElementById("name").focus();
			changeError('name')
			return false;
	}
	else{
		changeProper('name')
	}
	
	if(emailid==""){
		showError("The Email Id cannot be left blank");
		document.getElementById("emailid").focus();
		changeError('emailid');
		return false;
	}else{
		changeProper('emailid')
	} 
	
	if(!isValidEmail(emailid))
	{
		showError("Invalid email address.");
		document.getElementById("emailid").focus();
		changeError('emailid')
		return false;
	}else{
		changeProper('emailid')
	}
	
	if(subject==""){
		showError("Please Provide some comments");
		document.getElementById("fb").focus();
		changeError('fb')
		return false;
	}else{
		changeProper('fb')
	}
	
	if(mobile==""){
		showError("Phone Number should not be blank");
		document.getElementById("mobile").focus();
		changeError('mobile')
		return false;
	}else{
		changeProper('mobile')
	}
	
	if(!isNumber(mobile))
	{
		showError("Please enter numbers only");
		document.getElementById("mobile").focus();
		changeError('mobile')
		return false;
	}else{
		changeProper('mobile')
	}
	
	
		//toogleElement('msg','none')
		//showThanks(theform)
	
	
	
	
	url=url+"?name="+name;
	url=url+"&emailid="+emailid;
	url=url+"&subject="+subject;
	url=url+"&mobile="+mobile;
	url=url+"&requestname="+form;
//	alert(url);
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
 	 {
		  alert ("Your browser does not support AJAX!");
 		 return;
	  } 
  


xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
toogleElement(form,'none');
toogleElement('thanks','block');
}

function stateChanged() 
{ 

	if (xmlHttp.readyState==1){
	document.getElementById("thanks").innerHTML="Loading...";
	}else if (xmlHttp.readyState==2){
	document.getElementById("thanks").innerHTML="Loading...";
	}else if (xmlHttp.readyState==3){
	document.getElementById("thanks").innerHTML="Loading...";
	}else if (xmlHttp.readyState==4){
	document.getElementById("thanks").innerHTML=xmlHttp.responseText;
	}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
} 