    document.cookie = "res_width="+screen.width;
    document.cookie = "res_height="+screen.height;

  function winPopUp(name, url, width, height) {
    var x = Math.floor((screen.availWidth-width) / 2);
    var y = Math.floor((screen.availHeight-height) / 2);
    var config = ", left=" + x;
    config += ", top=" + y;
    config += ", scrollbars=yes,resizable=yes,status=yes";

    var popup=window.open(url,name,'width='+width+', height='+height+config);
  } /*winPopUp*/

  function winPopUpRet(name, url, width, height) {
    var x = Math.floor((screen.availWidth-width) / 2);
    var y = Math.floor((screen.availHeight-height) / 2);
    var config = ", left=" + x;
    config += ", top=" + y;
    config += ", scrollbars=yes,resizable=yes,status=yes";

    var popup=window.open(url,name,'width='+width+', height='+height+config);
    return popup;
  } /*winPopUp*/

  function winPopUp2(name, url, width, height) {
    winPopUp(name, url, width, height);
//    return false;
  }

  function parentRefresh (parent_anchor_id, element) {
    var text = "<table align=\"center\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\" width=\"100%\" class=\"blockItem\">\n"
      +"<tr>\n<td valign=\"top\">"+ element.value
      +"</td>\n</tr>\n</table><br />";

    opener.document.getElementById(parent_anchor_id).innerHTML = text;
  } /*parentRefresh*/

  function ResetParent (parent_anchor_id) {
    if (reset_parent_cond) {
      opener.document.getElementById(parent_anchor_id).innerHTML = start_value;
    } //if
  } /*ResetParent*/

  function parentSetFormInput(input, value)
  {
	  var formInput = opener.document.getElementById(input);
	  if (formInput != null)
	  {
		  formInput.value = value;
	  }
	  else
		  alert('[ERROR] Field not found: ' + input);
  }

  function parentOpenerSetFormInput(input, value)
  {
	  var formInput = parent.opener.document.getElementById(input);
	  if (formInput != null)
	  {
		  formInput.value = value;
	  }
	  else
		  alert('[ERROR] Field not found: ' + input);
  }

  function getValue(input)
  {
	  var formInput = window.document.getElementById(input);
	  if (formInput == null)
		  alert('[ERROR] Field not found: ' + input);
	
	  return formInput.value;
  }


  function chooseDocument(input, id)
  {
	 parentSetFormInput(input, 'index.php?document=' + id);
	 window.close();
	 return false;
  }

  function chooseDocumentID(input, id)
  {
	 parentSetFormInput(input, id);
	 window.close();
	 return false;
  }

  function chooseDocumentAlias(input, name)
  {
	 parentSetFormInput(input, 'index.php?documentName=' + name);
	 window.close();
	 return false;
  }

  function chooseDocumentAliasName(input, name)
  {
	 parentSetFormInput(input, name);
	 window.close();
	 return false;
  }

  function chooseFile(input, path)
  {
	 parentOpenerSetFormInput(input, path);
	 parent.window.close();
	 return false;
  }


    function showHideLayer (layer_id, show) {
        var styl = gls (layer_id);

        if (styl) {
            if (show) {
                styl.display = 'none';
            } //if
            else {
                styl.display = 'block';
            } //else
        } //if

        return false;

    } /*showHideLayer*/


  function gls (id) {
      var isIE = (document.all) ? true : false; 
      var isNS4 = (document.layers) ? true : false; 
      var isNS6 = (document.getElementById&&!document.all) ? true : false;

    if (id != "") {
      var styl;
      if (isIE) {
        styl = document.all[id].style;
      } //if
      else if (isNS6) {
        styl = document.getElementById(id).style;
      } //else if
      else if (isNS4) {
        return false;
      } //else if
      return styl;
    } //if
    else {
      return false;
    } //else
  } /*gls*/


    function correctTextXHTML (text) {
	    return String(text).replace(/\&/g, "&amp;").replace(/</g, "&lt;");
    } /*correctTextXHTML*/

    function validateXHTML (form) {

        var elems = form.elements;
        var i, text='', elem;
        for (i=0;i<elems.length; i++) {
            elem = elems[i];
            if (elem.type == 'text') {
                elem.value = correctTextXHTML (elem.value);
            } //if
            else if (elem.type == 'textarea') {
/*
                var nodes = elem.childNodes;
                var val = '';
                for (var i = 0; i < nodes.length; i++)
                    val += getXhtml(nodes[i]);
                elem.value = val;
*/
            } //else if
        } //for
    } /*validateXHTML*/

	function confirmLocation( tinfo, url ) {
		if(confirm(tinfo)) {
			document.location=url;
		}
	}

/*
* wywolanie ajaxa
*/	
function switchC(part, command, id) {
	var element = document.getElementById(part);

    writeElement(part, '<img src="gallery/system/p_snake.gif" border="0" />');

    advAJAX.get({
		url: "index.php",
        parameters: {
        	"command" : command,
            "id" : id,
            "ajax" : "1"
            },
        onSuccess: function(obj) { writeElement(part, obj.responseText);},
        onError: function(obj) {alert("Error: " + obj.status);}
     });
	
}

function submitC(part, firmId) {
	var element = document.getElementById(part);
    var formElement = document.getElementById(firmId);
   // writeElement(part, '<img src="gallery/system/p_snake.gif" border="0" />');
	
	element.style.display = 'none';
	
	advAJAX.submit(formElement, {
    	onSuccess : function(obj) { writeElement(part, obj.responseText); element.style.display = "block";},
    	onError : function(obj) { alert("Error: " + obj.status); ; }
});
	
}


/*
* 
* Ajax i funkcje pomocnicze
*
*/

function aSwitchForm( aDivFrom, aDivH, aForm ) {
	var elementFrom = document.getElementById(aDivFrom);
	var elementH = document.getElementById(aDivH);
	var elementForm = document.getElementById(aForm);
	
	elementFrom.style.display = 'none';
	elementH.style.display = 'block';
	
	advAJAX.submit(elementForm, {
    	onSuccess : function(obj) {writeElement(aDivFrom, obj.responseText); elementFrom.style.display = 'block'; elementH.style.display = 'none'; },
    	onError : function(obj) { alert("Error: " + obj.status); }
	});
} /*aSwitchForm*/


