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;
}

function SearchResult(pageurl,action,radiosearch,needy,limit,pages,preload)
{		
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		  alert ("Your browser does not support AJAX!");
		  return;
	}	
	if(preload == 'pagination') {		
	 	document.getElementById('divpreLoader').style.display = '';
		document.getElementById('divpreLoader1').style.display = '';
	}
	var url=pageurl;
	url=url+"?action="+action+"&radiosearch="+radiosearch+"&needy="+needy+"&limit="+limit+"&page="+pages;
	//alert(url);
	url=url+"&sid="+Math.random();	
	xmlHttp.onreadystatechange=searchPage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function searchPage()
{
	if (xmlHttp.readyState==4)	
	{							
		document.getElementById('divloader').style.display = 'none';		
		document.getElementById('divSearch').innerHTML = xmlHttp.responseText;			
	}
}

function CategoryResult(pageurl,action,radiosearch,category,type,need,limit,pages,preload)
{	
	//alert(action);
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		  alert ("Your browser does not support AJAX!");
		  return;
	}	
	if(preload == 'pagination') {		
	 	document.getElementById('divpreLoader').style.display = '';
		document.getElementById('divpreLoader1').style.display = '';
	}
	var url=pageurl;
	url=url+"?action="+action+"&radiosearch="+radiosearch+"&category="+category+"&type="+type+"&need="+need+"&limit="+limit+"&page="+pages;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.onreadystatechange=searchPage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function searchPage()
{
	if (xmlHttp.readyState==4)	
	{									
		document.getElementById('divloader').style.display = 'none';		
		document.getElementById('divSearch').innerHTML = xmlHttp.responseText;			
	}
}

function RegularResult(pageurl,action,radiosearch,category,type,need,country,state,photo,fromdate,todate,chkdate,limit,pages,preload)
{	
	//alert(action);
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		  alert ("Your browser does not support AJAX!");
		  return;
	}	
	if(preload == 'pagination') {		
	 	document.getElementById('divpreLoader').style.display = '';
		document.getElementById('divpreLoader1').style.display = '';
	}
	var url=pageurl;
	url=url+"?action="+action+"&radiosearch="+radiosearch+"&category="+category+"&type="+type+"&need="+need+"&country="+country+"&state="+state+"&photo="+photo+"&fromdate="+fromdate+"&todate="+todate+"&chkdate="+chkdate+"&limit="+limit+"&page="+pages;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.onreadystatechange=searchPage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function searchPage()
{
	if (xmlHttp.readyState==4)	
	{							
		document.getElementById('divloader').style.display = 'none';		
		document.getElementById('divSearch').innerHTML = xmlHttp.responseText;			
	}
}

function LocationResult(pageurl,action,radiosearch,country,state,city,limit,pages,preload)
{			
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		  alert ("Your browser does not support AJAX!");
		  return;
	}	
	if(preload == 'pagination') {		
	 	document.getElementById('divpreLoader').style.display = '';
		document.getElementById('divpreLoader1').style.display = '';
	}
	var url=pageurl;
	url=url+"?action="+action+"&radiosearch="+radiosearch+"&country="+country+"&state="+state+"&city="+city+"&limit="+limit+"&page="+pages;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.onreadystatechange=locationPage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function locationPage()
{
	if (xmlHttp.readyState==4)	
	{							
		document.getElementById('divloader').style.display = 'none';		
		document.getElementById('divSearch').innerHTML = xmlHttp.responseText;
	}
}

function VolunteerResult(pageurl,action,country,state,city,limit,pages,preload)
{			
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		  alert ("Your browser does not support AJAX!");
		  return;
	}	
	if(preload == 'pagination') {		
	 	document.getElementById('divpreLoader').style.display = '';
		document.getElementById('divpreLoader1').style.display = '';
	}
	var url=pageurl;
	url=url+"?action="+action+"&country="+country+"&state="+state+"&city="+city+"&limit="+limit+"&page="+pages;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.onreadystatechange=locationPage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function locationPage()
{
	if (xmlHttp.readyState==4)	
	{							
		document.getElementById('divloader').style.display = 'none';		
		document.getElementById('divSearch').innerHTML = xmlHttp.responseText;			
	}
}

