

/* funkcje dotyczace scrollbara */


/**************************************************
 * dom-drag.js
 * 09.25.2001
 * www.youngpup.net
 **************************************************
 * 10.28.2001 - fixed minor bug where events
 * sometimes fired off the handle, not the root.
 **************************************************/

var Drag = {

  obj : null,

  init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
  {
    o.onmousedown  = Drag.start;

    o.hmode      = bSwapHorzRef ? false : true ;
    o.vmode      = bSwapVertRef ? false : true ;

    o.root = oRoot && oRoot != null ? oRoot : o ;

    if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left   = "0px";
    if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top    = "0px";
    if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right  = "0px";
    if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";

    o.minX  = typeof minX != 'undefined' ? minX : null;
    o.minY  = typeof minY != 'undefined' ? minY : null;
    o.maxX  = typeof maxX != 'undefined' ? maxX : null;
    o.maxY  = typeof maxY != 'undefined' ? maxY : null;

    o.xMapper = fXMapper ? fXMapper : null;
    o.yMapper = fYMapper ? fYMapper : null;

    o.root.onDragStart  = new Function();
    o.root.onDragEnd  = new Function();
    o.root.onDrag  = new Function();
  },

  start : function(e)
  {
    var o = Drag.obj = this;
    e = Drag.fixE(e);
    var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
    var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
    o.root.onDragStart(x, y);

    o.lastMouseX  = e.clientX;
    o.lastMouseY  = e.clientY;

    if (o.hmode) {
      if (o.minX != null)  o.minMouseX  = e.clientX - x + o.minX;
      if (o.maxX != null)  o.maxMouseX  = o.minMouseX + o.maxX - o.minX;
    } else {
      if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
      if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
    }

    if (o.vmode) {
      if (o.minY != null)  o.minMouseY  = e.clientY - y + o.minY;
      if (o.maxY != null)  o.maxMouseY  = o.minMouseY + o.maxY - o.minY;
    } else {
      if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
      if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
    }

    document.onmousemove  = Drag.drag;
    document.onmouseup  = Drag.end;

    return false;
  },

  drag : function(e)
  {
    e = Drag.fixE(e);
    var o = Drag.obj;

    var ey  = e.clientY;
    var ex  = e.clientX;
    var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
    var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
    var nx, ny;

    if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
    if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
    if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
    if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);

    nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
    ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

    if (o.xMapper)    nx = o.xMapper(y)
    else if (o.yMapper)  ny = o.yMapper(x)

    Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
    Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
    Drag.obj.lastMouseX  = ex;
    Drag.obj.lastMouseY  = ey;

    Drag.obj.root.onDrag(nx, ny);
    return false;
  },

  end : function()
  {
    document.onmousemove = null;
    document.onmouseup   = null;
    Drag.obj.root.onDragEnd(  parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), 
                  parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));
    Drag.obj = null;
  },

  fixE : function(e)
  {
    if (typeof e == 'undefined') e = window.event;
    if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
    if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
    return e;
  }
};



/* =======================================================
* ypSimpleScroll
* 3/11/2001
* 
* http://www.youngpup.net/
* ======================================================= */

// Modified by Sergi Meseguer (www.zigotica.com) 04/2004
// Now it works with dragger and can use multiple instances in a page



ypSimpleScroll.prototype.scrollNorth = function(count) { this.startScroll(90, count) }
ypSimpleScroll.prototype.scrollSouth = function(count) { this.startScroll(270, count); }
ypSimpleScroll.prototype.scrollWest = function(count) { this.startScroll(180, count) }
ypSimpleScroll.prototype.scrollEast = function(count) { this.startScroll(10, count) }

ypSimpleScroll.prototype.startScroll = function(deg, count) {
  if (this.loaded){
  
    if (this.aniTimer) window.clearTimeout(this.aniTimer)
    this.overrideScrollAngle(deg)
    this.speed = this.origSpeed
    this.lastTime = (new Date()).getTime() - this.y.minRes
    this.aniTimer = window.setTimeout(this.gRef + ".scroll('"+deg+"','"+count+"')", this.y.minRes)
	
  }
}

