/** * Extrafotka.pl * * autors: jach&mikekim * product for Gery Gesign * Wroclaw 10/4/2006 * id: main.js */ var otwarta_warstwa = ''; var old_id = ''; var old_linia = ''; function $(id) { return _geb(id); } function _geb (id) { if (!document.getElementById (id)) return false; else return document.getElementById (id); } function show_layer(id) { var blok = _geb (id); blok.style.display = (blok.style.display == 'none' ? 'block' : 'none'); } function show_layer_whide(id) { if(otwarta_warstwa!='') { show_layer(otwarta_warstwa); } if (otwarta_warstwa != id) { otwarta_warstwa = id; show_layer(id); } else { otwarta_warstwa = ''; } } function edycja_aup() { _geb('upload_avatara').style.display='none'; _geb('loader').style.display='block'; document.edycja_danych.upload.value='jest'; document.edycja_danych.submit(); } function pozycja_kursora (e) { // jeśli nie ma e if (!e) var e = window.event; // pobieramy pozycje if (e.pageX || e.pageY) { // to jest dla mądrych przeglądarek px = e.pageX; py = e.pageY; } else if (e.clientX || e.clientY) { // a to jest dla IE px = e.clientX + document.body.scrollLeft; py = e.clientY + document.body.scrollTop; } if(showHint){ hintPos(); } } var IE = document.all?true:false /* if (!IE) document.captureEvents(Event.MOUSEMOVE) document.onmousemove = pozycja_kursora; */ var px = 0 var py = 0 var showHint = false; function hint(txt,szer,wys,timeout) { if(typeof timeout == 'undefined' || timeout == null){ var timeout = 500; } if(typeof szer == 'undefined' || szer == null){ var szer = 150; } if(typeof wys == 'undefined' || wys == null){ var wys = 13; } document.body.style.cursor = 'help'; _geb('hint').innerHTML = txt; _geb('hint').style.width = szer+'px'; _geb('hint').style.height = wys+'px'; setTimeout('hintS()',timeout); showHint = true; if (!IE) document.captureEvents(Event.MOUSEMOVE) document.onmousemove = pozycja_kursora; } function hintS(){ if(showHint) _geb('hint').style.display = 'block'; } function hintH(){ document.body.style.cursor = 'auto'; showHint = false; _geb('hint').style.display = 'none'; } function hintPos() { _geb('hint').style.left = px+5+'px'; _geb('hint').style.top = py+5+'px'; } function menu(obj, status, rodzaj) { if (status == "on") { if (rodzaj == "glosuj") obj.style.backgroundImage='url(img/glosuj_bg_gr.gif)'; if (rodzaj == "zmien_kategoria") obj.style.backgroundImage='url(img/menu/kategoria_zapalony.gif)'; } else { if (rodzaj == "glosuj") obj.style.backgroundImage='url(img/glosuj_bg.gif)'; if (rodzaj == "zmien_kategoria") obj.style.backgroundImage='url(img/menu/kategoria_zgaszony.gif)'; } } /*MENU przeglanie fotek*/ function ZmienKategoriaMenu(kategoria,id,tag) { /*wygaszamy na czas przelaczenia*/ _geb('PrzelaczStrzalkaLewo').innerHTML = '\"poprzedni\"poprzednie'; _geb('PrzelaczStrzalkaLewo').style.backgroundImage='url(img/menu/poprzedni_nastepny_wygaszony.gif)'; _geb('PrzelaczStrzalkaPrawo').innerHTML = 'następne\"\"'; _geb('PrzelaczStrzalkaPrawo').style.backgroundImage='url(img/menu/poprzedni_nastepny_wygaszony.gif)'; advAJAX.get({ url : '/sources/files/arekajax.php', parameters : { "menu_change":"true", "kategoria" : kategoria, "id" : id, "tag":tag }, onSuccess : function(obj) { eval(obj.responseText); }, onError : function(obj) { alert("Error: " + obj.status); }, mimeType: 'text/plain' }); } /*MENU - filtrowanie zdjec, przegladanie tylko extrafotek*/ function FiltrujExtra(filtruj,kategoria,id,tag) { /*wygaszamy na czas przelaczenia*/ _geb('PrzelaczStrzalkaLewo').innerHTML = '\"poprzedni\"poprzednie'; _geb('PrzelaczStrzalkaLewo').style.backgroundImage='url(img/menu/poprzedni_nastepny_wygaszony.gif)'; _geb('PrzelaczStrzalkaPrawo').innerHTML = 'następne\"\"'; _geb('PrzelaczStrzalkaPrawo').style.backgroundImage='url(img/menu/poprzedni_nastepny_wygaszony.gif)'; advAJAX.get({ url : '/sources/files/arekajax.php', parameters : { "menu_change":"true", "filtruj" : filtruj.value, "kategoria" : kategoria, "id" : id, "tag":tag }, onSuccess : function(obj) { eval(obj.responseText); }, onError : function(obj) { alert("Error: " + obj.status); }, mimeType: 'text/plain' }); } /*Stronicowanie zawartosci katalogu*/ function StronicujAlbum(album,strona) { /*wygaszamy na czas przelaczenia*/ _geb('PrzelaczStrzalkaLewoAlbum').innerHTML = '\"Brak'; _geb('PrzelaczStrzalkaPrawoAlbum').innerHTML = '\"Brak'; advAJAX.get({ url : '/sources/files/arekajax.php', parameters : { "stronicuj_album" : "true", "album" : album, "strona": strona }, onSuccess : function(obj) { eval(obj.responseText); }, onError : function(obj) { alert("Error: " + obj.status); }, mimeType: 'text/plain' }); } /*Moderecja fotek - ustawiania*/ function ModerujZdjecieUstaw(id,action,rodzaj,linia) { if(old_id != '' && rodzaj == 'multi') { //stare zdjecie _geb('ZdjeciaBorderMulti'+old_id+'').style.border = '2px solid #E3E3E3'; _geb('ZdjeciaNakryj'+old_id+'').style.display = 'none'; _geb('ZdjeciaAction'+old_id+'').style.display = 'block'; _geb('ZdjeciaAutor'+old_id+'').style.display = 'block'; _geb('ZdjeciaBorderMulti'+old_id+'').style.paddingBottom = '0px'; _geb('ZdjeciaOpis'+old_id+'').style.borderLeft = '0px'; _geb('ZdjeciaOpis'+old_id+'').style.borderRight = '0px'; } if(old_linia != '' && rodzaj == 'multi') { _geb('ZdjeciaBlokModeruj'+old_linia+'').style.display = 'none'; } old_id = id; old_linia = linia; advAJAX.get({ url : '/sources/files/arekajax.php', parameters : { "moderuj_zdjecie" : "true", "id" : id, "action" : action, "rodzaj" : rodzaj, "linia" : linia }, onSuccess : function(obj) { eval(obj.responseText); }, onError : function(obj) { alert("Error: " + obj.status); }, mimeType: 'text/plain' }); } /*Moderecja fotek - zapisywanie*/ function ModerujZdjecieZapisz(id,action,form,rodzaj,linia) { //wygaszamy _geb('ModerujZdjecie_kf').innerHTML = 'Zapisz zmianyAnuluj'; advAJAX.submit(document.getElementById(form), { url : '/sources/files/arekajax.php', parameters : { "id" : id, "action" : action, "rodzaj" : rodzaj, "linia" : linia }, onSuccess : function(obj) { eval(obj.responseText); }, onError : function(obj) { alert("Error: " + obj.status); }, mimeType: 'text/plain' }); } /*Zdjecie dla uzytkownika 18+*/ function ConfirmAdult(potwierdzenie,zdjecie_id) { var czas = new Date(); czas.setTime((24*60*60*1000) + czas.getTime()); if (_geb('Confirm_zapamietaj').checked) { document.cookie = "AdultCookie=" + escape(potwierdzenie) + "; expires=" + czas; } if (potwierdzenie == 'true') { _geb('FotoMain').style.display = 'block'; _geb('PokazAdultZdjecie').style.display = 'none'; _geb('AdultZastap').style.display = 'none'; } else { top.location = 'http://www.extrafotka.pl' + zdjecie_id; } } var oldObj; var menuHoverTimeout; function menuHoverExec(id,kategoria) { var obj = $(id); if(obj!=oldObj){ $('kategoria_content').style.display = 'block'; $('foto_extra').style.display = 'none'; if(typeof oldObj == 'object'){ oldObj.className = ''; } oldObj = obj; obj.className = "selected"; var left = absolute_left(obj); var top = absolute_top(obj); $('selectedt').style.left = left+266+'px'; $('selectedt').style.top = top+'px'; $('selectedt').style.display = 'block'; //wyswietlamy kategorie if (kategoria != undefined) $('KategoriaNaglowek').innerHTML = '' + kategoria + '<\/span>'; } if($('kat_div_0').style.display != 'none') $('kat_div_0').style.display = 'none'; var layer = id.replace('li','div'); swapLayer(layer); return true; } function menuHover(id,kategoria) { clearTimeout(menuHoverTimeout); if(typeof oldObj != 'undefined'){ menuHoverTimeout = setTimeout('menuHoverExec(\''+id+'\',\''+kategoria+'\')',50); } else { menuHoverExec(id,kategoria); } } function menuOutExec() { $('kategoria_content').style.display = 'none'; $('foto_extra').style.display = 'block'; $('selectedt').style.display = 'none'; if(typeof oldObj == 'object'){ oldObj.className = ''; } oldObj = ''; } function menuOut() { clearTimeout(menuHoverTimeout); menuHoverTimeout = setTimeout('menuOutExec()',500); } var oldLayer; function swapLayer(id) { obj = $(id); if(typeof obj != 'boolean'){ if(typeof oldLayer != 'undefined'){ oldLayer.style.display = 'none'; } oldLayer = obj; obj.style.display = 'block'; } } function mUstawT() { obj = $('kat_li_0'); var left = absolute_left(obj); var top = absolute_top(obj); $('selectedt').style.left = left+266+'px'; $('selectedt').style.top = top+'px'; $('selectedt').style.display = 'block'; } function absolute_top (obiekt) { // zerujemy zmienne var pos = 0; var oParent = obiekt; // nie ma if (!oParent) return pos; // pętla do { // ustawiamy pozycje pos += oParent.offsetTop; // pobieramy parentka oParent = oParent.offsetParent; } while (oParent.tagName != 'BODY' && oParent.tagName != 'HTML'); // zwracamy pos return pos; } function absolute_left (obiekt) { // zerujemy zmienne var pos = 0; var oParent = obiekt; // nie ma if (!oParent) return pos; // pętla do { // ustawiamy pozycje pos += oParent.offsetLeft; // pobieramy parentka oParent = oParent.offsetParent; } while (oParent.tagName != 'BODY' && oParent.tagName != 'HTML'); // zwracamy pos return pos; } function sprawdz_login_main(login) { advAJAX.post({ url : '/sources/files/mojajax.php', parameters : { "a" : "sprawdzLogin", "t" : "plain", "l" : login }, onSuccess : function(obj) { eval(obj.responseText); }, mimeType: 'text/plain' }); } function uploaduj() { $('main_upload').style.display = 'none'; $('loader').style.display = 'block'; document.upload.submit(); } function link(href) { top.location = href; } /*zanaczenie linkow*/ function ZaznaczPole(pole) { pole.focus(); pole.select(); } /*pokazywanie linkow do fotek na fora,blogi itp...*/ function PokazLinki(id) { if (_geb('FotoLinki').style.display == 'none') { //pokazujemy _geb('FotoLinki').style.display = 'block'; //dla IE7 _geb('MainBlok').style.height = $('MainBlok').clientHeight + 415 + 'px'; _geb('FotoLinki').innerHTML = '
Proszę czekać
proszę czekać...
'; //powtornie ustawiamy _geb('AkcjaLinki').innerHTML = 'Ukryj pozostałe kody'; advAJAX.get({ url : '/sources/files/arekajax.php', parameters : { "pokaz_linki" : "true", "id" : id }, onSuccess : function(obj) { eval(obj.responseText); }, onError : function(obj) { alert("Error: " + obj.status); }, mimeType: 'text/plain' }); } else { _geb('FotoLinki').innerHTML = ''; _geb('FotoLinki').style.display = 'none'; _geb('AkcjaLinki').innerHTML = 'Pokaż pozostałe kody'; //dla IE7 _geb('MainBlok').style.height = $('MainBlok').clientHeight - 415 + 'px'; } } /*pokazywanie linkow do fotek na fora,blogi itp...*/ function ShowHistory(id) { if (_geb('ShowHistory').style.display == 'none') { //pokazujemy _geb('ShowHistory').style.display = 'block'; //powtornie ustawiamy _geb('ShowHistoryButton').innerHTML = 'Ukryj historię zmian'; advAJAX.get({ url : '/sources/files/arekajax.php', parameters : { "show_foto_history" : "true", "id" : id }, onSuccess : function(obj) { eval(obj.responseText); }, onError : function(obj) { alert("Error: " + obj.status); }, mimeType: 'text/plain' }); } else { _geb('ShowHistory').innerHTML = ''; _geb('ShowHistory').style.display = 'none'; _geb('ShowHistoryButton').innerHTML = 'Pokaż historię zmian'; } } var mTimeout; function msg(txt) { var extraMsg = $('extraMsg'); if(typeof extraMsg == 'undefined' || extraMsg == false || extraMsg == null){ var extraMsg = document.createElement('div'); extraMsg.id = 'extraMsg'; extraMsg.style.position = 'absolute'; extraMsg.style.zIndex = '900'; extraMsg.style.width = '400px'; extraMsg.style.padding = '1px'; extraMsg.style.backgroundColor = '#ffffff'; extraMsg.style.border = '1px solid #38A7D0'; extraMsg.style.color = '#ffffff'; extraMsg.style.textAlign = 'center'; extraMsg.style.fontFamily = 'Tahoma'; extraMsg.style.fontSize = '11px'; extraMsg.style.fontWeight = 'bold'; extraMsg.style.top = '150px'; extraMsg.style.left = Math.round(document.body.clientWidth / 2 - 210)+'px'; var extraMsgTitle = document.createElement('div'); extraMsgTitle.id = 'extraMsgTitle'; extraMsgTitle.style.backgroundColor = 'black'; extraMsgTitle.style.margin = '1px'; extraMsgTitle.style.fontWeight = 'bold'; //extraMsg.appendChild(extraMsgTitle); var extraMsgText = document.createElement('div'); extraMsgText.id = 'extraMsgText'; extraMsgText.style.padding = '20px 10px'; extraMsgText.style.backgroundColor = '#38A7D0'; extraMsg.appendChild(extraMsgText); document.body.appendChild(extraMsg); } $('extraMsgText').innerHTML = txt; $('extraMsg').style.display = 'block'; mTimeout = setTimeout('msgHide()',3000); } function msgHide() { $('extraMsg').style.display = 'none'; } function changeOpacity(obj,opacity) { obj.style.opacity = (opacity / 100)+''; obj.style.filter = 'alpha(opacity='+opacity+')'; } function moveAd(from,to) { var to_obj = $(to); var from_obj = $(from); to_obj.innerHTML = from_obj.innerHTML; from_obj.parentNode.removeChild(from_obj); } //preload var preload = new Array(); preload[1] = new Image(); preload[1].src = '/img/tlo_selected.gif'; preload[2] = new Image(); preload[2].src = '/img/kategoria_selected.gif'; preload[2] = new Image(); preload[2].src = '/img/loader.gif';