function writeElement(id, text) {
	var element = window.document.getElementById(id);
    if(element) {
		element.innerHTML = text;
    }
    else {
        alert(id+' ERROR');
    }
}





    function openToPrint (url) {
      config = "toolbar=no,location=no,directories=no,status=yes,menubar=no";
      w = Math.floor(screen.availWidth * 0.9);
      h = Math.floor(screen.availHeight * 0.8);
      x = Math.floor(screen.availWidth * 0.05);
      y = Math.floor(screen.availHeight * 0.1);
      config += ",width=" + w;
      config += ",height=" + h;
      config += ",left=" + x;
      config += ",top=" + y;
      config += ", scrollbars=yes,resizable=yes";
      var printWnd=window.open(url,'printWnd',config);
    } /*openToPrint*/


    function printAndClose () {
        window.print();
        window.close();
    } /*printAndClose*/

    function printClose () {
        window.close();
    } /*printClose*/

	function print(){
	if (!window.print){
	alert("Musisz mieć NS4.x lub IE5,\naby użyć przycisku drukowania!")
	return
	}
	window.print()
	}

///////////////////////////////////////////////
  // Zmienne uzytkowe

  var isIE = (document.all) ? true : false;
  var isNS4 = (document.layers) ? true : false;
  var isNS6 = (document.getElementById&&!document.all) ? true : false;

  var ns4 = isNS4;
  var ie4 = isIE;

  // Zmienna przechowujaca identyfikatory uruchomionych przerwan
  var timerStore = Array;
  // Zmienna przechowujaca obiekty, ktore maja byc wywolane w poszczegolnych przerwaniach
  var timerObjStore = Array();
  // Zmienna przechowujaca nazwy metod, ktore maja byc uruchomione dla poszczegolnych obiektow
  var timerMethodStore = Array();
  // Zmienna przechowujaca argumenty, z ktorymi maja byc wywolane metody
  var timerArgsStore = Array();
  // Zmienna przechowujaca identyfikator aktualnie wolnego przerwania
  var timerEventId = 0;

  // pokazywanie / chowanie warstw

  function show(id) {
    if (isNS6) {
      document.getElementById(id).style.visibility='visible';
    } //if
    else if (isNS4) {
      document.layers[id].visibility = "show";
    } //else if
    else if (isIE) {
      document.all[id].style.visibility = "visible";
    } //else if
  }

  function hide(id) {
    if (isNS6)
      document.getElementById(id).style.visibility='hidden';
    else if (isNS4)
      document.layers[id].visibility = "hide";
    else if (isIE)
      document.all[id].style.visibility = "hidden";

  }


  // Wyszukiwanie warstw

  function getLayer(layer_name) {
    if (isNS6)
      return document.getElementById(layer_name);
    else if (ns4)
      return document.layers[layer_name];
    else if (ie4)
      return document.all[layer_name];

    return null;
  }

  function getLeft(id) {
    if (isNS6)
      return parseInt(document.getElementById(id).style.left);
    else if (ns4)
      return document.layers[id].left;
    else if (ie4)
      return Number(document.all[id].style.left.substring(0, document.all[id].style.left.indexOf("p")));

    return 0;
  }

  function getTop(id) {
    if (isNS6)
      return parseInt(document.getElementById(id).style.top);
    else if (ns4)
      return document.layers[id].top;
    else if (ie4)
      return Number(document.all[id].style.top.substring(0, document.all[id].style.top.indexOf("p")));

    return 0;
  }

  function getWidth(id) {
    if (isNS6)
      return parseInt(document.getElementById(id).style.width);
    else if (ns4)
      return 180 /*lay.width*/;
    else if (ie4)
      return Number(document.all[id].style.width.substring(0, document.all[id].style.width.indexOf("p")));

    return 0;
  }

  function getHeight(id) {
    if (isNS6)
      return parseInt(document.getElementById(id).style.height);
    else if (ns4)
      return 110 /*lay.height*/;
    else if (ie4)
      return Number(document.all[id].style.height.substring(0, document.all[id].style.height.indexOf("p")));

    return 0;
  }

  /* Obsluga kursora myszy */

  function getMenuPositionX (a_name, extra) {
    var x=100;
    if (ns4) {
      for (var i=0; i<document.anchors.length; i++) {
        if (document.anchors[i].name==a_name) {
          x=document.anchors[i].x;
          break;
        }
      }
      x+=5;
      if (extra) {
          x+=0;
      }
    } else if (ie4) {
      var el=document.all[a_name];
      var ol=el.offsetLeft;
      while ((el=el.offsetParent) != null) {
        ol += el.offsetLeft;
      }
      x=ol+23;
      if (extra) {
          x+=0;
      }
    }
    else if (isNS6) {
      var el=document.getElementById(a_name);
      var ol=el.offsetLeft;
      while ((el=el.offsetParent) != null) {
        ol += el.offsetLeft;
      }
      x=ol+5;
      if (extra) {
          x+=0;
      }
    }
    return x;
  } /*getMenuPositionX*/

  function getMenuPositionY (a_name, extra) {
    var y=50;
    if (ns4) {
      for (var i=0; i<document.anchors.length; i++) {
        if (document.anchors[i].name==a_name) {
          y=document.anchors[i].y;
          break;
        }
      }
      y-=23;
      if (extra) {
          y+=3;
      }
    } else if (ie4) {
      var el=document.all[a_name];
      var ot=el.offsetTop;
      while((el=el.offsetParent) != null) {
        ot += el.offsetTop;
      }
      y=ot-5;
      if (extra) {
          y-=5;
      }
    }
    else if (isNS6) {
      var el=document.getElementById(a_name);
      var ot=el.offsetTop;
      while((el=el.offsetParent) != null) {
        ot += el.offsetTop;
      }
      y=ot-23;
      if (extra) {
          y+=3;
      }
    }
    return y;
  } /*getMenuPositionY*/

  /* obsluga menu */

  // Tabica wyswietlonych warstw
  var showed = new Array();
  showed[0] = 0;
  // Tablica pokazujaca warswe, otworzona przez warstwe maciezysta
  // uzywana do szybkiego chowania warstw w sytuacji, gdy trzeba otworzyc nowa
  // - przejscie od jednej opcji menu do drugiej
  var opened_by = new Array();
  var opened_level = new Array();
  // Tablica przechowuje informacje, ktora z warstw sa przyblokowene przed schowaniem
  // z powodu tego, ze otworzyly nowe submenu - zapisy kogo - kto blokuje
  var blocked_by = new Array();
  // Taka sama jak wyzej, tylko odwrotne zapisy (kto - kogo blokuje)
  var blocking = new Array();
  // Tablica przechowuje identyfikatory tych warst, ktore mozna juz schowac,
  // jednak chowanie jest przyblokowane z powodu utworzenia submenu
  var ready_to_hide = new Array();
  // Identyfikator ostatnio otwartej pozycji w menu
