    // Globals
    //


    /*
     * Multiple Selection lists in HTML Document
     */
    var tableColumnList;
    var indexColumnList;

    /*
     * Two Array vars
     */

    var indexColumns, tableColumns;


    function buttonPressed(object) {

             if (object.name == "add") {
                 from = tableColumnList;
                 to = indexColumnList;
             }
             else {
                 to = tableColumnList;
                 from = indexColumnList;
             }

             var selectedOptions = getSelectedOptions(from);

             for (i = 0; i < selectedOptions.length; i++) {
                  option = new Option(selectedOptions[i].text,selectedOptions[i].value);
                 // alert(option.value);
                  addToArray(to, option);
                  removeFromArray(from, selectedOptions[i].index);
             }
    }

    function doSelectAll() {
      for(var x = 0; x < indexColumnList.options.length; x++){
         indexColumnList.options[x].selected = true;
      }
    }

    function init() {
             tableColumnList = document.getElementById("fromX");//formIndex.TableColumnList;
             indexColumnList = document.getElementById("toX");
             indexColumns = indexColumnList.options;
             tableColumns = tableColumnList.options;
    }


    function getSelectedOptions(obj) {
             var selectedOptions = new Array();

             for (i = 0; i < obj.options.length; i++) {
                  if (obj.options[i].selected) {
                      selectedOptions.push(obj.options[i]);
                  }
             }

             return selectedOptions;
    }

    function removeFromArray(obj, index) {
             obj.remove(index);
    }

    function addToArray(obj, item) {
             obj.options[obj.options.length] = item;
    }

    function showDiv(docID){
        document.getElementById(docID).style.display='inline';
    }

    function hideDiv(docID){
        document.getElementById(docID).style.display='none';
    }

    //date handling
   function y2k(year) {
	return year < 100 ? year < 70 ? 2000 + eval(year) : 1900 + eval(year) : year;
}

function is_leap(year) {
	return year % 400 == 0 || year % 100 != 0 && year % 4 == 0;
}

function month_days(mon,year) {
	days = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	if ( is_leap(year) ) {days[1] = 29;}

	return ( mon > 0 && mon <= 12 ? days[mon-1] : 0 );
}

var post_focused_object;

function post_focus() {
	post_focused_object.focus();
}

function proccess_date(txt_control, auto_expand, label, allow_empty, expand_empty) {
    re_empty = /^ *$/;
    is_empty = re_empty.test(txt_control.value);
	 if (allow_empty && (!auto_expand || !expand_empty) && is_empty) {
       txt_control.value = '';
       return true;
    }
    if (auto_expand) {
    	tst_date = /^\s*((\d{1,2})(\D(\d{1,2})(\D(\d{1,4}))?)?)?\s*$/;
        day_idx  = 2;
        mon_idx  = 4;
        year_idx = 6;
    }
    else {
    	tst_date = /^\s*(\d{1,2})\D(\d{1,2})\D(\d{1,4})\s*$/;
        day_idx  = 1;
        mon_idx  = 2;
        year_idx = 3;
    }
   if (txt_control.value.length > 1 &&
       isNaN(txt_control.value.charAt( txt_control.value.length-1 )))
   {
      txt_control.value = txt_control.value.substr(0, txt_control.value.length - 1);
   }
	result   = tst_date.exec( txt_control.value );
   if (isNaN(txt_control.value.charAt( txt_control.value.length-1 )))
   {
      txt_control.value = txt_control.value
   }
	ok			= false;
   if (is_empty && !allow_empty) {
   }
   else if (result) {
      today = new Date();
      today_year = today.getYear();
      if (today_year < 1900) today_year += 1900;
		day  = result[ day_idx ] ? result[ day_idx ] : today.getDate();
		mon  = result[ mon_idx ] ? result[ mon_idx ] : today.getMonth() + 1;
		year = result[ year_idx ] ? y2k(result[ year_idx ]) : today_year;
		if ( mon >= 1 && mon <= 12 && day > 0 && day <= month_days(mon,year) ) {
			txt_control.value = day + '.' + mon + '.' + year;
			ok = true;
		}
	}
	if (!ok) {
        if (!label) label = '';
		alert("Špatně zadané datum " + label + " !");
		post_focused_object = txt_control;
		setTimeout("post_focus()",50);
	}
    return ok;
}

