
// f:event_manager.js
if (typeof addEvent != 'function' ) { var addEvent = function(o, t, f, l) { var d = 'addEventListener' , n = 'on' + t, rO = o, rT = t, rF = f, rL = l; if (o[d]&& !l)return o[d](t, f, false); if (!o._evts)o._evts =  {  }
; if (!o._evts[t]) { o._evts[t]= o[n]?  { b : o[n] }
:  {  }
; o[n]= new Function('e' , 'var r = true, o = this, a = o._evts["' + t + '"], i; for (i in a) {' + 'o._f = a[i]; r = o._f(e||window.event) != false && r; o._f = null;' + '} return r' ); if (t != 'unload' )addEvent(window, 'unload' , function() { removeEvent(rO, rT, rF, rL);  }
);  }
if (!f._i)f._i = addEvent._i++; o._evts[t][f._i]= f;  }
; addEvent._i = 1; var removeEvent = function(o, t, f, l) { var d = 'removeEventListener' ; if (o[d]&& !l)return o[d](t, f, false); if (o._evts && o._evts[t]&& f._i)delete o._evts[t][f._i];  }
;  }
function cancelEvent(e, c) { e.returnValue = false; if (e.preventDefault)e.preventDefault(); if (c) { e.cancelBubble = true; if (e.stopPropagation)e.stopPropagation();  }
 }
function clone_add(a, o) { for (var i in o)a[i]= o[i];  }

// f:structure.class.js
function structure_class_item(name, value) { this.next = null; this.last = null; this.parent = null; this.child = null; this.name = name; this.value = value;  }
structure_class_item.prototype.append_child = function(ref) { if (this.child == null) { this.child = ref; ref.parent = this;  }
else  { var loop = this.child; while (loop.next != null)loop = loop.next; loop.next = ref; ref.last = loop; ref.parent = this;  }
return ref;  }
structure_class_item.prototype.add_child = function(name, value) { return this.append_child(new structure_class_item(name, value));  }
structure_class_item.prototype.get_child = function(name) { var founded = false; var loop = this.child; while (!founded && loop != null) { if (loop.name == name)founded = true; else loop = loop.next;  }
return founded ? loop : null;  }
structure_class_item.prototype.destroy = function(force) { if (force == null) {  }
else  { var stack = new Array(); var current = null; var loop = null; stack[stack.length]= this; while (stack.length > 0) { current = stack.pop(); if (current.child == null) { current.last = null; current.next = null; if (current.parent != null && current.parent.child == current)current.parent.child = null; current.parent = null;  }
else  { stack[stack.length]= current; loop = current.child; while (loop != null) { stack[stack.length]= loop; loop = loop.next;  }
 }
 }
 }
 }