ypSimpleScroll.prototype.endScroll = function() {
  if (this.loaded){
  
    window.clearTimeout(this.aniTimer)
    this.aniTimer = 0;
    this.speed = this.origSpeed
  
  }
}

ypSimpleScroll.prototype.overrideScrollAngle = function(deg) {
  if (this.loaded){
    deg = deg % 360
    if (deg % 90 == 0) {
      var cos = deg == 0 ? 1 : deg == 180 ? -1 : 0
      var sin = deg == 90 ? -1 : deg == 270 ? 1 : 0
    } 
    else {
      var angle = deg * Math.PI / 180
      var cos = Math.cos(angle)
      var sin = Math.sin(angle)
      sin = -sin
    }
    this.fx = cos / (Math.abs(cos) + Math.abs(sin))
    this.fy = sin / (Math.abs(cos) + Math.abs(sin))
    this.stopH = deg == 90 || deg == 270 ? this.scrollLeft : deg < 90 || deg > 270 ? this.scrollW : 0
    this.stopV = deg == 0 || deg == 180 ? this.scrollTop : deg < 180 ? 0 : this.scrollH
  }
}

ypSimpleScroll.prototype.overrideScrollSpeed = function(speed) {
  if (this.loaded) this.speed = speed
}


ypSimpleScroll.prototype.scrollTo = function(stopH, stopV, aniLen) {
  if (this.loaded){
    if (stopH != this.scrollLeft || stopV != this.scrollTop) {
      if (this.aniTimer) window.clearTimeout(this.aniTimer)
      this.lastTime = (new Date()).getTime()
      var dx = Math.abs(stopH - this.scrollLeft)
      var dy = Math.abs(stopV - this.scrollTop)
      var d = Math.sqrt(Math.pow(dx,2) + Math.pow(dy,2))
      this.fx = (stopH - this.scrollLeft) / (dx + dy)
      this.fy = (stopV - this.scrollTop) / (dx + dy)
      this.stopH = stopH
      this.stopV = stopV
      this.speed = d / aniLen * 1000
      window.setTimeout(this.gRef + ".scroll()", this.y.minRes)
    }
  }
}

ypSimpleScroll.prototype.jumpTo = function(nx, ny) { 
  if (this.loaded){
    nx = Math.min(Math.max(nx, 0), this.scrollW)
    ny = Math.min(Math.max(ny, 0), this.scrollH)
    this.scrollLeft = nx
    this.scrollTop = ny
    if (this.y.ns4)this.content.moveTo(-nx, -ny)
    else {
      this.content.style.left = -nx + "px"
      this.content.style.top = -ny + "px"
    }
  }
}

ypSimpleScroll.minRes = 10
ypSimpleScroll.ie = document.all ? 1 : 0
ypSimpleScroll.ns4 = document.layers ? 1 : 0
ypSimpleScroll.dom = document.getElementById ? 1 : 0
ypSimpleScroll.mac = navigator.platform == "MacPPC"
ypSimpleScroll.mo5 = document.getElementById && !document.all ? 1 : 0

ypSimpleScroll.prototype.scroll = function(deg,count) {
  this.aniTimer = window.setTimeout(this.gRef + ".scroll('"+deg+"','"+count+"')", this.y.minRes)
  var nt = (new Date()).getTime()
  var d = Math.round((nt - this.lastTime) / 1000 * this.speed)
  if (d > 0){
    var nx = d * this.fx + this.scrollLeft
    var ny = d * this.fy + this.scrollTop
    var xOut = (nx >= this.scrollLeft && nx >= this.stopH) || (nx <= this.scrollLeft && nx <= this.stopH)
    var yOut = (ny >= this.scrollTop && ny >= this.stopV) || (ny <= this.scrollTop && ny <= this.stopV)
    if (nt - this.lastTime != 0 && 
      ((this.fx == 0 && this.fy == 0) || 
      (this.fy == 0 && xOut) || 
      (this.fx == 0 && yOut) || 
      (this.fx != 0 && this.fy != 0 && 
      xOut && yOut))) {
      this.jumpTo(this.stopH, this.stopV)	  
      this.endScroll()
    }
    else {
      this.jumpTo(nx, ny)
      this.lastTime = nt
    }
  // (zgtc) now we also update dragger position:
  if(deg=='270')  theThumb[count].style.top = parseInt(((theThumb[count].maxY-theThumb[count].minY)*this.scrollTop/this.stopV)+theThumb[count].minY) + "px"; //ok nomes down
  if(deg=='90')  theThumb[count].style.top = parseInt(((theThumb[count].maxY-theThumb[count].minY)*this.scrollTop/this.scrollH)+theThumb[count].minY) + "px"; //ok nomes down
  }
}

