function getXMLHTTP()
 { /*fuction to return the xml http object*/
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
    }
	
	function getState(countryId,page) {
		/*alert(countryId);
		alert(page);*/
		var strURL="findState.php?country="+countryId+"&page="+page;		
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById('statediv').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	
	function getState75(countryId,page,stdiv,hidstate) {
		
		var strURL="findState.php?country="+countryId+"&page="+page+"&hidstate="+hidstate;		
		var req = getXMLHTTP();
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) {						
						document.getElementById(stdiv).innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	
	function trimLeftRightSpaces(obj)
 {
	 
	strToTrim = obj.value;
	strTrim = strToTrim.replace(/^(\s*)|(\s*)$/g,"");
	return(strTrim);
 }
	
   function isEmpty(obj)
    {
		isValid = false;
		if(trimLeftRightSpaces(obj)=="")
		 {
		 	isValid = true;
		 }
		return isValid; 
	}
	 function trimLeftSpaces(obj)
  {
 	strToTrim = obj.value;
	strTrim = strToTrim.replace(/^(\s*)/g,"");
	return(strTrim); 
  }
  
	function getCity(str,country,state,txt,page) 
	{		
	//alert(str);
	//alert(state);
		//alert(country.value);
		//alert(txt);
		//alert(page);
	   strTrim = str.replace(/^(\s*)/g,"");
		if(strTrim.length > 2)
		{
			//alert(strTrim.length);
			if(page == 'volunteer')
			{
				document.getElementById('divloader1').style.display ='block';
			} else {
          			document.getElementById('divloader').style.display ='block';
			}
		}

		var stateId = document.getElementById(state).value;  
		//alert(stateId);
	    var countryId = document.getElementById(country).value;
		//alert(countryId);
		var strURL="findCity.php?country="+countryId+"&state="+stateId+"&q="+str+"&page="+page;		
		//alert(strURL);
		var req = getXMLHTTP();
		//alert(req.responseText);

		
		if (req) {
			req.onreadystatechange = function() {
				if (req.readyState == 4) {				
					if (req.status == 200) {	
						if(req.responseText!="")
						{
							
						}
						document.getElementById(txt).innerHTML=req.responseText;
						//alert(document.getElementById(txt).innerHTML);
						/*document.getElementById('isdph').style.display='none';
						document.getElementById('isdph1').style.display='none';*/
					if(document.getElementById(txt).innerHTML!="")
					{
						
						if(page == 'volunteer')
						{
							document.getElementById('divloader1').style.display ='none';
						} else {
	                   		document.getElementById('divloader').style.display ='none';
						}
						document.getElementById('divloader').style.display ='none';
					}



					} else {
						
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}
		
				//document.getElementById(txtName).focus();
				//return false;
	}
		
function gethdValue(value,hidden)
{	
	var ddlControl2=document.getElementById(value);
	var countryvalue=ddlControl2.options[ddlControl2.selectedIndex].text;
	//alert(countryvalue);
	document.getElementById(hidden).value=countryvalue;
}