/**
 * SM_PopupElem.js
 *
 * Podpora pro zobrazeni popup menu.
 * - vyuziva jQuery, verze od 1.3.2
 *
 * @copy Symedia s. r. o. 2010
 * @version 1.0.1
 */
var SM_PopupElem={};SM_PopupElem.groups=new Array();SM_PopupElem.create=function(g,a,d,b){var h=null;var e=null;var c=null;var l=new Array();l.showType="slide";l.showDuration=100;l.hideType="slide";l.hideDuration=100;l.hideDelay=100;l.checkChildFocus=false;l.group="";if(g!=""){c=null;if(document&&document.getElementById){c=document.getElementById(g)}else{return}if(c!=null){h=c}else{return}}else{return}if(d!=""){c=null;if(document&&document.getElementById){c=document.getElementById(d)}else{return}if(c!=null){e=c}else{return}}else{return}if(b){if(b.showType&&b.showType!=""){l.showType=b.showType}if(b.showDuration&&b.showDuration>=0){l.showDuration=b.showDuration}if(b.hideType&&b.hideType!=""){l.hideType=b.hideType}if(b.hideDuration&&b.hideDuration>=0){l.hideDuration=b.hideDuration}if(b.hideDelay&&b.hideDelay>=0){l.hideDelay=b.hideDelay}if(b.checkChildFocus){l.checkChildFocus=b.checkChildFocus}if(l.checkChildFocus&&b.group&&b.group!=""){l.group=b.group;if(SM_PopupElem.groups[l.group]=="undefined"||SM_PopupElem.groups[l.group]==null){SM_PopupElem.groups[l.group]=new Array()}SM_PopupElem.groups[l.group][SM_PopupElem.groups[l.group].length]=e}}h.SM_PopupElem=new Array();h.SM_PopupElem.el=e;if(a!=""){h.SM_PopupElem.newClass=a;h.SM_PopupElem.oldClass=h.className}h.SM_PopupElem.onmouseover=null;if(h.onmouseover&&(typeof h.onmouseover=="function"||typeof h.onmouseover=="object")){h.SM_PopupElem.onmouseover=h.onmouseover}h.onmouseover=function(){if(this.SM_PopupElem&&this.SM_PopupElem.el&&typeof this.SM_PopupElem.el=="object"){SM_PopupElem.show(this.SM_PopupElem.el)}if(this.SM_PopupElem&&this.SM_PopupElem.onmouseover&&(typeof this.SM_PopupElem.onmouseover=="function"||typeof this.SM_PopupElem.onmouseover=="object")){this.SM_PopupElem.onmouseover()}};h.SM_PopupElem.onmouseout=null;if(h.onmouseout&&(typeof h.onmouseout=="function"||typeof h.onmouseout=="object")){h.SM_PopupElem.onmouseout=h.onmouseout}h.onmouseout=function(){if(this.SM_PopupElem&&this.SM_PopupElem.el&&typeof this.SM_PopupElem.el=="object"){SM_PopupElem.hideProcess(this.SM_PopupElem.el)}if(this.SM_PopupElem&&this.SM_PopupElem.onmouseout&&(typeof this.SM_PopupElem.onmouseout=="function"||typeof this.SM_PopupElem.onmouseout=="object")){this.SM_PopupElem.onmouseout()}};h.SM_PopupElem.changeOnclick=true;e.SM_PopupElem=new Array();e.SM_PopupElem.parentEl=h;e.SM_PopupElem.timeout=null;e.SM_PopupElem.opt=l;e.SM_PopupElem.onmouseover=null;if(e.onmouseover&&(typeof e.onmouseover=="function"||typeof e.onmouseover=="object")){e.SM_PopupElem.onmouseover=e.onmouseover}e.onmouseover=function(){SM_PopupElem.show(this);if(this.SM_PopupElem&&this.SM_PopupElem.onmouseover&&(typeof this.SM_PopupElem.onmouseover=="function"||typeof this.SM_PopupElem.onmouseover=="object")){this.SM_PopupElem.onmouseover()}};e.SM_PopupElem.onmouseout=null;if(e.onmouseout&&(typeof e.onmouseout=="function"||typeof e.onmouseout=="object")){e.SM_PopupElem.onmouseout=e.onmouseout}e.onmouseout=function(){SM_PopupElem.hideProcess(this);if(this.SM_PopupElem&&this.SM_PopupElem.onmouseout&&(typeof this.SM_PopupElem.onmouseout=="function"||typeof this.SM_PopupElem.onmouseout=="object")){this.SM_PopupElem.onmouseout()}};if(l.checkChildFocus){e.SM_PopupElem.inputs=new Array();var j=e.getElementsByTagName("input");var f=0;for(f=0;f<j.length;f++){var k=j[f];k.SM_PopupElem=new Array();k.SM_PopupElem.el=e;k.SM_PopupElem.allowHide=true;k.onfocus=function(){if(this.SM_PopupElem){this.SM_PopupElem.allowHide=false}else{return}var n=null;if(this.SM_PopupElem.el&&typeof this.SM_PopupElem.el=="object"){n=this.SM_PopupElem.el}else{return}var o=new Array();if(n.SM_PopupElem&&n.SM_PopupElem.opt&&n.SM_PopupElem.opt.group&&n.SM_PopupElem.opt.group!=""&&SM_PopupElem.groups[n.SM_PopupElem.opt.group]){o=SM_PopupElem.groups[n.SM_PopupElem.opt.group]}if(o.length>0){n.SM_PopupElem.activateParentEls=true}var i=0;for(i=0;i<o.length;i++){var m=null;if(o[i].id!=n.id&&o[i].SM_PopupElem&&o[i].SM_PopupElem.parentEl){m=o[i].SM_PopupElem.parentEl}else{continue}if(!m.SM_PopupElem.tmpOnmouseover){m.SM_PopupElem.tmpOnmouseover=m.onmouseover}m.onmouseover=null;if(m.SM_PopupElem.onmouseover){m.onmouseover=m.SM_PopupElem.onmouseover}if(!m.SM_PopupElem.tmpOnmouseout){m.SM_PopupElem.tmpOnmouseout=m.onmouseout}m.onmouseout=null;if(m.SM_PopupElem.onmouseout){m.onmouseout=m.SM_PopupElem.onmouseout}if(m.SM_PopupElem.changeOnclick){m.SM_PopupElem.tmpOnclick=m.onclick;m.SM_PopupElem.changeOnclick=false}m.onclick=function(){if(this.SM_PopupElem&&this.SM_PopupElem.el&&typeof this.SM_PopupElem.el=="object"){SM_PopupElem.show(this.SM_PopupElem.el)}return false}}};k.onblur=function(){if(this.SM_PopupElem){this.SM_PopupElem.allowHide=true}else{return}var i=null;if(this.SM_PopupElem.el&&typeof this.SM_PopupElem.el=="object"){i=this.SM_PopupElem.el}else{return}SM_PopupElem.hideProcess(i)};e.SM_PopupElem.inputs[f]=k}}};SM_PopupElem.show=function(c){if(c.SM_PopupElem==null||c.SM_PopupElem=="undefined"){return}var a=c.SM_PopupElem.opt;if(c.SM_PopupElem.timeout!=null&&window&&window.clearTimeout){window.clearTimeout(c.SM_PopupElem.timeout);c.SM_PopupElem.timeout=null}switch(a.showType){case"fade":if($){$("#"+c.id).fadeIn(a.showDuration)}else{c.style.display="block"}break;case"toggle":if($){$("#"+c.id).show()}else{c.style.display="block"}break;case"slide":default:if($){$("#"+c.id).slideDown(a.showDuration)}else{c.style.display="block"}break}var b=c.SM_PopupElem.parentEl;if(b&&b.SM_PopupElem&&b.SM_PopupElem.newClass&&b.SM_PopupElem.newClass!=""&&b.SM_PopupElem.oldClass){b.className=b.SM_PopupElem.newClass}};SM_PopupElem.hideProcess=function(b){if(b.SM_PopupElem==null||b.SM_PopupElem=="undefined"){return}var a=b.SM_PopupElem.opt;b.SM_PopupElem.timeout=window.setTimeout("SM_PopupElem.hide('"+b.id+"')",a.hideDelay)};SM_PopupElem.hide=function(c){var b=null;if(c!=""&&document&&document.getElementById){b=document.getElementById(c)}else{return}if(b.SM_PopupElem==null||b.SM_PopupElem=="undefined"){return}var a=b.SM_PopupElem.opt;if(b.SM_PopupElem.timeout!=null&&window&&window.clearTimeout){window.clearTimeout(b.SM_PopupElem.timeout);b.SM_PopupElem.timeout=null}if(a.checkChildFocus){var e=0;for(e=0;e<b.SM_PopupElem.inputs.length;e++){var g=b.SM_PopupElem.inputs[e];if(g.SM_PopupElem&&!g.SM_PopupElem.allowHide){return}}if(b.SM_PopupElem.activateParentEls){b.SM_PopupElem.activateParentEls=false;var k=new Array();if(b.SM_PopupElem&&b.SM_PopupElem.opt&&b.SM_PopupElem.opt.group&&b.SM_PopupElem.opt.group!=""&&SM_PopupElem.groups[b.SM_PopupElem.opt.group]){k=SM_PopupElem.groups[b.SM_PopupElem.opt.group]}var d=0;for(d=0;d<k.length;d++){var f=null;if(k[d].id!=b.id&&k[d].SM_PopupElem&&k[d].SM_PopupElem.parentEl){f=k[d].SM_PopupElem.parentEl}else{continue}f.onmouseover=null;if(f.SM_PopupElem.tmpOnmouseover){f.onmouseover=f.SM_PopupElem.tmpOnmouseover}f.SM_PopupElem.tmpOnmouseover=null;f.onmouseout=null;if(f.SM_PopupElem.tmpOnmouseout){f.onmouseout=f.SM_PopupElem.tmpOnmouseout}f.SM_PopupElem.tmpOnmouseout=null;f.onclick=null;if(f.SM_PopupElem.tmpOnclick){f.onclick=f.SM_PopupElem.tmpOnclick}f.SM_PopupElem.tmpOnclick=null;f.SM_PopupElem.changeOnclick=true}}}switch(a.hideType){case"fade":if($){$("#"+b.id).fadeOut(a.hideDuration)}else{b.style.display="none"}break;case"toggle":if($){$("#"+b.id).hide()}else{b.style.display="none"}break;case"slide":default:if($){$("#"+b.id).slideUp(a.hideDuration)}else{b.style.display="none"}break}var h=b.SM_PopupElem.parentEl;if(h&&h.SM_PopupElem&&h.SM_PopupElem.newClass&&h.SM_PopupElem.newClass!=""&&h.SM_PopupElem.oldClass){h.className=h.SM_PopupElem.oldClass}};