function viewprofile(pid,pageurl)
{
	document.getElementById('divpreLoader').style.display = '';
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		  alert ("Your browser does not support AJAX!");
		  return;
	} 	  
	var url=pageurl;
	url=url+"?pid="+pid;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.onreadystatechange=viewsearchPage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function viewsearchPage()
{
	if (xmlHttp.readyState==4)	
	{			 	
		var msg = xmlHttp.responseText;	
		if(msg == 'No')
		{				
			//document.getElementById('divprofile').style.display ='none';
			//document.getElementById('line1').style.display ='none';
			//document.getElementById('errorresult').style.display ='';
			//document.getElementById('errorresult').innerHTML = msg;
			document.getElementById('divpreLoader').style.display = 'none';
			document.getElementById('err_prof_id').innerHTML = 'The given criteria does not match with our database,please try again.';
		} else {
			//alert("login/viewprofile.php?pid="+msg);			
			window.location.href = "login/viewprofile.html?"+msg;
		}
	}
}

function viewprofileid(pid,pageurl)
{
	document.getElementById('divpreLoader').style.display = '';
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		  alert ("Your browser does not support AJAX!");
		  return;
	} 	  
	var url=pageurl;
	url=url+"?pid="+pid;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.onreadystatechange=viewidsearchPage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function viewidsearchPage()
{
	if (xmlHttp.readyState==4)	
	{			 	
		var msg = xmlHttp.responseText;	
		//alert(msg);
		
		if(msg == 'No')
		{				
			//document.getElementById('divprofile').style.display ='none';
			//document.getElementById('line1').style.display ='none';
			//document.getElementById('errorresult').style.display ='';
			//document.getElementById('errorresult').innerHTML = msg;
			document.getElementById('divpreLoader').style.display = 'none';
			document.getElementById('err_prof_id').innerHTML = 'The given criteria does not match with our database,please try again.';
		} else {
			//alert("login/viewprofile.php?pid="+msg);			
			window.location.href = "viewfullprofile.html?pid="+msg;
		}
	}
}

function showvolun(pro_id,url,pagename)
{
	//alert("sdfsfsdfS");
	//document.getElementById('rightadd').style.display='none';
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	} 	   	
	url=url+"?pro_id="+pro_id+"&pagename="+pagename;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.onreadystatechange=light_vol;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function light_vol()
{ 
	if (xmlHttp.readyState==4)
	{	
	/*	if(xmlHttp.responseText=="")
	{
	 document.getElementById("fri").innerHTML ="<center><img src='../images/preload_send.gif'></center>";	
	}
	else
	{*/
	document.getElementById("fri").innerHTML=xmlHttp.responseText;	
	//}
		//document.getElementById("fri").innerHTML=xmlHttp.responseText;
		var objOverlay = document.getElementById('fade');
		document.getElementById("fri").style.display='';
		
		var objLoadingImage = document.getElementById('alignfri');
		var arrayPageSize = getPageSize();
		var arrayPageScroll = getPageScroll();
		if (objLoadingImage) 
		{
		objLoadingImage.style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - objLoadingImage.offsetHeight) / 2) + 'px');
		//objLoadingImage.style.left = (((arrayPageSize[0] - 20 - objLoadingImage.width) / 2) + 'px');
		}
		objOverlay.style.height = (arrayPageSize[1] + 'px');
	}
}

function showvolunteer1(m_id,f_id,t_id,url)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
  		alert ("Your browser does not support AJAX!");
 		return;
 	} 
	url=url+"?action=send&sid="+Math.random()+"&m_id="+m_id+"&f_id="+f_id+"&t_id="+t_id;	
	//alert(url);
	xmlHttp.onreadystatechange=light_volunteer;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function light_volunteer() 
{ 
	if (xmlHttp.readyState==4)
	{	
	
		if(xmlHttp.responseText=="")
		{
		 document.getElementById("inter_msg").innerHTML ="<center><img src='../images/preload_send.gif'></center>";	
		}
		else
		{
		 document.getElementById("inter_msg").innerHTML=xmlHttp.responseText;	
		}
		document.getElementById("msg_show").style.display ='none';		
		//document.getElementById("inter_msg").innerHTML=xmlHttp.responseText;		
	}
}

