function _escape(str) {
        return str.replace(/\+/g, "%2B");
}

function loadSub(cat_id) {
var xmlHttp;

try  {
  xmlHttp=new XMLHttpRequest();
} catch (e) {
  try {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }

  xmlHttp.onreadystatechange=function() {
    if(xmlHttp.readyState==4) {
      response=xmlHttp.responseText;

	  elem = document.getElementById('content_for_layout');
	  elem.innerHTML = response;
	  $('#partImage').lightBox({
		fixedNavigation:false,
		overlayOpacity: 0.8,
		containerResizeSpeed: 400
	  });

      }
    }

  xmlHttp.open("GET","view_category.php?ajax=y&cat_id="+cat_id,true);
  xmlHttp.setRequestHeader('If-Modified-Since', 'Wed, 15 Nov 1995 00:00:00 GMT');
  xmlHttp.send(null);
}

function add(curr) {

	queue.push(curr);

	e('back').innerHTML = '<a href="#" onclick="back(1)"><< Wstecz <<</a>'

}

function back(n) {

	hide(curr);

	e(curr.substring(0,3)).innerHTML='';

	e(curr.substring(0,3)).style.display = 'none';

	for(i=0;i<n;i++) {

		queue.pop();

	}

	curr=queue[queue.length-1];

	show(curr);

	if(curr=="kats" || curr=="catooo") {

		e('back').innerHTML = '<a href="javascript:history.back();"><< Wstecz <<</a>';

	}

	return false;

}