function ypSimpleScroll(id, left, top, width, height, speed) {
  var y = this.y = ypSimpleScroll
  if (document.layers && !y.ns4) history.go(0)
  if (y.ie || y.ns4 || y.dom) {
    this.loaded = false
    this.id = id
    this.origSpeed = speed
    this.aniTimer = false
    this.op = ""
    this.lastTime = 0
    this.clipH = height
    this.clipW = width
    this.scrollTop = 0
    this.scrollLeft = 0
    this.gRef = "ypSimpleScroll_"+id
    eval(this.gRef+"=this")
    var d = document
    d.write('<style type="text/css">')
    d.write('#' + this.id + 'Container { left:' + left + 'px; top:' + top + 'px; width:' + width + 'px; height:' + height + 'px; clip:rect(0 ' + width + ' ' + height + ' 0); overflow:hidden; }')
    d.write('#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; }')
    d.write('#' + this.id + 'Content { left:' + (-this.scrollLeft) + 'px; top:' + (-this.scrollTop) + 'px; width:' + width + 'px; }')
    // (zgtc) fix to overwrite p/div/ul width (would be clipped if wider than scroller in css):
    d.write('#' + this.id + 'Container p, #' + this.id + 'Container div {width:' + parseInt(width-10) + 'px; }')
    d.write('</style>')
  }
}

ypSimpleScroll.prototype.load = function() {
  var d, lyrId1, lyrId2
  d = document
  lyrId1 = this.id + "Container"
  lyrId2 = this.id + "Content"
  this.container = this.y.dom ? d.getElementById(lyrId1) : this.y.ie ? d.all[lyrId1] : d.layers[lyrId1]
  this.content = obj2 = this.y.ns4 ? this.container.layers[lyrId2] : this.y.ie ? d.all[lyrId2] : d.getElementById(lyrId2)
  this.docH = Math.max(this.y.ns4 ? this.content.document.height : this.content.offsetHeight, this.clipH)
  this.docW = Math.max(this.y.ns4 ? this.content.document.width : this.content.offsetWidth, this.clipW)
  this.scrollH = this.docH - this.clipH
  this.scrollW = this.docW - this.clipW
  this.loaded = true
  this.scrollLeft = Math.max(Math.min(this.scrollLeft, this.scrollW),0)
  this.scrollTop = Math.max(Math.min(this.scrollTop, this.scrollH),0)
  this.jumpTo(this.scrollLeft, this.scrollTop)
}




// ==============================================================
// HANDLES SCROLLER/S
// Modified from Aaron Boodman http://webapp.youngpup.net/?request=/components/ypSimpleScroll.xml
// mixed ypSimpleScroll with dom-drag script and allowed multiple scrolelrs through array instances
// (c)2004 Sergi Meseguer (http://zigotica.com/), 04/2004:
// ==============================================================
var theHandle = []; var theRoot = []; var theThumb = []; var theScroll = []; var thumbTravel = []; var ratio = [];

function instantiateScroller(count, id, left, top, width, height, speed){
  if(document.getElementById) {
    theScroll[count] = new ypSimpleScroll(id, left, top, width, height, speed);
  }
}

