var widoczne=0;
var e;
var r;
//ajax wczytywanie tresci dla menu z lewej
$(document).ready(function(){
	$(".button").click(function(){
	nazwa=$(this).attr("id");
	if(nazwa == "ezamowienia" )
		return false;
	$("#ezamowienia").animate({top:390});
	$("#misja").fadeOut();
	$("#wizja").fadeOut();
	$("#logo").fadeOut();
	$("#glowna").css({"visibility":"visible"});
	$('#trescStala').fadeOut();
	$('#tresc').fadeIn();
	$('#tresc').load(nazwa+'.txt');
	$('#glowna').css({"filter":"alpha(opacity=50)"});
	$('#glowna').css({"opacity":"0.5"});
	if(widoczne==0){
		$("#glowna").hide(0);
		$("#glowna").fadeIn(2000);
		widoczne=1;
	}
	return false;

});
});

$(document).ready(function(){
	$('#stacje').click(function(){
	$("#tresc").delegate("#stacje_boryszew","click",function(){
		$("#tresc").hide();
		$("#tresc").load("boryszew.txt");
		$("#tresc").fadeIn();
		$("#tresc").delegate(".klim","click",function(){
			nazwa=$(this).attr("id");
			$("#box1").load(nazwa+".txt");	
			if(navigator.appName=="Opera")
				$("#box1").animate({height:"370px"},"slow");
			else
				$("#box1").animate({height:"330px"},"slow");
			$("#close").css("visibility","visible");
			$("#box1").delegate("#close","click",function(){
				$("#close").css("visibility","hidden");
				$("#box1").animate({height:"0px"},"slow");
				$("#box1").load("blank.txt");				
				});
			});
		$("#tresc").delegate("#borygo_powrot","click",function(){
			$("#tresc").hide();
			$("#tresc").load("stacje.txt");
			$("#tresc").fadeIn();
			});
		return false;
		});
	});
});

$(document).ready(function(){
	$('#transport').click(function(){
	$("#tresc").delegate("#transport_boryszew","click",function(){
		$("#tresc").hide();
		$("#tresc").load("boryszew.txt");
		$("#tresc").fadeIn();
		$("#tresc").delegate(".klim","click",function(){
			nazwa=$(this).attr("id");
			$("#box1").load(nazwa+".txt");	
			if(navigator.appName=="Opera")
				$("#box1").animate({height:"370px"},"slow");
			else
				$("#box1").animate({height:"330px"},"slow");
			$("#close").css("visibility","visible");
			$("#box1").delegate("#close","click",function(){
				$("#close").css("visibility","hidden");
				$("#box1").animate({height:"0px"},"slow");
				$("#box1").load("blank.txt");				
				});
			});
		$("#tresc").delegate("#borygo_powrot","click",function(){
			$("#tresc").hide();
			$("#tresc").load("transport.txt");
			$("#tresc").fadeIn();
			});
		return false;
		});
	});
});

$(document).ready(function(){
	$('#hurtownie').click(function(){
	$("#tresc").delegate("#hurtownie_boryszew","click",function(){
		$("#tresc").hide();
		$("#tresc").load("boryszew.txt");
		$("#tresc").fadeIn();
		$("#tresc").delegate(".klim","click",function(){
			nazwa=$(this).attr("id");
			$("#box1").load(nazwa+".txt");	
			if(navigator.appName=="Opera")
				$("#box1").animate({height:"370px"},"slow");
			else
				$("#box1").animate({height:"330px"},"slow");
			$("#close").css("visibility","visible");
			$("#box1").delegate("#close","click",function(){
				$("#close").css("visibility","hidden");
				$("#box1").animate({height:"0px"},"slow");
				$("#box1").load("blank.txt");				
				});
			});
		$("#tresc").delegate("#borygo_powrot","click",function(){
			$("#tresc").hide();
			$("#tresc").load("hurtownie.txt");
			$("#tresc").fadeIn();
			});
		return false;
		});
	});
});