//  current_menu = null;
  var timerID = new Array();

  function htS(pageid, parent_id, issub) {
    if (issub && (! showed[pageid])) {
        hMA();
    }
  }


  function tS(pageid, parent_id, issub) {
    if (issub && (! showed[pageid])) {
      showed[pageid] = 1;
      cH(pageid);
      ready_to_hide[pageid] = 0;
      if (blocked_by[parent_id]) {
        blocking[blocked_by[parent_id]] = 0;
      }
      blocked_by[parent_id] = pageid;
      if (opened_by[parent_id]) {
        hideMenuNow(opened_by[parent_id]);
      }
      opened_by[parent_id] = pageid;
      blocking[pageid] = parent_id;
      moveDiv(getMenuPositionX('a'+pageid, (! showed[parent_id])), getMenuPositionY('a'+pageid, (! showed[parent_id])), 'submenu_' + pageid);
      show('submenu_' + pageid);
    }
    return true;
  }

  function uS(pageid, issub) {
    if (issub) {
      pH(pageid);
    }
    return true;
  }

  function hM(parent_id) {
    if (opened_by[parent_id]) {
    hideMenuNow(opened_by[parent_id]);
       }
 }

  function hMA() {
    for (elem in showed)
    {
        if (elem != 0)
        {
            //alert (elem);
            hideMenuNow(elem);
        }

    }
 }

  function pH(page_id) {

    // Przygotowuje menu do ukrycia - ustawia timer na 1 sekunde
    timerID[page_id] = setTimeout("hideMenu('" + page_id + "')", 2000);
  }

  function cH(page_id) {
    // Anuluje chowanie warstwy, ktora zostala ustawiona w kolejce do ukrycia
    if (timerID[page_id]){
      clearTimeout(timerID[page_id]);
      timerID[page_id] = 0;
      ready_to_hide[page_id] = 0;
    }
  }

  function hideMenu(page_id) {
    // Przygotowuje do ukrycia warstwy
    if (! blocked_by[page_id]) {
      showed[page_id] = 0;
      cH(page_id);
      hide('submenu_' + page_id);
      if (blocking[page_id]) {
        // jezeli aktualnie chowana warstwa blokowala ukrycie innej warstwy
        blocked_id = blocking[page_id];
        // to odblokowujemy te inna - parentMenu
//        opened_by[page_id] = 0;
        blocking[page_id] = 0;
        if (blocked_by[blocked_id] == page_id) {
          blocked_by[blocked_id] = 0;
          if (ready_to_hide[blocked_id]) {
            // jezeli blokowana warstwa byla gotowa do schowania, to ja chowamy
            hideMenu(blocked_id);
          }
        }
      }
    } else {
      ready_to_hide[page_id] = 1;
    }
  }

  function hideMenuNow(page_id) {
    // Chowa warstwe natychmiast, ukrywajac jednoczesnie wszystkie warstwy
    // otworzone powyzej
    cH(page_id);
    hide('submenu_' + page_id);
    blocked_id = blocking[page_id];
    blocking[page_id] = 0;
    blocked_by[blocked_id] = 0;
    showed[page_id] = 0;
    if (opened_by[page_id]) {
      opened_id = opened_by[page_id];
      opened_by[page_id] = 0;
      hideMenuNow(opened_id);
    }
  }


  function moveDiv(x,y,div_name) {
    if(isNS4){
      eval("document." + div_name  + ".top=" + y);
      eval("document." + div_name + ".left=" + x);
    } else
      if(isNS6) {
        document.getElementById(div_name).style.top = y + "px";
        document.getElementById(div_name).style.left = x + "px";
      } else
        if(isIE) {
          eval(div_name + ".style.top=" + y);
          eval(div_name + ".style.left=" + x);
        }
  }

  function getLayerX (div_name) {
        var layer = getLayer (div_name);
        var x=100;
        if (ns4) {
          x=layer.pageX;
        }
        else if (ie4) {
            var el=layer;
            var ol=el.offsetLeft;
            while ((el=el.offsetParent) != null) {
                ol += el.offsetLeft;
            }
            x=ol;
        }
        else if (isNS6) {
            var el=layer;
            var ol=el.offsetLeft;
            while ((el=el.offsetParent) != null) {
                ol += el.offsetLeft;
            }
            x=ol;
        }
        return x;
    } /*getLayerX*/

    function getLayerY (div_name) {
        var layer = getLayer (div_name);
        var y=50;
        if (ns4) {
            y=layer.pageY;
        }
        else if (ie4) {
            var el=layer;
            var ot=el.offsetTop;
            while((el=el.offsetParent) != null) {
                ot += el.offsetTop;
            }
            y=ot;
        }
        else if (isNS6) {
            var el=layer;
            var ot=el.offsetTop;
            while((el=el.offsetParent) != null) {
                ot += el.offsetTop;
            }
            y=ot;
        }
        return y;
    } /*getLayerY*/

  function sm (id, parent_id, level) {
     var styl = glss (id);
    if (styl) {
      if (styl.display == 'block') {
        xm (parent_id, level);
        styl.display = 'none';
        opened_by[parent_id] = 0;
        opened_level[parent_id] = 0;
        changeImages('g_'+id , 'gallery/system/itd_'+level+'.gif');
        } //if
      else {
        xm (parent_id, level);
        styl.display = 'block';
        opened_by[parent_id] = id;
        opened_level[parent_id] = level;
        changeImages('g_'+id , 'gallery/system/itu_'+level+'.gif');
      } //else
    } //if

    return false;
  } /*sm*/

  function xm (parent_id, level) {
    if (opened_by[parent_id] > 0) {
      xm (opened_by[parent_id], opened_level[parent_id]);
      var styl = glss (opened_by[parent_id]);
      if (styl) {
        styl.display = 'none';
        changeImages('g_'+opened_by[parent_id] , 'gallery/system/itd_'+opened_level[parent_id]+'.gif');
        opened_by[parent_id] = 0;
        opened_level[parent_id] =0;
      } //if
    } //if
  } /*xm*/

  function glss (id) {
    if (id != "") {
      var styl;
      if (isIE) {
        styl = document.all['submenu_'+id].style;
    //    alert( document.all['submenu_' + id].style);

      } //if
      else if (isNS6) {
        styl = document.getElementById('submenu_'+id).style;
    //    alert(document.getElementById('submenu_'+id).style.display);
      } //else if
      else if (isNS4) {
        return false;
      } //else if
      return styl;
    } //if
    else {
      return false;
    } //else
  } /*gls*/

 function changeImages() {
  var tmp;
    if (document.images) {
        for (var i=0; i<changeImages.arguments.length; i+=2) {
            document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
        }
    }
}