function createDragger(count, handler, root, thumb, minX, maxX, minY, maxY){
    var buttons = '<div class="up" id="up'+count+'">'+
                  '<a href="#" onmouseover="theScroll['+count+'].scrollNorth(\''+count+'\')" '+
                  'onmouseout="theScroll['+count+'].endScroll()" onclick="return false;">'+
                  '<img src="template/img/textScrollUp.gif" width="20" height="20" style="height:20px;width:20px;"></a></div>'+
                  '<div class="dn"  id="dn'+count+'"">'+
                  '<a href="#" onmouseover="theScroll['+count+'].scrollSouth(\''+count+'\')" '+
                  'onmouseout="theScroll['+count+'].endScroll()" onclick="return false;">'+
                  '<img src="template/img/textScrollDown.gif" width="20" height="20" style="height:20px;width:20px;"></a></div>'+
                  '<div class="thumb" id="'+thumb+'" style="left: 135px; top: 20px;">'+
                  '<img src="template/img/brownThumb.gif" width="20" height="20" style="height:20px;width:20px;"></div>';
    
    
    document.getElementById(root).innerHTML = buttons + document.getElementById(root).innerHTML;

    theRoot[count]   = document.getElementById(root);
    theThumb[count]  = document.getElementById(thumb);
    var thisup = document.getElementById("up"+count);
    var thisdn = document.getElementById("dn"+count);
	
	//alert(navigator.appName);
	
	if ((navigator.appName == 'Netscape')||(navigator.appName == 'Opera'))
		theThumb[count].style.left = parseInt(minX+20) + "px";
	else	
		theThumb[count].style.left = parseInt(minX+15) + "px";
    thisup.style.left = parseInt(minX+15) + "px";
    thisdn.style.left = parseInt(minX+15) + "px";
    theThumb[count].style.border =0;
    theThumb[count].style.top = parseInt(minY) + "px";
    thisup.style.top = 0 + "px";
    thisdn.style.top = parseInt(minY+maxY) + "px";
    //thisdn.style.top = 20 + "px";

    theScroll[count].load();

    //Drag.init(theHandle[count], theRoot[count]); //not draggable on screen
	if ((navigator.appName == 'Netscape')||(navigator.appName == 'Opera'))
		Drag.init(theThumb[count], null, minX+20, maxX+20, minY, maxY);
	else
		Drag.init(theThumb[count], null, minX+15, maxX+15, minY, maxY);
    
    // the number of pixels the thumb can travel vertically (max - min)
    thumbTravel[count] = theThumb[count].maxY - theThumb[count].minY;

    // the ratio between scroller movement and thumbMovement
    ratio[count] = theScroll[count].scrollH / thumbTravel[count];

    theThumb[count].onDrag = function(x, y) {
      theScroll[count].jumpTo(null, Math.round((y - theThumb[count].minY) * ratio[count]));
    }
		
	//toogleProjektSubMenu('opinie');	
}  

// INITIALIZER:
// ==============================================================
// ala Simon Willison http://simon.incutio.com/archive/2004/05/26/addLoadEvent
function addLoadEvent(fn) {
      var old = window.onload;
      if (typeof window.onload != 'function') {
         window.onload = fn;
      }
      else {
         window.onload = function() {
         old();
         fn();
         }
      }
   }
addLoadEvent(function(){
    if(theScroll.length>0) {
    for(var i=0;i<theScroll.length;i++){
      createDragger(i, "handle"+i, "root"+i, "thumb"+i, theScroll[i].clipW, theScroll[i].clipW, 20, theScroll[i].clipH-30);
    }
  }
}) 



/* koniec funkcji dotyczących scrollbara */