$(document).ready(function(){
	$('#serwisy').click(function(){
	$("#tresc").delegate("#serwisy_boryszew","click",function(){
		$("#tresc").hide();
		$("#tresc").load("boryszew.txt");
		$("#tresc").fadeIn();
		$("#tresc").delegate(".klim","click",function(){
			nazwa=$(this).attr("id");
			$("#box1").load(nazwa+".txt");	
			if(navigator.appName=="Opera")
				$("#box1").animate({height:"370px"},"slow");
			else
				$("#box1").animate({height:"330px"},"slow");
			$("#close").css("visibility","visible");
			$("#box1").delegate("#close","click",function(){
				$("#close").css("visibility","hidden");
				$("#box1").animate({height:"0px"},"slow");
				$("#box1").load("blank.txt");				
				});
			});
		$("#tresc").delegate("#borygo_powrot","click",function(){
			$("#tresc").hide();
			$("#tresc").load("serwisy.txt");
			$("#tresc").fadeIn();
			});
		return false;
		});
	});
});
//ajax wczytywanie tresci dla przyciskow-obrazkow
var nazwa='';
$(document).ready(function(){
	$(".menu").click(function(){
	nazwa=$(this).attr("id");
	
	$("#ezamowienia").animate({top:390},"slow");
	$("#misja").fadeOut();
	$("#wizja").fadeOut();
	$("#logo").fadeOut();
	$("#glowna").css({"visibility":"visible"});
	$('#trescStala').fadeOut();
	$('#tresc').fadeIn();
	if(nazwa == "serwisy" || nazwa == "stacje" || nazwa == "transport" || nazwa == "hurtownie" ) 
                $('#tresc').load('kontakt.txt');
        else
                $('#tresc').load(nazwa+'.txt');

	$('#glowna').css({"filter":"alpha(opacity=50)"});
	$('#glowna').css({"opacity":"0.5"});
	if(widoczne==0){
		$("#glowna").hide(0);
		$("#glowna").fadeIn(2000);
		widoczne=1;
	}
	return false;
});
});

//powrót na główną
$(document).ready(function(){
  $("#glowna").click(function(){
	$("#misja").fadeIn();
	$("#logo").fadeIn();
	$("#wizja").fadeIn();
	$(".menu").fadeIn();
	$("#glowna").fadeOut(500);
	$("#glowna").css({"visibility":"hidden"});
	widoczne=0;
	$("#tresc").fadeOut();
	$("#trescStala").fadeIn();
        $("#ezamowienia").animate({top:360},"fast");
  });
}); 
//przycisk dalej wstecz w dziale ofirmie
$(document).ready(function(){
	$("#ofirmie").click(function(){
	$("#tresc").delegate("#dalej","click",function(){
	$("#tresc").load("ofirmie2.txt");
	});
	$("#tresc").delegate("#wstecz","click",function(){
	$("#tresc").load("ofirmie.txt");
	});
});
});

$(document).ready(function(){
	$("#klimatyzacja").click(function(){
	$("#close").hide();
	$("#tresc").delegate(".klim","click",function(){
		nazwa=$(this).attr("id");
		$("#box").load(nazwa+".txt");	
		if(navigator.appName=="Opera")
			$("#box").animate({height:"570px"},"slow");
		else
			$("#box").animate({height:"530px"},"slow");
		$("#close").css("visibility","visible");
		$("#box").delegate("#close","click",function(){
			$("#close").css("visibility","hidden");
			$("#box").animate({height:"0px"},"slow");
		  	$("#box").load("blank.txt");				
			});
		});
	});
});
function bgChange(bg) {
document.getElementById('tlo').style.background="url("+bg+")";
}


var plik=' ';


function przesun(){
    $("#sklad_reszta").animate({top:360},"slow");
  }

function informacje(plik)
{
var xmlhttp;
przesun();
$('#sklad_jpg').fadeOut();

if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("infobox").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET",plik,true);
xmlhttp.send();
}