<!--
var data = new Date();
var amies = data.getMonth();
var arok = data.getFullYear();
var adzien = data.getDate();
var adzientyg = data.getDay();
var frmpole;

// ilość dni w roku
var dni = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
// nazwy miesięcy
var miesiac = new Array('Styczeń','Luty','Marzec','Kwiecień', 'Maj','Czerwiec','Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień');

// dane kolorów
var kol = new Array(9)
kol[0] = '#FFFFFF'; 
kol[1] = '#FFFEEC'; 
kol[2] = '#FFDBDB'; 
kol[3] = '#BCBC89'; 
kol[4] = '#CDCA8E'; 
kol[5] = '#000000'; 
kol[6]='#CDCA8E';
kol[7]='#333333';
kol[8]='#999999';
// ile lat pokazywane w kalendarzu od aktualnej daty
var wstecz = 66; 
var wprzod = 1;

// ilość dni w Lutym - przeliczane po zmianie miesiąca lub roku
function dniMies()
{
	dni[1] = (rok % 4 == 0) ? 29 : 28;
}

function getFieldDate(dateString)
{
  var dateVal;
  var dArray;
  var d, m, y;
  
  try {
    dArray = dateString.split("-");
    d = parseInt(dArray[0], 10);
    m = parseInt(dArray[1], 10) - 1;
    y = parseInt(dArray[2], 10);
	dateVal = new Date(y, m, 1);
  } catch(e) {
    dateVal = new Date();
  }
  
  return dateVal;
}


function displayDatePicker(dateFieldObject, displayBelowThisObject, dtFormat, dtSep)
{

  var x = displayBelowThisObject.offsetLeft;
  var y = displayBelowThisObject.offsetTop + displayBelowThisObject.offsetHeight;
  
  // deal with elements inside tables and such
  var parent = displayBelowThisObject;
  while (parent.offsetParent) {
    parent = parent.offsetParent;
    x += parent.offsetLeft;
    y += parent.offsetTop;
  }

  if (dateFieldObject.value != null && dateFieldObject.value != '')
	  data  = getFieldDate(dateFieldObject.value);
  else  
	  data = new Date(arok, amies, 1);

  mies = data.getMonth();
  rok = data.getFullYear();
  dzien = data.getDate();
  dzientyg = data.getDay();
	
  dniMies();
  frmpole =  dateFieldObject;

  pozx = x;
  pozy = y;
  rysujKal();		

  document.getElementById('kalendarz').style.left = pozx+'px';
  document.getElementById('kalendarz').style.top = (pozy+5)+'px';
  document.getElementById('kalendarz').style.visibility = 'visible';

}

// funkcja ukrywajaca kalendarz i wstawiajaca wybraną datę do pola formularza
function hideKal()
{
	document.getElementById('kalendarz').style.visibility = 'hidden';


	mies++;
	if(mies < 10)
		mies = '0' + mies;
	if(selectday < 10)
		selectday = '0' + selectday;

	format = selectday+'-'+mies+'-'+rok	
			
	frmpole.value = format;
}

// ukrywanie kalendarza bez wstawiania daty
function exitKal()
{
	document.getElementById('kalendarz').style.visibility = 'hidden';
}

// ustawianie nowej daty po zmianie miesiaca lub roku
function setData()
{
	mies = document.forms['sdata'].elements['month'].value;
	rok = document.forms['sdata'].elements['year'].value;
	
	data = new Date(rok, mies, 1);
	mies = data.getMonth();
	rok = data.getFullYear();
	dzien = data.getDate();
	dzientyg = data.getDay();
	dniMies();
	rysujKal();
}

// rysowanie kalendarza
function rysujKal()
{
	kaltxt = '<form name="sdata" onSubmit="return false;">';
	kaltxt += '<table border=0 cellpadding=0 cellspacing=2 style="border:'+kol[3]+' 2px solid;background-color:'+kol[1]+';">';
	kaltxt += '<tr class=dzien><td colspan=6 height=25><select name="month" class="lista" onChange="setData()">';		
	for(i=0;i<12;i++)
	{
		if(i==mies)
			kaltxt += '<option value="'+i+'" selected>'+miesiac[i]+'</option>';
		else
			kaltxt += '<option value="'+i+'">'+miesiac[i]+'</option>';
	}
	kaltxt += '</select>&nbsp;<select name="year" class="lista" onChange="setData()">';
	for(i=(arok-wstecz);i<=(arok+wprzod);i++)
	{
		if(i==rok)
			kaltxt += '<option value="'+i+'" selected>'+i+'</option>';
		else
			kaltxt += '<option value="'+i+'">'+i+'</option>';	
	}
	kaltxt += '</select>';
	kaltxt += '</td><td><a href="javascript:exitKal()"><span class="aktday">&nbsp;X&nbsp;</span></a></td></tr>';
	kaltxt += '<tr class=dnityg><td width=30 class=akt>Nd</td><td width=30 class=akt>Pn</td><td width=30 class=akt>Wt</td><td width=30 class=akt>Śr</td>';
	kaltxt += '<td width=30 class=akt>Czw</td><td width=30 class=akt>Pt</td><td width=30 class=akt>So</td></tr><tr class=dzien>';

	j = 1;

	for(i=0;i<dzientyg+dni[mies];i++)
	{
		if(i>=dzientyg)
		{
			if(j==adzien && rok==arok && mies==amies)
				kaltxt += '<td class=akt_day><a class=aktday href="javascript:selectday='+j+';hideKal();" >'+j+'</a></td>';
			else if(i%7==0)
				kaltxt += '<td class=akt_n><a class=niedz href="javascript:selectday='+j+';hideKal();" >'+j+'</a></td>';
			else
				kaltxt += '<td class=akt><a class=dzien href="javascript:selectday='+j+';hideKal();" >'+j+'</a></td>';
			j++;
			if(i%7==6)
				kaltxt += '</tr><tr class=dzien>';
		}
		else
			kaltxt += '<td></td>';
	}

	kaltxt += '</tr></table></form>';
	
	document.getElementById("kalendarz").innerHTML = kaltxt;
}