function proccess_month(txt_control, auto_expand, label, allow_empty) {
	if (allow_empty && !auto_expand && txt_control.value == '') return true;
    if (auto_expand) {
    	tst_month = /^\s*((\d{1,2})(\D(\d{1,4}))?)?\s*$/;
        mon_idx  = 2;
        year_idx = 4;
    }
    else {
    	tst_month = /^\s*(\d{1,2})\D(\d{1,4})\s*$/;
        mon_idx  = 1;
        year_idx = 2;
    }
   if (txt_control.value.length > 1 &&
       isNaN(txt_control.value.charAt( txt_control.value.length-1 )))
   {
      txt_control.value = txt_control.value.substr(0, txt_control.value.length - 1);
   }
	result   = tst_month.exec( txt_control.value );
	ok			= false;
	if (result) {
        today       = new Date();
        today_year  = today.getYear();
        if (today_year < 1900) today_year += 1900;
		mon  = result[ mon_idx ] ? result[ mon_idx ] : today.getMonth() + 1;
		year = result[ year_idx ] ? y2k( result[ year_idx ] ) :  today_year;
		if ( mon >= 1 && mon <= 12 ) {
			txt_control.value = mon + '.' + year;
			ok = true;
		}
	}
	if (!ok) {
        if (!label) label = '';
		alert("©patnì zadaný mìsíc " + label + " !");
		post_focused_object = txt_control;
		setTimeout("post_focus()",50);
	}
    return ok;
}

function proccess_time(txt_control, show_sec, label, allow_empty, def_time) {
   re_empty = /^ *$/;
	if (allow_empty && re_empty.test(txt_control.value)) {
        if (def_time || def_time == '')
            txt_control.value = def_time
        else
            txt_control.value = '00:00' + (show_sec ? ':00' : '');
        return true;
    }
	tst_time = /^\s*(\d{1,2})(\D(\d{1,2})(\D(\d{1,2}))?)?\s*$/;
	result   = tst_time.exec( txt_control.value );
	hour	   = -1;
	if (result) {
		hour = result[1];
		min  = result.length >= 4 ? result[3] ? result[3] : '00' : '00';
		sec  = result.length >= 6 ? result[5] ? result[5] : '00' : '00';

		if (min < 10) min = '0' + eval(min);
		if (sec < 10) sec = '0' + eval(sec);
	}
	if ( hour >= 0 && hour <= 23 && min <= 59 && sec <= 59 ) {
		txt_control.value = hour + ':' + min + (show_sec ? ':' + sec : '');
	}
	else {
		alert("©patnì zadán èas " + label + " !");
		post_focused_object = txt_control;
		setTimeout("post_focus()",50);
        return false;
	}
    return true;
}

function date_diff(date_from,date_to,time_from,time_to) {
   re_date = /^(\d+)\D(\d+)\D(\d+)$/;
   res_from = re_date.exec(date_from);
   res_to   = re_date.exec(date_to);
   re_time = /^(\d+)\D(\d+)(\D(\d+))?$/;
   if (time_from) {
      res = re_time.exec(time_from);
      h_from = res[1] ? res[1] : 0;
      m_from = res[2] ? res[2] : 0;
      s_from = res[4] ? res[4] : 0;
   }
   else {
      h_from = m_from = s_from = 0;
   }
   if (time_to) {
      res = re_time.exec(time_to);
      h_to = res[1] ? res[1] : 0;
      m_to = res[2] ? res[2] : 0;
      s_to = res[4] ? res[4] : 0;
   }
   else {
      h_to = m_to = s_to = 0;
   }

   if (! res_to || ! res_from ) return 1;

   return (new Date(res_to[3],res_to[2]-1,res_to[1],h_to,m_to,s_to) -
           new Date(res_from[3],res_from[2]-1,res_from[1],h_from,m_from,s_from)) / 1000;
}

