/** * @author Sławomir Kokłowski {@link http://www.kurshtml.edu.pl} * @copyright NIE usuwaj tego komentarza! (Do NOT remove this comment!) */ function Galeria(id, zdjecia, css, ochrona, zaladuj) { this.kolumny = 2; this.naStronie = 10; this.id = id; this.zdjecia = zdjecia; this.ochrona = typeof ochrona != 'undefined' ? ochrona : false; this.css = css; if (typeof zaladuj != 'undefined' && zaladuj) { for (var i = 0; i < this.zdjecia.length; i++) { new Image().src = this.zdjecia[i][0]; } } this.wyswietl = function(strona) { if (typeof strona == 'undefined') strona = 1; var html = ''; for (var i = start_ = (strona - 1) * this.naStronie, stop_ = Math.min(start_ + this.naStronie, this.zdjecia.length); i < stop_; i++) { if (i > start_ && !(i % this.kolumny)) html += ''; html += '' + '' + (typeof this.zdjecia[i][2] != 'undefined' ? '
' + this.zdjecia[i][2] + '
' : '') + ''; } if (html) html = '' + html + '
'; if (this.zdjecia.length > this.naStronie) { html += '
'; if (strona > 1) html += '«'; for (var i = 1, stop_ = Math.ceil(this.zdjecia.length / this.naStronie); i <= stop_; i++) { html += ' ' + (i == strona ? i : '' + i + ''); } if (strona < stop_) html += ' »'; html += '
'; } document.getElementById(this.id).innerHTML = '
' + html + '
'; } this._pokaz = function(i) { var numer = (i + 1) + '/' + this.zdjecia.length; if (this.zdjecia.length < 2) var stronicowanie = ''; else { var stronicowanie = '
' + (i > 0 ? '« Wstecz   ' : '') + numer + (i < this.zdjecia.length - 1 ? '   Dalej »' : '') + '
'; } var html = '' + '' + '' + (typeof this.zdjecia[i][2] != 'undefined' ? this.zdjecia[i][2].replace(/<[^>]+>/g, '') + (numer ? ' (' + numer + ')' : '') : numer) + '' + (typeof this.css != 'undefined' && this.css ? '' : '') + '<'+'script type="text/javascript">' + 'function dopasuj() { window.resizeTo(Math.min(screen.availWidth, Math.max(document.getElementById(\'img\').width + 50, document.getElementById(\'body\').offsetWidth)), Math.min(screen.availHeight, document.getElementById(\'body\').offsetHeight + 80)); }' + (this.ochrona ? 'window.onblur = function() { if (document.getElementById(\'body\')) document.getElementById(\'body\').style.visibility = \'hidden\'; try { clipboardData.clearData(); } catch (e) {} }; window.onfocus = function () { if (document.getElementById(\'body\')) document.getElementById(\'body\').style.visibility = \'visible\'; };' : '') + '<'+'/script>' + '' + '' + '
' + '
' + (typeof this.zdjecia[i][2] != 'undefined' || numer ? '

' + (typeof this.zdjecia[i][2] != 'undefined' ? this.zdjecia[i][2] : numer) + '

' : '') + '
' + (typeof this.zdjecia[i][3] != 'undefined' ? '
' + this.zdjecia[i][3] + '
' : '') + stronicowanie + '
' + '
' + '' + ''; return html; } this.pokaz = function(i) { try { Galeria.okno.close() } catch (e) {} Galeria.okno = window.open('', this.id, 'menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,width=400,height=400'); if (!Galeria.okno) return false; Galeria.okno.document.close(); Galeria.okno.document.write(this._pokaz(i)); Galeria.okno.document.close(); Galeria.okno.focus(); return true; } document.write('
'); this.wyswietl(); } Galeria.okno = null;