// style kalendarza i warstwa, na której się znajduje
document.write('<div id="kalendarz" style="visibility:hidden;position:absolute;z-index: 1000"></div>');
document.write('<style type="text/css">');
document.write('.dzien{font-family:Arial;font-size:12px;color:'+kol[7]+';text-align:center;background-color:'+kol[1]+';text-decoration:none}');
document.write('.niedz{font-family:Arial;font-size:12px;color:'+kol[7]+';text-align:center;background-color:'+kol[2]+';text-decoration:none}');
document.write('.aktday{color:'+kol[7]+';font-weight:bold;text-align:center;background-color:'+kol[3]+';text-decoration:none}');
document.write('.akt_day{background-color:'+kol[3]+';border-top: '+kol[8]+' solid 1px;border-bottom: '+kol[8]+' solid 1px;border-right: '+kol[8]+' solid 1px;border-left: '+kol[8]+' solid 1px;}');
document.write('.dnityg{font-family:Verdana;font-size:12px;color:'+kol[5]+';text-align:center;background-color:'+kol[6]+';}');
document.write('.akt{border-top: '+kol[8]+' solid 1px;border-bottom: '+kol[8]+' solid 1px;border-right: '+kol[8]+' solid 1px;border-left: '+kol[8]+' solid 1px;}');
document.write('.akt_n{background-color:'+kol[2]+';border-top: '+kol[8]+' solid 1px;border-bottom: '+kol[8]+' solid 1px;border-right: '+kol[8]+' solid 1px;border-left: '+kol[8]+' solid 1px;}');
document.write('.lista{font-family:Verdana;font-size:12px;color:'+kol[5]+';}</style>');




//-->



/*
 * AdvancedAJAX 1.1.2
 * (c) 2005-2006 Lukasz Lach
 *  mail: anakin@php5.pl
 *  www:  http://advajax.anakin.us/
 *        http://anakin.us/
 * http://creativecommons.org/licenses/LGPL/2.1/
 *
 */