structure_class_item.prototype.matchEntity = function(string) { string = string.replace(/&/g,'&amp;' ); string = string.replace(/</g,'&lt;' ); string = string.replace(/>/g,'&gt;' ); string = string.replace(/'/g,'&apos;' ); string = string.replace(/"/g,'&quot;' ); return string;  }
structure_class_item.prototype.getXMLstring = function() { if (typeof this.value == 'string' ) { return this.matchEntity(this.value);  }
else return this.value;  }
function structure_class() { this.root = null; this.flush();  }
structure_class.prototype.flush = function() { if (this.root != null) { this.root.destroy(); this.root = null;  }
this.root = new structure_class_item();  }
structure_class.prototype.destroy = function() { this.flush(); context.object_destroy(this);  }
structure_class.prototype.path_parts = function(path) { var path_parts = new Array(); var point = 0; var cur_char = '' ; var cur_str = '' ; for (point = 0; point <= path.length; point++) { cur_char = point == path.length ? '/' : path.substr(point, 1); switch (cur_char) { case '/' : path_parts[path_parts.length]= cur_str; cur_str = '' ; break; default : cur_str += cur_char; break;  }
 }
return path_parts  }
structure_class.prototype.map = function(path, value) { var path_parts = this.path_parts(path); if (path_parts.length > 0) { var current = this.root; var child; var f; for (f = 0; f < path_parts.length; f++) { child = current.get_child(path_parts[f]); if (child == null) { child = new structure_class_item(path_parts[f], f + 1 == path_parts.length ? value : null); current.append_child(child);  }
else  { if (f + 1 == path_parts.length)child.value = value;  }
current = child;  }
return current;  }
return null;  }
structure_class.prototype.get = function(path) { var path_parts = this.path_parts(path); var founded = null; if (path_parts.length > 0) { var f; var founded = this.root; for (f = 0; f < path_parts.length && founded != null; f++)founded = founded.get_child(path_parts[f]);  }
return founded != null ? founded.value : null;  }
structure_class.prototype.compose = function(container_element) { var output = '<' + '?xml version="1.0" encoding="utf-8"?' + '><' + container_element + '>' ; var stack = new Array(); var opened = new Array(); var current, add, loop; stack[stack.length]= this.root; while (stack.length > 0) { current = stack.pop(); if (current != this.root) { var brk = false; var pos = opened.length - 1; while (!brk && pos >= 0) { if (opened[pos]== current.parent)brk = true; else pos--;  }
if (brk) { var max; for (max = opened.length - 1; max > pos; max--) { output += '</' + opened[max].name + '>' ; opened.pop();  }
 }
else  { var f; for (f = opened.length -1; f >= 0; f--) { output += '</' + opened[f].name + '>' ;  }
opened = new Array();  }
if (current.child != null) { output += '<' + current.name + '>' ; opened[opened.length]= current;  }
if (current.child == null) { output += '<' + current.name + '>' + current.getXMLstring()+ '</' + current.name + '>\r\n' ;  }
 }
if ((loop = current.child)!= null) { add = new Array(); while (loop != null) { add[add.length]= loop; loop = loop.next;  }
var f; for (f = add.length - 1; f >= 0; f--)stack[stack.length]= add[f];  }
 }
var f; for (f = opened.length - 1; f >= 0; f--) { output += '</' + opened[f].name + '>' ;  }
output += '</' + container_element + '>' ; return output;  }

// f:collection.class.js
function collection_list_item() { this.next = null; this.last = null; this.collection_parent = null;  }
function collection_list() { this.fisrt = null; this.end = null; this.count = 0;  }
collection_list.prototype.collection_exists = function(item) { var loop = this.first; while (loop != null && loop != item)loop = loop.next; return loop  }
collection_list.prototype.collection_add = function(item) { if (item.collection_parent == null) { if (this.first == null) { this.first = item; this.end = item; this.count++;  }
else  { this.end.next = item; item.last = this.end; this.end = item; this.count++;  }
item.collection_parent = this; return item;  }
else  { if (item.collection_parent == this)context.error("Cannot add to collection, item allready included here!" ); else context.error("Cannot add to collection, item allready included in other collection!" );  }
return null;  }
collection_list.prototype.collection_rem = function(item) { if (item.collection_parent == this) { if (item.last == null && item.next == null) { this.first = null; this.end = null;  }
else if (item.last == null) { this.first = this.first.next; this.first.last = null;  }
else if (item.next == null) { this.end = this.end.last; this.end.next = null;  }
else  { item.last.next = item.next; item.next.last = item.last;  }
item.collection_parent = null; item.next = null; item.last = null; this.count--; return item;  }
else  { context.error("Cannot remove, no such item in collection!" );  }
return null;  }
collection_list.prototype.collection_flush = function() { if (this.first != null) { var loop = this.first; var next = null; while (loop != null) { next = loop.next; loop = next;  }
this.first = null; this.last = null;  }
 }

// f:http_request.class.js
function http_request(parent, data, structure_root, keep) { this.inheritFrom = collection_list_item; this.inheritFrom(); this.inheritFrom = structure_class; this.inheritFrom(); this.parent = parent; this.data = data; this.keep = keep; this.request = null; this.evt_oncreate = null; this.evt_ondone = null; this.time_start = null; this.time_end = null; this.construct(structure_root);  }
clone_add(http_request.prototype, structure_class.prototype); http_request.prototype.construct = function(structure_root) { var self = this; if (window.ActiveXObject) { this.request = new ActiveXObject("Microsoft.XMLHTTP" );  }
else  { this.request = new XMLHttpRequest();  }
this.request.onreadystatechange = function() { self.state_changed();  }
if (structure_root == null) { this.flush();  }
else  { this.root = structure_root;  }
 }
http_request.prototype.destroy = function() { if (!this.keep)this.flush(); context.object_destroy(this);  }
http_request.prototype.state_changed = function() { switch (this.request.readyState) { case 4 : if (this.evt_ondone != null)this.evt_ondone(this.data, this); this.parent.dequeue(this); break;  }
 }
http_request.prototype.make = function() { if (this.parent != null) { if (this.evt_oncreate != null)this.evt_oncreate(this.data, this); this.request.open("POST" , this.parent.interface_ref, true); this.request.setRequestHeader("Content-Type" , "application/x-www-form-urlencoded" ); this.request.send(this.compose('request_data' )); if (this.request.overrideMimeType != null)this.request.overrideMimeType('text/xml' );  }
else  { context.error("Unable to process request, no parent collector specified!" );  }
 }
http_request.prototype.get_response = function() { xml = this.request.responseXML; if (xml != null) { if (xml.normalize != null)xml.normalize(); var head = xml.getElementsByTagName("head" )[0]; var body = xml.getElementsByTagName("body" )[0]; var f; if (head != null && body != null) { var error_flags = head.getElementsByTagName("error_flag" ); if (context.catch_error_flags(error_flags)) {  }
else  { var errors = head.getElementsByTagName("error" ); if (errors.length == 0) { return new Array(head, body);  }
else  { var error_str = "" ; for (f = 0; f < errors.length; f++) { if (f != 0)error_str += "\r\n" ; error_str += context.element_value(errors[f]);  }
context.error(error_str);  }
 }
 }
else  { context.error("Document does not contain base elements! output: " + this.request.responseText);  }
 }
else  { context.error("Invalid response document! output: " + this.request.responseText);  }
return null;  }
http_request.prototype.debug_data = function(show_res) { var put, head, major = null; if ((head = this.root.get_child("head" ))!= null)major = head.get_child("major" ); var compose = this.compose("request_data" ); compose = compose.split("<" ).join("&lt;" ); compose = compose.split(">" ).join("&gt;" ); put = "<tr>" ; put += "<td>" + (major == null ? "unknown" : major.value)+ "</td>" ; put += "<td>" + compose + "</td>" ; put += "<td>" + (this.time_end != null && this.time_start != null ? ("time: " + (this.time_end - this.time_start)): "running" )+ "</td>" ; var resp; if (!show_res)resp = "running" ; else  { var resp = this.request.responseText; resp = resp.split("<" ).join("&lt;" ); resp = resp.split(">" ).join("&gt;" );  }
put += "<td>" + resp + "</td>" ; put += "</tr>" ; return put;  }
function http_request_collector(interface_ref) { this.inheritFrom = collection_list; this.inheritFrom(); this.interface_ref = interface_ref; this.first = null; this.end = null; this.debug = false; this.debug_container = null; this.debug_history = null; this.debug_history_inner = null; this.construct();  }
clone_add(http_request_collector.prototype, collection_list.prototype); http_request_collector.prototype.construct = function() { if (this.debug) { this.debug_container = context.createElement("DIV" ); this.debug_container.style.padding = "20px" ; this.debug_history = context.createElement("DIV" ); this.debug_history.style.padding = "20px" ; this.debug_history.innerHTML = "<strong>request collector history</strong><br/><br/>" ; this.debug_history_inner = context.createElement("TABLE" ); this.debug_history_inner.border = 1; this.debug_history.appendChild(this.debug_history_inner); context.document_ref.body.appendChild(this.debug_container); context.document_ref.body.appendChild(this.debug_history);  }
 }
http_request_collector.prototype.debug_update = function(req, add_flag) { if (this.debug) { if (add_flag)req.time_start = (new Date()).getTime(); else req.time_end = (new Date()).getTime(); var put; put = "<strong>request collector debug</strong><br/><br/>" ; put += "active requests: " + this.count + "<br/><br/>" ; if (this.first != null) { put += "<table border='1'>" ; var loop = this.first; while (loop != null) { put += loop.debug_data(false); loop = loop.next;  }
put += "</table>" ;  }
this.debug_container.innerHTML = put; if (!add_flag)this.debug_history_inner.innerHTML += req.debug_data(true);  }
 }
http_request_collector.prototype.enqueue = function(data, evt_oncreate, evt_ondone, structure_root, keep) { var req = new http_request(this, data, structure_root, keep); req.evt_oncreate = evt_oncreate; req.evt_ondone = evt_ondone; this.enqueue_ref(req);  }
http_request_collector.prototype.enqueue_ref = function(req) { if (this.collection_add(req)!= null) { this.debug_update(req, true); req.make();  }
 }
http_request_collector.prototype.dequeue = function(req) { if ((req = this.collection_rem(req))!= null) { this.debug_update(req, false); req.destroy(); req = null;  }
else  { context.error("Unable to dequeue, nothing in request collector!" );  }
 }

// f:context.class.js
function context_class() { var self = this; this.collector = null; this.context = null; this.window_ref = window; this.document_ref = document; this.evt_destroy = null;  }
context_class.prototype.ifc_path = "http://perfecto-new.designplus.local/ifc.php" ; context_class.prototype.construct = function(widget_id, widget_ident) { this.collector = new http_request_collector(this.ifc_path);  }
context_class.prototype.destroy = function() { if (this.evt_destroy != null)this.evt_destroy();  }
context_class.prototype.createElement = function(input) { return this.document_ref.createElement(input);  }
context_class.prototype.confirm_wnd = function(message) { return confirm(message);  }
context_class.prototype.catch_error_flags = function(elms) { if (elms.length > 0) { for (f = 0; f < elms.length; f++) { switch (this.element_value(elms[f])) { case "unauthorized" : break;  }
 }
return true;  }
return false;  }
context_class.prototype.request = function(data, evt_oncreate, evt_ondone, structure) { this.collector.enqueue(data, evt_oncreate, evt_ondone, structure.root);  }
context_class.prototype.layerX = function(evt, pos) { if (evt.layerX)return evt.layerX; else return evt.clientX - pos;  }
context_class.prototype.layerY = function(evt, pos) { if (evt.layerY)return evt.layerY; else return evt.clientY - pos;  }
context_class.prototype.wnd_x = function() { var result = 0; if (typeof(this.window_ref.innerWidth)== 'number' )result = this.window_ref.innerWidth; else if (this.document_ref.documentElement && (this.document_ref.documentElement.clientWidth || this.document_ref.documentElement.clientHeight))result = this.document_ref.documentElement.clientWidth; else if (this.document_ref.body && (this.document_ref.body.clientWidth || this.document_ref.body.clientHeight))result = this.document_ref.body.clientWidth; return result;  }
context_class.prototype.wnd_y = function() { var result = 0; if (typeof(this.window_ref.innerWidth)== 'number' )result = this.window_ref.innerHeight; else if (this.document_ref.documentElement && (this.document_ref.documentElement.clientWidth || this.document_ref.documentElement.clientHeight))result = this.document_ref.documentElement.clientHeight; else if (this.document_ref.body && (this.document_ref.body.clientWidth || this.document_ref.body.clientHeight))result = this.document_ref.body.clientHeight; return result;  }
context_class.prototype.get_scX = function() { var a = this.document_ref.body.scrollLeft; var b = this.document_ref.documentElement.scrollLeft; return a != 0 ? a : b;  }
context_class.prototype.get_scY = function() { var a = this.document_ref.body.scrollTop; var b = this.document_ref.documentElement.scrollTop; return a != 0 ? a : b;  }
context_class.prototype.get_elementX = function(ref) { var loop = ref; var out = 0; while (loop != null) { out += loop.offsetLeft; loop = loop.offsetParent;  }
return out;  }
context_class.prototype.get_elementY = function(ref) { var loop = ref; var out = 0; while (loop != null) { out += loop.offsetTop; loop = loop.offsetParent;  }
return out;  }
context_class.prototype.get_elementWidth = function(ref) { return ref.offsetWidth;  }
context_class.prototype.get_elementHeight = function(ref) { return ref.offsetHeight;  }
context_class.prototype.get_parent_index = function(ref) { var founded = false; var pos = 0; while (!founded && pos < ref.parentNode.childNodes.length)if (ref.parentNode.childNodes[pos]=== ref)founded = true; else pos++; return founded ? pos : null;  }
context_class.prototype.center_by = function(target, source) { var sX = this.get_elementX(source); var sY = this.get_elementY(source); var sW = this.get_elementWidth(source); var sH = this.get_elementHeight(source); var tW = this.get_elementWidth(target); var tH = this.get_elementHeight(target); var pX = sW > tW ? (sX + (sW - tW)/2): sX; var pY = sH > tH ? (sY + (sH - tH)/2): sY; target.style.position = "absolute" ; target.style.left = pX + "px" ; target.style.top = pY + "px" ;  }
context_class.prototype.element_value = function(ref) { return ref.firstChild == null ? '' : ref.firstChild.nodeValue;  }
context_class.prototype.element_value_null = function(ref) { return ref.firstChild == null ? null : ref.firstChild.nodeValue;  }
context_class.prototype.sub_element_value = function(ref, name) { var subs = ref.getElementsByTagName(name); if (subs != null && subs.length > 0)return this.element_value(subs[0]); return "" ;  }
context_class.prototype.sub_element_value_null = function(ref, name) { var subs = ref.getElementsByTagName(name); if (subs != null && subs.length > 0)return this.element_value_null(subs[0]); return null;  }
context_class.prototype.error = function(value) {  }
context_class.prototype.object_create = function(ref) { return ref;  }
context_class.prototype.object_destroy = function(ref) {  }
context_class.prototype.path_explode = function(input) { var out = new Array(); var f, ch, last = '' , len = input.length; for (f = 0; f <= len; f++) { ch = f == len ? '/' : input.substr(f, 1); switch (ch) { case '/' : if (last != '' )out[out.length]= last; last = '' ; break; default : last += ch; break;  }
 }
return out;  }
context_class.prototype.purge = function(d) { var a = d.attributes, i, l, n; if (a) { l = a.length; for (i = 0; i < l; i++) { n = a[i].name; if (typeof d[n]=== 'function' )d[n]= null;  }
 }
 }
context_class.prototype.structure_destroy = function(ref) { if (ref != null) { var stack = new Array(); var current, f; stack[stack.length]= ref; while (stack.length > 0) { current = stack.pop(); if (current.childNodes != null && current.childNodes.length > 0) { stack[stack.length]= current; for (f = 0; f < current.childNodes.length; f++)stack[stack.length]= current.childNodes[f];  }
else  { this.purge(current); if (current.parentNode != null)current.parentNode.removeChild(current);  }
 }
 }
 }
context_class.prototype.object_destroy = function(ref) { for (var i in ref) { ref[i]= null;  }
 }

// f:shadow.block.class.js
function shadow_block_class() { this.shadows = null; this.shadow_size = 15;  }
shadow_block_class.prototype.shadow_context = function() { return this.context == null ? context : this.context;  }
shadow_block_class.prototype.shadow_container = function() { return this.container;  }
shadow_block_class.prototype.shadows_destroy = function() { if (this.shadows != null) { var f; for (f = this.shadows.length - 1; f >= 0; f--) { this.shadow_context().structure_destroy(this.shadows[f]); this.shadows[f]= null;  }
this.shadows = null;  }
 }
shadow_block_class.prototype.shadow_width = function() { return 0;  }
shadow_block_class.prototype.shadow_height = function() { return 0;  }
shadow_block_class.prototype.shadows_build = function() { var create; if (create = (this.shadows == null))this.shadows = new Array(); var s_x = new Array(0, this.shadow_size, this.shadow_width(), this.shadow_width()+ this.shadow_size); var s_y = new Array(0, this.shadow_size, this.shadow_height(), this.shadow_height()+ this.shadow_size); var f, sx, sy, sw, sh, el; var cont = this.shadow_container(); for (f = 0; f < 3; f++) { sx = s_x[2]; sy = s_y[f]; sw = s_x[3]- s_x[2]; sh = s_y[f + 1]- s_y[f]; if (create) { el = this.shadow_context().createElement("DIV" ); el.style.position = "absolute" ; el.style.left = sx + "px" ; el.style.top = sy + "px" ; el.style.width = sw + "px" ; el.style.height = sh + "px" ; el.style.fontSize = "1px" ; switch (f) { case 0 : if (document.all)el.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/web/perfecto/gfx/sh_right_top.png')" ; else el.style.background = "url('/web/perfecto/gfx/sh_right_top.png')" ; break; case 1 : if (document.all)el.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/web/perfecto/gfx/sh_right.png',sizingMethod='scale')" ; else el.style.background = "url('/web/perfecto/gfx/sh_right.png')" ; break; case 2 : if (document.all)el.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/web/perfecto/gfx/sh_bottom_right.png')" ; else el.style.background = "url('/web/perfecto/gfx/sh_bottom_right.png')" ; break;  }
cont.appendChild(el); this.shadows[this.shadows.length]= el;  }
else  { el = this.shadows[f]; el.style.left = sx + "px" ; el.style.top = sy + "px" ; el.style.width = sw + "px" ; el.style.height = sh + "px" ; el.style.fontSize = "1px" ;  }
 }
for (f = 1; f >= 0; f--) { sx = s_x[f]; sy = s_y[2]; sw = s_x[f + 1]- s_x[f]; sh = s_y[3]- s_y[2]; if (create) { el = this.shadow_context().createElement("DIV" ); el.style.position = "absolute" ; el.style.left = sx + "px" ; el.style.top = sy + "px" ; el.style.width = sw + "px" ; el.style.height = sh + "px" ; el.style.fontSize = "1px" ; switch (f) { case 1 : if (document.all)el.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/web/perfecto/gfx/sh_bottom.png',sizingMethod='scale')" ; else el.style.background = "url('/web/perfecto/gfx/sh_bottom.png')" ; break; case 0 : if (document.all)el.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/web/perfecto/gfx/sh_bottom_left.png')" ; else el.style.background = "url('/web/perfecto/gfx/sh_bottom_left.png')" ; break;  }
cont.appendChild(el); this.shadows[this.shadows.length]= el;  }
else  { el = this.shadows[3 + (1 - f)]; el.style.left = sx + "px" ; el.style.top = sy + "px" ; el.style.width = sw + "px" ; el.style.height = sh + "px" ; el.style.fontSize = "1px" ;  }
 }
 }

// f:gallery.main.class.js
function gallery_node(parent, container) { this.parent = parent; this.container = container; this.circle = null; this.big = null; this.href = null; this.href_click_flag = true; this.full = null; this.active = null;  }
gallery_node.prototype.construct = function() { var self = this; var box = null, sf, current, stack = new Array(); stack[0]= this.container; while (stack.length > 0) { current = stack.pop(); switch (current.tagName.toUpperCase()) { case "DIV" : if (current.className == "circle" )this.circle = current; break; case "INPUT" : if (current.type == "hidden" && current.name == "big" )this.big = current; break; case "A" : this.href = current; this.href.onclick = function(trgEvent) { if (self.href_click_flag) { var evt = trgEvent == null ? window.event : trgEvent; cancelEvent(evt, true); self.evt_click(); return false;  }
return true;  }
this.full = current.href; break;  }
if (current.childNodes.length > 0) { for (sf = 0; sf < current.childNodes.length; sf++)if (current.childNodes[sf].nodeType == 1)stack[stack.length]= current.childNodes[sf];  }
 }
this.container.onmouseover = function() { self.circle.style.display = "block" ;  }
this.container.onmouseout = function() { self.circle.style.display = "none" ;  }
this.container.onclick = function() { self.evt_click();  }
 }
gallery_node.prototype.fire_href_click = function() { this.href_click_flag = false; if (document.createEvent) { var evt = document.createEvent("MouseEvents" ); evt.initEvent("click" , true, false); this.href.dispatchEvent(evt);  }
else if (document.createEventObject) { this.href.fireEvent("onclick" );  }
this.href_click_flag = true;  }
gallery_node.prototype.evt_click = function() { this.parent.preload(this);  }
gallery_node.prototype.visible = function(flag) { this.container.style.display = flag ? "block" : "none" ;  }
function gallery_main(container, zoom, arrow_left, arrow_right, image_info, move_length) { this.container = container; this.zoom = zoom; this.arrow_left = arrow_left; this.arrow_right = arrow_right; this.image_info = image_info; this.items = new Array(); this.info = null; this.img = null; this.loader = null; this.move_index = 0; this.move_length = move_length; this.move_pages = 0;  }
gallery_main.prototype.construct = function() { var f, ref, divs = document.getElementsByTagName("DIV" ), pref = "gallery_node" ; for (f = 0; f < divs.length; f++) { if (divs[f].className.length >= pref.length && divs[f].className.substr(0, pref.length)== pref) { ref = new gallery_node(this, divs[f]); this.items[this.items.length]= ref; ref.construct();  }
 }
this.move_index = 0; this.move_pages = Math.floor((this.items.length - 1)/this.move_length)+ 1; var self = this; this.zoom.onclick = function() { self.evt_zoom();  }
this.zoom.href = "javascript:void(0)" ; if (this.move_pages > 1) { this.arrow_left.onclick = function() { self.evt_move(-1);  }
this.arrow_left.href = "javascript:void(0)" ; this.arrow_right.onclick = function() { self.evt_move(1);  }
this.arrow_right.href = "javascript:void(0)" ; this.evt_move(0);  }
else  { this.arrow_left.style.display = "none" ; this.arrow_right.style.display = "none" ;  }
this.info = document.createElement("P" ); this.info.innerHTML = "Nahrávám obrázek ..." ; this.info.style.display = "block" ; this.loader = document.createElement("IMG" ); this.loader.onload = null; this.img = document.createElement("IMG" ); this.img.style.display = "none" ; this.container.appendChild(this.img); this.container.appendChild(this.info); if (this.items.length > 0)this.items[0].evt_click();  }
gallery_main.prototype.preload = function(ref) { if (this.loader.onload == null) { var self = this; this.img.style.display = "none" ; this.info.style.display = "block" ; this.loader.onload = function() { self.evt_load();  }
this.loader.src = ref.big.value; this.active = ref;  }
 }
gallery_main.prototype.evt_load = function() { this.img.src = this.loader.src; this.info.style.display = "none" ; this.img.style.display = "block" ; this.img.alt = this.active.href.title; this.loader.onload = null; this.image_info.innerHTML = this.active.href.title;  }
gallery_main.prototype.evt_move = function(direct) { this.move_index += direct; if (this.move_index >= this.move_pages)this.move_index = this.move_pages - 1; if (this.move_index < 0)this.move_index = 0; var start = this.move_index * this.move_length; var end = start + this.move_length; var pos = 0; while (pos < this.items.length) { this.items[pos].visible(pos >= start && pos < end); pos++;  }
this.arrow_left.style.display = this.move_index == 0 ? "none" : "block" ; this.arrow_right.style.display = this.move_index < this.move_pages - 1 ? "block" : "none" ;  }
gallery_main.prototype.evt_zoom = function() { if (this.active != null) { this.active.fire_href_click();  }
 }

// f:title.bubble.class.js
function title_bubble(arrow_right, arrow_left) { this.arrow_right = arrow_right; this.arrow_left = arrow_left; this.items = new Array(); this.index = 0;  }
title_bubble.prototype.construct = function() { var f, divs = document.getElementsByTagName("DIV" ), pref = "cat_title cat_kol" ; for (f = 0; f < divs.length; f++) { if (divs[f].className.length >= pref.length && divs[f].className.substr(0, pref.length)== pref) { this.items[this.items.length]= divs[f];  }
 }
this.evt_move(0); var self = this; this.arrow_right.href = "javascript:void(0)" ; this.arrow_right.onclick = function() { self.evt_move(1);  }
this.arrow_left.href = "javascript:void(0)" ; this.arrow_left.onclick = function() { self.evt_move(-1);  }
 }
title_bubble.prototype.evt_move = function(direct) { this.index += direct; if (this.index < 0)this.index = this.items.length - 1; else if (this.index >= this.items.length)this.index = 0; var pos = 0; while (pos < this.items.length) { this.items[pos].style.display = pos == this.index ? "block" : "none" ; pos++;  }
 }

// f:global.js
function error_wnd() { var self = this; this.container = null; this.div = null; this.input = null; this.overlay = null; this.ondone = null; this.box_button = null; this.caption = null; this._onresize = function() { self.position();  }
this._onscroll = function() { self.position();  }
 }
error_wnd.prototype.construct = function(container, caption, inner, add_class) { var self = this; document.body.appendChild(container); this.container = container; this.container.className = "error_box error_box_float" + (add_class != null ? (" " + add_class): "" ); this.container.style.display = "block" ; if (inner != null)this.container.innerHTML = inner; else  { var current, f, stack = new Array(); stack[0]= this.container; while (stack.length > 0 && this.box_button == null) { current = stack.pop(); if (current.tagName.toUpperCase()== "A" && current.className == "box_button" )this.box_button = current; else  { if (current.childNodes.length > 0)for (f = 0; f < current.childNodes.length; f++)if (current.childNodes[f].nodeType == 1)stack[stack.length]= current.childNodes[f];  }
 }
 }
this.caption = caption; this.div = document.createElement("DIV" ); this.div.className = "button" ; if (typeof caption == 'string' ) { this.input = document.createElement("INPUT" ); this.input.type = "button" ; this.input.className = "fbutt" ; this.input.value = caption; this.input.onclick = function() { self.done();  }
this.div.appendChild(this.input); if (this.box_button != null) { this.input.value = this.box_button.innerHTML; this.ondone = function() { document.location.href = self.box_button.href;  }
this.box_button.parentNode.removeChild(this.box_button);  }
 }
else  { this.input = new Array(); var key; for (key in caption) { this.input[key]= document.createElement("INPUT" ); this.input[key].type = "button" ; this.input[key].className = "fbutt" ; this.input[key].value = key; if (caption[key]== null) { this.input[key].onclick = function() { self.done();  }
 }
else  { this.input[key].onclick = function() { document.location.href = self.caption[this.value];  }
 }
this.div.appendChild(this.input[key]);  }
 }
this.overlay = document.createElement("DIV" ); this.overlay.className = "overlay" ; this.container.appendChild(this.div); this.container.parentNode.appendChild(this.overlay); this.position(); addEvent(window, "resize" , this._onresize); addEvent(window, "scroll" , this._onscroll);  }
error_wnd.prototype.done = function() { removeEvent(window, "resize" , this._onresize); removeEvent(window, "scroll" , this._onscroll); if (this.ondone != null)this.ondone(); document.body.style.border = "" ; this.container.style.display = "none" ; context.structure_destroy(this.div); context.structure_destroy(this.overlay); context.object_destroy(this);  }
error_wnd.prototype.position = function() { this.overlay.style.width = document.body.offsetWidth + "px" ; this.overlay.style.height = document.body.offsetHeight + "px" ; this.container.style.left = Math.round((context.wnd_x()- context.get_elementWidth(this.container))/2)+ "px" ; this.container.style.top = (Math.round((context.wnd_y()- context.get_elementHeight(this.container))/2)+ context.get_scY())+ "px" ;  }
function bubble_class(inner, inst) { this.ref = null; this.container = null; this.inner = inner; this.inst = inst; this.timeout = null;  }
bubble_class.prototype.construct = function() { var self = this; this.container = document.createElement("DIV" ); this.container.className = "bubble" ; this.container.innerHTML = "<p>" + this.inner + "</p>" ; this.container.style.display = "none" ; this.container.onmouseout = function(trgEvent) { if (self.o_ds == null)self.evt_over(trgEvent == null ? window.event : trgEvent);  }
document.body.appendChild(this.container);  }
bubble_class.prototype.destroy = function() { context.structure_destroy(this.container); context.object_destroy(this);  }
bubble_class.prototype.open = function(ref) { if (this.timeout != null)clearTimeout(this.timeout); if (this.ref != null)this.ref.onmouseout = null; var self = this; this.ref = ref; this.ref.onmouseout = function(trgEvent) { if (self.o_ds == null)self.evt_over(trgEvent == null ? window.event : trgEvent);  }
this.container.style.left = (context.get_elementX(this.ref)- 10)+ "px" ; this.container.style.top = (context.get_elementY(this.ref)- 65)+ "px" ; this.container.style.display = "block" ;  }
bubble_class.prototype.close = function() { if (this.ref != null)this.ref.onmouseout = null; this.container.style.display = "none" ;  }
bubble_class.prototype.evt_over = function(evt) { var target = evt.toElement == null ? evt.relatedTarget : evt.toElement; while (target != null && target != this.container)target = target.parentNode; if (target == null) { if (this.timeout != null)clearTimeout(this.timeout); this.timeout = setTimeout(this.inst + ".close()" , 1000);  }
 }
function bubble_cont(parent, container) { this.container = container; this.parent = parent; this.px = null; this.py = null; this.width = null; this.height = null;  }
bubble_cont.prototype.construct = function() { this.px = context.get_elementX(this.container); this.py = context.get_elementY(this.container); this.width = context.get_elementWidth(this.container); this.height = context.get_elementHeight(this.container);  }
bubble_cont.prototype.motion = function() { this.evt_move();  }
bubble_cont.prototype.evt_out = function() { this.container.style.left = this.px + "px" ; this.container.style.top = this.py + "py" ;  }
bubble_cont.prototype.evt_move = function() { var sd_x = this.width /2.0; var sd_y = this.height /2.0; var cx = this.px + sd_x; var cy = this.py + sd_y; var dx = this.parent.ms_x - cx; var dy = this.parent.ms_y - cy; var angle = Math.atan2(dx, dy); if (angle < 0)angle += Math.PI * 2; var dst_max = Math.sqrt(sd_x * sd_x + sd_y * sd_y); var dst_c = Math.sqrt(dx * dx + dy * dy); dst_c = 10; angle += Math.PI; var nx = cx + Math.sin(angle)* dst_c - sd_x; var ny = cy + Math.cos(angle)* dst_c - sd_y; this.container.style.left = nx + "px" ; this.container.style.top = ny + "px" ;  }
function bubble_collector() { this.items = null; this.ms_x = null; this.ms_y = null;  }
bubble_collector.prototype.construct = function() { this.items = new Array(); var f, span, spans = document.getElementsByTagName("SPAN" ); for (f = 0; f < spans.length; f++) { span = spans[f]; if (span.className.length > 6 && span.className.substr(0, 6)== "bubble" ) { this.add_bubble(span);  }
 }
var self = this; addEvent(window, "mousemove" , function(trgEvent) { self.evt_move(trgEvent == null ? window.event : trgEvent);  }
); addEvent(document.body, "mousemove" , function(trgEvent) { self.evt_move(trgEvent == null ? window.event : trgEvent);  }
);  }
bubble_collector.prototype.add_bubble = function(container) { var ref = new bubble_cont(this, container); this.items[this.items.length]= ref; ref.construct();  }
bubble_collector.prototype.motion = function() { var f; for (f = 0; f < this.items.length; f++)this.items[f].motion();  }
bubble_collector.prototype.evt_move = function(trgEvent) { this.ms_x = trgEvent.clientX; this.ms_y = trgEvent.clientY;  }
var g_bl = null; function area_insert(ref, input) { if (ref != null) { if (document.selection) { ref.focus(); var sel = document.selection.createRange(); sel.text = input;  }
else if (ref.selectionStart || ref.selectionStart == 0) { var startPos = ref.selectionStart; var endPos = ref.selectionEnd; ref.value = ref.value.substring(0, startPos)+ input + ref.value.substring(endPos, ref.value.length);  }
else  { ref.value += input;  }
 }
 }
function g_set_lang(lang) {  }
function do_print() { window.print();  }
function open_window(href, wid) { window.open(href, wid, "toolbar=0,statusbar=0,menubar=0,resizable=1,width=1000,height=830" );  }
function new_captcha_make(ref, skip_new) { var link = "/captcha.php?" ; if (skip_new == null)link += "new=1&" ; link += "r=" ; var univ = "qwertyuiopasdfghjklzxcvbnm0123456789" ; var f, letter, len = Math.round(Math.random()* 20)+ 15; for (f = 0; f < len; f++)link += univ.substr(Math.round(Math.random()* (univ.length - 1)), 1); ref.src = link;  }
function new_captcha() { var ref = document.getElementById("captcha" ); if (ref != null) { new_captcha_make(ref);  }
else  { ref = null; var index = 1; do  { if ((ref = document.getElementById("captcha_" + index))!= null)new_captcha_make(ref, index == 1 ? null : true); index++;  }
while (ref != null);  }
 }
function motion() { if (g_bl != null)g_bl.motion(); setTimeout("motion()" , 50);  }
function mount_box(form, dtext) { var box = null, sf, current, stack = new Array(); stack[0]= form; while (stack.length > 0) { current = stack.pop(); switch (current.tagName.toUpperCase()) { case "TEXTAREA" : box = current; break; case "INPUT" : if (current.type == "text" )box = current; break;  }
if (current.childNodes.length > 0) { for (sf = 0; sf < current.childNodes.length; sf++)if (current.childNodes[sf].nodeType == 1)stack[stack.length]= current.childNodes[sf];  }
 }
if (box != null) { var founded = box; while (founded != null && founded.tagName.toUpperCase()!= "FORM" )founded = founded.parentNode; if (founded != null) { addEvent(founded, "submit" , function() { if (box.value == dtext)box.value = "" ;  }
);  }
box.onblur = function() { if (this.value == "" )this.value = dtext;  }
box.onfocus = function() { if (this.value == dtext)this.value = "" ;  }
if (box.value == "" )box.value = dtext;  }
 }
function evt_body_load() { evt_body_load_final();  }
function evt_body_load_final() { context = new context_class(); context.construct(); if (!document.all) { g_bl = new bubble_collector(); g_bl.construct();  }
var tmp = document.getElementById("gallery_detail_cont" ); if (tmp != null) { var gm = new gallery_main(tmp, document.getElementById("gallery_detail_zoom" ), document.getElementById("arrow_left_cont" ), document.getElementById("arrow_right_cont" ), document.getElementById("gallery_detail_info_ref" ), 14 ); gm.construct();  }
tmp = document.getElementById("cat_title_arrow_cont" ); var tmpb = document.getElementById("cat_title_arrow_cont_left" ); if (tmp != null && tmpb != null) { var tb = new title_bubble(tmp, tmpb); tb.construct();  }
motion(); evt_page_load();  }
function evt_page_load() {  }

