/////////////////////////////////////////////////////////
//                                                     //
//                      DOM 1-2                        //
//       emulace insertAdjacentHTML pro netscape       //
//       freeware z codelibrary                        //
//                                                     //
//                                        						 //
//                                                     //
/////////////////////////////////////////////////////////


if(typeof HTMLElement!="undefined" && !
HTMLElement.prototype.insertAdjacentElement){
	HTMLElement.prototype.insertAdjacentElement = function (where,parsedNode)
	{
		switch (where){
		case 'beforeBegin':
			this.parentNode.insertBefore(parsedNode,this)
			break;
		case 'afterBegin':
			this.insertBefore(parsedNode,this.firstChild);
			break;
		case 'beforeEnd':
			this.appendChild(parsedNode);
			break;
		case 'afterEnd':
			if (this.nextSibling)
this.parentNode.insertBefore(parsedNode,this.nextSibling);
			else this.parentNode.appendChild(parsedNode);
			break;
		}
	}

	HTMLElement.prototype.insertAdjacentHTML = function (where,htmlStr)
	{
		var r = this.ownerDocument.createRange();
		r.setStartBefore(this);
		var parsedHTML = r.createContextualFragment(htmlStr);
		this.insertAdjacentElement(where,parsedHTML)
	}


	HTMLElement.prototype.insertAdjacentText = function (where,txtStr)
	{
		var parsedText = document.createTextNode(txtStr)
		this.insertAdjacentElement(where,parsedText)
	}
}

 LINUX = null;
 WIN = null;
 MAC = null;
 OS = null;

if (!OS)
{
if (checkIt('linux')) LINUX = true;
else if (checkIt('x11')) LINUX = true;
else if (checkIt('mac')) MAC = true;
else if (checkIt('win')) WIN = true;
else OS = "unknown operating system"; 

if (checkIt('linux')) OS = "linux";
if (checkIt('x11')) OS = "linux";
if (checkIt('mac')) OS = "Mac";
if (checkIt('win')) OS = "Win";

//alert(OS);
}

function checkIt(string)
{
detect = navigator.userAgent.toLowerCase(); 
place = detect.indexOf(string) + 1;
thestring = string;
return place;
} 

 IE= null; //IE5+
 NS= null; // Mozilla 0.9.1+
 OPERA = null; // Opera 7
 OPERA6 = null;
 IE55 = null;
 IE5 = null;
 IE6=null;

 ua = navigator.appName.toLowerCase();
 var browser = navigator.appName.toLowerCase();

 if(ua.indexOf('explorer')>-1 && document.getElementById && document.childNodes && !document.addEventListener) {IE=true;}
 if(ua == 'netscape' && document.getElementById && document.childNodes && !document.all) {NS=true;}
 if(ua == 'opera' && document.getElementById && document.childNodes) {OPERA=true;}
 if(navigator.userAgent.indexOf("Opera")>- 1 && document.getElementById){OPERA6=true;}


 if(!IE && !NS && !OPERA && document.addEventListener) {OPERA=true;}

 ua = navigator.userAgent.toLowerCase();

 if(IE && ua.indexOf('5.5')>-1) {IE55=true;}
 if(IE && ua.indexOf('5.0')>-1) {IE5=true;}
 if(IE && !IE5 && !IE55) {IE6=true;}
 if(OPERA6 || !IE && !NS && !OPERA)
    {
    	self.location = "javascript: alert('Vas Prohlizec nepodporuje standard W3C DOM. Pro spravne zobrazeni stranky budete potrebovat novejsi verzy vaseho oblibeneho prohlizece.')";
    }





/////////////////////////////////////////////////////////
//                                                     //
//                      DOM 1-2                        //
//       popup s centrovanim                           //
//       autor: Tomas Bulva                            //
//                                                     //
//                                        						 //
//                                                     //
/////////////////////////////////////////////////////////