function advAJAX() {

    var obj = new Object();

    obj.url = window.location.href;
    obj.method = "GET";
    obj.parameters = new Object();
    obj.jsonParameters = new Object();
    obj.headers = new Object();
    obj.async = true;
    obj.mimeType = "text/xml";
    obj.username = null;
    obj.password = null;
    obj.form = null;
    obj.disableForm = true;

    obj.unique = true;
    obj.uniqueParameter = "_uniqid";

    obj.requestDone = false;
    obj.queryString = "";
    obj.responseText = null;
    obj.responseXML = null;
    obj.status = null;
    obj.statusText = null;
    obj.aborted = false;
    obj.timeout = 0;
    obj.retryCount = 0;
    obj.retryDelay = 1000;
    obj.tag = null;
    obj.group = null;
    obj.progressTimerInterval = 50;

    obj.xmlHttpRequest = null;

    obj.onInitialization = null;
    obj.onFinalization = null;
    obj.onReadyStateChange = null;
    obj.onLoading = null;
    obj.onLoaded = null;
    obj.onInteractive = null;
    obj.onComplete = null;
    obj.onProgress = null;
    obj.onSuccess = null;
    obj.onFatalError = null;
    obj.onError = null;
    obj.onTimeout = null;
    obj.onRetryDelay = null;
    obj.onRetry = null;
    obj.onGroupEnter = null;
    obj.onGroupLeave = null;

    obj.createXmlHttpRequest = function() {

        if (typeof XMLHttpRequest != "undefined")
            return new XMLHttpRequest();
        var xhrVersion = [ "MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0",
                "MSXML2.XMLHttp","Microsoft.XMLHttp" ];
        for (var i = 0; i < xhrVersion.length; i++) {
            try {
                var xhrObj = new ActiveXObject(xhrVersion[i]);
                return xhrObj;
            } catch (e) { }
        }
        obj.raiseEvent("FatalError");
        return null;
    };

    obj._oldResponseLength = null;
    obj._progressTimer = null;
    obj._progressStarted = navigator.userAgent.indexOf('Opera') == -1;
    obj._onProgress = function() {

        if (typeof obj.onProgress == "function" &&
            typeof obj.xmlHttpRequest.getResponseHeader == "function") {
            var contentLength = obj.xmlHttpRequest.getResponseHeader("Content-length");
            if (contentLength != null && contentLength != '') {
                var responseLength = obj.xmlHttpRequest.responseText.length;
                if (responseLength != obj._oldResponseLength) {
                    obj.raiseEvent("Progress", obj, responseLength, contentLength);
                    obj._oldResponseLength = obj.xmlHttpRequest.responseText.length;
                }
            }
        }
        if (obj._progressStarted) return;
        obj._progressStarted = true;
        var _obj = this;
        this.__onProgress = function() {
            obj._onProgress();
            obj._progressTimer = window.setTimeout(_obj.__onProgress, obj.progressTimerInterval);
        }
        _obj.__onProgress();
    }

    obj._onInitializationHandled = false;
    obj._initObject = function() {

        if (obj.xmlHttpRequest != null) {
            delete obj.xmlHttpRequest["onreadystatechange"];
            obj.xmlHttpRequest = null;
        }
        if ((obj.xmlHttpRequest = obj.createXmlHttpRequest()) == null)
            return null;
        if (typeof obj.xmlHttpRequest.overrideMimeType != "undefined")
            obj.xmlHttpRequest.overrideMimeType(obj.mimeType);
        obj.xmlHttpRequest.onreadystatechange = function() {

            if (obj == null || obj.xmlHttpRequest == null)
                return;
            obj.raiseEvent("ReadyStateChange", obj, obj.xmlHttpRequest.readyState);
            obj._onProgress();
            switch (obj.xmlHttpRequest.readyState) {
                case 1: obj._onLoading(); break;
                case 2: obj._onLoaded(); break;
                case 3: obj._onInteractive(); break;
                case 4: obj._onComplete(); break;
            }
        };
        obj._onLoadingHandled =
            obj._onLoadedHandled =
            obj._onInteractiveHandled =
            obj._onCompleteHandled = false;
    };

    obj._onLoading = function() {

        if (obj._onLoadingHandled)
            return;
        if (!obj._retry && obj.group != null) {
            if (typeof advAJAX._groupData[obj.group] == "undefined")
                advAJAX._groupData[obj.group] = 0;
            advAJAX._groupData[obj.group]++;
            if (typeof obj.onGroupEnter == "function" && advAJAX._groupData[obj.group] == 1)
                obj.onGroupEnter(obj);
        }
        obj.raiseEvent("Loading", obj);
        obj._onLoadingHandled = true;
    };
    obj._onLoaded = function() {

        if (obj._onLoadedHandled)
            return;
        obj.raiseEvent("Loaded", obj);
        obj._onLoadedHandled = true;
    };
    obj._onInteractive = function() {

        if (obj._onInteractiveHandled)
            return;
        obj.raiseEvent("Interactive", obj);
        obj._onInteractiveHandled = true;
        if (!obj._progressStarted)
            obj._onProgress();
    };
    obj._onComplete = function() {

        if (obj._onCompleteHandled || obj.aborted)
            return;
        if (obj._progressStarted) {
            window.clearInterval(obj._progressTimer);
            obj._progressStarted = false;
        }
        obj.requestDone = true;
        with (obj.xmlHttpRequest) {
            obj.responseText = responseText;
            obj.responseXML = responseXML;
            if (typeof status != "undefined")
                obj.status = status;
            if (typeof statusText != "undefined")
                obj.statusText = statusText;
        }
        obj.raiseEvent("Complete", obj);
        obj._onCompleteHandled = true;
        if (obj.status == 200)
            obj.raiseEvent("Success", obj); else
            obj.raiseEvent("Error", obj);
        delete obj.xmlHttpRequest['onreadystatechange'];
        obj.xmlHttpRequest = null;
        if (obj.disableForm)
            obj.switchForm(true);
        obj._groupLeave();
        obj.raiseEvent("Finalization", obj);
    };

    obj._groupLeave = function() {

        if (obj.group != null) {
            advAJAX._groupData[obj.group]--;
            if (advAJAX._groupData[obj.group] == 0)
                obj.raiseEvent("GroupLeave", obj);
        }
    };

    obj._retry = false;
    obj._retryNo = 0;
    obj._onTimeout = function() {

        if (obj == null || obj.xmlHttpRequest == null || obj._onCompleteHandled)
            return;
        obj.aborted = true;
        obj.xmlHttpRequest.abort();
        obj.raiseEvent("Timeout", obj);
        obj._retry = true;
        if (obj._retryNo != obj.retryCount) {
            obj._initObject();
            if (obj.retryDelay > 0) {
                obj.raiseEvent("RetryDelay", obj);
                startTime = new Date().getTime();
                while (new Date().getTime() - startTime < obj.retryDelay);
            }
            obj._retryNo++;
            obj.raiseEvent("Retry", obj, obj._retryNo);
            obj.run();
        } else {
            delete obj.xmlHttpRequest["onreadystatechange"];
            obj.xmlHttpRequest = null;
            if (obj.disableForm)
                obj.switchForm(true);
            obj._groupLeave();
            obj.raiseEvent("Finalization", obj);
        }
    };

    obj.run = function() {

        obj._initObject();
        if (obj.xmlHttpRequest == null)
            return false;
        obj.aborted = false;
        if (!obj._onInitializationHandled) {
            obj.raiseEvent("Initialization", obj);
            obj._onInitializationHandled = true;
        }
        if (obj.method == "GET" && obj.unique)
            obj.parameters[encodeURIComponent(obj.uniqueParameter)] =
            new Date().getTime().toString().substr(5) + Math.floor(Math.random() * 100).toString();
        if (!obj._retry) {
            for (var a in obj.parameters) {
                if (obj.queryString.length > 0)
                    obj.queryString += "&";
                if (typeof obj.parameters[a] != "object")
                    obj.queryString += encodeURIComponent(a) + "=" + encodeURIComponent(obj.parameters[a]); else {
                    for (var i = 0; i < obj.parameters[a].length; i++)
                        obj.queryString += encodeURIComponent(a) + "=" + encodeURIComponent(obj.parameters[a][i]) + "&";
                    obj.queryString = obj.queryString.slice(0, -1);
                }
            }
            for (var a in obj.jsonParameters) {
                var useJson = typeof [].toJSONString == 'function';
                if (obj.queryString.length > 0)
                    obj.queryString += "&";
                obj.queryString += encodeURIComponent(a) + "=";
                if (useJson)
                    obj.queryString += encodeURIComponent(obj.jsonParameters[a].toJSONString()); else
                    obj.queryString += encodeURIComponent(obj.jsonParameters[a]);
            }
            if (obj.method == "GET" && obj.queryString.length > 0)
                obj.url += (obj.url.indexOf("?") != -1 ? "&" : "?") + obj.queryString;
        }
        if (obj.disableForm)
            obj.switchForm(false);
        try {
            obj.xmlHttpRequest.open(obj.method, obj.url, obj.async, obj.username || '', obj.password || '');
        } catch (e) {
            obj.raiseEvent("FatalError", obj, e);
            return;
        }
        if (obj.timeout > 0)
            setTimeout(obj._onTimeout, obj.timeout);
        if (typeof obj.xmlHttpRequest.setRequestHeader != "undefined")
            for (var a in obj.headers)
                obj.xmlHttpRequest.setRequestHeader(encodeURIComponent(a), encodeURIComponent(obj.headers[a]));
        if (obj.method == "POST" && typeof obj.xmlHttpRequest.setRequestHeader != "undefined") {
            obj.xmlHttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            obj.xmlHttpRequest.send(obj.queryString);
        } else if (obj.method == "GET")
            obj.xmlHttpRequest.send('');
    };

    obj.handleArguments = function(args) {

        if (typeof args.form == "object" && args.form != null) {
            obj.form = args.form;
            obj.appendForm();
        }
        for (a in args) {
            if (typeof obj[a] == "undefined")
                obj.parameters[a] = args[a]; else {
                if (a != "parameters" && a != "headers")
                    obj[a] = args[a]; else
                    for (b in args[a])
                        obj[a][b] = args[a][b];
            }
        }
        obj.method = obj.method.toUpperCase();
    };

    obj.switchForm = function(enable) {

        if (typeof obj.form != "object" || obj.form == null)
            return;
        with (obj.form)
            for (var nr = 0; nr < elements.length; nr++)
                if (!enable) {
                    if (elements[nr]["disabled"])
                        elements[nr]["_disabled"] = true; else
                        elements[nr]["disabled"] = "disabled";
                } else
                    if (typeof elements[nr]["_disabled"] == "undefined")
                        elements[nr].removeAttribute("disabled");
    };

    obj.appendForm = function() {

        with (obj.form) {
            obj.method = getAttribute("method").toUpperCase();
            obj.url = getAttribute("action");
            for (var nr = 0; nr < elements.length; nr++) {
                var e = elements[nr];
                if (e.disabled)
                    continue;
                switch (e.type) {
                    case "text":
                    case "password":
                    case "hidden":
                    case "textarea":
                        obj.addParameter(e.name, e.value);
                        break;
                    case "select-one":
                        if (e.selectedIndex >= 0)
                            obj.addParameter(e.name, e.options[e.selectedIndex].value);
                        break;
                    case "select-multiple":
                        for (var nr2 = 0; nr2 < e.options.length; nr2++)
                            if (e.options[nr2].selected)
                                obj.addParameter(e.name, e.options[nr2].value);
                        break;
                    case "checkbox":
                    case "radio":
                        if (e.checked)
                            obj.addParameter(e.name, e.value);
                        break;
                }
            }
        }
    };

    obj.addParameter = function(name, value) {
        if (typeof obj.parameters[name] == "undefined")
            obj.parameters[name] = value; else
        if (typeof obj.parameters[name] != "object")
            obj.parameters[name] = [ obj.parameters[name], value ]; else
        obj.parameters[name][obj.parameters[name].length] = value;
    };
    obj.delParameter = function(name) {

        delete obj.parameters[name];
    };
    obj.raiseEvent = function(name) {
        var args = [];
        for (var i = 1; i < arguments.length; i++)
            args.push(arguments[i]);
        if (typeof obj["on" + name] == "function")
            obj["on" + name].apply(null, args);
        if (name == "FatalError")
            obj.raiseEvent("Finalization", obj);
    }

    if (typeof advAJAX._defaultParameters != "undefined")
        obj.handleArguments(advAJAX._defaultParameters);
    return obj;
}

