function InsertChangePassword(id)
	{
		var id = id;
		var oldPass = document.getElementById("oldPass").value;
		var newPass = document.getElementById("newPass").value;
		var cNewPass = document.getElementById("cNewPass").value;
	    var xmlhttp1 = new cl_xmlHttpObject();
    	xmlhttp1.open("POST","submit_password.php?oldPass="+oldPass+"&newPass="+newPass+"&id="+id+"&cNewPass="+cNewPass,true);
        xmlhttp1.onreadystatechange = function()
    	{
    		
			 if (xmlhttp1.readyState < 4) {
 
                      document.getElementById('home_id').innerHTML = "<img src='images/working.gif'>Loading......";
					  //display_info(xmlhttp1.responseText);
  
                  }
				  else if(xmlhttp1.readyState ==4)
						{
							if(xmlhttp1.status==200)
							{
								get_message(xmlhttp1.responseText);//clear_message();
								ChangePassword();
								
							}
							else
							{
							display_info("An Error Occured:"+ xmlhttp1.statusText);
							}
						}
    	};
    xmlhttp1.send(null);
	}

	
	
	function ChangePassword(id)
	{   			
       	var id = id; 
		var xmlhttp1 = new cl_xmlHttpObject();				
		xmlhttp1.open("GET","changepassword.php?id="+id,true);
        xmlhttp1.onreadystatechange = function()
    	{
    		
			if (xmlhttp1.readyState <4) {
 
                      document.getElementById('home_id').innerHTML = "<img src='images/working.gif'>Loading......";
					  //display_info(xmlhttp1.responseText);
  
                  }
				  else if(xmlhttp1.readyState ==4)
						{
							if(xmlhttp1.status==200)
							{
								//alert('hiiiiiiiii');
								//clear_message();
								display_info(xmlhttp1.responseText);
								//document.getElementById('home_id').innerHTML = xmlhttp1.responseText;
							}
							else
							{
								display_info("An Error Occured:"+ xmlhttp1.statusText);
							}
						}
    	};

    xmlhttp1.send(null);
    }
	
	
	function ChangePassword1(id)
	{   clear_message();			
       	var id = id; 
		var xmlhttp1 = new cl_xmlHttpObject();				
		xmlhttp1.open("GET","changepassword.php?id="+id,true);
        xmlhttp1.onreadystatechange = function()
    	{
    		
			if (xmlhttp1.readyState <4) {
 
                      document.getElementById('home_id').innerHTML = "<img src='images/working.gif'>Loading......";
					  //display_info(xmlhttp1.responseText);
  
                  }
				  else if(xmlhttp1.readyState ==4)
						{
							if(xmlhttp1.status==200)
							{
								//alert('hiiiiiiiii');
								//clear_message();
								display_info(xmlhttp1.responseText);
								//document.getElementById('home_id').innerHTML = xmlhttp1.responseText;
							}
							else
							{
								display_info("An Error Occured:"+ xmlhttp1.statusText);
							}
						}
    	};

    xmlhttp1.send(null);
    }
	
	function CallCancel_Changepassword()
	{   			
       	//var URL; 
		//if(url == 'user')
		//{
		//	URL = 'user_list.php';	
		//}	
		
		var xmlhttp1 = new cl_xmlHttpObject();				
		xmlhttp1.open("GET","admincontent.php",true);
        xmlhttp1.onreadystatechange = function()
    	{
    		if (xmlhttp1.readyState <4) {
 
                      document.getElementById('home_id').innerHTML = "<img src='images/working.gif'>Loading......";
					  //display_info(xmlhttp1.responseText);
  
                  }
				  else if(xmlhttp1.readyState ==4)
						{
							if(xmlhttp1.status==200)
							{
								clear_message();
								display_info(xmlhttp1.responseText);
							}
							else
							{
							display_info("An Error Occured:"+ xmlhttp1.statusText);
							}
						}
    	};

    xmlhttp1.send(null);
    }




function trim(inputString) 
{
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   
   while (ch == " ") { 
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { 
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { 
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
   }
   return retValue;
}



function validateChangePassword(id)
{
	var id = id;
	form = document.changepassword;
	if(trim(form.oldPass.value)=='')
	{
		alert("Please Enter Old Password");
		form.oldPass.focus();
		return false;
		}
	if(trim(form.newPass.value)=='')
	{
		alert("Please Enter New Password");
		form.newPass.focus();
		return false;
		}	
	if(trim(form.cNewPass.value)=='')
	{
		alert("Please Enter Confirm Password");
		form.cNewPass.focus();
		return false;
		}	
	if(form.newPass.value!=form.cNewPass.value)
	{
		alert("New Password and Confirm Password are not matched ");
		form.cNewPass.focus()
		return false;
	}
	//form.action = "submit_changePassword.php";
	//form.submit();
	//return true;
	
	InsertChangePassword(id);
}	