var foto
 function Popup(popupURL,foto,name,w,h) {
  var foto = escape(Popup.arguments[1]);
	var widht = escape(Popup.arguments[3]);
	var height = escape(Popup.arguments[4]);
	LeftPosition=(screen.width)?(screen.width-w)/2:100;
  TopPosition=(screen.height)?(screen.height-h)/2:100;
	//alert(screen.width);
	//alert(screen.height);
	//alert(popupURL+'?arg='+foto+'&arg1='+widht+'&arg2='+height,name,'toolbar=0,location=1,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width='+w+',height='+h+',left='+LeftPosition+',top='+TopPosition);
	window.open (popupURL+'?arg='+foto+'&arg1='+widht+'&arg2='+height,name,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width='+w+',height='+h+',left='+LeftPosition+',top='+TopPosition);
}




/////////////////////////////////////////////////////////
//                                                     //
//                      DOM 1-2                        //
//       KA3dovacA­ funkce                               //
//       freeware z codelibrary                        //
//                                                     //
//                                        						 //
//                                                     //
/////////////////////////////////////////////////////////


// ZakA3duje parametry do vA1slednA© adresy
function EncodeString (Url){
  // Tato promA¬nnA! bude obsahovat vA1slednou adresu
  Str = new String();

  // Forcyklus pA¸es vÂšechny argumenty funkce
  for (var i=1; i<EncodeString.arguments.length; i++){
    // Pokud se zpracovA!vA! prvnA­ parametr,
    // prA¸idA! se do adresy znak '?' oddA¬lujA­cA­ parametrickou
    // A¨A!st adresy, jinak pA¸idA!me znak '&'
    // oddA¬lujA­cA­ jednotlivA© parametry
    if (i==1)
      Str = Str + '?';
    else
        Str = Str + '&';

    // Do A¸etA¬zce se uloÂžA­ nA!zev parametru a jeho hodnota
    // Na tu se jeÂštA¬ pA¸edtA­m volA! funkce escape(), kterA!
    // pA¸evede "nebezpeA¨nA© znaky"
    Str = Str + 'Arg' + (i-1) + '=' +
      escape (EncodeString.arguments[i]);
  }

  // VA1slednA! adresa je adresa cA­lovA© strA!nky, kterA© se
  // budou parametry pA¸edA!vat a vlastnA­ch parametrA1
  Str = Url + Str;
  return (Str);
}





/////////////////////////////////////////////////////////
//                                                     //
//                      DOM 1-2                        //
//       DekA3dovacA­ funkce                             //
//       freeware z codelibrary                        //
//                                                     //
//                                        						 //
//                                                     //
/////////////////////////////////////////////////////////

// PA¸evA!dA­ URL na pole parametrA1
function DecodeString (Url){
  // VyslednA© pole parametrA1
  Args=new Array();

  // PomocnA© pole pro uloÂženA­ A¨A!stA­ URL
  var DecodeUrl;

  var PomUrl, PomArgs, PomArg;

  // ZiskA!nA­ A¨A!sti adresy s parametry
  Url = Url.toString();
  // Adresa se rozdA¬lA­ do pole podle znaku '?'
  DecodeUrl = Url.split ('?');
  // Pokud za znakem '?' byl nA¬jakA1 text
  if (DecodeUrl.length>1 && DecodeUrl[1].length>0){
    // Do promA¬nnA© PomUrl se uloÂžA­ A¨A!st adresy s parametry
    PomUrl = DecodeUrl[1];
    // RozdA¬lA­ se podle znaku '&' na dvojice Parametr=Hodnota
      PomArgs = PomUrl.split ('&');
    for (var i=0; i<PomArgs.length; i++){
      // Pro kaÂždA1 parametr se zA­skA! jeho hodnta
      // (A¸etA¬zec se tentokrA!te rozdA¬lA­ podle znaku '=')
        PomArg = PomArgs[i].split('=');
      Args[i] = unescape(PomArg[1]);
    }
  }
  // VrA!tA­ se vA1slednA© pole hodnot
  return (Args);
}




/////////////////////////////////////////////////////////
//                                                     //
//                      DOM 1-2                        //
//       cistej paste img do popupu                    //
//       autor: Tomas Bulva                            //
//                                                     //
//                                        						 //
//                                                     //
/////////////////////////////////////////////////////////

function loadpic(){

 					var Args = DecodeString (document.location);
					//alert(document.fotka.widht);


					if (Args[1]>0) {
						 width = Args[1];
					}
					else
					{
					 	 width = 400;
					}

					if (Args[2]>0) {
						 heigth = Args[2];
					}
					else
					{
					 	 heigth = 300;
					}
					cv = '<img src="'+Args[0]+'" alt="foto" name="fotka" width="'+width+'" height="'+heigth+'" style="margin:0px; padding:0px; position: absolute; top:0px; left:0px;" />';

					document.getElementById('body').insertAdjacentHTML("afterBegin",cv);
 }




/////////////////////////////////////////////////////////
//                                                     //
//                      DOM 1-2                        //
//       rollover obrazku obecne pouzivana funkce      //
//                                                     //
//                                                     //
//                                        						 //
//                                                     //
/////////////////////////////////////////////////////////


 function newImage(arg) {
  	if (document.images) {
  		rslt = new Image();
  		rslt.src = arg;
  		return rslt;
  	}
  }

  function changeImages() {
  	if (document.images && (preloadFlag == true)) {
  		for (var i=0; i<changeImages.arguments.length; i+=2) {
  			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
  		}
  	}
  }

  var preloadFlag = false;
  function preloadImages() {
  	if (document.images) {
  	//pic1 = newImage("pic/menu/home.gif_o");
pic1 = newImage("pic/bvyhledat_off.gif");
pic2 = newImage("pic/bvyhledat_over.gif");
pic3 = newImage("pic/cenik_off.gif");
pic4 = newImage("pic/cenik_on.gif");
pic5 = newImage("pic/cenik_over.gif");
pic6 = newImage("pic/cistit_off.gif");
pic7 = newImage("pic/cistit_over.gif");
pic8 = newImage("pic/detaily_off.gif");
pic9 = newImage("pic/detaily_on.gif");
pic10 = newImage("pic/detaily_over.gif");
pic11 = newImage("pic/dockingControl.gif");
pic12 = newImage("pic/editovat_off.gif");
pic13 = newImage("pic/editovat_over.gif");
pic14 = newImage("pic/fakturace_off.gif");
pic15 = newImage("pic/fakturace_on.gif");
pic16 = newImage("pic/fakturace_over.gif");
pic17 = newImage("pic/iconaPapir.gif");
pic18 = newImage("pic/kalendar.gif");
pic19 = newImage("pic/klient_off.gif");
pic20 = newImage("pic/klient_on.gif");
pic21 = newImage("pic/klient_over.gif");
pic22 = newImage("pic/krajicekloginu.gif");
pic23 = newImage("pic/kur");
pic24 = newImage("pic/logo.gif");
pic25 = newImage("pic/motolinka_off.gif");
pic26 = newImage("pic/motolinka_on.gif");
pic27 = newImage("pic/motolinka_over.gif");
pic28 = newImage("pic/objednat_off.gif");
pic29 = newImage("pic/objednat_over.gif");
pic30 = newImage("pic/objednavka_off.gif");
pic31 = newImage("pic/objednavka_on.gif");
pic32 = newImage("pic/objednavka_over.gif");
pic33 = newImage("pic/objendavajici_off.gif");
pic34 = newImage("pic/objendavajici_on.gif");
pic35 = newImage("pic/objendavajici_over.gif");
pic36 = newImage("pic/oblibene_off.gif");
pic37 = newImage("pic/oblibene_over.gif");
pic38 = newImage("pic/ocenikbut_off.gif");
pic39 = newImage("pic/ocenikbut_over.gif");
pic40 = newImage("pic/odhlasit_off.gif");
pic41 = newImage("pic/odhlasit_over.gif");
pic42 = newImage("pic/onovatras_off.gif");
pic43 = newImage("pic/onovatras_over.gif");
pic44 = newImage("pic/oobjednatbut_off.gif");
pic45 = newImage("pic/oobjednatbut_over.gif");
pic46 = newImage("pic/opodminkybut_off.gif");
pic47 = newImage("pic/opodminkybut_over.gif");
pic48 = newImage("pic/osluzbybut_off.gif");
pic49 = newImage("pic/osluzbybut_over.gif");
pic50 = newImage("pic/osmazat_off.gif");
pic51 = newImage("pic/osmazat_over.gif");
pic52 = newImage("pic/ovybrat_off.gif");
pic53 = newImage("pic/ovybrat_over.gif");
pic54 = newImage("pic/ozpet_off.gif");
pic55 = newImage("pic/ozpet_over.gif");
pic56 = newImage("pic/podklad-pre.gif");
pic57 = newImage("pic/podklad-pre2.gif");
pic58 = newImage("pic/podklad.gif");
pic59 = newImage("pic/prihlasit_off.gif");
pic60 = newImage("pic/prihlasit_on.gif");
pic61 = newImage("pic/prihlasit_over.gif");
pic62 = newImage("pic/registrovat_off.gif");
pic63 = newImage("pic/registrovat_over.gif");
pic64 = newImage("pic/ruka-ie.gif");
pic65 = newImage("pic/ruka-seda-ie.gif");
pic66 = newImage("pic/ruka-seda.gif");
pic67 = newImage("pic/ruka.gif");
pic68 = newImage("pic/sikmejruzek.gif");
pic69 = newImage("pic/sipeckadolu.gif");
pic70 = newImage("pic/sipeckaleva.gif");
pic71 = newImage("pic/sipeckaprava.gif");
pic72 = newImage("pic/spacer.gif");
pic73 = newImage("pic/spocitat_off.gif");
pic74 = newImage("pic/spocitat_over.gif");
pic75 = newImage("pic/stinek_leva.gif");
pic76 = newImage("pic/stinek_prava.gif");
pic77 = newImage("pic/ulozoblibene_off.gif");
pic78 = newImage("pic/ulozoblibene_over.gif");
pic79 = newImage("pic/video.png");
pic80 = newImage("pic/vyhledat_off.gif");
pic81 = newImage("pic/vyhledat_over.gif");
pic82 = newImage("pic/vyhledavani_off.gif");
pic83 = newImage("pic/vyhledavani_on.gif");
pic84 = newImage("pic/vyhledavani_over.gif");
pic85 = newImage("pic/vymazat_off.gif");
pic86 = newImage("pic/vymazat_over.gif");
pic87 = newImage("pic/zakladni_off.gif");
pic88 = newImage("pic/zakladni_on.gif");
pic89 = newImage("pic/zakladni_over.gif");
pic90 = newImage("pic/zasilky_off.gif");
pic91 = newImage("pic/zasilky_over.gif");
pic92 = newImage("pic/ceniktab_ram.gif");

  	preloadFlag = true;
		}
}




/////////////////////////////////////////////////////////
//                                                     //
//                      DOM 1-2                        //
//       ukladani cookies                              //
//                                                     //
//                                                     //
//                                        						 //
//                                                     //
/////////////////////////////////////////////////////////

function timeshell(minutes,seconds) {
	if(seconds == null) seconds = 60;
	cas = (1000*seconds)*minutes;
	return cas;
}

function ulozKukinu(){
var cas=timeshell(3,null);
panYpsilon = new Date();
panYpsilon.setTime(panYpsilon.getTime()+cas);
for(i=0;i<ulozKukinu.arguments.length;i++) {
		kukina = ulozKukinu.arguments[i] + '=' + ulozKukinu.arguments[i+1];
		i++;
	document.cookie = kukina + '; expires=' + panYpsilon.toGMTString();
}
}




/////////////////////////////////////////////////////////
//                                                     //b1
//                      DOM 1-2                        //
//       manipulace s barvou tr tagu v table           //
//       autor: Tomas Bulva                            //
//                                                     //
//                                        						 //
//                                                     //
/////////////////////////////////////////////////////////
var cli = 0;
var tr = '';

function lightcoloring(action,ajdy){
     if (cli!=1 || ajdy!=tr) {
    						 document.getElementById(ajdy).className = 'TabVN'+action;

								 //innerhtmlFUN('showit','<p>'+ajdy+'</p>');
    						 //innerhtmlFUN('showit3','<p>cli = '+cli+' | tr = '+tr+'</p>');

     }
}



 function clickandtrans(ajdy,value,path) {

 					//innerhtmlFUN('showit','<p>'+ajdy+'</p>');

					if (cli==0 && tr=='') {
						 pathnode = document.getElementById(path)

  					 document.getElementById(ajdy).className = 'TabVNclick';
  					 cli = 1;
  					 tr = ajdy;

  					 pathnode.value = value;

						 //innerhtmlFUN('msg','<p>value = '+pathnode.value+'</p>');
						 //innerhtmlFUN('showit3','<p>cli = '+cli+' | tr = '+tr+'</p>');
					}
					else
					{
  					 if(cli==1 && tr==ajdy){
						 pathnode = document.getElementById(path)

  						 pathnode.value = 'NULL';
  						 cli = 0;
  						 tr = '';
  						 document.getElementById(ajdy).className = 'TabVNout';

							 //innerhtmlFUN('msg','<p>value = '+pathnode.value+'</p>');
  						 //innerhtmlFUN('showit3','<p>out-cli = '+cli+' | tr = '+tr+'</p>');
						 }
					}

					if (cli==1 && tr!=ajdy || cli==1 && tr!='') {
						 pathnode = document.getElementById(path)
						 pathnode.value = value;

  					 document.getElementById(tr).className = 'TabVN';

  					 document.getElementById(ajdy).className = 'TabVNclick';
  					 cli = 1;
  					 tr = ajdy;

						 //innerhtmlFUN('msg','<p>value = '+pathnode.value+'</p>');
						 //innerhtmlFUN('showit3','<p>cli = '+cli+' | tr = '+tr+'</p>');
					 }

 }

function innerhtmlFUN(elementid,content){
				 //alert(elementid+' . '+content)
			if(NS){
				 if (document.getElementById){
				 		rng = document.createRange();
						el = document.getElementById(elementid);
						rng.setStartBefore(el);
						htmlFrag = rng.createContextualFragment(content);
				 while (el.hasChildNodes())
				 		el.removeChild(el.lastChild);
						el.appendChild(htmlFrag);
				 }
		 }
		 if(IE){
		 		document.getElementById(elementid).innerHTML = content;
		 }
}

// zkusime x-lib
var hiZ = 2;

function initPos(){
				 ele = xGetElementById('d2Container');
				 if (!get_cookie('nodey')) {
							width = 139;//getAbsY(dragwinX);
							height = 760;//getAbsX(dragwinX);
							var nodey_coo=(document.cookie='nodey='+width);
							var nodex_coo=(document.cookie='nodex='+height);
							xMoveTo(ele,width,height);
				 }
				 
}
/*
window.onload = function()
{
    if (window.winOnLoad) window.winOnLoad();
}



window.onload = function()
{
  var ele = xGetElementById('d1');
  xMoveTo(ele, (xClientWidth() - xWidth(ele)) / 2, (xClientHeight() - xHeight(ele)) / 2);
  xEnableDrag(ele, myOnDragStart, myOnDrag, myOnDragEnd);

  ele = xGetElementById('d2Container');
  xMoveTo(ele, xClientWidth() - xWidth(ele) - 10, (xClientHeight() - xHeight(ele)) / 2);
  
  ele = xGetElementById('d2');
  xResizeTo(ele, 20, 20);
  xMoveTo(ele, 180, 0);
  xEnableDrag(ele, myOnDragStart, myOnDrag, myOnDragEnd);
}
*/

function myOnDragStart(ele, mx, my)
{
  window.status = '';
  if (ele.id == 'd2') xZIndex('d2Container', hiZ++);
  else xZIndex(ele, hiZ++);
  ele.myTotalMX = 0;
  ele.myTotalMY = 0;
}
function myOnDrag(ele, mdx, mdy)
{
  if (ele.id == 'd2') {
    xMoveTo('d2Container', xLeft('d2Container') + mdx, xTop('d2Container') + mdy);
  }
  else {
    xMoveTo(ele, xLeft(ele) + mdx, xTop(ele) + mdy);
  }  
  ele.myTotalMX += mdx;
  ele.myTotalMY += mdy;
}
function myOnDragEnd(ele, mx, my)
{
  var nodey_coo=(document.cookie='nodey='+ele.myTotalMY);
	var nodex_coo=(document.cookie='nodex='+ele.myTotalMX);
  window.status =
    ele.id +
    ':  Total X movement: ' + ele.myTotalMX +
    ',  Total Y movement: ' + ele.myTotalMY;
}

var elm
var elm2

function minimize1(dragwin) {
		elm = document.getElementById('telicko');
		if (!document.getElementById('dragwinMini')) {
			 elm2 = document.getElementById(dragwin);
			 }
		else
			 {
			 	elm2 = document.getElementById('dragwinMini');
			 }
			 //alert(minimze1)

		elm.style.visibility = 'visible';
		elm2.setAttribute('id',dragwin);
		var minimi_coo=(document.cookie='minimi=1');
}

function minimize0(dragwin) {
		elm = document.getElementById('telicko');
		elm2 = document.getElementById(dragwin);
		//alert(minimze0)
		elm.style.visibility = 'hidden';
		elm2.setAttribute('id','dragwinMini');
		var minimi_coo=(document.cookie='minimi=0');
}

function minimize(object){
elm = document.getElementById('telicko');
//alert(object);
//alert(elm);

if (!document.getElementById(object)) {
 elm2 = document.getElementById('dragwinMini');
}
else
{
	 elm2 = document.getElementById(object);
 //alert('else');
}

//alert(elm2);
id = elm2.getAttribute('id');



if (id == object) {
		elm.style.visibility = 'hidden';
		elm2.setAttribute('id','dragwinMini');
		var minimi_coo=(document.cookie='minimi=0');
		}
		else
		{
		elm.style.visibility = 'visible';
		elm2.setAttribute('id', object);
		var minimi_coo=(document.cookie='minimi=1');
		}
}



//Get cookie routine by Shelley Powers
function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    // if cookie exists
    if (offset != -1) {
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1) end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

function docking(what) {
	if(!document.getElementById(what)) {
			//alert('dragmini');
	 		var whatToDock = document.getElementById('dragwinMini');
	}
	else
	{
	 		var whatToDock = document.getElementById(what);
	}

	//alert(whatToDock);
	dragwin2.style.position = "relative";
	dragwin2.style.left = 754+"px";
	dragwin2.style.top = 139+"px";

	var nodey = getAbsY(whatToDock);
	var nodex = getAbsX(whatToDock);
  var nodey_coo=(document.cookie='nodey='+nodey);
	var nodex_coo=(document.cookie='nodex='+nodex);

}


/////////////////////////////////////////////////////////
//                                                     //
//                      DOM 1-2                        //
//       show details                                  //
//       autor: Tomas Bulva                            //
//                                                     //
//                                        						 //
//                                                     //
/////////////////////////////////////////////////////////

function pausecomp(Amount)
{
d = new Date() //today's date
while (1)
{
mill=new Date() // Date Now
diff = mill-d //difference in milliseconds
if( diff > Amount ) {break;}
}
}


var moveBg=0;
var justMoving = '';

function setVerticalPosition(position){

								//container = document.getElementById(moveobj);
								//container.style.top = position+'px';
								moveBg = position;
}



function startShowDetail(moveobj,position) {

f = function () {
                //alert(moveobj+" "+position);
                //alert('show '+currpos);
                //alert(moveBg+'px');
								container = document.getElementById(moveobj);
								currpos = container.style.top;
//moveBg = currpos;

                container.style.top = moveBg+'px';

                //alert(moveBg);

                if (moveBg >= position) {
                		//alert(moveBg)
		justMoving = true;
		if(NS){
  			moveBg--;moveBg--;moveBg--;moveBg--;
		}
		else
		{
			moveBg--;
		}
                		//
                }
                else
                {
              			clearInterval(showtime1); // pokud se dosA!hlo pozice spodnA­ho okraje okna, zacA­t od zacA!tku
              			justMoving = false
										//alert(showtime1);
              			//showtime1 = null;
                }

              }

if(justMoving == false){ showtime1=setInterval(f,1); }
}

function startHideDetail(moveobj,position) {

f = function () {
						 		//alert(moveobj+" "+position);
								container = document.getElementById(moveobj);
								currpos = container.style.top;
								//moveBg = currpos;
                //alert('hide '+currpos);
                //alert(moveBg+'px');
                container.style.top = moveBg+'px';

                //alert(moveBg);

                if (moveBg <= position) {
                		//alert(moveBg)
										justMoving = true;
                		if(NS){
  												 moveBg++;moveBg++;moveBg++;moveBg++;
										}
										else
										{
										 			 moveBg++;
										};
										//moveBg++;//moveBg++;moveBg++;moveBg++;

                }
                else
                {
                		//alert(showtime2);
                		clearInterval(showtime2); // pokud se dosA!hlo pozice spodnA­ho okraje okna, zacA­t od zacA!tku
										justMoving = false;
              			//showtime2 = null;

                }

              }

if(justMoving == false){ showtime2=setInterval(f,1); }
}




function managebuttons(detail,swich) {

	if(detail==0 && justMoving == false){
				if(IE) insert = '<img src="pic/zakladni_on.gif" alt="zakladni" /><a href="javascript: setVerticalPosition(\'0\'); startShowDetail(\'innerPevnyKont\', \'-180\'); managebuttons(1);" onmouseover="changeImages(\'detailybut\', \'pic/detaily_over.gif\'); return true;" onmouseout="changeImages(\'detailybut\', \'pic/detaily_off.gif\'); return true;"><img src="pic/detaily_off.gif" alt="detaily" name="detailybut" /></a><br clear="all" />';
				if(NS) insert = '<img src="pic/zakladni_on.gif" alt="zakladni" /><a href="javascript: setVerticalPosition(\'0\'); startShowDetail(\'innerPevnyKont\', \'-198\'); managebuttons(1);" onmouseover="changeImages(\'detailybut\', \'pic/detaily_over.gif\'); return true;" onmouseout="changeImages(\'detailybut\', \'pic/detaily_off.gif\'); return true;"><img src="pic/detaily_off.gif" alt="detaily" name="detailybut" /></a><br clear="all" />';
	}

	if(detail==1 && justMoving == false)	{
			  if(IE) insert = '<a href="javascript: setVerticalPosition(\'-180\'); startHideDetail(\'innerPevnyKont\',\'0\'); managebuttons(0);" onmouseover="changeImages(\'zakladnibut\', \'pic/zakladni_over.gif\'); return true;" onmouseout="changeImages(\'zakladnibut\', \'pic/zakladni_off.gif\'); return true;"><img src="pic/zakladni_off.gif" alt="zakladni" name="zakladnibut" /></a><img src="pic/detaily_on.gif" alt="detaily" name="detailybut" /><br clear="all" />';
				if(NS) insert = '<a href="javascript: setVerticalPosition(\'-198\'); startHideDetail(\'innerPevnyKont\',\'0\'); managebuttons(0);" onmouseover="changeImages(\'zakladnibut\', \'pic/zakladni_over.gif\'); return true;" onmouseout="changeImages(\'zakladnibut\', \'pic/zakladni_off.gif\'); return true;"><img src="pic/zakladni_off.gif" alt="zakladni" name="zakladnibut" /></a><img src="pic/detaily_on.gif" alt="detaily" name="detailybut" /><br clear="all" />';
	}
	
	if(detail==3 && justMoving == false) {
				if(IE) insert = '<img src="pic/zakladni_on.gif" alt="zakladni" /><a href="javascript: setVerticalPosition(\'0\'); startShowDetail(\'innerPevnyKont\', \'-180\'); managebuttons(1);" onmouseover="changeImages(\'detailybut\', \'pic/detaily_over.gif\'); return true;" onmouseout="changeImages(\'detailybut\', \'pic/detaily_off.gif\'); return true;"><img src="pic/detaily_off.gif" alt="detaily" name="detailybut" /></a><br clear="all" />';
				if(NS) insert = '<img src="pic/zakladni_on.gif" alt="zakladni" /><a href="javascript: setVerticalPosition(\'0\'); startShowDetail(\'innerPevnyKont\', \'-198\'); managebuttons(1);" onmouseover="changeImages(\'detailybut\', \'pic/detaily_over.gif\'); return true;" onmouseout="changeImages(\'detailybut\', \'pic/detaily_off.gif\'); return true;"><img src="pic/detaily_off.gif" alt="detaily" name="detailybut" /></a><br clear="all" />';
	}
//alert(document.getElementById('butcontainer').innerHTML);	
	document.getElementById('butcontainer').innerHTML = "";
	document.getElementById('butcontainer').insertAdjacentHTML("afterBegin",insert);
	
}





/*
 var moveBg=0; // pocA!tecnA­ pozice, odkud se bude rolovat

function BackgroundRoll()
{ // funkce, kterA! roluje pozadA­ v rozmezA­ moveBg aÂž clientHeight
  document.body.style.backgroundPosition='20px '+moveBg + 'px'; // nastavit pozici na 20px od leva a moveBg px shora
  moveBg++; // zvA1Âšit pozici o 1
  if (moveBg>=document.body.clientHeight)
    moveBg=0; // pokud se dosA!hlo pozice spodnA­ho okraje okna, zacA­t od zacA!tku
}
window.setInterval("BackgroundRoll()",32); // nastavit opakovA!nA­ funkce BackgroundRoll kaÂždA1ch 32 ms



*/
function setzeKeks(){
	//alert('jsme in');
  var zeit=(1000*300)*288; // 5 minut x 1 000 000
  gueltig = new Date();
  gueltig.setTime(gueltig.getTime()+zeit);
  for(i=0;i<setzeKeks.arguments.length;i++) {
			//alert(setzeKeks.arguments[1]+' '+setzeKeks.arguments.length);
  		keks = setzeKeks.arguments[i] + '=' + setzeKeks.arguments[i+1];
  		i++;
  	document.cookie = keks + '; expires=' + gueltig.toGMTString();
		//alert(document.cookie);
  }
}


var timer, i, hiddenMenuTops = new Array('','10'), moveUp = false, justMovingDown = false, justMovingUp = false, queue = ''; //,'-49','-49'

var dom = document.getElementById ? true : false;
var ie4 = ((document.all) && (!dom)) ? true : false;
var ns4 = document.layers ? true : false;
var opera = navigator.userAgent.indexOf('Opera') != -1 ? true : false;
var opera4 = navigator.userAgent.indexOf('Opera 4') != -1 ? true : false;
var dhtml = opera4 ? false : dom ? true : ie4 ? true : ns4 ? true : false;

if (dhtml) document.write ('<style type="text/css">#scriptSupport {display: none;} html>body #menuHolder {width: 187px;} #menuHolder {position: absolute; top:335px; left:358px; height: 60px; width: 180px; overflow: hidden; clip: rect(0px,188px,60px,0px); visibility: hidden; z-index: 105; border-top: 2px solid #959595;} #visibleMenu1 {display: none; position: absolute; left: 0px; top: 0px; z-index: 100;} #whiteMenu {display: none; position: absolute; left: 0px; top: 0px; z-index: 4; background-color: #ffffff; height: 22px; width: 227px;} #hiddenMenu1 {position: absolute; left: 0px; top: 0px; z-index: 100;} </style>');

function setTop(element,inOrDecrementation,newTop)
{
  if (dhtml)
  {
    if (!inOrDecrementation)
    {
      if (dom) document.getElementById(element).style.top = newTop;
      else if (ie4) document.all[element].style.top = newTop;
      else if (ns4) eval('document.menuHolder.document.' + element + '.top = newTop');
    }
    else
    {
      if (dom) document.getElementById(element).style.top = parseInt(document.getElementById(element).style.top) + newTop;
      else if (ie4) document.all[element].style.top = parseInt(document.all[element].style.top) + newTop;
      else if (ns4) eval('document.menuHolder.document.' + element + '.top = parseInt(document.menuHolder.document.' + element + '.top) + newTop');
    }
  }
}

function getTop(element)
{
  if (dhtml)
  {
    if (dom) return parseInt(document.getElementById(element).style.top);
    if (ie4) return parseInt(document.all[element].style.top);
    if (ns4) return parseInt (eval('document.menuHolder.document.' + element + '.top'));
  }
}

function menu()
{
  if (dhtml)
  {
    for(i = 1; i <= 1; i++) setTop('hiddenMenu' + i,false,hiddenMenuTops[i]);
    if (opera) for(i = 1; i <= 1; i++) setTop('visibleMenu' + i,false,1);
    if (ie4) for(i = 1; i <= 1; i++) setTop('visibleMenu' + i,false,3);
    if (dom) document.getElementById('menuHolder').style.visibility = 'visible';
    else if (ie4) document.all.menuHolder.style.visibility = 'visible';
    else if (ns4) document.menuHolder.visibility = 'visible';
  }
}

function showMenu(id)
{
  if (dhtml)
  {
    if (((getTop('hiddenMenu1') == 10) || (id == 1)) && (!justMovingDown)) // || (id == 2)) && ((getTop('hiddenMenu3') == -49) || (id == 3)) && (!justMovingDown))
    {
      moveUp = false;
      clearTimeout(timer);
      justMovingUp = false;
      queue = '';
      justMovingDown = true;
      showMenu2(id);
    }
    else queue = id;
  }
}

function showMenu2(id)
{
  if ((!moveUp) && (getTop('hiddenMenu' + id) < 45))
  {
    setTop('hiddenMenu' + id,true,2);
    timer = setTimeout('showMenu2(' + id + ')',15);
  }
  else
  {
	  var clickRuce=(document.cookie='clickruce=0; expires='+setime(15));
    moveUp = true;
    justMovingDown = false;
		setTopPosition('HlavniPosuvnyKont',-225);
                                                                           /* if ((id == 3) && (getTop('hiddenMenu3') == 21))
                                                                            {
                                                                              if (dom) document.getElementById('hiddenMenu3').style.zIndex = 8;
                                                                              else if (ie4) document.all.hiddenMenu3.style.zIndex = 8;
                                                                              else if (ns4) document.menuHolder.document.hiddenMenu3.zIndex = 8;
                                                                            }*/
  }
}

function setime(minut) {
pridanyCas = (1000*60)*minut;
tim = new Date();
tim.setTime(tim.getTime()+pridanyCas)

//alert(tim.toGMTString());

return tim.toGMTString();
}


function hideMenu(id)
{
  if (dhtml)
  {
    if (!justMovingUp)
    {
      moveUp = true;
      clearTimeout(timer);
      showMenu2(id);
      justMovingUp = true;
      timer = setTimeout('hideMenu2(' + id + ')',50);
    }
    else if (queue == id) queue = '';
  }
}

function hideMenu2(id)
{
 				 														 			 	 				 								//alert(getTop('hiddenMenu1')+" "+moveUp+" "+id+" "+queue);
  if  ( ((getTop('hiddenMenu1') != 10) && (id == 1)) && (moveUp) )  // || ((getTop('hiddenMenu2') != -49) && (id == 2)) || ((getTop('hiddenMenu3') != -49) && (id == 3)) && (moveUp) )
  {
    setTop('hiddenMenu1' + id,true,-2);
                                                                    /*if ((id == 3) && (getTop('hiddenMenu3') != 21))
                                                                    {
                                                                      if (dom) document.getElementById('hiddenMenu3').style.zIndex = 1;
                                                                      else if (ie4) document.all.hiddenMenu3.style.zIndex = 1;
                                                                      else if (ns4) document.menuHolder.document.hiddenMenu3.zIndex = 1;
                                                                    }*/
    timer = setTimeout('hideMenu2(' + id + ')',15);
  }
  else
  {
	 	var clickRuce=(document.cookie='clickruce=1; expires='+setime(15));
    moveUp = false;
    justMovingUp = false;
		setTopPosition('HlavniPosuvnyKont',-207);
    if (queue != '') showMenu(queue);
  }
}

function dontHideMenu(id)
{
  if (dhtml)
  {
    if ((!justMovingDown) && (!justMovingUp)) clearTimeout(timer);
    if (moveUp) showMenu(id);
  }
}

function s() {
				 if(get_cookie('clickruce') == 1) {showMenu(1);} //////////////////dontHideMenu(1)
				 //else
				 if(get_cookie('clickruce') == 0) {hideMenu(1);}
}

function initS() {
				 if(!get_cookie('clickruce')) {
					var clickRuce=(document.cookie='clickruce=1; expires='+setime(15));
				 }
}


function showCas() {
				 datum = new Date()
				 with (datum){
				 			h = getHours();
							m = getMinutes();
							if( m < 10 ){ mm = '0'+m } 
							else { mm = m; } 
							//s = getSeconds();
				 }
 				 return (h+":"+mm);

}

function showDat() {
				 datum = new Date()
				 with (datum){
				 			d = getDate();
							den = (d < 10) ? '0' + d : d;
							m = getMonth() + 1;
							mesic = (m < 10) ? '0' + m : m;
							yy = getYear();
							rok = (yy < 1000) ? yy + 1900 : yy;
							rokl = rok+"";
							rok2 = rokl.substring(2,4);
				 }
				 
				 
				 //alert(rok2);
 				 return (den+". "+mesic+". "+rok2);

}

function transfertrasi(fromarray,tofieldset) {
	var fromarraynum = document.getElementById('TRASA').value;

	//alert(fromarraynum+' '+tofieldset)

	document.forms[tofieldset].firma1.value = TabT[fromarraynum][0];
	document.forms[tofieldset].ulice1.value = TabT[fromarraynum][1];
	document.forms[tofieldset].cislo1.value = TabT[fromarraynum][2];
	document.forms[tofieldset].obec1.value = TabT[fromarraynum][3];

	document.forms[tofieldset].firma2.value = TabT[fromarraynum][4];
	document.forms[tofieldset].ulice2.value = TabT[fromarraynum][5];
	document.forms[tofieldset].cislo2.value = TabT[fromarraynum][6];
	document.forms[tofieldset].obec2.value = TabT[fromarraynum][7];
}

function setTopPosition(moveobj,position){
	container = document.getElementById(moveobj);
	container.style.top = position+'px';
	moveBg = position;
}




var cast1;
var cast2;
var cast3;

function parseUliceValue(stringUlice){

//alert(stringUlice);
//alert(stringUlice.indexOf('*') != -1);

if (stringUlice.indexOf('*') != -1) {
	 //alert(stringUlice);
	 konecStringu = stringUlice.length;
	 
	 hv1 = stringUlice.indexOf('*');
	 
	 //hv1 = hv1-1;
	 //alert("hv1 "+hv1);
	 cast1 = stringUlice.substring(0,hv1);
	 //alert("cast1 "+cast1);
	 hv2 = hv1+1;
	 dalsicast = stringUlice.substring(hv2,konecStringu);
	 //alert("dalsicast "+dalsicast);
	 hv3 = dalsicast.indexOf('*');
	 //hv3 = hv3-1;
	 //alert("hv2 "+hv2);
	 //alert("hv3 "+hv3);
	 cast2 = dalsicast.substring(0,hv3);
	 //alert("cast2 "+cast2);
	 konecStringu2 = dalsicast.length;
	 hv4 = hv3+1;
	 cast3 = dalsicast.substring(hv4+1,konecStringu2-1);
	 
	 //alert("cast 3"+cast3);
	 //alert(stringUlice+' '+hv1+' '+cast1+' '+hv2+' '+hv3+' '+cast2+' '+konecStringu+' '+cast3);
	 
	 //return cast1,);
   //return (cast2);
	 //return (cast3);	 
	 } 
	 else
	 {
	 cast1 = stringUlice;
	 cast2 = "";
	 cast3 = "";
	 
	 //alert(stringUlice+' '+hv1+' '+cast1+' '+hv2+' '+hv3+' '+cast2+' '+konecStringu+' '+cast3);
	 //return (cast1)
	 }
}

function parseAdresa(selectino){

textbox = "<input type='text' name='ulice"+selectino+"' class='HInputD' value='' />";
var javacache1;
var javacache2;			

switch(selectino){
		case 1: javacache1 = document.forms['TabHForm'].ulice1.value; document.getElementById('selectToText1').innerHTML = textbox; parseUliceValue(javacache1); document.forms['TabHForm'].ulice1.value = cast1; document.forms['TabHForm'].obec1.value = cast3; document.forms['TabHForm'].cislo1.value = cast2; //alert(javacache1);
		break;
		case 2: javacache2 = document.forms['TabHForm'].ulice2.value; document.getElementById('selectToText2').innerHTML = textbox; parseUliceValue(javacache2); document.forms['TabHForm'].ulice2.value = cast1; document.forms['TabHForm'].obec2.value = cast3; document.forms['TabHForm'].cislo2.value = cast2; //alert(javacache2);
		break;
}

}

function parseAdresa2(selectino){

textbox = "<input type='text' name='ulice"+selectino+"' id='ulice"+selectino+"' class='HInputD' value='' />";
var javacache1;
var javacache2;			

switch(selectino){
		case 1: javacache1 = document.forms['ceniktrasi'].ulice1.value; document.getElementById('selectToText1').innerHTML = textbox; parseUliceValue(javacache1); document.forms['ceniktrasi'].ulice1.value = cast1; document.forms['ceniktrasi'].obec1.value = cast3; document.forms['ceniktrasi'].cislo1.value = cast2; //alert(javacache1);
		break;
		case 2: 
				 javacache2 = document.forms['ceniktrasi'].ulice2.value; 
				 document.getElementById('selectToText2').innerHTML = textbox; 
				 
				 parseUliceValue(javacache2); 
				 
				 //alert(cast1);
				 document.getElementById('ulice2').value = cast1;
				 //document.forms['ceniktrasi'].ulice2.value = cast1; 
				 document.forms['ceniktrasi'].obec2.value = cast3; 
				 document.forms['ceniktrasi'].cislo2.value = cast2; 
				 
				 /*alert(cast1);  */ 
				 
				 //alert(document.getElementById('selectToText2').innerHTML);
				 //alert(javacache2);
				 //alert(document.forms['ceniktrasi'].ulice2.value);
		break;
}

}

function getValue(formName,inputName){
				 return (document.forms[formName][inputName].value);
}

function putValue(formName, inputName, inputValue){
				 document.forms[formName][inputName].value = inputValue;
}

fieldsName = new Array();
inputcache1 = new Array();
inputcache2 = new Array();

function switchSide(){
				 
				 //changeImages.arguments.length
				 fieldsNameN = switchSide.arguments.length;
				 //alert(fieldsNameN);
				 for(i=0; i<fieldsNameN; i++){
				 					 //alert(arguments[i]+"1");
				 					 inputcache1[i] = getValue('TabHForm', arguments[i]+"1");
									 
									 if(IE){
    									 if(inputcache1[i].indexOf('*') != -1){ 
                      									 alert('dokoneete výbir!');
                      									 i = 10;
    									 }
									 }
									 if(NS){
									 		 if(document.forms['TabHForm'].ulice1.value.indexOf('*') != -1){ 
                      									 alert('dokoneete výbir!');
                      									 i = 10;
    									 }
									 }
									 
									 
									 inputcache2[i] = getValue('TabHForm', arguments[i]+"2");
  								 
									 if(IE){
										 if(inputcache2[i].indexOf('*') != -1){ 
  									 								alert('dokoneete výbir!');
  									 								i = 10;
  									 }
									 }
									 if(NS){
									 		 if(document.forms['TabHForm'].ulice2.value.indexOf('*') != -1){ 
                      							alert('dokoneete výbir!');
                      							i = 10;
    									 }
									 }
									 
									 //alert(inputcache2[i]);
									 putValue('TabHForm', arguments[i]+"2", inputcache1[i]);
									 putValue('TabHForm', arguments[i]+"1", inputcache2[i]);
				 }
				 
				 //alert('cau');
}


// nakonec nepouzito pouze prida jmeno a mail do poznamky2

var jmeno;
var mail;
var poznamka;


function makeNote(){
		if(IE){
				 if(document.forms['TabHForm']['jmenoruce'].value != '' || document.forms['TabHForm']['mailruce'].value != '' ){
				 						if(document.forms['TabHForm']['mailruce'].value != '') { mailString = ' m:'+document.forms['TabHForm']['mailruce'].value+'| '; } else { mailString = '| ' }
				 						if(document.forms['TabHForm']['poznamka2'].value != '' && document.forms['TabHForm']['poznamka2'].value.indexOf('|') != -1) {
											xx0 = document.forms['TabHForm']['poznamka2'].value.length;
				 		 					xx1 = document.forms['TabHForm']['poznamka2'].value.indexOf('|');
											
											xclearedNote = document.forms['TabHForm']['poznamka2'].value.substring(xx1+2,xx0);
											document.forms['TabHForm']['poznamka2'].value = xclearedNote;
										}
										miniCache = document.forms['TabHForm']['poznamka2'].value;
										document.forms['TabHForm']['poznamka2'].value = "k rukám:" + document.forms['TabHForm']['jmenoruce'].value + ' # ' + mailString + miniCache; 
				 }
				 else
				 {	 
				 		 				x0 = document.forms['TabHForm']['poznamka2'].value.length;
				 		 				x1 = document.forms['TabHForm']['poznamka2'].value.indexOf('|');
										
										clearedNote = document.forms['TabHForm']['poznamka2'].value.substring(x1+2,x0);
										
										document.forms['TabHForm']['poznamka2'].value = clearedNote; 
				 }
		 }
		
		if(NS)
		 {	
		 		
		 		//jmeno = document.getElementById('jmenoruce').value;
				//mail = document.getElementById('mailruce').value;
				//poznamka = document.getElementById('poznamka2').value;
				
				mnozstvinodu = document.forms['TabHForm'].elements.length;
				var testo = 0;
				for(c=0;c<mnozstvinodu;c++){
				
				//document.forms['TabHForm'].elements[10].value = document.getElementById('innerPevnyKont').innerHTML;
				//alert(c+" "+document.forms['TabHForm'].elements[c].name);
				
				 			if(document.forms['TabHForm'].elements[c].name == 'jmenoruce'){
									jmeno = document.forms['TabHForm'].elements[c].value;
									//alert(jmeno);
									//testo++;
							}
							if(document.forms['TabHForm'].elements[c].name == 'mailruce'){
									mail = document.forms['TabHForm'].elements[c].value;
									//alert(mail);
									//testo++;
							}
							if(document.forms['TabHForm'].elements[c].name == 'poznamka2'){
									poznamka = document.forms['TabHForm'].elements[c].value;
									//alert(poznamka);
									//testo++;
							}				
				 }
				
				 
				if(jmeno != '' || mail != ''){
								 if(document.forms['TabHForm'].poznamka2.value.indexOf('|') == -1){
								 miniCache = document.forms['TabHForm'].poznamka2.value;
								 }
								 document.forms['TabHForm'].poznamka2.value = "";
								 
								 if(mail != '') { mailString = ' m:'+mail+'| '; } else { mailString = '| ' }
								 document.forms['TabHForm'].poznamka2.value = "k rukám:" + jmeno + ' # ' + mailString + miniCache;
								 
								 //alert(poznamka+" "+mail +" "+ jmeno);
				}
				else
				{
				 				 x0 = poznamka.length;
				 		 		 x1 = poznamka.indexOf('|');
								 clearedNote = poznamka.substring(x1+2,x0);
								 poznamka = clearedNote; 
				}
				
				//alert(document.getElementById('neco').innerHTML);
		 }
}

function changeInputType(selectino){

textbox = "<input type='text' name='cislo"+selectino+"' class='HInputCislo' value='' />";

var javacache1;
var javacache2;			

switch(selectino){
		case 1: javacache1 = document.forms['TabHForm'].cislo1.value; document.getElementById('cisloselectToText1').innerHTML = textbox; document.forms['TabHForm'].cislo1.value = javacache1;//alert(javacache1);
		break;
		case 2: javacache2 = document.forms['TabHForm'].cislo2.value; document.getElementById('cisloselectToText2').innerHTML = textbox; document.forms['TabHForm'].cislo2.value = javacache2;//alert(javacache2);
		break;
}				
}

function changeInputType2(selectino){

textbox = "<input type='text' name='cislo"+selectino+"' class='HInputCislo' value='' />";

var javacache1;
var javacache2;			

switch(selectino){
		case 1: javacache1 = document.forms['ceniktrasi'].cislo1.value; document.getElementById('cisloselectToText1').innerHTML = textbox; document.forms['ceniktrasi'].cislo1.value = javacache1;//alert(javacache1);
		break;
		case 2: javacache2 = document.forms['ceniktrasi'].cislo2.value; document.getElementById('cisloselectToText2').innerHTML = textbox; document.forms['ceniktrasi'].cislo2.value = javacache2;//alert(javacache2);
		break;
}				
}

function showcentrum(what) {
	if(what == true) {
		document.getElementById('ceniktab').innerHTML = '';
		document.getElementById('ceniktab').innerHTML = table[1];
		document.getElementById('centrumval').value = true;
		document.getElementById('centrum').className = 'centrumShow';
		//document.getElementById('praha').className = 'centrumHidde';
	}
	if(what == false) {
		document.getElementById('ceniktab').innerHTML = '';
		document.getElementById('ceniktab').innerHTML = table[0];
	  document.getElementById('centrumval').value = false;
		//document.getElementById('centrum').className = 'centrumHidde';
		document.getElementById('praha').className = 'centrumShow';
	}

recoverTable();

}

function resetForced(formName){
				 			
				 mnozstvinodu = document.forms[formName].elements.length;
				 //alert(mnozstvinodu);
				 
				 for(c=0;c<mnozstvinodu;c++){
				 			document.forms[formName].elements[c].value = ''
							document.forms[formName].elements[c].disabled=false;
				 }
}

var promitacka;

function vysvetluj(which){
				 if(which == 'boss') which = 0;
				 if(which == 'fakturace') which = 1;
				 if(which == 'produkce') which = 2;
				 if(which == 'recepce a') which = 3;
				 if(which == 'recepce b') which = 4;
				 
				 
				 if(which == 0) {
				 					text = "<ul><li>objednávání</li><li>vyhledávání všech objednávek</li><li>změna dat klienta</li><li>zadávání uživatelů a přidělování oprávnění</li><li>poehled faktur za služby</li></ul>";
				 }
				 
				 if(which == 1) {
				 					text = "<ul><li>vyhledávání všech objednávek</li><li>změna dat klienta</li><li>přehled faktur za služby</li></ul>";
				 }
				 
				 if(which == 2) {
				 					text = "<ul><li>objednávání</li><li>vyhledávání objednávek zadaných uživatelů</li><li>zadávání uživatelů recepce a vrátnice</li></ul>";
				 }
				 
				 if(which == 3) {
				 					text = "<ul><li>objednávání</li><li>vyhledávání vlastních objednávek</li></ul>";
				 }
				 
				 if(which == 4) {
				 					text = "<ul><li>vyhledávání objednávek dne</li><li>sledováni všech aktivních objednávek</li></ul>";
				 }
				 
				 document.getElementById('promitacka').innerHTML = "";
				 document.getElementById('promitacka').innerHTML = text;
}

var passstav;

function checkpass(pass1,pass2){
//alert('chekpass');
	heslo1 = document.getElementById(pass1).value;
	heslo2 = document.getElementById(pass2).value;

	if(heslo1 == heslo2 && heslo1 != ''){
		passstav = true;
		
	}
	else
	{
		passstav = false;

if(document.getElementById(pass1).currentStyle){
			        document.getElementById(pass1).style.backgroundColor = 'red';
           document.getElementById(pass2).style.backgroundColor = 'red';
   }
else
  {
//alert('cervena')
          document.getElementById(pass1).style.setProperty("background-color", "red",null) ;
          document.getElementById(pass2).style.setProperty("background-color", "red",null) ;
  }

	}
	
	return passstav;
}


function checkobjednavajici(){
	
	var inputsobj = true;
	if(checkobjednavajici.arguments[0] == "klient" && !document.getElementById(checkobjednavajici.arguments[1])){
						document.KlientRegistrovat.submit();
	}
	inputslength = checkobjednavajici.arguments.length
//	alert(inputslength);	
	
	for(obj = 1; obj < inputslength; obj++){
      //alert(obj);
          //document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
          //alert(arguments[obj]+' = '+document.getElementById(checkobjednavajici.arguments[obj]).value);
		if(checkobjednavajici.arguments[obj] != "add"){
          if(document.getElementById(checkobjednavajici.arguments[obj]).value == ''){
													if(checkobjednavajici.arguments[obj] == "prava"){ alert('nemužet poidat uživatele s oprávniním boss'); }
             if(document.getElementById(checkobjednavajici.arguments[obj]).currentStyle){
          			    document.getElementById(checkobjednavajici.arguments[obj]).style.backgroundColor = 'red';
										
             }
          	 else
             {
          //alert('cervena1')
                    document.getElementById(checkobjednavajici.arguments[obj]).style.setProperty("background-color", "red",null) ;
             }
          			inputsobj = false;
          }
          else
          {
           		if(document.getElementById(checkobjednavajici.arguments[obj]).currentStyle){
          			        document.getElementById(checkobjednavajici.arguments[obj]).style.backgroundColor = '#a1a1a1';
             	}
          		else
              {
          //alert('seda')
                        document.getElementById(checkobjednavajici.arguments[obj]).style.setProperty("background-color", "silver",null) ;
              }
          }
      }
	}
	
	if(checkpass(checkobjednavajici.arguments[1], checkobjednavajici.arguments[2])){
			//alert('checkpass = true');
			//alert('inputsobj'+inputsobj);
			if(inputsobj == false){
				alert('Nevyplnily jste povinnné pole!');
			}
			else
			{ 
				if(checkobjednavajici.arguments[0]=="objednavajici" && checkobjednavajici.arguments[9]=="add"){
											//alert(document.forms[1].action);
											document.forms[1].action='index.php?page=orp&action=add_user';
											//alert(document.forms[1].action);
											//document.forms[1].action='index.php?page=orp&action=add_user';
											//document.TabVForm.action='index.php?page=orp&action=del_user
											document.TabHFormVyhledavani.submit();
    			}
    			if(checkobjednavajici.arguments[0]=="objednavajici" && checkobjednavajici.arguments[9] != "add"){
    									//alert('submit');
											document.forms[1].action='index.php?page=orp&action=edit_user';
											//document.TabVForm.action='index.php?page=orp&action=del_user
											document.TabHFormVyhledavani.submit();
    			}
					if(checkobjednavajici.arguments[0]=="klient"){
    									potvrditklient();
											//document.KlientRegistrovat.submit();
    			}
			}
	 }
	 else
	 {
	 	alert('Prosím, vyplote správné heslo!');
	 }
	
}

function changebutonstoed(which){
				 document.getElementById('changedbut').innerHTML = buttonstoed[which];
}






function potvrditklient() {
potvrdit = confirm("souhlasím s obchodními podmínkami"); 
  if (potvrdit == true){
  	 alert("Vaše registrace probihla úspišni"); 
		 document.KlientRegistrovat.submit();
  }else
	
  if (potvrdit == false){
  	 alert("Vaše registrace nemohla být dokoneena!");
  }
}

var idcache = null;
var idcache2 = null;
var roatedID = null;
var roatedID2 = null;


function idtranslate(id){
				 switch(id){
    				 case 'PS1': return 1  
    				 break;
    				 
    				 case 'PS2': return 2  
    				 break;
    				 
    				 case 'PS3': return 3  
    				 break;
    				 
    				 case 'PS4': return 4  
    				 break;
    				 
    				 case 'PS5': return 5  
    				 break;
						 
						 //volume
						 case 'PV1': return 1  
    				 break;
						 
						 case 'PV2': return 2  
    				 break;
						 
						 case 'PV3': return 3  
    				 break;
						 
						 case 'PV4': return 4  
    				 break;
						 
						 case 'PV5': return 5  
    				 break;
				 }
}

function pushcenikoptions(typ,kol,id){
				 //document.getElementById('msg').innerHTML = 'id = '+id+' |<br>';
				 //document.getElementById('msg').innerHTML += 'idcache = '+idcache+' |<br>';
				 //document.getElementById('msg').innerHTML += 'idcache2 = '+idcache2+' |<br>';
				 //document.getElementById('msg').innerHTML += 'roatedID = '+roatedID+' |<br>';
				 //document.getElementById('msg').innerHTML += 'roatedID2 = '+roatedID2+' |<br>';
				 
if(block != false){
				 
				 if(typ == 'speed'){
					 document.getElementById('rychlostcoo').value = id;
				 				if(idtranslate(idcache2) > 3 && idtranslate(id) <= 3){
												//alert('Tato kombinace rychlosti a zpusobu poepravy není možná.');
												//alert(idcache);
												
												if(idcache2 != null && idcache != null){
																			 		 //alert(makerouteintable(idtranslate(idcache),idtranslate(idcache2))+' '+idtranslate(idcache)+ ' ' + idtranslate(idcache2))
																					 
																					 roatedID = 'b'+makerouteintable(idtranslate(idcache),idtranslate(idcache2));
																					 color = '#E6E6E6';
																}
																else
																{
																 					 roatedID = null;
																					 color = null;
																}
												
												if (idcache2 != null) { 
													 			 if(idcache != null) colorjogglingcenik(idcache,'#FEE600',color,roatedID);
																 colorjogglingcenik(idcache2,'#FEE600',color,roatedID);
																 idcache2 = null;
																 idcache = null;
																 
																 colorjogglingcenik(id,'red',null,null);
																 //idcache = id;
												}
												else
												{
												 				 	colorjogglingcenik(idcache,'#FEE600',null,null);
																  idcache2 = null;
																	idcache = null;
																	
																  colorjogglingcenik(id,'red',null,null);
																	//idcache = id;
												 					//alert('1');
												}
												
								}
								if(idtranslate(idcache2) <= 3 && idtranslate(id) > 3){
												//alert('Tato kombinace rychlosti a zpusobu poepravy není možná.');
												if(idcache2 != null){
																					 roatedID = 'b'+makerouteintable(idtranslate(idcache),idtranslate(idcache2));
																					 color = '#E6E6E6';
																}
																else
																{
																 					 roatedID = null;
																					 color = null;
																}
																
												
												
												if(idcache != null) { 
																 colorjogglingcenik(idcache,'#FEE600',color,roatedID);
												   			 colorjogglingcenik(idcache2,'#FEE600',color,roatedID);
																 idcache2 = null;
																 idcache = null;
																 
																 colorjogglingcenik(id,'red',null,null);
																 //idcache = id;
												}
												else
												{
												 				 colorjogglingcenik(idcache2,'#FEE600',null,null);
																 idcache2 = null;
																 idcache = null;
																 
																 colorjogglingcenik(id,'red',null,null);
																 //idcache = id;
												 				 //alert('2');
												}
								}
								
				 				if(idcache == null){
												if(idcache2 != null){
																					 roatedID = 'b'+makerouteintable(idtranslate(id),idtranslate(idcache2));
																}
																else
																{
																 					 roatedID = null;
																}
												colorjogglingcenik(id,'red',null,roatedID);
												
												idcache = id;
												
								 }
								 else
								 {
								 		 		 if(id == idcache){
      								 		 	    if(idcache2 != null){
																					 roatedID = 'b'+makerouteintable(idtranslate(id),idtranslate(idcache2));
																}
																else
																{
																 					 roatedID = null;
																}
																
																colorjogglingcenik(id,'#FEE600','#E6E6E6',roatedID);
																
																idcache = null; 
																id = null;
															
												  }
													if(id != idcache){
																if(idcache2 != null){
																//alert('1jakto!');
																					 roatedID1 = 'b'+makerouteintable(idtranslate(idcache),idtranslate(idcache2));
																					 color = '#E6E6E6';
																}
																else
																{
																//alert('1tady!');
																 					 roatedID1 = null;
																					 color = null;
																}
																
																colorjogglingcenik(idcache,'#FEE600',color,roatedID1);
																idcache = id;
																
																if(idcache2 != null){
																//alert('2jakto!');
																					 roatedID2 = 'b'+makerouteintable(idtranslate(id),idtranslate(idcache2));
																}
																else
																{
																//alert('2tady!');
																 					 roatedID2 = null;
																}
																
																colorjogglingcenik(id,'red',null,roatedID2);
																idcache = id;
												  }
								 }
								 
					}
					
					if(typ == 'volume'){
						 document.getElementById('velikostcoo').value = id;
								if(idtranslate(idcache) > 3 && idtranslate(id) <= 3){
												//alert('Tato kombinace rychlosti a zpusobu poepravy není možná.');
												if(idcache2 != null){
																					 roatedID = 'b'+makerouteintable(idtranslate(idcache),idtranslate(idcache2));
																					 color = '#E6E6E6';
																}
																else
																{
																 					 roatedID = null;
																					 color = null;
																}
												
												if(idcache2 != null && idcache != null) { 
																		colorjogglingcenik(idcache2,'#FEE600',color,roatedID);
																		colorjogglingcenik(idcache,'#FEE600',color,roatedID);
																		idcache = null;
																		idcache2 = null;
																		
																		colorjogglingcenik(id,'red',null,null);
																		//idcache2 = id;
												}
												else
												{
												 						colorjogglingcenik(idcache,'#FEE600',null,null);
																		idcache = null;
																		idcache2 = null;
																		
																		colorjogglingcenik(id,'red',null,null);
																		//idcache2 = id;
												 				 		//alert('3');
												}
								}
								if(idtranslate(idcache) <= 3 && idtranslate(id) > 3){
												if(idcache2 != null){
																					 roatedID = 'b'+makerouteintable(idtranslate(idcache),idtranslate(idcache2));
																					 //alert('kontrola1');
																}
																else
																{
																 					 roatedID = null;
																}
																
												
												if(idcache2 != null) { 
																		//alert('kontrola2');
																		colorjogglingcenik(idcache2,'#FEE600','#E6E6E6',roatedID);
																		colorjogglingcenik(idcache,'#FEE600','#E6E6E6',roatedID);
																		idcache = null;
																		idcache2 = null;
																		
																		colorjogglingcenik(id,'red',null,null);
																		//idcache2 = id;
												}
												else
												{
												 						colorjogglingcenik(idcache,'#FEE600',null,null);
																		idcache = null;
																		idcache2 = null;
																		
																		colorjogglingcenik(id,'red',null,null);
																		//idcache2 = id;
												 						//alert('4');
												}
												
								}
								
				 				if(idcache2 == null){
												if(idcache != null){
																		roatedID = 'b'+makerouteintable(idtranslate(idcache),idtranslate(id));
																}
																else
																{
																 		roatedID = null;
																}
												
												
												colorjogglingcenik(id,'red',null,roatedID);
												
												idcache2 = id;
								 }
								 else
								 {
						 		 	      if(id == idcache2){
																if(idcache != null){
																		roatedID = 'b'+makerouteintable(idtranslate(idcache),idtranslate(id));
																}
																else
																{
																 		roatedID = null;
																}
																
												colorjogglingcenik(id,'#FEE600','#E6E6E6',roatedID);
																
												idcache2 = null; 
												id = null;
												
														
												  }
													if(id != idcache2){
																
																if(idcache != null){
																//alert('jakto!');
																					 roatedID1 = 'b'+makerouteintable(idtranslate(idcache),idtranslate(idcache2));
																					 color = '#E6E6E6';
																}
																else
																{
																//alert('tady!');
																 					 roatedID1 = null;
																					 color = null;
																}
																
																colorjogglingcenik(idcache2,'#FEE600',color,roatedID1);
																idcache2 = id;
																
																if(idcache != ''){
																//alert('jakto!');
																					 roatedID2 = 'b'+makerouteintable(idtranslate(idcache),idtranslate(id));
																}
																else
																{
																//alert('tady!');
																 					 roatedID2 = null;
																}
																
																colorjogglingcenik(id,'#FF0000',null,roatedID2);
																
												  }
												
								 }
								 
					}
		}
		else
		{
		document.getElementById('msg').innerHTML = 'V editacnim režimu nemužete zadavat velikost a rychlost.';
		}
}

function colorjogglingcenik(id,color1,color2,roatedID){
//alert(id+' | '+color1+' | '+color2+' | '+roatedID)
				 												if(document.getElementById(id).currentStyle){
      																	document.getElementById(id).style.backgroundColor = color1;
																				
																				if(color2 != null) { colorX = color2; }  else { colorX = color1; }
																				if(roatedID != null) document.getElementById(roatedID).style.backgroundColor = colorX;
                                }
                                else
                                {
      																	document.getElementById(id).style.setProperty("background-color", color1, null);
																				
																				if(color2 != null) { colorX = color2; } else { colorX = color1; }
																				if(roatedID != null) document.getElementById(roatedID).style.setProperty("background-color", colorX, null);
                                }
}

function pushvalue(id,value){
				 document.getElementById(id).value = value;
}

function makerouteintable(x,y){
	//alert(x);
	//alert(y);
				  if(x == 1 && y == 1){ pushvalue('rychlost','obyc'); pushvalue('velikost','B'); return 1; }
					if(x == 2 && y == 1){ pushvalue('rychlost','expres'); pushvalue('velikost','B');return 2; }
					if(x == 3 && y == 1){  pushvalue('rychlost','vip'); pushvalue('velikost','B'); return 3; }
					
					if(x == 1 && y == 2){  pushvalue('rychlost','obyc'); pushvalue('velikost','A'); return 4; }
					if(x == 2 && y == 2){  pushvalue('rychlost','expres'); pushvalue('velikost','A'); return 5; }
					if(x == 3 && y == 2){  pushvalue('rychlost','vip'); pushvalue('velikost','A'); return 6; }
					
					if(x == 1 && y == 3){  pushvalue('rychlost','obyc'); pushvalue('velikost','P'); return 7; }
					if(x == 2 && y == 3){  pushvalue('rychlost','expres'); pushvalue('velikost','P'); return 8; }
					if(x == 3 && y == 3){ document.getElementById('msg').innerHTML = 'Tato kombinace není možná.'; return 9;  /*clearSpeedTable();  return null; */ }
					
					if(x == 4 && y == 4){ document.getElementById('msg').innerHTML = 'Tato kombinace není možná.'; pushvalue('rychlost','obyc'); pushvalue('velikost','MMA'); return 17; }
					if(x == 5 && y == 4){ document.getElementById('msg').innerHTML = 'Tato kombinace není možná.'; pushvalue('rychlost','expres'); pushvalue('velikost','MMB'); return 18; }
					if(x == 5 && y == 5){  pushvalue('rychlost','expres'); pushvalue('velikost','OSA'); return 19; }
					if(x == 4 && y == 5){ document.getElementById('msg').innerHTML = 'Tato kombinace není možná.'; return 20;  /*clearSpeedTable();  return null; */ }
					
}


function replaceSubstring(inputString, fromString, toString) {
   // Goes through the inputString and replaces every occurrence of fromString with toString
   var temp = inputString;
   if (fromString == "") {
      return inputString;
   }
   if (toString.indexOf(fromString) == -1) { // If the string being replaced is not a part of the replacement string (normal situation)
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } else { // String being replaced is part of replacement string (like "+" being replaced with "++") - prevent an infinite loop
      var midStrings = new Array("~", "`", "_", "^", "#");
      var midStringLen = 1;
      var midString = "";
      // Find a string that doesn't exist in the inputString to be used
      // as an "inbetween" string
      while (midString == "") {
         for (var i=0; i < midStrings.length; i++) {
            var tempMidString = "";
            for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
            if (fromString.indexOf(tempMidString) == -1) {
               midString = tempMidString;
               i = midStrings.length + 1;
            }
         }
      } // Keep on going until we build an "inbetween" string that doesn't exist
      // Now go through and do two replaces - first, replace the "fromString" with the "inbetween" string
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + midString + toTheRight;
      }
      // Next, replace the "inbetween" string with the "toString"
      while (temp.indexOf(midString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(midString));
         var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } // Ends the check to see if the string being replaced is part of the replacement string or not
   return temp; // Send the updated string back to the user
} // Ends the "replaceSubstring" function




function round(num) {
//alert(num);
if(isNaN(num)) num = 0;
amount = Math.round(num*Math.pow(10,2))/Math.pow(10,2);
amount -= 0;
// .99 cent format courtsey of Martin Webb
myString = (amount == Math.floor(amount)) ? amount + ',00' : ( (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
results = myString; //replaceSubstring(myString, ".", ",");
return results;
}

function enablePriplatky(){
				 //alert(enablePriplatky.arguments[0]);
				 if(enablePriplatky.arguments[0]) {
				 						priplatkyStore = enablePriplatky.arguments;
				 }
				 else
				 {
				 		 				priplatkyStore =  new Array('dojezd', 'cekani', 'potvrddoruc', 'dovlastnich', 'nocvyk', 'dodatek', 'poznamka', 'zpet');
				 }
				 
				 x = priplatkyStore.length;
				 
				 for(id=0; id<x; id++){
				 					first = false;
				 					priplatkycore(priplatkyStore[id]);
				 }	
				 recoverPriplatky();
}




var idcacheP;
function colormark(id){
    if(id != idcacheP) {
    colorpriplatky(id,'red');
    idcacheP = id;
    }
}



var first = false;
var block;
var a1 = 0;
var a2 = 0;
var b2 = 0;
//var c2 = 0;
var a3 = 0;
var b3 = 0;
var a4 = 0;
var b4 = 0;
var a5 = 0;
var b5 = 0;
var a6 = 0;
var b6 = 0;
var a7 = 0;
var b7 = 0;
var a8 = 0;
var b8 = 0;
var a9 = 0;
var b9 = 0;
var hlaska = '';
var hlaska2 = '';
var hlaska3 = '';
var hlaska4 = '';
var hlaska5 = '';
var rucemsg;
var poznamkamsg;
var priplatkypole = new Array();

function recoverPriplatky(){
				 if(get_cookie('dojezd') > 0 && !isNaN(get_cookie('dojezd')) ) { 
				 		a1 = (get_cookie('dojezd')-1); 
						priplatkycore('dojezd'); 
						//alert(get_cookie('dojezd'));
				 }
				 
				 if(get_cookie('cekani') > 0 && !isNaN(get_cookie('cekani')) ) { 
				 		a2 = (get_cookie('cekani')-10); 
						priplatkycore('cekani'); 
						//alert(get_cookie('cekani'));
						}
				 
				 if(get_cookie('potvrddoruc') > 0) priplatkycore('potvrddoruc');
				 if(get_cookie('dovlastnich') > 0) priplatkycore('dovlastnich');
				 if(get_cookie('nocvyk') > 0) priplatkycore('nocvyk');
				 if(get_cookie('zpet') > 0) priplatkycore('zpet');
}

function savePriplatky(){
		xz = priplatkypole.length;
		//alert(xz);
		for(n=0; n<xz; n += 2){
				 //alert(priplatkypole[n]);
				 //alert(priplatkypole[n+1]);
				 
				 ulozKukinu(priplatkypole[n], priplatkypole[n+1]);
		}				 
}

function priplatkycore(id){
			//alert(id);
			//alert(block);
      if(id == 'dojezd') {
						priplatkypole[0] = id;
						b1 = parseInt(document.getElementById('dojezdP').value);
						//a1 = parseInt(a1);
         		if(block != false){
						if(first != false) { a1 +=1; priplatkypole[1] = a1; if(a1 > 3) { a1 = 0; priplatkypole[1] = a1; colorpriplatky(id,'#E6E6E6'); } else { colorpriplatky(id,'#FF0000'); } }
						
						document.getElementById('dojezdV').value = round(parseFloat(a1*b1));
         		document.getElementById(id+'text').innerHTML = a1+'x '+document.getElementById('dojezdV').value+'&nbsp;';
						}
						else
						{
						document.getElementById(id+'text').innerHTML = document.getElementById('dojezdV').value+'&nbsp;';
						}
      }
      
      if(id == 'cekani') {
		  				priplatkypole[2] = id;
						//alert(a2);
						b2 = parseInt(document.getElementById('cekaniP').value);
      	 		//alert(a2);
						//alert(first);
						if(block != false){
						if(first != false) { a2 +=10; priplatkypole[3] = a2; if(a2 > 60) { a2 = 0; priplatkypole[3] = a2; colorpriplatky(id,'#E6E6E6'); } else { colorpriplatky(id,'#FF0000'); } }
						//alert(a2);
						a7 = a2*b2;
						if(a7 > 0) a7 = parseFloat(a7)-30;
						//alert(c2);
						document.getElementById('cekaniV').value = round(parseFloat(a7));
						//alert(c2);
      	 				document.getElementById(id+'text').innerHTML = a2+'m '+document.getElementById('cekaniV').value+'&nbsp;';
						}
						else
						{
						document.getElementById(id+'text').innerHTML = document.getElementById('cekaniV').value+'&nbsp;';
						}
						
      }
      
      if(id == 'potvrddoruc') {
		  				priplatkypole[4] = id;
						b3 = parseInt(document.getElementById('potvrddorucP').value);
      	 		
						if(block != false){
						if(first != false) { a3 +=1; if(a3 > 1) { a3 = 0; hlaska = ''; priplatkypole[5] = 0;  colorpriplatky(id,'#E6E6E6'); } else { hlaska = 'ano'; priplatkypole[5] = 1; colorpriplatky(id,'#FF0000'); } }
						
						//a3 +=1;
						document.getElementById('potvrddorucV').value = round(parseFloat(b3));
      	 				document.getElementById(id+'text').innerHTML = hlaska+' '+document.getElementById('potvrddorucV').value+'&nbsp;';
						
						}
						else
						{
						document.getElementById(id+'text').innerHTML = document.getElementById('potvrddorucV').value+'&nbsp;';
						}
      }
      
      if(id == 'dovlastnich') {
		  				priplatkypole[6] = id;
						b4 = parseInt(document.getElementById('dovlastnichV').value);
      			if(block != false){
						if(first != false) { a4 +=1; if(a4 > 1) { a4 = 0; hlaska2 = ''; priplatkypole[7] = 0; colorpriplatky(id,'#E6E6E6'); } else { hlaska2 = 'ano'; priplatkypole[7] = 1; colorpriplatky(id,'#FF0000'); } }
						
						document.getElementById('dovlastnichV').value = round(parseFloat(b4));
						if(rucemsg != "") document.getElementById('rucezmena').innerHTML = '&nbsp;&nbsp;<a href="javascript: alert(rucemsg);">do vlastních rukou</a>';
      					document.getElementById(id+'text').innerHTML = hlaska2+' '+document.getElementById('dovlastnichV').value+'&nbsp;';
						
						}
						else
						{
						document.getElementById('rucezmena').innerHTML = '<a href="javascript: alert(rucemsg);">do vlastních rukou</a>&nbsp;';
						document.getElementById(id+'text').innerHTML = document.getElementById('dovlastnichV').value+'&nbsp;';
						
						}
      }
      
      if(id == 'nocvyk') {
		  				priplatkypole[8] = id;
						b5 = parseInt(document.getElementById('nocvykV').value);
      			//a5 +=1;
						document.getElementById('nocvykV').value = false;
						//if(first==false) a5 = a5-1;
						if(block != false){
						if(first != false) { a5 +=1; if(a5 > 1) { a5 = 0; hlaska3 = ''; priplatkypole[9] = 0; colorpriplatky(id,'#E6E6E6'); document.getElementById('nocvykV').value = false; } else { hlaska3 = 'ano'; priplatkypole[9] = 1; colorpriplatky(id,'#FF0000'); document.getElementById('nocvykV').value = true; } }
						//document.getElementById('nocvykV').value = round(parseFloat(a5));
						if(block != false) { procenta = '%'; } else { procenta = ''; }
						
      			document.getElementById(id+'text').innerHTML = hlaska3+' '+document.getElementById('nocvykP').value+procenta+'&nbsp;';
						}
						else
						{
						document.getElementById(id+'text').innerHTML = document.getElementById('nocvykV').value+'&nbsp;';
						}
      }
      
      if(id == 'dodatek') {
						//a6 = parseInt(document.getElementById('dodatekV').value);
      			//a6 +=1;
						//if(first==false) a6 = a6-1;
						if(block != false){
						document.getElementById('dodatekV').value = round(parseFloat(document.getElementById('dodatekV').value));
      			document.getElementById(id+'text').innerHTML = document.getElementById('dodatekV').value+'&nbsp;';
						}
						else
						{
						document.getElementById(id+'text').innerHTML = document.getElementById('dodatekV').value+'&nbsp;';
						}
      }
      
      if(id == 'poznamka') {
						//a7 = parseInt(document.getElementById('poznamkaV').value);
      			//a7 +=1;
						//if(first==false) a7 = a7-1;
						if(first == true) alert(poznamkamsg);
						if(block != false){
						if(poznamkamsg != "") document.getElementById('poznamkazmena').innerHTML = '&nbsp;&nbsp;<a href="javascript: alert(poznamkamsg);">poznamka</a>';
						document.getElementById('poznamkaV').value = round(parseFloat(document.getElementById('poznamkaV').value));
      					document.getElementById(id+'text').innerHTML = document.getElementById('poznamkaV').value+'&nbsp;';
						}
						else
						{
						
						document.getElementById(id+'text').innerHTML = document.getElementById('poznamkaV').value+'&nbsp;';
						}
      }
      
      if(id == 'zpet') {
		  				priplatkypole[10] = id;
						b8 = parseInt(document.getElementById('zpetV').value);
      			//a8 +=1;
						//if(first==false) a8 = a8-1;
						if(block != false){
						if(first != false) { a8 +=1; if(a8 > 1) { a8 = 0; priplatkypole[11] = 0; hlaska4 = ''; colorpriplatky(id,'#E6E6E6'); } else { hlaska4 = 'ano'; priplatkypole[11] = 1; colorpriplatky(id,'#FF0000'); } }
						//document.getElementById('zpetV').value = round(parseFloat(a8));
						if(block != false) { procenta = '%'; } else { procenta = ''; }
      			document.getElementById(id+'text').innerHTML = hlaska4+' '+document.getElementById('zpetP').value+procenta+'&nbsp;';
						}
						else
						{
						 document.getElementById(id+'text').innerHTML = document.getElementById('zpetV').value+'&nbsp;';
						}
      }
			first = true;
			
//document.getElementById('msg').innerHTML = 'a8 '+a8+'<br>';
//document.getElementById('msg').innerHTML += 'a5 '+a5+'<br>';
//document.getElementById('msg').innerHTML += 'first '+first;
}

function colorpriplatky(id,color){
//alert(color);
//alert(document.getElementById(id).currentStyle);

if(document.getElementById(id).currentStyle){
//																						 alert(id);
			if(document.getElementById(id+'3')){
			 document.getElementById(id+'3').style.backgroundColor = color;
			}
			document.getElementById(id+'2').style.backgroundColor = color;
  }
  else
  {
   		document.getElementById(id).style.setProperty("background-color", color, null);
  }
//alert(document.getElementById(id).style.backgroundColor);
}


function clearSpeedTable(){
				 var mynoderoute1 = new Array('1','2','3','4','5','6','7','8','17','18','19');
				 var priplatkyroute = new Array('zpet','poznamka','dodatek','nocvyk','dovlastnich','dovlastnich','potvrddoruc','cekani','dojezd');
				 
				 //faze 1
				 var maxnodenum = 6;
				 for(x=1; x<maxnodenum;x++){
				 					colorjogglingcenik('PS'+x,'#FEE600',null,null);
									colorjogglingcenik('PV'+x,'#FEE600',null,null);
				 }
				 
				 //faze 2
				 var maxnode2num = mynoderoute1.length;
				 for(z=0 ; z<maxnode2num ; z++){
				 				 colorjogglingcenik('b'+mynoderoute1[z],'#e6e6e6',null,null);
				 }
				 
				 //faze 3
				 var maxnode3num = priplatkyroute.length;
				 for(y=0 ; y<maxnode3num ; y++){
				 				 colorjogglingcenik(priplatkyroute[y],'#e6e6e6',null,null);
								 splitIt('a'+y);
								 splitIt('b'+y);
				 }
				 
				 //ulice 2 hack
				 document.getElementById('ulice2').value = '';
				 
				 ulozKukinu('rychlost', 'null'); 
				 ulozKukinu('velikost', 'null'); 
				 
				 document.getElementById('rychlostcoo').value = null;
				 document.getElementById('velikostcoo').value = null;
				 
				 resetForced('ceniktrasi');
				 enablePriplatky();
}


function splitIt(vari){
				 vari = '';
}

					

function recoverTable(){
	//alert(document.cookie)
	if(get_cookie('rychlost_t') != '') pushcenikoptions('speed','', get_cookie('rychlost_t')); 
	if(get_cookie('velikost_t') != '') pushcenikoptions('volume','', get_cookie('velikost_t'));
}

					

function reset_rows(rx) {
		for(r=1;r<=rx;r++){
			document.getElementById('TabVN'+r).className = 'TabVNout';
		}
}




	
/*

/etc/postgresql stop
pak to prekopirujes (nejlepe celej /var/)
/etc/postgresql start


klasika jako vsude, rychlost(obyc,expres,vip) velikost(A,B,P)

*/	
