var ns6=document.getElementById&&!document.all;
var ie4=document.all;
var ns4=document.layers;
var opp=false;

if (document.all){ if (navigator.userAgent.search('Opera')>=0){ ie4=false; opp=true;} else {ie4=true; opp=false;}}



function setBackgroundColor (lay, color) {
		lay.style.backgroundColor=color;
						  }
						  
function setBackgroundImage (lay, url) {
		lay.style.backgroundImage=url;
						  }
function createCookie(name,value,days) {
	if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires=0";
	}
	else var expires = "0";
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function eraseCookie2(name) {
	alert(name);
	createCookie(name,"",-1);
}

function pokaz_prod(id,id_cat)
  {

//netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
//alert(history[0]);
  var xmlHttp;
  var xmlHttp2;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    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)
      {
	if(ns6) {       document.getElementById('producent_all').innerHTML=xmlHttp.responseText;}
	if(ie4 || opp) { document.all['producent_all'].innerHTML=xmlHttp.responseText; }
  	if(ns4) { document.layers['producent_all'].innerHTML=xmlHttp.responseText; }

		pokaz_status(0,id,0);
      }
      }

	xmlHttp.open("GET","office/producent_ajax.php?get_prod=1&id_prod="+ id +"&id_cat="+id_cat+"",true);
//	createCookie('back','index.php?id=15&id_prod='+id+'');
    xmlHttp.send(null);
  }
function pokaz_status(id,id_prod,id_cat)
  {
  var xmlHttp;
  var xmlHttp2;
	var back;
//	back=readCookie('back');
//alert(history[1]);
//	window.history.previous=back;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    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)
      {
	        document.getElementById('producent_status').innerHTML=xmlHttp.responseText;
      }
      }

	xmlHttp.open("GET","office/producent_ajax.php?get_status=1&id_prod="+ id_prod +"&id_cat="+id_cat+"&id_stuff="+id+"",true);
    xmlHttp.send(null);
  }


function show_category(id_prod,id_prod_cat)
  {
  var xmlHttp;
  var xmlHttp2;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    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)
      {
		while(!document.getElementById('srodeczek')) {setiTimeout(show_category(id_prod,id_prod_cat),300);return ;}
 
	        document.getElementById('srodeczek').innerHTML=xmlHttp.responseText;
//	if(ie4 || opp) { document.all['srodeczek'].innerHTML==xmlHttp.responseText; }
//  	if(ns4) { document.layers['srodeczek'].innerHTML==xmlHttp.responseText; }

		pokaz_status(0,id_prod,id_prod_cat);
      }
      }

	xmlHttp.open("GET","office/producent_ajax.php?get_prod_cat=1&id_prod="+ id_prod +"&id_prod_cat="+id_prod_cat+"",true);
    xmlHttp.send(null);
  }
function show_stuff(id,id_prod,id_prod_cat)
  {
  var xmlHttp;
  var xmlHttp2;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    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)
      {
	        document.getElementById('producent_all').innerHTML=xmlHttp.responseText;
	if(ie4 || opp) { document.all['producent_all'].innerHTML==xmlHttp.responseText; }
  	if(ns4) { document.layers['producent_all'].innerHTML==xmlHttp.responseText; }

		pokaz_status(id,id_prod,id_prod_cat);
      }
      }

	xmlHttp.open("GET","office/producent_ajax.php?get_stuff=1&id="+id+"&id_prod="+ id_prod +"&id_cat="+id_prod_cat+"",true);
    xmlHttp.send(null);
  }
function show_wojew(id)
  {
  var xmlHttp;
  var xmlHttp2;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    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)
      {
	        document.getElementById('wojew').innerHTML=xmlHttp.responseText;
	if(ie4 || opp) { document.all['wojew'].innerHTML==xmlHttp.responseText; }
  	if(ns4) { document.layers['wojew'].innerHTML==xmlHttp.responseText; }

      }
      }

	xmlHttp.open("GET","office/producent_ajax.php?get_wojew=1&id_woj="+id+"",true);
    xmlHttp.send(null);
  }


