 var xmlHttp = createXmlHttpObject() ;
  
function createXmlHttpObject()
{
	var xmlHttp;
	try
	{
		xmlHttp = new XMLHttpRequest();
		//alert('Соединение установленно'+xmlHttp);
	}
	catch(e)
	{

		var xmlHttpVersion =  new Array('MSXML2.XMLHTTP.6.0',
										'MSXML2.XMLHTTP.5.0',
										'MSXML2.XMLHTTP.4.0',
										'MSXML2.XMLHTTP.3.0',
										'MSXML2.XMLHTTP',
										'Microsoft XMLHTTP');
		for(var i = 0; i < xmlHttpVersion.length && !xmlHttp; i++)
		{
			try
			{
				xmlHttp = new ActiveXObject(xmlHttpVersion[i]);

			}
			catch(e){}
		}

   	}
   	if (!xmlHttp)
			alert("Невозможно создать объект XmlHttpRequest");
		else
			return xmlHttp;
}



function addFilesToNewOrder(fileid,orderid)
{
        if (xmlHttp)
        {
           try
           {
           //lert("addNewFileToForm.php?fileCount="+count);
               //alert(fileid);
               xmlHttp.open("Get","./include/myphoto_ajax.php?fileid="+fileid+"&orderid="+orderid,false);
               xmlHttp.onreadystatechange = resultOfAdding;
               xmlHttp.send(null);
               status= "Busy"


           }
           catch(e)
           {
              alert("Невозможно соедениться с сервером: "+e.toString());

           }
         } else alert('Невозможно отправить запрос серверу');    
}


function resultOfAdding()
{
   if (xmlHttp.readyState == 4)
    {
        if(xmlHttp.status == 200)
        {
            //try
            //{

                response = xmlHttp.responseText;
                //alert("show"+oldorderid2);
                status = "Free";
                 document.getElementById("show").innerHTML += "<p>" + response;


            //}
        //    catch(e)
            //{
            //    alert("Невозможно обработать заказ");

            //}

        }
    } 
    
}
function deleteFile(fileid)
{
        if (xmlHttp)
        {
           try
           {
           //lert("addNewFileToForm.php?fileCount="+count);
               //alert(fileid);
               xmlHttp.open("Get","./include/myphoto_ajax_delete.php?fileid="+fileid,false);
               xmlHttp.onreadystatechange = resultOfAdding;
               xmlHttp.send(null);
               status= "Busy"


           }
           catch(e)
           {
              alert("Невозможно соедениться с сервером: "+e.toString());

           }
         } else alert('Невозможно отправить запрос серверу');    
}

function resultOfAdding()
{
   if (xmlHttp.readyState == 4)
    {
        if(xmlHttp.status == 200)
        {
            //try
            //{

                response = xmlHttp.responseText;
                //alert("show"+oldorderid2);
                status = "Free";
                 document.getElementById("show").innerHTML += "<p>" + response;


            //}
        //    catch(e)
            //{
            //    alert("Невозможно обработать заказ");

            //}

        }
    } 
    
}



