var XMLHttp=getXMLHttp();

function getXMLHttp() 
{
   var XMLHttp=null;
   if (window.XMLHttpRequest) 
   {
      try { XMLHttp=new XMLHttpRequest(); } 
      catch(e) { }
   } 
   else if(window.ActiveXObject) 
   {
      try { XMLHttp=new ActiveXObject("Msxml2.XMLHTTP"); } 
      catch(e) 
	  {
         try { XMLHttp=new ActiveXObject("Microsoft.XMLHTTP"); } 
   	     catch(e) { }
      }
   }
   return XMLHttp;
}

function getData() // календарь
{
	var l=document.getElementById('id_l').options[document.getElementById('id_l').selectedIndex].value;
	var w=document.getElementById('id_w').options[document.getElementById('id_w').selectedIndex].value;
	var h=document.getElementById('id_h').options[document.getElementById('id_h').selectedIndex].value;
	var p=document.getElementById('id_p').options[document.getElementById('id_p').selectedIndex].value;
	var kolvo=document.getElementById('id_kolvo').value;
	var kolvo_r_obj=document.calculator.kolvo_r;
	var kolvo_r="";
	for(var i=0;i<kolvo_r_obj.length; i++)
		if (kolvo_r_obj[i].checked) kolvo_r=kolvo_r_obj[i].value;
	var url='calculator.php?l='+l+'&w='+w+'&h='+h+'&p='+p+'&kolvo='+kolvo+'&kolvo_r='+kolvo_r;	
	XMLHttp.open("GET", url, true);
	XMLHttp.onreadystatechange=return_data;
   XMLHttp.send(null);
}

function return_data()
{
	if(XMLHttp.readyState==4) 
   {         
      if(XMLHttp.status==200) 
      {      
			var text=XMLHttp.responseText;
			var p1=document.getElementById("container_p1");
			var p2=document.getElementById("container_p2");
			var p3=document.getElementById("container_p3");
			var p4=document.getElementById("container_p4");
			var p5=document.getElementById("container_p5");
			var p6=document.getElementById("container_p6");
			var p7=document.getElementById("container_p7");
			var p8=document.getElementById("container_p8");
			var sht=document.getElementById("container_sht");
			var itogo=document.getElementById("container_itogo");			
			var mas=text.split('|');			
			p1.innerHTML=mas[0];
			p2.innerHTML=mas[1];
			p3.innerHTML=mas[2];
			p4.innerHTML=mas[3];
			p5.innerHTML=mas[4];
			p6.innerHTML=mas[5];
			p7.innerHTML=mas[6];
			p8.innerHTML=mas[7];
			sht.innerHTML=mas[8];
			itogo.innerHTML=mas[9];
      }
   }	
}
