function tabclick(t) { var tabs = t.parentNode; var tp = tabs.parentNode; var panel = false; var list = tp.getElementsByTagName('div'); for (var i = 0; i < list.length; i++) { if (list[i].className == 'panel') { panel = list[i]; } } if (!panel) return; var list1 = tabs.getElementsByTagName('a'); var list2 = panel.getElementsByTagName('div'); var tmplist = []; for (var i = 0; i < list2.length; i++) if(list2[i].parentNode==panel) tmplist.push(list2[i]); list2 = tmplist; for (var i = 0; i < list1.length; i++) { var tmp = list1[i] == t ? 'a' : ''; list1[i].className = tmp + 'tab'; if (list2[i]) list2[i].className = tmp + 'content'; } return false; } function setParam(f, name, value) { var p = document.createElement('input'); p.type = 'hidden'; p.name = name; p.value = value; f.appendChild(p); } function preview(text) { var f = document.createElement('form'); f.target = '_blank'; f.method = 'post'; f.action = '.'; setParam(f, 'source', 'preview'); setParam(f, 'text', text); document.body.appendChild(f); f.submit(); document.body.removeChild(f); } function doPost(action,p) { var f = document.createElement("form"); f.method = "post"; f.action = action; for (var i in p) { var t = document.createElement("input"); t.type = "hidden"; t.name = i; t.value = p[i]; f.appendChild(t); } document.body.appendChild(f); f.submit(); } function fixdescription(url) { var strurl = url+''; if (strurl.indexOf('#') != -1) { var a = document.getElementsByName(strurl.substring(strurl.indexOf('#')+1, strurl.length))[1]; tabclick(a); } } $(function(){ var st = "/static/lightbox/images"; var opts = { overlayBgColor: "#000", overlayOpacity: 0.4, fixedNavigation: false, imageLoading: st + "/lightbox-ico-loading.gif", imageBtnPrev: st + "/prevlabel.gif", imageBtnNext: st + "/nextlabel.gif", imageBtnClose: st + "/bt-close.png", imageBlank: st + "/blank.gif", containerBorderSize: 10, containerResizeSpeed: 400, txtImage: "Фото", txtOf: "из", keyToClose: "p", keyToPrev: "g", keyToNext: "c" }; $("#center a img").each(function() { var i = $(this); var a = i.closest("a"); var src = i.attr("src"); var href = a.attr("href"); var re = /^(site)?\?resource=/i; if (re.exec(href) && re.exec(src)) { a.addClass("ltbox"); } }); $("a.ltbox").lightBox(opts); });