advAJAX.get = function(args) {

    return advAJAX.handleRequest("GET", args);
};

advAJAX.post = function(args) {

    return advAJAX.handleRequest("POST", args);
};

advAJAX.head = function(args) {

    return advAJAX.handleRequest("HEAD", args);
};

advAJAX.submit = function(form, args) {

    if (typeof args == "undefined" || args == null)
        return -1;
    if (typeof form != "object" || form == null)
        return -2;
    var request = new advAJAX();
    args["form"] = form;
    request.handleArguments(args);
    return request.run();
};

advAJAX.assign = function(form, args) {

    if (typeof args == "undefined" || args == null)
        return -1;
    if (typeof form != "object" || form == null)
        return -2;
    if (typeof form["onsubmit"] == "function")
        form["_onsubmit"] = form["onsubmit"];
    form["advajax_args"] = args;
    form["onsubmit"] = function() {
        if (typeof this["_onsubmit"] != "undefined" && this["_onsubmit"]() === false)
            return false;
        if (advAJAX.submit(this, this["advajax_args"]) == false)
            return true;
        return false;
    }
    return true;
};

advAJAX.download = function(targetObj, url) {

    if (typeof targetObj == "string")
        targetObj = document.getElementById(targetObj);
    if (!targetObj)
        return -1;
    advAJAX.get({
        url: url,
        onSuccess : function(obj) {
            targetObj.innerHTML = obj.responseText;
        }
    });
};

advAJAX.scan = function() {

    var obj = document.getElementsByTagName("a");
    for (var i = 0; i < obj.length;) {
        if (obj[i].getAttribute("rel") == "advancedajax" && obj[i].getAttribute("href") !== null) {
            var url = obj[i].getAttribute("href");
            var div = document.createElement("div");
            div.innerHTML = obj[i].innerHTML;
            div.className = obj[i].className;
            var parent = obj[i].parentNode;
            parent.insertBefore(div, obj[i]);
            parent.removeChild(obj[i]);
            advAJAX.download(div, url);
        } else i++;
    }
};

advAJAX.handleRequest = function(requestType, args) {

    if (typeof args == "undefined" || args == null)
        return -1;
    var request = new advAJAX();
    window.advajax_obj = request;
    request.method = requestType;
    request.handleArguments(args);
    return request.run();
};

advAJAX._defaultParameters = new Object();
advAJAX.setDefaultParameters = function(args) {

    advAJAX._defaultParameters = new Object();
    for (a in args)
        advAJAX._defaultParameters[a] = args[a];
};

advAJAX._groupData = new Object();

/**
 * jQuery lightBox plugin
 * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
 * and adapted to me for use like a plugin from jQuery.
 * @name jquery-lightbox-0.5.js
 * @author Leandro Vieira Pinho - http://leandrovieira.com
 * @version 0.5
 * @date April 11, 2008
 * @category jQuery plugin
 * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
 * @license CCAttribution-ShareAlike 2.5 Brazil - http://creativecommons.org/licenses/by-sa/2.5/br/deed.en_US
 * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
 */
