// JavaScript Document
function slice_by_space(str, num)
	{
		var str = "";
		alert(str.length);
		for(i=num;i>0;i--)
		{
			if(str[i] == ' '){str = str.slice(0, i); found = true; break;}
		}
		if(found != true)
		{
			if(str.length < num)
			{
				str = str.slice(0, str.length);
			}
				else
			{
				str = str.slice(0, num);
			}
		}
	  return str;
	}
createAJAX = function() {
		try {
			this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (err) {
				this.xmlhttp = null;
			}
		}
		if(!this.xmlhttp && typeof XMLHttpRequest != "undefined")
			this.xmlhttp = new XMLHttpRequest();
		if (!this.xmlhttp){
			this.failed = true; 
		}
	};
	
	function nop(){var i =i++;};

function hide_el(el) {document.getElementById(el).style.display='none';};
function show_el(el) {document.getElementById(el).style.display='block';};
function jq_hide_el(el) {$(el).css({display:"none"});};
function jq_show_el(el) {$(el).css({display:"block"});};

/////////////////////////////////////////////////////////////////////////////////////
							function do_cookie(id_tov, count_)
							{
								zapros = 'mode=cookie'+'&id_tov='+id_tov+'&count='+count_+'&str='+getCookie('cart');
								post_(zapros,'engine.php');
							}
                            function setCookie(name, value, expires, path, domain, secure) {
							  document.cookie = name + "=" + escape(value) +
								((expires) ? "; expires=" + expires : "") +
								((path) ? "; path=" + path : "") +
								((domain) ? "; domain=" + domain : "") +
								((secure) ? "; secure" : "");
							}

function setCookie3(name, value) {
   /* Счетчик числа посещений и
определение срока хранения в 1 год. */
   var expireDate = new Date();

   // Установка даты автоматического удаления.
   expireDate.setYear(expireDate.getYear() + 1);
   // Сохранение числа посещений.
   document.cookie = name+"="+escape(value)+ ";expires="+expireDate.toGMTString()+";"; 
   }

function setCookie2 (name, value) {
        var argv = setCookie2.arguments;
        var argc = setCookie2.arguments.length;
        var expires = (argc > 2) ? argv[2] : null;
        var path = (argc > 3) ? argv[3] : null;
        var domain = (argc > 4) ? argv[4] : null;
        var secure = (argc > 5) ? argv[5] : false;
        document.cookie = name + "=" + escape (value) +
                ((expires == null) ? "" : ("; expires=" +
expires.toGMTString())) +
                ((path == null) ? "" : ("; path=" + path)) +
                ((domain == null) ? "" : ("; domain=" + domain)) +
                ((secure == true) ? "; secure" : "");
}
							function getCookie(name) {
								var cookie = " " + document.cookie;
								var search = " " + name + "=";
								var setStr = null;
								var offset = 0;
								var end = 0;
								if (cookie.length > 0) {
									offset = cookie.indexOf(search);
									if (offset != -1) {
										offset += search.length;
										end = cookie.indexOf(";", offset)
										if (end == -1) {
											end = cookie.length;
										}
										setStr = unescape(cookie.substring(offset, end));
									}
								}
								return(setStr);
							}
	function msg_to_user(text_, hide_time, place_to_view)
	{
		var div = document.createElement("div");
		div.setAttribute("id", "msg_span");
		div.setAttribute("style", "font-size: 14px; font-weight: bold; color: red; min-width: 200px; min-height: 40px; background: #D8E6FA; position:fixed; top:35%; left: 45%; border: 1px solid blue; padding:10px;");
		div.setAttribute("align", "center");
		yyy = el(place_to_view);
		yyy.appendChild(div);
		div.innerHTML=text_;
		$('#msg_span').hide();
		$('#msg_span').fadeIn();
		setTimeout('$("#msg_span").fadeOut();', hide_time);
		setTimeout('$("#msg_span").remove();', hide_time+200);		
	}
String.prototype.stripTags = function() {
  return this.replace(/<\/?[^>]+>/g, '');
};
function slice_by_space(str, num)
{
	for(i=num;i>0;i--)
	{
		if(str[i] == ' '){str = str.slice(0, i); break;}
	}
  return str;
}
