
/* ------------------------------  init()   ------------------------------ */	
// init()
function init() {
	
	MM_preloadImages(
					 // WEBROOT+'images/menu/menuitem.'+SECTIONID+'.'+LANG+'.on.gif'
					 );
	return;
} //  end f


/* ------------------------------  openWin()   --------------------------- */	
// openWin()
function openWin(theURL, w, h) {
	//alert('theURL: ' + theURL + ', w: ' + w + ', h: ' + h);
	var w = (typeof w == 'undefined') ? 600 : w;
	var h = (typeof h == 'undefined') ? 400 : h;
	var left = 20;
	var top = 20;
	window.open(theURL, 'new_win', 'location=no, menubar=no, toolbar=no, status=yes, resizable=yes, scrollbars=auto, width='+w+', height='+h+', left='+left+', top='+top);
	//return false;
} // end f

// openPhotoDetail()
function openPhotoDetail(theURL) {
	openWin(theURL, 400, 200);
	return false;
}

function ShowPopup(popupURL){
	if(popupURL.length < 1) return true
	window.open(popupURL,"Jmeno okna",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=575,height=105');
}

/* ------------------------------  pseudoHover()   ------------------------ */	
// pseudoHover()
// @param Object obj
// @param String stav 'over' x 'out'
function pseudoHover(obj, stav) {
	var o = objGet(obj);
	var c = o.className;
	if ( stav == 'over' ) { o.className = c + ' hover';  }
	if ( stav == 'out' ) { o.className = c.replace(/( hover)/gi, ''); }
	//alert(o.className);
	return;
} // end f


/* ------------------------------  toggleCheckbox()   ------------------------ */	
// toggleCheckbox()
// @param Strong checkboxID 		DOM ID checkboxu
// @param Object labelObj 			Object label
function toggleCheckbox(checkboxID, labelObj) {
	var o = objGet(checkboxID);
	if (!o) return;
	var l = objGet(labelObj);
	if (!l) return;
	var c = l.className;
	
	if ( o.checked == false ) { 
		o.checked = true;
		l.className += ' hilited';
	} else {
		o.checked = false;
		l.className = c.replace(/( hilited)/gi, '');
	}
	//if ( stav == 'over' ) { o.className = c + ' hover';  }
	//if ( stav == 'out' ) { o.className = c.replace(/( hover)/gi, ''); }
	//alert(o.className);
	return;
} // end f

/* ------------------------------  toggleLabel()   ------------------------ */	
// toggleLabel()
// @param String labelID 			DOM ID labelu
function toggleLabel(labelID) {
	var l = objGet(labelID);
	if (!l) return;
	var c = l.className;
	
	if ( c.search(/(hilited)/) != -1 ) { 
		l.className = c.replace(/( hilited)/gi, '');
	} else {
		l.className += ' hilited';
	}
	//alert(l.className);
	return;
} // end f

/* ======================================================================== */

/* ----------------------   DHTML knihovna by Pixy   ---------------------- */	
function objGet(x) {
	if (typeof x != 'string') return x;
	else if (Boolean(document.getElementById)) return document.getElementById(x);
	else if (Boolean(document.all)) return eval('document.all.'+x);  // pro MSIE 4
	else return null;
} // end f
function objSetStyle (obj,prop,val) {
	var o = objGet(obj);
	if (o && o.style) {
			eval ('o.style.'+prop+'="'+val+'"');
			return true;
			}
	else return false;
} // end f
function objShow (obj, on) {
		return objSetStyle(obj,'visibility',(on) ? 'visible':'hidden');
} // end f
function objDisplay (obj, on, type) {
		if (on && !type) type = 'block';
		return objSetStyle(obj,'display',(on) ? type:'none');
} // end f
/* end DHTML knihovna */
/* ----------------------------------------------------------------------- */



/* ----------------------   Acess CSS with JS   ---------------------- */	
/* @see http://www.quirksmode.org/dom/w3c_css.html */
var nr = 2; //  poradi_css_souboru pri linkovani
function splitBrowsers() {

	if ( document.styleSheets ) {

		if (document.styleSheets[nr].cssRules)
			return document.styleSheets[nr].cssRules;
		else
			return document.styleSheets[nr].rules;
	}
} // end f
function getCSSPropertyValue(prop) {	
	var theRules = splitBrowsers();
	//alert(theRules[0].style[prop]);
	return theRules[0].style[prop];
} // end f

/* ----------------------------------------------------------------------- */



/* -----------------------------  ZEBRA TABLES  --------------------------- */
/* @see http://www.alistapart.com/articles/zebratables/ */
// this function is need to work around 
  // a bug in IE related to element attributes
  function hasClass(obj) {
     var result = false;
     if (obj.getAttributeNode("class") != null) {
         result = obj.getAttributeNode("class").value;
     }
     return result;
  }   

 function stripe(id) {

    // the flag we'll use to keep track of 
    // whether the current row is odd or even
    var even = false;
  
    // if arguments are provided to specify the colours
    // of the even & odd rows, then use the them;
    // otherwise use the following defaults:
    var evenColor = arguments[1] ? arguments[1] : "#fff";
    var oddColor = arguments[2] ? arguments[2] : "#eee";
  
    // obtain a reference to the desired table
    // if no such table exists, abort
   // var table = document.getElementById(id);
    //if (! table) { return; }
    
    // by definition, tables can have more than one tbody
    // element, so we'll have to get the list of child
    // &lt;tbody&gt;s 
    var tbodies = document.getElementsByTagName("tbody");

    // and iterate through them...
    for (var h = 0; h < tbodies.length; h++) {
    
     // find all the &lt;tr&gt; elements... 
      var trs = tbodies[h].getElementsByTagName("tr");
      
      // ... and iterate through them
      for (var i = 0; i < trs.length; i++) {

	    // avoid rows that have a class attribute
        // or backgroundColor style
	    if (!hasClass(trs[i]) && ! trs[i].style.backgroundColor) {
 
         // get all the cells in this row...
          var tds = trs[i].getElementsByTagName("td");
        
          // and iterate through them...
          for (var j = 0; j < tds.length; j++) {
        
            var mytd = tds[j];

            // avoid cells that have a class attribute
            // or backgroundColor style
	        if (! hasClass(mytd) && ! mytd.style.backgroundColor) {
        
		      mytd.style.backgroundColor = even ? evenColor : oddColor;
              
            }
          }
        }
        // flip from odd to even, or vice-versa
        even =  ! even;
      }
    }
  }