(function($){$.fn.lightBox=function(settings){settings=jQuery.extend({overlayBgColor:'#000',overlayOpacity:0.8,fixedNavigation:false,imageLoading:'gallery/lightbox/lightbox-ico-loading.gif',imageBtnPrev:'gallery/lightbox/lightbox-btn-prev.gif',imageBtnNext:'gallery/lightbox/lightbox-btn-next.gif',imageBtnClose:'gallery/lightbox/lightbox-btn-close.gif',imageBlank:'gallery/lightbox/lightbox-blank.gif',containerBorderSize:10,containerResizeSpeed:400,txtImage:'Image',txtOf:'of',keyToClose:'c',keyToPrev:'p',keyToNext:'n',imageArray:[],activeImage:0},settings);var jQueryMatchedObj=this;function _initialize(){_start(this,jQueryMatchedObj);return false;}
function _start(objClicked,jQueryMatchedObj){$('embed, object, select').css({'visibility':'hidden'});_set_interface();settings.imageArray.length=0;settings.activeImage=0;if(jQueryMatchedObj.length==1){settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title')));}else{for(var i=0;i<jQueryMatchedObj.length;i++){settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title')));}}
while(settings.imageArray[settings.activeImage][0]!=objClicked.getAttribute('href')){settings.activeImage++;}
_set_image_to_view();}
function _set_interface(){$('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="'+settings.imageLoading+'"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="'+settings.imageBtnClose+'"></a></div></div></div></div>');var arrPageSizes=___getPageSize();$('#jquery-overlay').css({backgroundColor:settings.overlayBgColor,opacity:settings.overlayOpacity,width:arrPageSizes[0],height:arrPageSizes[1]}).fadeIn();var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]}).show();$('#jquery-overlay,#jquery-lightbox').click(function(){_finish();});$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function(){_finish();return false;});$(window).resize(function(){var arrPageSizes=___getPageSize();$('#jquery-overlay').css({width:arrPageSizes[0],height:arrPageSizes[1]});var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]});});}
function _set_image_to_view(){$('#lightbox-loading').show();if(settings.fixedNavigation){$('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}else{$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}
var objImagePreloader=new Image();objImagePreloader.onload=function(){$('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);objImagePreloader.onload=function(){};};objImagePreloader.src=settings.imageArray[settings.activeImage][0];};function _resize_container_image_box(intImageWidth,intImageHeight){var intCurrentWidth=$('#lightbox-container-image-box').width();var intCurrentHeight=$('#lightbox-container-image-box').height();var intWidth=(intImageWidth+(settings.containerBorderSize*2));var intHeight=(intImageHeight+(settings.containerBorderSize*2));var intDiffW=intCurrentWidth-intWidth;var intDiffH=intCurrentHeight-intHeight;$('#lightbox-container-image-box').animate({width:intWidth,height:intHeight},settings.containerResizeSpeed,function(){_show_image();});if((intDiffW==0)&&(intDiffH==0)){if($.browser.msie){___pause(250);}else{___pause(100);}}
$('#lightbox-container-image-data-box').css({width:intImageWidth});$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({height:intImageHeight+(settings.containerBorderSize*2)});};function _show_image(){$('#lightbox-loading').hide();$('#lightbox-image').fadeIn(function(){_show_image_data();_set_navigation();});_preload_neighbor_images();};function _show_image_data(){$('#lightbox-container-image-data-box').slideDown('fast');$('#lightbox-image-details-caption').hide();if(settings.imageArray[settings.activeImage][1]){$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();}
if(settings.imageArray.length>1){$('#lightbox-image-details-currentNumber').html(settings.txtImage+' '+(settings.activeImage+1)+' '+settings.txtOf+' '+settings.imageArray.length).show();}}
function _set_navigation(){$('#lightbox-nav').show();$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({'background':'transparent url('+settings.imageBlank+') no-repeat'});if(settings.activeImage!=0){if(settings.fixedNavigation){$('#lightbox-nav-btnPrev').css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnPrev').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}}
if(settings.activeImage!=(settings.imageArray.length-1)){if(settings.fixedNavigation){$('#lightbox-nav-btnNext').css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnNext').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}}
_enable_keyboard_navigation();}
function _enable_keyboard_navigation(){$(document).keydown(function(objEvent){_keyboard_action(objEvent);});}
function _disable_keyboard_navigation(){$(document).unbind();}
function _keyboard_action(objEvent){if(objEvent==null){keycode=event.keyCode;escapeKey=27;}else{keycode=objEvent.keyCode;escapeKey=objEvent.DOM_VK_ESCAPE;}
key=String.fromCharCode(keycode).toLowerCase();if((key==settings.keyToClose)||(key=='x')||(keycode==escapeKey)){_finish();}
if((key==settings.keyToPrev)||(keycode==37)){if(settings.activeImage!=0){settings.activeImage=settings.activeImage-1;_set_image_to_view();_disable_keyboard_navigation();}}
if((key==settings.keyToNext)||(keycode==39)){if(settings.activeImage!=(settings.imageArray.length-1)){settings.activeImage=settings.activeImage+1;_set_image_to_view();_disable_keyboard_navigation();}}}
function _preload_neighbor_images(){if((settings.imageArray.length-1)>settings.activeImage){objNext=new Image();objNext.src=settings.imageArray[settings.activeImage+1][0];}
if(settings.activeImage>0){objPrev=new Image();objPrev.src=settings.imageArray[settings.activeImage-1][0];}}
function _finish(){$('#jquery-lightbox').remove();$('#jquery-overlay').fadeOut(function(){$('#jquery-overlay').remove();});$('embed, object, select').css({'visibility':'visible'});}
function ___getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;}
windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=xScroll;}else{pageWidth=windowWidth;}
arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight);return arrayPageSize;};function ___getPageScroll(){var xScroll,yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;}
arrayPageScroll=new Array(xScroll,yScroll);return arrayPageScroll;};function ___pause(ms){var date=new Date();curDate=null;do{var curDate=new Date();}
while(curDate-date<ms);};return this.unbind('click').click(_initialize);};})(jQuery);








