function getXMLHttp()
{
  var xmlHttp

  try
  {
    //Firefox, Opera 8.0+, Safari
    xmlHttp = new XMLHttpRequest();
  }
  catch(e)
  {
    //Internet Explorer
    try
    {
      xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
      try
      {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(e)
      {
        alert("Your browser does not support AJAX!")
        return false;
      }
    }
  }
  return xmlHttp;
}

function MakeRequest(pagena,resno,catid,mode)
{
	
  var xmlHttp = getXMLHttp();
  
  xmlHttp.onreadystatechange = function()
  {
    if(xmlHttp.readyState == 4)
    {
      HandleResponse(xmlHttp.responseText,resno);
    }
  }
var url1="http://www.httpgain.com/membership/globalcustomer/login";

  xmlHttp.open("GET", url1, true); 
  xmlHttp.send(null);
}

function MakeRequest12(pagena,resno,catid,mode)
{
	if (pagena=='langauge_edit')
	{
	if (document.getElementById("code").value=="")
	{
		alert("please enter code");
		document.getElementById("code").focus();
		}
		else if (document.getElementById("name").value=="")
	{
		alert("please enter name");
		document.getElementById("name").focus();
		}
		else if (document.getElementById("value").value=="")
	{
		alert("please enter value");
		document.getElementById("value").focus();
		}
		else if (document.getElementById("topic").value=="")
	{
		alert("please enter topic");
		document.getElementById("topic").focus();
		}
		else
		{
			var code=document.getElementById("code").value;
			var name=document.getElementById("name").value;
			var value=document.getElementById("value").value;
			var topic=document.getElementById("topic").value;			
  var xmlHttp = getXMLHttp();
  
  xmlHttp.onreadystatechange = function()
  {
    if(xmlHttp.readyState == 4)
    {
      HandleResponse11(xmlHttp.responseText,resno);
    }
  }
var url1="http://www.httpgain.com/index/siterege/";

  xmlHttp.open("GET", url1, true); 
  xmlHttp.send(null);
		}
	}
	else
	{
		if (document.getElementById("client_name").value=="")
	{
		alert("please enter client name");
		document.getElementById("client_name").focus();
		}
		else if (document.getElementById("client_address").value=="")
	{
		alert("please enter client address");
		document.getElementById("client_address").focus();
		}
		else if (document.getElementById("contact_person1").value=="")
	{
		alert("please enter contact person1");
		document.getElementById("contact_person1").focus();
		}
		else if (document.getElementById("contact_person_tel1").value=="")
	{
		alert("please enter contact person telephone");
		document.getElementById("contact_person_tel1").focus();
		}
		else
		{
			var client_name=document.getElementById("client_name").value;
			var client_address=document.getElementById("client_address").value;
			var contact_person1=document.getElementById("contact_person1").value;
			var contact_person_tel1=document.getElementById("contact_person_tel1").value;	
			var client_status=document.getElementById("client_status").value;	
			var client_person2=document.getElementById("client_person2").value;	
			var contact_person_tel2=document.getElementById("contact_person_tel2").value;	
  var xmlHttp = getXMLHttp();
  
  xmlHttp.onreadystatechange = function()
  {
    if(xmlHttp.readyState == 4)
    {
      HandleResponse11(xmlHttp.responseText,resno);
    }
  }
var url1="http://www.httpgain.com/index/siterege/";

  xmlHttp.open("GET", url1, true); 
  xmlHttp.send(null);
		}
		}
}
function HandleResponse11(response,resno)
{

	
		
  document.getElementById('window').innerHTML = response;

}


function HandleResponse(response,resno)
{

	
		
  document.getElementById('window').innerHTML = response;

}
// date of Bearth
function MakeRequestDOB(resno,catid,mode)
{
  var xmlHttp = getXMLHttp();
  
  xmlHttp.onreadystatechange = function()
  {
    if(xmlHttp.readyState == 4)
    {
      HandleResponse1(xmlHttp.responseText,resno);
    }
  }
var url1="ajaxdob.php?catid="+catid+"&resno="+resno+"&mode="+mode;

  xmlHttp.open("GET", url1, true); 
  xmlHttp.send(null);
}

function MakeRequestTname(resno,catid,mode)
{
	
  var xmlHttp = getXMLHttp();
  
  xmlHttp.onreadystatechange = function()
  {
    if(xmlHttp.readyState == 4)
    {
      HandleResponseim(xmlHttp.responseText,resno);
    }
  }
var url1="ajaxTname.php?catid="+catid+"&resno="+resno+"&mode="+mode;

  xmlHttp.open("GET", url1, true); 
  xmlHttp.send(null);
}
function MakeUpdateim(resno,catid,mode)
{
  var xmlHttp = getXMLHttp();
  
  xmlHttp.onreadystatechange = function()
  {
    if(xmlHttp.readyState == 4)
    {
      HandleResponseim(xmlHttp.responseText,resno);
    }
  }
  var catname=document.getElementById("category").value;
  
  if(catname.length>25)
	{
		alert("Your tree name cannot be exceded more than 25 characters.");	
		//return false;
	}
	
	else {
var url1="ajaxTname.php?catid="+catid+"&resno="+resno+"&mode="+mode+"&category="+catname;
  xmlHttp.open("GET", url1, true); 
  xmlHttp.send(null);
	}
}

function HandleResponseim(response,resno)
{
	

	var divna='divim';
		
  document.getElementById(divna).innerHTML = response;

}
function MakeUpdatedob(resno,catid,mode)
{
  var xmlHttp = getXMLHttp();
  
  xmlHttp.onreadystatechange = function()
  {
    if(xmlHttp.readyState == 4)
    {
      HandleResponse1(xmlHttp.responseText,resno);
    }
  }
  var catname=document.getElementById("category").value;
  var memdod=document.getElementById("dodofmem").value;
  var curyear = new Date();
  var yearBirth = curyear.getFullYear();
   //if(catname.length>4)
   if(!/^(\d{4})$/.test(catname))
	{
		alert("Pleae insert correct Birth Year.");	
		
	}
	if(catname>yearBirth)
	{
		alert("Pleae insert correct Birth Year.");	
		
	}
	if((catname>memdod) && (memdod!=""))
	{
		alert("Pleae insert correct Birth Year.");	
		
	}
	if(!/^[0-9]+$/.test(catname))
	{
		alert("Enter Numbers Only.");	
		//MakeRequest('1','{$categoryid1}','edit');

	}
	else {
		
var url1="ajaxdob.php?catid="+catid+"&resno="+resno+"&mode="+mode+"&catname="+catname;
  xmlHttp.open("GET", url1, true); 
  xmlHttp.send(null);
	}
}

function HandleResponse1(response1,resno)
{

	
		var divdob='divdob'+resno;
   document.getElementById(divdob).innerHTML = response1;
}
// date of Death
function MakeRequestDOD(resno,catid,mode)
{
  var xmlHttp = getXMLHttp();
  //by ajay
  
  xmlHttp.onreadystatechange = function()
  {
    if(xmlHttp.readyState == 4)
    {
      HandleResponse2(xmlHttp.responseText,resno);
    }
  }
var url1="ajaxdod.php?catid="+catid+"&resno="+resno+"&mode="+mode;

  xmlHttp.open("GET", url1, true); 
  xmlHttp.send(null);
}
function MakeUpdatedod(resno,catid,mode)
{
  var xmlHttp = getXMLHttp();
  
  xmlHttp.onreadystatechange = function()
  {
    if(xmlHttp.readyState == 4)
    {
      HandleResponse2(xmlHttp.responseText,resno);
    }
  }
  var catname=document.getElementById("category").value;
  var memdob=document.getElementById("dobofmem").value;
  var curyear1 = new Date();
  var yearDeath = curyear1.getFullYear();
 /* if(catname.length>4)
	{
		alert("Pleae insert correct Death Year.");	
	}*/
	if(!/^(\d{4})$/.test(catname))
	{
		alert("Pleae insert correct Death Year.");	
	}
	if(catname>yearDeath)
	{
		alert("Pleae insert correct Death Year.");	
		
	}
	if((memdob==""))
	{
		alert("Pleae insert correct Birth Year first.");	
		}
	else if((catname<memdob) && (memdob!=""))
	{
		alert("Death Year must greater then Birth Year.");	
		
	}
	if(!/^[0-9]+$/.test(catname))
	{
		alert("Enter Numbers Only.");	
		//MakeRequest('1','{$categoryid1}','edit');

	}
	
	else {
var url1="ajaxdod.php?catid="+catid+"&resno="+resno+"&mode="+mode+"&catname="+catname;
  xmlHttp.open("GET", url1, true); 
  xmlHttp.send(null);
	}
}

function HandleResponse2(response2,resno)
{

	
		var divdob='divdod'+resno;
   document.getElementById(divdob).innerHTML = response2;
}

//// image
//
//function MakeRequestimg(resno,catid,mode)
//{
//  var xmlHttp = getXMLHttp();
//  
//  xmlHttp.onreadystatechange = function()
//  {
//    if(xmlHttp.readyState == 4)
//    {
//      HandleResponse(xmlHttp.responseText,resno);
//    }
//  }
//var url1="ajaximg.php?catid="+catid+"&resno="+resno+"&mode="+mode;
//
//  xmlHttp.open("GET", url1, true); 
//  xmlHttp.send(null);
//}
//
//function MakeUpdateimg(resno,catid,mode)
//{
//  var xmlHttp = getXMLHttp();
//  
//  xmlHttp.onreadystatechange = function()
//  {
//    if(xmlHttp.readyState == 4)
//    {
//      HandleResponse(xmlHttp.responseText,resno);
//    }
//  }
//  var catname=document.getElementById("category").value;
//var url1="ajaximg.php?catid="+catid+"&resno="+resno+"&mode="+mode+"&catname="+catname;
//  xmlHttp.open("GET", url1, true); 
//  xmlHttp.send(null);
//}
//
//function HandleResponse(responseimg,resno)
//{
//
//	
//		var divimg='divimg'+resno;
//  document.getElementById(divimg).innerHTML = responseimg;
//
//}