var czasreklamy = "10"

/*function czas() {
window.status="Strona przeladuje sie automatycznie za "+ czasreklamy+" s";
    if (czasreklamy > 0) {
        czasreklamy--
    }
    else if(czasreklamy==0){
	window.status="Pofrabat";
        getData('podstrony/ofirmie.txt', 'ekran');
	return false;
    }
	if (czasreklamy < 0) {
    window.status="Pofrabat";
    }

setTimeout('czas()',1000)

}
czas()*/

var ObiektXMLHttp = false;
	if (window.XMLHttpRequest)
		{ 
		ObiektXMLHttp = new XMLHttpRequest(); 
		}
	else if (window.ActiveXObject) 
		{ 
		ObiektXMLHttp = new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
	function getData(zrodlo, cel) 
		{
			if(ObiektXMLHttp) 
				{
				var cel = document.getElementById(cel);
				ObiektXMLHttp.open("GET", zrodlo);
				ObiektXMLHttp.onreadystatechange = function()
					{
					if (ObiektXMLHttp.readyState == 4)
						{
						cel.innerHTML = ObiektXMLHttp.responseText;
						}
					} 
				ObiektXMLHttp.send(null);
				} 
		} 
$(document).ready(function() {
	var m1=1;
	var m2=0;
	var m3=0;
	var m4=0;
	var m5=0;
	$("#m1").stop().animate({backgroundPosition: '0px 0px'}, 150);

	$("#m1").mouseenter(function()
	{
		$(this).stop().animate({backgroundPosition: '0px 0px'}, 150);
	});
		
		
	$("#m1").mouseleave(function() {
	if(m1==0){
		$(this).stop().animate({backgroundPosition: '0px -36px'}, 150);
		$(this).find("span")
		.stop()
		.animate({marginTop: "-3"}, 80)
		.animate({marginTop: "0"}, 80);
	}
	});
	
	$("#m1").focus(function(){
	$(this).blur();
	});
	
	$("#m1").click(function(){
		
		m1=1;
		m2=m3=m4=m5=0;
		$("#m2").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m3").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m4").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m5").stop().animate({backgroundPosition: '0px -36px'}, 150);
		getData('podstrony/ofirmie.txt', 'ekran');
		czasreklamy="-1";
		return false;
	
	});
	
	$("#m2").mouseenter(function() {
		$(this).stop().animate({backgroundPosition: '0px 0px'}, 150);
		});
		
		
	$("#m2").mouseleave(function() {
	if(m2==0){
		$(this).stop().animate({backgroundPosition: '0px -36px'}, 250);
		$(this).find("span")
		.stop()
		.animate({marginTop: "-3"}, 80)
		.animate({marginTop: "0"}, 80);
		}
		});
	
	$("#m2").focus(function(){
	$(this).blur();
	});
	
	$("#m2").click(function(){
		
		m2=1;
		m1=m3=m4=m5=0;
		$("#m1").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m3").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m4").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m5").stop().animate({backgroundPosition: '0px -36px'}, 150);
		getData('podstrony/kompensacja.txt', 'ekran');
		czasreklamy="-1";
		return false;
	});	
		
	$("#m3").mouseenter(function() {
		$(this).stop().animate({backgroundPosition: '0px 0px'}, 150);
		});
		
		
	$("#m3").mouseleave(function() {
	if(m3==0){
		$(this).stop().animate({backgroundPosition: '0px -36px'}, 150);
		$(this).find("span")
		.stop()
		.animate({marginTop: "-3"}, 80)
		.animate({marginTop: "0"}, 80);
		}
		});
	
	$("#m3").focus(function(){
	$(this).blur();
	});
	
	$("#m3").click(function(){
		
		m3=1;
		m1=m2=m4=m5=0;
		$("#m1").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m2").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m4").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m5").stop().animate({backgroundPosition: '0px -36px'}, 150);	
		getData('podstrony/pcb.txt', 'ekran');
		czasreklamy="-1";
		return false;
	
	});		

	$("#m4").mouseenter(function() {
		$(this).stop().animate({backgroundPosition: '0px 0px'}, 150);
		});
		
		
	$("#m4").mouseleave(function() {
	if(m4==0){
		$(this).stop().animate({backgroundPosition: '0px -36px'}, 150);
		$(this).find("span")
		.stop()
		.animate({marginTop: "-3"}, 80)
		.animate({marginTop: "0"}, 80);
		}
		});
	
	$("#m4").focus(function(){
	$(this).blur();
	});
	
	$("#m4").click(function(){
		
		m4=1;
		m1=m2=m3=m5=0;
		$("#m1").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m2").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m3").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m5").stop().animate({backgroundPosition: '0px -36px'}, 150);	
		getData('podstrony/magtech.txt', 'ekran');
		czasreklamy="-1";
		return false;
	
	});	

	$("#m5").mouseenter(function() {
		$(this).stop().animate({backgroundPosition: '0px 0px'}, 150);
		});
		
		
	$("#m5").mouseleave(function() {
	if(m5==0){
		$(this).stop().animate({backgroundPosition: '0px -36px'}, 150);
		$(this).find("span")
		.stop()
		.animate({marginTop: "-3"}, 80)
		.animate({marginTop: "0"}, 80);
		}
		});
	
	$("#m5").focus(function(){
	$(this).blur();
	});
	
	$("#m5").click(function(){
		
		m5=1;
		m1=m2=m3=m4=0;
		$("#m1").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m2").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m3").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m4").stop().animate({backgroundPosition: '0px -36px'}, 150);
		getData('podstrony/kontakt.txt', 'ekran');
		czasreklamy="-1";
		return false;
		

		
	});	
	
	//----------------------menu dol--------------------------
	
	$("#m1d").focus(function(){
	$(this).blur();
	});
	
	$("#m1d").click(function(){
		
		m1=1;
		m2=m3=m4=m5=0;
		$("#m1").stop().animate({backgroundPosition: '0px 0px'}, 150);
		$("#m2").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m3").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m4").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m5").stop().animate({backgroundPosition: '0px -36px'}, 150);
		getData('podstrony/ofirmie.txt', 'ekran');
		czasreklamy="-1";
		return false;
	});
	
	$("#m2d").focus(function(){
	$(this).blur();
	});
	
	$("#m2d").click(function(){
		
		m2=1;
		m1=m3=m4=m5=0;
		$("#m1").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m2").stop().animate({backgroundPosition: '0px 0px'}, 150);
		$("#m3").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m4").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m5").stop().animate({backgroundPosition: '0px -36px'}, 150);
		getData('podstrony/kompensacja.txt', 'ekran');
		czasreklamy="-1";
		return false;
	});
	
	$("#m3d").focus(function(){
	$(this).blur();
	});
	
	$("#m3d").click(function(){
		
		m3=1;
		m1=m2=m4=m5=0;
		$("#m1").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m2").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m3").stop().animate({backgroundPosition: '0px 0px'}, 150);
		$("#m4").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m5").stop().animate({backgroundPosition: '0px -36px'}, 150);
		getData('podstrony/pcb.txt', 'ekran');
		czasreklamy="-1";
		return false;
	});
	
	$("#m4d").focus(function(){
	$(this).blur();
	});
	
	$("#m4d").click(function(){
		
		m4=1;
		m1=m2=m3=m5=0;
		$("#m1").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m2").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m3").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m4").stop().animate({backgroundPosition: '0px 0px'}, 150);
		$("#m5").stop().animate({backgroundPosition: '0px -36px'}, 150);
		getData('podstrony/magtech.txt', 'ekran');
		czasreklamy="-1";
		return false;
	});
	
	$("#m5d").focus(function(){
	$(this).blur();
	});
	
	$("#m5d").click(function(){
		
		m5=1;
		m1=m2=m3=m4=0;
		$("#m1").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m2").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m3").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m4").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m5").stop().animate({backgroundPosition: '0px 0px'}, 150);
		getData('podstrony/kontakt.txt', 'ekran');
		czasreklamy="-1";
		return false;
	});
	
