function $(id) { return document.getElementById(id); } /* * funkcja pobierajaca dodatkowe skrypty, normalizuje podane sciezki i zalacza tylko jesli jeszcze nie jest zalaczony */ function include(src) { if(typeof __includedFiles == 'undefined'){ __includedFiles = new Array(); } var tempSrc = src; var protocol = /^http[s]?:\/\//; if(!protocol.test(tempSrc)){ if(tempSrc.charAt(0) == '/'){ tempSrc = document.location.protocol+'//'+document.location.host+tempSrc; } else { tempSrc = document.location.href.replace(document.location.hash,''); tempSrc = 'http://www.gbox.eu/zdjecia/aaa/'; tempSrc = tempSrc.replace(/(.*)\/.*/,'$1/')+src; var k = 0; while((k = tempSrc.indexOf('../')) != -1){ var s = 0; var c = 0; while((s = tempSrc.indexOf('/',c)) < k-1){ c = s+1; } tempSrc = tempSrc.substring(0,c)+tempSrc.substring(k+3,tempSrc.length); } } } if(__includedFiles.indexOf(tempSrc) != -1){ return false; } __includedFiles.push(tempSrc); document.write(''); return true; } function isFunc(v) { return typeof v == 'function'; } if(!Array.indexOf){ Array.prototype.indexOf = function(obj){ for(var i=0; i "+theRules[i].style[rule]); } } } } return ret; } function cancelBubble(e) { if(!e){ window.event.cancelBubble = true; } else { e.stopPropagation(); } } function getParentElement(obj,element,className) { var temp = obj; if(not(className)){ var className = ''; } while(temp = temp.parentNode){ if(temp.nodeName.toUpperCase() == element.toUpperCase()){ if(!className){ return temp; } if(temp.className.toUpperCase() == className.toUpperCase()){ return temp; } } } return false; } /** * usuwa wszystkich podomków * * @param {Object} obj node dla którego należy usunąć potomków */ function removeChildren(obj){ while(obj.childNodes.length) obj.removeChild(obj.childNodes[0]); } // skopiowane beszczelnie z django-admin // quickElement(tagType, parentReference, textInChildNode, [, attribute, attributeValue ...]); function quickElement() { var obj = document.createElement(arguments[0]); if (arguments[2] != '' && arguments[2] != null) { var textNode = document.createTextNode(arguments[2]); obj.appendChild(textNode); } var len = arguments.length; for (var i = 3; i < len; i += 2) { obj.setAttribute(arguments[i], arguments[i+1]); } arguments[1].appendChild(obj); return obj; } function wheel(event,callback){ var delta = 0; if (!event) /* For IE. */ event = window.event; if (event.wheelDelta) { /* IE/Opera. */ delta = event.wheelDelta/120; /** In Opera 9, delta differs in sign as compared to IE. */ if (window.opera) delta = -delta; } else if (event.detail) { /** Mozilla case. */ /** In Mozilla, sign of delta is different than in IE. * Also, delta is multiple of 3. */ delta = -event.detail/3; } if (delta) callback(delta); if (event.preventDefault) event.preventDefault(); event.returnValue = false; } function strip_tags(str) { return str.replace(/(<([^>]+)>)/ig,""); } // skopiowane beszczelnie z django-admin (a nastepnie troche zmienione) // quickElement(tagType, parentReference, textInChildNode, [, attribute, attributeValue ...]); function quickElement() { var obj = document.createElement(arguments[0]); if (arguments[2] != '' && arguments[2] != null) { var textNode = document.createTextNode(arguments[2]); obj.appendChild(textNode); } var len = arguments.length; for (var i = 3; i < len; i += 2) { obj.setAttribute(arguments[i], arguments[i+1]); } if(arguments[1]) arguments[1].appendChild(obj); return obj; } //quickElement(tagType, className, textInChildNode, [, attribute, attributeValue ...]); function quickerElement() { var obj = document.createElement(arguments[0]); if (arguments[2] != '' && arguments[2] != null) { var textNode = document.createTextNode(arguments[2]); obj.appendChild(textNode); } var len = arguments.length; for (var i = 3; i < len; i += 2) { obj.setAttribute(arguments[i], arguments[i+1]); } if(arguments[1]) setClass(obj,arguments[1]); return obj; }