//hint
/***********************************************
* Show Hint script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var horizontal_offset="9px" //horizontal offset of hint box from anchor link

/////No further editting needed

var vertical_offset="0" //horizontal offset of hint box from anchor link. No need to change.
var ie=document.all
var ns6=document.getElementById&&!document.all

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 iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
if (whichedge=="rightedge"){
var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset)
}
else{
var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
}
return edgeoffset
}

function showhint(menucontents, obj, e, tipwidth){
if ((ie||ns6) && document.getElementById("hintbox")){
dropmenuobj=document.getElementById("hintbox");
dropmenuobj.innerHTML=menucontents;
dropmenuobj.style.left=dropmenuobj.style.top=-500;
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style;
dropmenuobj.widthobj.width=tipwidth;
}
dropmenuobj.x=getposOffset(obj, "left");
dropmenuobj.y=getposOffset(obj, "top");
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px";
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px";
dropmenuobj.style.visibility="visible";
obj.onmouseout=hidetip;
}
}

function hidetip(e){
dropmenuobj.style.visibility="hidden";
dropmenuobj.style.left="-500px";
}

function createhintbox(){
var divblock=document.createElement("div");
divblock.setAttribute("id", "hintbox");
document.body.appendChild(divblock);
}


/*
var heading = null
function moveText(milliseconds) {
 window.setInterval("changePosition()", milliseconds);
}
function changePosition() {
 //var x = Math.random()*400;
 //var y = Math.random()*400;
 if(document.getElementById)
  heading = document.getElementById("moveme");
 else if(navigator.appName == "Microsoft Internet Explorer")
  heading = document.all.item("moveme");
 else if(document.layers)
  heading = document.layers["moveme"];
// alert(heading);
 if(heading != null) {
  if(heading.style == null) { // Navigator 4
   heading.left = heading.left+10+"px";
   heading.top = heading.top+10+"px";
  }else if(heading.style.left != null) { // DOM-capable
   heading.style.left = heading.style.left+10+"px";
   heading.style.top = heading.style.top+10+"px";
  }else{ // IE 4
   heading.style.posLeft = heading.style.posLeft+10+"px";
   heading.style.posTop = heading.style.posTop+10+"px";
  }
  //alert (heading.style.left);
 }
}

*/
 
var SCROLLING_TEXT_ID = "scrolling_text";

var scroller;

(function()
{
if (window.addEventListener)
{
  window.addEventListener("load", setup, false);
}
else
{
  window.attachEvent("onload", setup);
}

function setup()
{	  
  //The controls should all be input elements (type="button") so that they can be disabled
  scroller = new Scroller("scrolling_text");
}
})();

//Scroller class
function Scroller(id)
{
this.allHTMLTags = new Array();
this.scrolling_text = new Array();
var index=0;

//Create Array of All HTML Tags
var allHTMLTags=document.getElementsByTagName("*");

	//Loop through all tags using a for loop
for (i=0; i<allHTMLTags.length; i++) {

	//Get all tags with the specified class name.
	if (allHTMLTags[i].className=="scrolling_text") {
		this.scrolling_text[index] = allHTMLTags[i];
		index++;
	
	}
}

//this.scrolling_text = document.getElementById(id)[0];
//this.scrolling_text2 = document.getElementById(id)[1];
//alert (this.scrolling_text2);
var obj = this;
//Relies on disabling this button when the scroller is running to stop repeated timeouts from starting
obj.scroll();
     
this.timer = null;
this.speed = 250;	//1000 = 1 second
this.right_to_left = true;
this.stopped = false;	//Stopped initially
     
//this.update_controls();
}

Scroller.prototype.scroll = function()
{ 	  
//var text = this.scrolling_text.innerHTML;
for (i = 0; i < this.scrolling_text.length; i++){
	var text = this.scrolling_text[i].firstChild.nodeValue; 
	//alert (text);
	var node;
	
	this.stopped = false;        
	
	if (text.length > 0)
	{
	  //Remove the first character and add it to the end
	  if (this.right_to_left)
	  {	      
	    text = text.substring(1, text.length) + text.substring(0, 1);
	  }
	  else
	  {
	    text = text.substring(text.length - 1, text.length) + text.substring(0, text.length - 1);
	  }
	  this.scrolling_text[i].firstChild.nodeValue = text;
	  /* bluedead
	  var obj = this;
	  this.timer = setTimeout(function(){obj.scroll();}, this.speed);
	  */		 

	}

}
var obj = this;
this.timer = setTimeout(function(){obj.scroll();}, this.speed);	
//this.update_controls();
}


if (window.addEventListener)
window.addEventListener("load", createhintbox, false);
else if (window.attachEvent)
window.attachEvent("onload", createhintbox);
else if (document.getElementById)
window.onload=createhintbox;