//-----------------------------animacja-podstrony ------------------------------//
$("#ofirmielink1").live('click', function() {
	
		m2=1;
		m1=m3=m4=m5=0;
		$("#m1").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m2").stop().animate({backgroundPosition: '0px 0px'}, 150);
		$("#m3").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m4").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m5").stop().animate({backgroundPosition: '0px -36px'}, 150);
		getData('podstrony/kompensacja.txt', 'ekran');
		return false;
});

$("#pcblink1").live('click', function() {
	
		m3=1;
		m1=m2=m4=m5=0;
		$("#m1").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m2").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m3").stop().animate({backgroundPosition: '0px 0px'}, 150);
		$("#m4").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m5").stop().animate({backgroundPosition: '0px -36px'}, 150);
		getData('podstrony/pcb9.txt', 'ekran');
		return false;
});
$("#ofirmielink2").live('click', function() {
	
		m3=1;
		m1=m2=m4=m5=0;
		$("#m1").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m2").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m3").stop().animate({backgroundPosition: '0px 0px'}, 150);
		$("#m4").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m5").stop().animate({backgroundPosition: '0px -36px'}, 150);
		getData('podstrony/pcb.txt', 'ekran');
		return false;
});
$("#ofirmielink3").live('click', function() {
		
		m4=1;
		m1=m2=m3=m5=0;
		$("#m1").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m2").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m3").stop().animate({backgroundPosition: '0px -36px'}, 150);
		$("#m4").stop().animate({backgroundPosition: '0px 0px'}, 150);
		$("#m5").stop().animate({backgroundPosition: '0px -36px'}, 150);
		getData('podstrony/magtech.txt', 'ekran');
		return false;
	});



	
});

