
function CheckFields(){

var valid=true;
var Chars = "0123456789";
var Phones = "0123456789";
var mess="";
var Mail = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_@.-"; 
var FIO = " ёйцукенгшщзхъэждлорпавыфячсмитьбюЁЙЦУКЕНГШЩЗХЪЭЖДЛОРПАВЫФЯЧСМИТЬБЮABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; 
var Mail2 = "@"; 
var Mail3 = ".";  

var nn=String.fromCharCode(10)+String.fromCharCode(13);


	if(document.FReg.Name.value  == '') {
		mess=mess+'Вы не ввели ИМЯ'+nn; valid = false;
		}
	if(document.FReg.Email.value  == '') {
		mess=mess+'Вы не ввели E-MAIL'+nn; valid = false;
		}
	if(document.FReg.Login.value  == '') {
		mess=mess+'Вы не ввели ЛОГИН'+nn; valid = false;
		}
	if(document.FReg.Password.value  == '') {
		mess=mess+'Вы не ввели ПАРОЛЬ'+nn; valid = false;
		}



if(mess!=""){alert(mess);}
return valid;
}




function UploadDop(d, s){
	document.FormU.Dop.value=d;
	$("#uuu").text("Загрузить дополнительную фотографию для работы \""+s+"\"");
	$("#uuu2").html("<input type='submit' class=but value='Загрузить'>&nbsp;&nbsp;&nbsp;<input type='button' onclick='UploadCancel();' class=but value='Отмена'>");
	$(".upl").css("display", "none");
}
function UploadCancel(){
	document.FormU.Dop.value=0;
	$("#uuu").text("Загрузить новую работу");
	$("#uuu2").html("<input type='submit' class=but value='Добавить работу'>");
	$(".upl").css("display", "block");
}
function MoveEdit(d){
	$("#"+d).animate({"left": "+=890"}, 1000, function(){
		$("#"+d).animate({"left": "+=10"}, 500);
	});
}
function MoveEditCancel(d){
	$("#"+d).animate({"left": "-=10"}, 500, function(){
		$("#"+d).animate({"left": "-=890"}, 700);
	});
}





// stores the reference to the XMLHttpRequest object
var xmlHttp = createXmlHttpRequestObject(); 
var gPid;

// retrieves the XMLHttpRequest object
function createXmlHttpRequestObject() 
{	
  // will store the reference to the XMLHttpRequest object
  var xmlHttp;
  // if running Internet Explorer
  if(window.ActiveXObject)
  {
    try
    {
      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e) 
    {
      xmlHttp = false;
    }
  }
  // if running Mozilla or other browsers
  else
  {
    try 
    {
      xmlHttp = new XMLHttpRequest();
    }
    catch (e) 
    {
      xmlHttp = false;
    }
  }
  // return the created object or display an error message
  if (!xmlHttp)
 
    alert("Error creating the XMLHttpRequest object.");
  else 
    return xmlHttp;
}

// make asynchronous HTTP request using the XMLHttpRequest object 
function GetContacts(uid, tip)
{

      // proceed only if the xmlHttp object isn't busy
      if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
      {
        // execute the quickstart.php page from the server
        xmlHttp.open("GET", "_get.php?uID="+uid+"&Tip="+tip, true);  
      
        // define the method to handle server responses
        xmlHttp.onreadystatechange = handleServerResponse;
        // make the server request
        xmlHttp.send(null);
      }
}

// executed automatically when a message is received from the server
function handleServerResponse() 
{
  // move forward only if the transaction has completed
  if (xmlHttp.readyState == 4) 
  {
    // status of 200 indicates the transaction completed successfully
    if (xmlHttp.status == 200) 
    {
      // extract the XML retrieved from the server
      xmlResponse = xmlHttp.responseXML;
      // obtain the document element (the root element) of the XML structure
     // xmlDocumentElement = xmlResponse.documentElement;
      // get the text message, which is in the first child of
      // the the document element
	  
	  if(!xmlResponse || !xmlResponse.documentElement){
	  	//alert("Неверная структура xml "+xmlHttp.responseText);
	  }
	
	  
	  xmlRoot = xmlResponse.documentElement;
  
	  var textArray=xmlRoot.getElementsByTagName("txt");
	  nm=textArray.item(0).firstChild.data;
	  
	  var tipArray=xmlRoot.getElementsByTagName("tip");
	  tip=tipArray.item(0).firstChild.data;
	  
	  if(tip==1){document.getElementById("umail").innerHTML =nm;}
	  else{document.getElementById("uphone").innerHTML =nm;}
	  
      // restart sequence
    } 
    // a HTTP status different than 200 signals an error
    else 
    {
      alert("There was a problem accessing the server: " + xmlHttp.statusText);
    }
  }
}
