/**
* Pigeon AJAX CMS
*
* @author	Karol Krawczyk | www.ajax-cms.net | zlecenie@gmail.com
* @since	2007-01-01
* @version	1.00
* @package	_js
* @date		2007-07-20
*
* Zabranie się jakichkolwiek zmian w kodzie oraz jego rozpowszechniania bez zgody autora
* Wszystkie prawa zastrzeżone
*
*---------------------------------------------------------------------------------
* Oprogramowanie jest chronione prawem autorskim
*---------------------------------------------------------------------------------
 */
_editor_url  = "../";function gotosite(site) {if (site != "") {self.location = site;}}function okno(url, width, height) {height = height + 30;width = width + 30;xx = (screen.availHeight - height) / 2 - 10;yy = (screen.availWidth - width) / 2;var Win = window.open(url, "displayWindow", 'width=' +width + ',height=' +height + ',top=' +xx + ',left=' +yy + ',resizable=0,scrollbars=yes,menubar=no');}var colr = new Array ("#fff", "#eee", "#ddd", "#ccc", "#bbb", "#aaa", "#888", "#666", "#444", "#222", "#000");var count = 0;var timeexp =0;function fade(id) {}var last_id = null;function pops(id, event, fx) {document.onmouseout = poph;document.onclick = poph;obj = $ (id);cursor = getPosition(event);count=0;clearTimeout(timeexp);if (obj.offsetWidth) {ew = obj.offsetWidth;}else if (obj.clip.width) {ew = obj.clip.width;}tv = cursor.y + 25;lv = cursor.x - (ew/4);;if (lv < 2) {lv = 2;} else if (lv + ew > ww()) {lv -= ew/2;}obj.style.top = tv + 'px';obj.style.left = lv + 'px';obj.style.visibility = "visible";if (fx == 'fade'){fade(id);}last_id=id;}function poph(event){if($(last_id)){$(last_id).style.visibility = "hidden";document.onmouseout = null;count=0;}}function $ (obj) {return document.getElementById(obj);}function getPosition(e) {e = e || window.event;var cursor = { x : 0, y : 0 };if (e.pageX || e.pageY) {cursor.x = e.pageX;cursor.y = e.pageY;} else {var de = document.documentElement;var b = document.body;cursor.x = e.clientX + (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);cursor.y = e.clientY + (de.scrollTop || b.scrollTop) - (de.clientTop || 0);}return cursor;}function submitForm(form) {formName = form;advAJAX.submit(document.getElementById(formName), {    onError : function(obj) { alert("Error: " + obj.status); },onSuccess : function (obj) {runJS(obj.responseText);parseForm(obj.responseXML);}});}function submitFormD(formName,loadID,op) {$ (loadID).innerHTML = working('Pobieranie danych...');advAJAX.submit(document.getElementById(formName), {    onError : function(obj) { alert("Error: " + obj.status); },onSuccess : function (obj) {if (op){$ (loadID).innerHTML = obj.responseText;}else{parseForm(obj.responseXML);}},   disableForm : false});}function parseForm(xml) {with(xml.getElementsByTagName("records").item(0)) {error = getAttribute("error");total = getAttribute("total");state = getAttribute("state");}if (error.substring(0,7)=='action:'){eval(error);return;}if (state == '1') {window.location.href = error;} else {if (error.length > 1){$ ("editError").innerHTML = '<span class="error">' +error + '</span>';}record = xml.getElementsByTagName("record");for (i = 0; i < total; i++) {$ (record[0].childNodes[i].nodeName + 'Edit').innerHTML = record[0].childNodes[i].childNodes[0].nodeValue;}}}function loadAction(loadID, startURL,NOKOM) {advAJAX.get({url : startURL + 'output/ajax/', onInitialization : function () {if (!NOKOM){$ (loadID).innerHTML = working();}}, onError : function (obj) {alert("Error: " + obj.status);}, onSuccess : function (obj) {$ (loadID).innerHTML = obj.responseText;runJS(obj.responseText);}});}var expiryBT=0;var bufor = new Array();function lab(loadID, startURL,op) { if (typeof(bufor[startURL]) == "string" ){$ (loadID).innerHTML=bufor[startURL];clearTimeout(expiryBT);return;}if (op){advAJAX.get({url : startURL + 'output/ajax/', onInitialization : function () {$ (loadID).innerHTML = working();}, onError : function (obj) {alert("Error: " + obj.status);}, onSuccess : function (obj) {bufor[startURL] = obj.responseText;$ (loadID).innerHTML=bufor[startURL];runJS(obj.responseText);}});}else{$ (loadID).innerHTML = working();clearTimeout(expiryBT);my = "lab('" + loadID + "','" + startURL + "',1)";expiryBT = setTimeout(my, 600);}}function working(text) {if (typeof(text) != "string" ){text='Pobieranie danych...';}return '<div class="load">' +text + '</div>';}function check_option(tmp) {if ($(tmp).checked){$ ("layer_"+tmp).style.display = 'block';}else{$ ("layer_"+tmp).style.display = 'none';}}var cstop=0;function getJS(content){if (cstop){content=content.substr(cstop+9);}cstart = content.indexOf('<script type="text/javascript">');cstop = content.indexOf('</script>');if(cstart == -1 || cstop == -1 || cstart > cstop ){return null;}cstart+=31;return content.substr(cstart,(cstop-cstart));}function runJS(content){cmd = getJS(content);if(cmd){eval(cmd);}cmd = getJS(content);if(cmd){eval(cmd);}cstop=0;}function setCookie(name,value,days) {if (days) {var date = new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires = "; expires="+date.toGMTString();}else var expires = "";document.cookie = name+"="+value+expires+"; path=/";}function getCookie(name) {var nameEQ = name + "=";var ca = document.cookie.split(';');for(var i=0;i < ca.length;i++) {var c = ca[i];while (c.charAt(0)==' ') c = c.substring(1,c.length);if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);}return null;}function deleteCookie(name) {setCookie(name,"",-1);}