function sm(n,x) {
	if (document.getElementById(n)) {
		document.getElementById(n).style.display='inline';
	}
	x.style.display='none';
}

function map(name,w,h){
  if (window.msgWindow) { if (!msgWindow.closed) msgWindow.close ()};
	prop="toolbar=no,scrollbars=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=" + w + ",height=" + h;
	msgWindow=window.open("","winpic",prop);
  	pm="<center><img src='" + name + "' border='0' onclick='window.close();' title='нажмите, чтобы закрыть' alt='нажмите, чтобы  закрыть'><\center>";
    msgWindow.document.write(pm);
    msgWindow.document.close();
}

function gcookie(n){
	n+='='; c=document.cookie;
	if (c.length > 0){
		o=c.indexOf(n);
		if (o!=-1){
			o+=n.length;e=c.indexOf(';',o);
			if (e==-1) e=c.length;
			return unescape(c.substring(o,e))
		}
	}
	return '';
}

function send_order_form() {
	JsHttpRequest.query('/js/jshttprequest/_order.php', 
		{ 
		'username': document.getElementById('username').value,
		'phone': document.getElementById('phone').value,
		'email': document.getElementById('email').value,
		'comments': document.getElementById('comments').value,
		'rnd': Math.random() },
		function(result,errors) { 
			if (result['ok']=='ok') {
				document.getElementById('order_form').innerHTML='<br><br><b style=color:green;font-size:14pt;>&nbsp;&nbsp;&nbsp;Спасибо! Ваша заявка отправлена.<br>&nbsp;&nbsp;&nbsp;Мы свяжемся с вами в ближайшее время.</b><br>';
			} else {
				if (result['alert']) { alert(result['alert']); }
			}
	}, false);
}

window.onload = function() {
	if (gcookie('bc_order')!="" && document.URL.indexOf('/basket/')==-1) {
		document.getElementById('basket').style.paddingTop='25px';
		document.getElementById('basket').innerHTML='<center><b style=font-size:14pt;color:#3D8716;>Пожалуйста, не забудьте <a href=/basket/ style=font-size:14pt;color:red;>отправить заявку</a> на выбранные заезды в лагеря.</b></center>';
	}
}