$(document).ready(function() {
	$('body').supersleight(); // png ie6fix
	/*
	$(".drukuj").bind("click", function() {
		window.open("page,drukuj,idp," + $(this).attr("rel") +","+$(this).attr("alt")+".html", 'okienko', 'menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=no, status=no,width=700, height=650');
	});
	*/
	
	$('#panel1').hover(
		function(){ $('#panel_1').css('display', 'block'); }, 
		function(){ $('#panel_1').css('display', 'none'); }
	);
	
	$('#panel2').hover(
		function(){ $('#panel_2').css('display', 'block'); }, 
		function(){ $('#panel_2').css('display', 'none'); }
	);
	
	$('#panel3').hover(
		function(){ $('#panel_3').css('display', 'block'); }, 
		function(){ $('#panel_3').css('display', 'none'); }
	);
	
	$('#panel4').hover(
		function(){ $('#panel_4').css('display', 'block'); }, 
		function(){ $('#panel_4').css('display', 'none'); }
	);
	
	$('#panel5').hover(
		function(){ $('#panel_5').css('display', 'block'); }, 
		function(){ $('#panel_5').css('display', 'none'); }
	);
	
	$('#panel6').hover(
		function(){ $('#panel_6').css('display', 'block'); }, 
		function(){ $('#panel_6').css('display', 'none'); }
	);
	
	$('#panel7').hover(
		function(){ $('#panel_7').css('display', 'block'); }, 
		function(){ $('#panel_7').css('display', 'none'); }
	);
	
	$('#panel8').hover(
		function(){ $('#panel_8').css('display', 'block'); }, 
		function(){ $('#panel_8').css('display', 'none'); }
	);
	
	$('#panel9').hover(
		function(){ $('#panel_9').css('display', 'block'); }, 
		function(){ $('#panel_9').css('display', 'none'); }
	);
	
	$('#panel10').hover(
		function(){ $('#panel_10').css('display', 'block'); }, 
		function(){ $('#panel_10').css('display', 'none'); }
	);



	$("a[rel=lightbox]").lightBox({fixedNavigation:false});
	
	$('li#rzuty_list a').lightBox({fixedNavigation:true});	
	$('li#elewacje_list a').lightBox({fixedNavigation:true});
	$('li#widoki_list a').lightBox({fixedNavigation:true});
	$('li#usytuowanie_list a').lightBox({fixedNavigation:true});
	$('li#realizacje_list a').lightBox({fixedNavigation:true});	
	$('li#karty_list a').lightBox({fixedNavigation:true});
	
	$('#projekty_rozsuwane').hover(
		function() { $(this).css('display', 'block'); },
		function() { $(this).css('display', 'none'); }
	);
	
	$('#rozsuwany_div').hover(
		function() { $(this).css('display', 'block'); },
		function() { $(this).css('display', 'none'); }
	);

	if ($("#flashcontent").length > 0){
	var so = new SWFObject("template/flash/textbox.swf", "textbox", "100%", "100%", "9", "#000000");
	so.addParam("wmode", "transparent");
	so.addParam("scale", "noscale");
	so.addParam("menu", "false");
	so.addParam("salign", "lt");
	so.addVariable("tekst", $('#flashcontent').text());
	so.write("flashcontent");
	}

	if ($("#art_nagl").length > 0){
	var so = new SWFObject("template/flash/textbox.swf", "textbox", "100%", "100%", "9", "#000000");
	so.addParam("wmode", "transparent");
	so.addParam("scale", "noscale");
	so.addParam("menu", "false");
	so.addParam("salign", "lt");
	so.addVariable("tekst", $('#art_nagl').text());
	so.write("art_nagl");
	}

	if ($("#news_nagl").length > 0){
	var so = new SWFObject("template/flash/textbox.swf", "textbox", "100%", "100%", "9", "#000000");
	so.addParam("wmode", "transparent");
	so.addParam("scale", "noscale");
	so.addParam("menu", "false");
	so.addParam("salign", "lt");
	so.addVariable("tekst", $('#news_nagl').text());
	so.write("news_nagl");
	}

	if ($("#projekty_nagl").length > 0){
	var so = new SWFObject("template/flash/textbox.swf", "textbox", "100%", "100%", "9", "#000000");
	so.addParam("wmode", "transparent");
	so.addParam("scale", "noscale");
	so.addParam("menu", "false");
	so.addParam("salign", "lt");
	so.addVariable("tekst", $('#projekty_nagl').text());
	so.write("projekty_nagl");
	}

	if ($("#partnerzy_nagl").length > 0){
	var so = new SWFObject("template/flash/textbox.swf", "textbox", "100%", "100%", "9", "#000000");
	so.addParam("wmode", "transparent");
	so.addParam("scale", "noscale");
	so.addParam("menu", "false");
	so.addParam("salign", "lt");
	so.addVariable("tekst", $('#partnerzy_nagl').text());
	so.write("partnerzy_nagl");
	}

	if ($("#nagl_menu").length > 0){
	var so = new SWFObject("template/flash/textbox.swf", "textbox", "100%", "100%", "9", "#000000");
	so.addParam("wmode", "transparent");
	so.addParam("scale", "noscale");
	so.addParam("menu", "false");
	so.addParam("salign", "lt");
	so.addVariable("tekst", $('#nagl_menu').text());
	so.write("nagl_menu");
	}

	if ($("#menu_nagl").length > 0){
	var so = new SWFObject("template/flash/textbox.swf", "textbox", "100%", "100%", "9", "#000000");
	so.addParam("wmode", "transparent");
	so.addParam("scale", "noscale");
	so.addParam("menu", "false");
	so.addParam("salign", "lt");
	so.addVariable("tekst", $('#menu_nagl').text());
	so.write("menu_nagl");
	}

	if ($("#bocz_nagl").length > 0){
	var so = new SWFObject("template/flash/textbox.swf", "textbox", "100%", "100%", "9", "#000000");
	so.addParam("wmode", "transparent");
	so.addParam("scale", "noscale");
	so.addParam("menu", "false");
	so.addParam("salign", "lt");
	so.addVariable("tekst", $('#bocz_nagl').text());
	so.write("bocz_nagl");
	}

	if ($("#newsl_menu").length > 0){
	var so2 = new SWFObject("template/flash/textbox.swf", "textbox", "100%", "100%", "9", "#000000");
	so2.addParam("wmode", "transparent");
	so2.addParam("scale", "noscale");
	so2.addParam("menu", "false");
	so2.addParam("salign", "lt");
	so2.addVariable("tekst", $('#newsl_menu').text());
	so2.write("newsl_menu");
	}
	
	$(".carousel-elewacje").jCarouselLite({
        btnNext: ".nexte",
        btnPrev: ".preve",
		visible: 2,
		circular: false
    });
	
	
	$(".carousel-widoki").jCarouselLite({
        btnNext: ".nextw",
        btnPrev: ".prevw",
		visible: 2,
		circular: false
    });
	
	$(".carousel-karty").jCarouselLite({
        btnNext: ".nextk",
        btnPrev: ".prevk",
		visible: 2,
		circular: false
    });
	
	$("#elewacje_list").hide();
	$("#widoki_list").hide();
	$("#karty_list").hide();
	
	$('#rzuty_list').hide();
	$('#opinie_list').hide();
	$('#usytuowanie_list').hide();
	$('#kosztorysy_list').hide();
	$('#realizacje_list').hide();
	$('#pliki_list').hide();
	
	toogleProjektSubMenu('widoki');
	//toogleProjektSubMenu('opinie');
});

