/* Form tag functions */ function addClass(element, className) { if (!hasClass(element, className)) { if (element.className) element.className += " " + className; else element.className = className; } }; function removeClass(element, className) { var regexp = new RegExp("(^|\\s)" + className + "(\\s|$)"); element.className = element.className.replace(regexp, "$2"); }; function hasClass(element, className) { var regexp = new RegExp("(^|\\s)" + className + "(\\s|$)"); return regexp.test(element.className); }; /* Script Name: Javascript Cookie Script Author: Public Domain, with some modifications Script Source URI: http://techpatterns.com/downloads/javascript_cookies.php Version 1.0.0 Last Update: 30 May 2004 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ // this function gets the cookie, if it exists function getCookie( name ) { var start = document.cookie.indexOf( name + "=" ); var len = start + name.length + 1; if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) { return null; } if ( start == -1 ) return null; var end = document.cookie.indexOf( ";", len ); if ( end == -1 ) end = document.cookie.length; return unescape( document.cookie.substring( len, end ) ); } /* only the first 2 parameters are required, the cookie name, the cookie value. Cookie time is in milliseconds, so the below expires will make the number you pass in the Set_Cookie function call the number of days the cookie lasts, if you want it to be hours or minutes, just get rid of 24 and 60. Generally you don't need to worry about domain, path or secure for most applications so unless you need that, leave those parameters blank in the function call. */ function setCookie( name, value, expires, path, domain, secure ) { // set time, it's in milliseconds var today = new Date(); today.setTime( today.getTime() ); // if the expires variable is set, make the correct expires time, the // current script below will set it for x number of days, to make it // for hours, delete * 24, for minutes, delete * 60 * 24 if ( expires ) { expires = expires * 1000 * 60 * 60 * 24; } //alert( 'today ' + today.toGMTString() );// this is for testing purpose only var expires_date = new Date( today.getTime() + (expires) ); //alert('expires ' + expires_date.toGMTString());// this is for testing purposes only document.cookie = name + "=" +escape( value ) + ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + //expires.toGMTString() ( ( path ) ? ";path=" + path : "" ) + ( ( domain ) ? ";domain=" + domain : "" ) + ( ( secure ) ? ";secure" : "" ); } // this deletes the cookie when called function deleteCookie( name, path, domain ) { if ( getCookie( name ) ) document.cookie = name + "=" + ( ( path ) ? ";path=" + path : "") + ( ( domain ) ? ";domain=" + domain : "" ) + ";expires=Thu, 01-Jan-1970 00:00:01 GMT"; } /* * Kills an event's propagation and default action */ function knackerEvent(eventObject) { if (eventObject && eventObject.stopPropagation) { eventObject.stopPropagation(); } if (window.event && window.event.cancelBubble ) { window.event.cancelBubble = true; } if (eventObject && eventObject.preventDefault) { eventObject.preventDefault(); } if (window.event) { window.event.returnValue = false; } } function Obj_findStyleValue(target, styleProp, IEStyleProp) { if (target.currentStyle) return target.currentStyle[ IEStyleProp ] ; else if (window.getComputedStyle) { compStyle = window.getComputedStyle(target,'') ; return compStyle.getPropertyValue(styleProp) ; } } /* dynamicCSS.js v1.0 Copyright 2005 Bobby van der Sluis This software is licensed under the CC-GNU LGPL */ function createStyleRule(selector, declaration) { if (!document.getElementsByTagName || !(document.createElement || document.createElementNS)) return; var agt = navigator.userAgent.toLowerCase(); var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)); var is_iewin = (is_ie && (agt.indexOf("win") != -1)); var is_iemac = (is_ie && (agt.indexOf("mac") != -1)); if (is_iemac) return; // script doesn't work properly in IE/Mac var head = document.getElementsByTagName("head")[0]; var style = (typeof document.createElementNS != "undefined") ? document.createElementNS("http://www.w3.org/1999/xhtml", "style") : document.createElement("style"); if (!is_iewin) { var styleRule = document.createTextNode(selector + " {" + declaration + "}"); style.appendChild(styleRule); // bugs in IE/Win } style.setAttribute("type", "text/css"); style.setAttribute("media", "screen"); head.appendChild(style); if (is_iewin && document.styleSheets && document.styleSheets.length > 0) { var lastStyle = document.styleSheets[document.styleSheets.length - 1]; if (typeof lastStyle.addRule == "object") { // bugs in IE/Mac and Safari lastStyle.addRule(selector, declaration); } } } function setElementStyleByClass(cl, propertyName, propertyValue) { if (!document.getElementsByTagName) return; var re = new RegExp("(^| )" + cl + "( |$)"); var el = document.all ? document.all : document.getElementsByTagName("body")[0].getElementsByTagName("*"); // fix for IE5.x for (var i = 0; i < el.length; i++) { if (el[i].className && el[i].className.match(re)) { el[i].style[propertyName] = propertyValue; } } } function setElementStyleById(id, propertyName, propertyValue) { if (!document.getElementById) return; var el = document.getElementById(id); if (el) el.style[propertyName] = propertyValue; } /*********************************************** * AnyLink Drop Down Menu- � Dynamic Drive (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit http://www.dynamicdrive.com/ for full source code * http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm ***********************************************/ function showMenu(e, menu, menudiv) { knackerEvent(e); var obj = document.getElementById(menu); if (!obj) return; changeMenus(menu); //var menuwidth = (obj.offsetWidth - 10) + 'px'; var menuwidth = 190 + 'px'; dropdownmenu(obj, e, menuwidth, menudiv); } function getposOffset(what, offsettype) { var totaloffset = (offsettype=="left")? what.offsetLeft : what.offsetTop; var parentEl = what.offsetParent; while(parentEl!=null) { totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop; parentEl=parentEl.offsetParent; } return totaloffset; } function showhide(obj, e, visible, hidden, menuwidth) { if(ie4||ns6) dropmenuobj.style.left = dropmenuobj.style.top="-500px"; if(menuwidth != "") { dropmenuobj.widthobj = dropmenuobj.style; dropmenuobj.widthobj.width = menuwidth; } if(e.type == "click" && obj.display == 'none' || e.type == "mouseover") obj.display = visible; else if(e.type == "click") obj.display = hidden; } function iecompattest() { return (document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body; } function clearbrowseredge(obj, whichedge){ var edgeoffset=0; if (whichedge == "rightedge") { var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15; dropmenuobj.contentmeasure=dropmenuobj.offsetWidth; if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure) edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth; } else { var topedge = ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset; var windowedge = ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18; dropmenuobj.contentmeasure = dropmenuobj.offsetHeight; if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure) { //move up? edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight; if ((dropmenuobj.y-topedge)'); Behaviour.register(page_events); } // add bookmark / favorites // example: Oblíbený function AddFavorite(uri, title, this_a) { if (document.all && !window.opera) { window.external.AddFavorite(uri,title); return false; } else if (window.opera) { this_a.title = title; return true; } else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function')) { if (window.confirm('Přidat oblíbenou stránku jako nový panel?')) { window.sidebar.addPanel(title, uri, ''); return false; } } window.alert('Po potvrzení stiskněte CTRL-D,\nstránka bude přidána k vašim oblíbeným odkazům.'); return false; }