
// stores the reference to the XMLHttpRequest object 
var xmlHttp = null;

// retrieves the XMLHttpRequest object 
function createXmlHttpRequestObject() 
{ 
  // if running Internet Explorer 
  if(window.ActiveXObject) 
  { 
    try 
    { 
      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 
    } 
    catch (e) 
    { 
      xmlHttp = false; 
    } 
  } 
  // if running Mozilla , Opera or other browsers 
  else 
  { 
    try 
    { 
      xmlHttp = new XMLHttpRequest(); 
    } 
    catch (e) 
    { 
      xmlHttp = false; 
    } 
  } 
    return xmlHttp; 
}




			
function CheCk_UseR(language){

   createXmlHttpRequestObject(); 
        var username_get = document.getElementById("username_i").value;
        var password_get = document.getElementById("password_i").value;

		      var random_id = Math.random() * 99999999
								
								var 	url = "process_userlogin.php?check_login=check_login&user_name_login=" + username_get + "&password_login=" + password_get + "&lang=fa" + "&random_id=" + random_id ;
								
         xmlHttp.open("GET",  	url , true); 
									
									
									var waiting = "<img src='Images/Users_loading.gif'>"
									xmlHttp.onreadystatechange = function() {
									
									if (xmlHttp.readyState == 1) { 
						     			 user_waiting.innerHTML = waiting ; 
													  document.getElementById("login_field").style.visibility = 'hidden';
															document.getElementById("login_field").style.display = 'none'
													  document.getElementById("user_waiting").style.visibility = 'visible';
															document.getElementById("user_waiting").style.display = ''
									 	} 
								else	if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { 
													  document.getElementById("user_waiting").style.visibility = 'hidden';
															document.getElementById("user_waiting").style.display = 'none'
														 //document.getElementById("all_mood").style.visibility = 'hidden';
														//	document.getElementById("all_mood").style.display = '';
													  document.getElementById("view_process").style.visibility = 'visible';
															document.getElementById("view_process").style.display = ''
													  document.getElementById("login_field").style.visibility = 'visible';
															document.getElementById("login_field").style.display = ''
														 //document.getElementById("login_field").style.position = 'absolute'
						     		  user_waiting.innerHTML = '' ; 
							        view_process.innerHTML = xmlHttp.responseText ; 

									 	} 
									} 
									xmlHttp.send(null); 
																	
  

}	