function subscribeNewsletter()
{
	var email = document.getElementById('newsl_email').value;
	$.post("zapiszNewsletter.php", { newsl_email: email }, function(data){
		$('#newsl_results')
		$('#newsl_results').html(data);
	});
}

function unsubscribeNewsletter()
{
	var email = document.getElementById('newsl_email').value;
	$.post("wypiszNewsletter.php", { newsl_email: email }, function(data){
		$('#newsl_results')
		$('#newsl_results').html(data);
	});
}

function displayProjekt(id)
{
	var div = document.getElementById('p_wiecej_'+id);
	var link = document.getElementById('p_wiecej_link_'+id);
	div.style.display="block";
	//link.style.fontWeight="bold";
}
function hideProjekt(id)
{
	var div = document.getElementById('p_wiecej_'+id);
	var link = document.getElementById('p_wiecej_link_'+id);
	div.style.display="none";
	//link.style.fontWeight="normal";
}

function displayPanel(id)
{
	
	var div = document.getElementById('panel_'+id);
	//var link = document.getElementById('p_wiecej_link_'+id);
	div.style.display="block";
	//if ( document.getElementById('belka1_'+id)) document.getElementById('belka1_'+id).style.borderBottom="1px solid #A42A66";
	//if ( document.getElementById('belka2_'+id)) document.getElementById('belka2_'+id).style.borderTop="1px solid #A42A66";
	//link.style.fontWeight="bold";
}
function hidePanel(id)
{
	var div = document.getElementById('panel_'+id);
	//var link = document.getElementById('p_wiecej_link_'+id);
	div.style.display="none";
	//if ( document.getElementById('belka1_'+id)) document.getElementById('belka1_'+id).style.borderBottom="1px solid #474747";
	//if ( document.getElementById('belka2_'+id)) document.getElementById('belka2_'+id).style.borderTop="1px solid #474747";
	//link.style.fontWeight="lighter";
}

function menuBoczneOver(id)
{
	document.getElementById('menu_boczne_'+id).src='template/img/strzalka_on.gif';
	return;
}

