function create_zamforma()
{
	var xrequest;
	var html_body;
	function xmlh()
	{
		var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
		if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
			xmlhttp = new XMLHttpRequest();
		}
		return xmlhttp;
	}
	var mce=["stycznia","lutego","marca","kwietnia",
		"maja","czerwca","lipca","sierpnia",
		"wrze\u015Bnia","pa\u017Adziernika","listopada","grudnia"];
	function m2(a)
	{
		return (a<10)?('0'+a):a;
	}
	function replaceby(zczego,naco,html)
	{
		if (!html) {
			var d=document.createElement('span');
			d.appendChild(document.createTextNode(naco));
			naco=d.innerHTML;
		}
		var n=html_body.indexOf(zczego);
		if (n<0) return;
	
		html_body=html_body.substr(0,n)+naco+html_body.substr(n+zczego.length);
		
	}
	function gval(el)
	{
		switch(el.nodeName.toLowerCase()) {
			case 'input':
			return el.value;
			case 'textarea':
			return el.value.replace(/\n/g,'<br>\n');
			
			case 'select':
			return el.options[el.selectedIndex].text;
		}
		return '-';
	}
	xrequest=xmlh();
	if (!xrequest) return true;
	xrequest.open("GET","/js/zamzam.html",false);
	xrequest.send(null);
	html_body=xrequest.responseText;
	if (html_body.indexOf('#usluga#')<0) return true;
	var s;
	try {
		s=create_usluga();
	}
	catch(e) {
		return true;
	}
	
	var sa=html_body.match(/#[a-z]+#/g);
	var i;
	if (sa) {
		for(i=0;i<sa.length;i++) {
			var st=sa[i].replace(/#/g,'');
			if (st == 'usluga') continue;
			if (st == 'odbior') continue;
			if (st == 'cajmer') continue;
			var el=document.getElementById(st);
			if (el) replaceby(sa[i],el.value);
		}
	}
	replaceby('#usluga#',s,true);
	var zeht=new Date();
	var str=document.getElementById('adrmiasto').value+', '+
		zeht.getDate()+' '+mce[zeht.getMonth()]+' '+zeht.getFullYear()+
		'r, godz. '+m2(zeht.getHours())+':'+m2(zeht.getMinutes());
	replaceby('#cajmer#',str);
	var ty=document.getElementById('odbior');
	if (ty.selectedIndex<ty.options.length-1) str=gval(ty);
	else str=gval(document.getElementById('odbiorinny'));
	replaceby('#odbior#',str);
	
	
	var inputy=document.getElementById('kalkform').getElementsByTagName('input');
	for (i=0;i<inputy.length;i++) {
		var c=inputy[i].getAttribute('name');
		if (c && c == 'htmlversion') {
			inputy[i].value=html_body;
			return true;
		}
	}
	var div=document.createElement('div');
	div.innerHTML='<input type="hidden" name="htmlversion">';
	div=div.firstChild;
	document.getElementById('kalkform').appendChild(div);
	div.value=html_body;
	return true;
	
	

}