function menuBoczneOut(id)
{
	document.getElementById('menu_boczne_'+id).src='template/img/strzalka_off.gif';
	return;
}

function menuOver(id)
{
	document.getElementById(id).src='template/img/strzalka_on.gif';
	return;
}

function menuOut(id)
{
	document.getElementById(id).src='template/img/strzalka_off.gif';
	return;
}

function toogleProjektSubMenu(id)
{
	$(".carousel").show();
	if(document.getElementById('opinie_list')!=null      && document.getElementById('opinie_list').style.display=='block'      && id+'_list' != 'opinie_list'){ hideSubMenu('opinie') }
	if(document.getElementById('karty_list')!=null       && document.getElementById('karty_list').style.display=='block'       && id+'_list' != 'karty_list') {  hideSubMenu('karty') }
	if(document.getElementById('rzuty_list')!=null       && document.getElementById('rzuty_list').style.display=='block'       && id+'_list' != 'rzuty_list') {  hideSubMenu('rzuty') }
	if(document.getElementById('elewacje_list')!=null    && document.getElementById('elewacje_list').style.display=='block'    && id+'_list' != 'elewacje_list') {  hideSubMenu('elewacje') }
	if(document.getElementById('widoki_list')!=null      && document.getElementById('widoki_list').style.display=='block'      && id+'_list' != 'widoki_list') {  hideSubMenu('widoki') }
	if(document.getElementById('usytuowanie_list')!=null && document.getElementById('usytuowanie_list').style.display=='block' && id+'_list' != 'usytuowanie_list') {  hideSubMenu('usytuowanie') }
	if(document.getElementById('kosztorysy_list')!=null  && document.getElementById('kosztorysy_list').style.display=='block'  && id+'_list' != 'kosztorysy_list') {  hideSubMenu('kosztorysy') }
	if(document.getElementById('realizacje_list')!=null  && document.getElementById('realizacje_list').style.display=='block'  && id+'_list' != 'realizacje_list') {  hideSubMenu('realizacje') }
	if(document.getElementById('pliki_list')!=null       && document.getElementById('pliki_list').style.display=='block'       && id+'_list' != 'pliki_list') {  hideSubMenu('pliki') }
		
	_toogleProjektSubMenu(id);
}

function _toogleProjektSubMenu(id) {
	var header = document.getElementById(id+'_head');
	var display = document.getElementById(id+'_list').style.display;
	
	if(document.getElementById(id+'_head2')!=null) { 
		var header2 = document.getElementById(id+'_head2');
		display=="block"?header2.setAttribute("onmouseover", "menuOver('"+id+"_img')"):header2.setAttribute("onmouseover","");
		display=="block"?header2.setAttribute("onmouseout", "menuOut('"+id+"_img')"):header2.setAttribute("onmouseout", "");
	}
	
	var img = document.getElementById(id+'_img');
	//alert(display);
	display=="none"?document.getElementById(id+'_list').style.display="block":document.getElementById(id+'_list').style.display="none";
	display=="block"?header.setAttribute("class", ""):header.setAttribute("class", "a_active");
	display=="block"?header.setAttribute("className", ""):header.setAttribute("className", "a_active");
	display=="block"?header.setAttribute("onmouseover", "menuOver('"+id+"_img')"):header.setAttribute("onmouseover","");
	display=="block"?header.setAttribute("onmouseout", "menuOut('"+id+"_img')"):header.setAttribute("onmouseout", "");
	display=="block"?img.setAttribute("src", "/template/img/strzalka_off.gif"):img.setAttribute("src", "/template/img/button_dol_menu.gif");
}

function hideSubMenu(id)
{
	var header = document.getElementById(id+'_head');
	var img = document.getElementById(id+'_img');
	var display = document.getElementById(id+'_list').style.display;
	
	document.getElementById(id+'_list').style.display="none";
	header.setAttribute("class", "");
	header.setAttribute("className", "");
	header.setAttribute("onmouseover", "menuOver('"+id+"_img')");
	header.setAttribute("onmouseout", "menuOut('"+id+"_img')");
	img.setAttribute("src", "/template/img/strzalka_off.gif");
}



