﻿eval("try {document.execCommand('BackgroundImageCache', false, true);} catch(e) {}");

/**
 * DU - Debug Utils
 * @property {Boolean} debug Debugging on/off
 * @property {String} outputType Output type (alert, console.log etc)
 * @example
 * du.echo("Log this to defautt output"); // default output used
 * @example
 * du.echo("Log this message to 'alert' output", "alert");
 */
var du = {
    /* setup */
     debug : true,
     outputType:  "console",
    /* wrapper function */
     echo : function(str, output) {
        outputType =  (typeof output == 'undefined') ? this.outputType : output;
        if(this.debug) {
            this[outputType](str);
        }
     },
    /* custom output methods */
     alert : function(str) {
         alert(str);
     },
     console : function(str) {
        if (window.console && window.console.firebug) {
            console.log(str);
        }
     }
};

jQuery(window).load(function () {

	/**
	 * Record page load time using Google Analytics event
	 * (Object created in HTML page head <script>.)
	 * @property {String} pageid String containing page id + lang (e.g. 'p.www.1|cs')
	 * @property {Integer} start Time in miliseconds when page header is rendered
	 * @property {Integer} stop Time in miliseconds when page is loaded (via $.load)
	 * @property {Integer} diff Time difference between start and stop time
	 * @property {Object} watchedPages Object containing pages to be watched as JSON keys
	 */

	(function() {
		if (typeof pageLoadWatch == "object") {
			pageLoadWatch.watchedPages = { "p.bg2.1|bg":1, "p.bg2.1|en":1 };
			if ( pageLoadWatch.pageid in pageLoadWatch.watchedPages ) {
				pageLoadWatch.stop = new Date().getTime();
				pageLoadWatch.diff = (pageLoadWatch.stop - pageLoadWatch.start);
				du.echo("Page "+pageLoadWatch.pageid+" loaded in cca "+Math.ceil( pageLoadWatch.diff / 1000 )+" seconds. / Exact milis: " + pageLoadWatch.diff );
	 			_gaq.push(['_trackEvent', 'Page Load Time', (Math.ceil( pageLoadWatch.diff / 1000 ))+' s', pageLoadWatch.pageid, pageLoadWatch.diff]);			
			}
		}
	})();

});	  

/***** cookie CRUD functions *****/
// more at http://www.quirksmode.org/js/cookies.html

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


/***********************************************************/

function vytisknoutstranku(tisknout)
{
	document.write('<a href="#" id="print" onclick="window.print();return false;">'+tisknout+'</a></a> <span class="hidden"> | </span>'); 
};

/* vyskakovaci okno (pouzite napr. pro napovedu v Pece a podpora  > Kalkulacky  > Vyber optimalniho tarifu */
function helpWindow(url, windowName, windowWidth, windowHeight) {
	if (windowWidth == undefined) {
        windowWidth = 650;
    }
    if (windowHeight == undefined) {
        windowHeight = 450;
    }
    
    var params = "width=" + windowWidth + ",height=" + windowHeight + ",resizable=1,left=10,top=100";
    return !window.open(url, windowName, params);
}

/* vyskakovaci okno pro soutezni pravidla */
function helpWindow_souteze(url, windowName) {
	return !window.open(url, windowName, "width=700,height=560,scrollbars=yes,menubar=no,resizable=yes,left=10,top=100");	
} 
 
 
/********************************************************/


jQuery.noConflict();

jQuery(document).ready( /* jQuery no conflict block */
	function($) {

    $("#chbox4-08").click(function() { 
        isChecked = $(this).is(':checked');
        if ( isChecked ) {
          $(".hidden-question").hide();
          $("#chbox4-01").attr("checked","");
   	      $("#chbox4-02").attr("checked","");
          $("#chbox4-03").attr("checked","");
          $("#chbox4-04").attr("checked","");
          $("#chbox4-05").attr("checked","");
          $("#chbox4-06").attr("checked","");
          $("#chbox4-07").attr("checked","");
          setTimeout ( 'jQuery("#stin-end").hide();jQuery("#stin-end").show();', 1000 );
          } else {
          $(".hidden-question").show();
          setTimeout ( 'jQuery("#stin-end").hide();jQuery("#stin-end").show();', 1000 );          	
        };
    });

    $("#chbox5-13").click(function() { 
        isChecked = $(this).is(':checked');
        if ( isChecked ) {
          $(".hidden-question2").hide();
          $("#chbox5-01").attr("checked","");
   	      $("#chbox5-02").attr("checked","");
          $("#chbox5-03").attr("checked","");
          $("#chbox5-04").attr("checked","");
          $("#chbox5-05").attr("checked","");
          $("#chbox5-06").attr("checked","");
          $("#chbox5-07").attr("checked","");
          $("#chbox5-08").attr("checked","");
   	      $("#chbox5-09").attr("checked","");
          $("#chbox5-10").attr("checked","");
          $("#chbox5-11").attr("checked","");
          $("#chbox5-12").attr("checked","");
          setTimeout ( 'jQuery("#stin-end").hide();jQuery("#stin-end").show();', 1000 );
        } else {
          $(".hidden-question2").show();
          setTimeout ( 'jQuery("#stin-end").hide();jQuery("#stin-end").show();', 1000 );	
        };
    });	
	
    $("#chbox6-11").click(function() { 
        isChecked = $(this).is(':checked');
        if ( isChecked ) {
          $(".hidden-question3").hide();
          $("#chbox6-01").attr("checked","");
   	      $("#chbox6-02").attr("checked","");
          $("#chbox6-03").attr("checked","");
          $("#chbox6-04").attr("checked","");
          $("#chbox6-05").attr("checked","");
          $("#chbox6-06").attr("checked","");
          $("#chbox6-07").attr("checked","");
          $("#chbox6-08").attr("checked","");
   	      $("#chbox6-09").attr("checked","");
          $("#chbox6-10").attr("checked","");
          setTimeout ( 'jQuery("#stin-end").hide();jQuery("#stin-end").show();', 1000 );
        } else {
          $(".hidden-question3").show();
          setTimeout ( 'jQuery("#stin-end").hide();jQuery("#stin-end").show();', 1000 );	
        };
    });	
	
    $("#chbox7-07").click(function() { 
        isChecked = $(this).is(':checked');
        if ( isChecked ) {
          $(".hidden-question4").hide();
          setTimeout ( 'jQuery("#stin-end").hide();jQuery("#stin-end").show();', 1000 );          
          $("#chbox7-01").attr("checked","");
   	      $("#chbox7-02").attr("checked","");
          $("#chbox7-03").attr("checked","");
          $("#chbox7-04").attr("checked","");
          $("#chbox7-05").attr("checked","");
          $("#chbox7-06").attr("checked","");       	
        } else {
          $(".hidden-question4").show();	
          setTimeout ( 'jQuery("#stin-end").hide();jQuery("#stin-end").show();', 1000 );
        };
    });		


		/* sumbit miniform using ajax */		
	
		$("#error404noticeForm").submit( function() {
			actionUrl=$(this).attr("action");
			error404urlValue=$("input[@name=error404url]",this).val();
                        error404urlreferrerValue=$("input[@name=error404urlreferrer]",this).val();
			error404langValue=$("input[@name=error404lang]",this).val();
	//		thanksMsg="Upozorneni bylo odeslano. Dekujeme.";
                        thanksMsg=$("input[@name=error404thanks]",this).val();

			$.get(actionUrl,
				 { go: "1", error404url: error404urlValue, error404lang: error404langValue, error404urlreferrer: error404urlreferrerValue },
				  function(data){
				    alert(thanksMsg);
					$("#error404noticeForm").hide(); // hide form to prevent multiple submits
				  }			 
			  );
		} );

		/* zobrazeni skryteho selectu pro prechod na jinou stranku pomoci js */
		$(".jsonly").css("display","block");

	
		/* presmerovani na jinou stranku ihned po vyberu polozky ze selectu */
		/**produkty**/
		/* Nepouziva se JHM
			$("form[@class='produkt'] select").change( function(){
				if(this.value!='') {
					window.location="http://"+this.value;
				};
			});
		*/
		/**zeme**/
		$("p#cez-world").hide();
        var index = $("#cez-world a").length;
        $("#cez-world-select").append('<label for="svet">'+ $("#cez-worldwide").text() +'</label><select id="svet"><option value="">'+ $("#cez-worldwide").attr("title") +'</option></select>');
        for(var i=0;i<index;i++){
            var href = $("#cez-world a").eq(i).attr("href");
            var aValue = $("#cez-world a").eq(i).text();
            $("#svet").append('<option value="'+ href +'">'+ aValue +'</option>'); 
        }
		$("select#svet").change( function(){
			if(this.value!='') {
				window.location=this.value;
			};
		});


/********* Jazykova priprava - skryti/odkryti prihl. formu do eSdilite *************/
$("#jazykovky-form").hide(); //inic. skryti

$("#jazykovky-links a").click( function() { 
	$("#jazykovky-form").show(); 
	$("#jazykovky-links").hide(); 
	return false;
 } 
);
/********* END - Jazykova priprava - skryti/odkryti prihl. formu do eSdilite *************/


                /** zmena odkazu na login pro prihlasenehou uzivatele **/
                // writeUserName();
	}
)

// zopakovana cast kodu z document.ready v jQuery(window).load - bug solution
jQuery(window).load( function() {
		/* zobrazeni skryteho selectu pro prechod na jinou stranku pomoci js */
		jQuery(".jsonly").css("display","block");
		/**zeme**/
		jQuery("select#svet").change( function(){
			if(this.value!='') {
				window.location=this.value;
			};
		});
} );

/*******************************/

/* Injectincg Flash Objects */
function writeFlash(fId,objectId,fMovie,fW,fH,paramArray,classId) {
	var flashCode = '<object type="application/x-shockwave-flash"  width="'+fW+'" height="'+fH+'"  data="'+fMovie+'"';
	if (classId) {
		flashCode += ' class="'+classId+'" ';
	}
	if (objectId) {
		flashCode += ' id="'+objectId+'" ';
	}
	flashCode += '>';
	flashCode += '<param name="movie" value="'+fMovie+'" />';
	for (i=0;i<paramArray.length;i++) {
		flashCode += '<param name="'+paramArray[i][0]+'" value="'+paramArray[i][1]+'" />';
    	flashCodeParam += ' ' + paramArray[i][0] + '="'+paramArray[i][1] + '"';
	}
	if (document.getElementById(fId+'-noscript')) {
		flashCode += document.getElementById(fId+'-noscript').innerHTML;
	}
	flashCode += '</object>';
	if (document.getElementById(fId)) {
		document.getElementById(fId).innerHTML = flashCode;
	}
}

/* Injectincg Random Flash Objects - inserts random item of an array of swf files*/
function writeRandomFlash(fId,objectId,fMovieCSV,fW,fH,paramArray,classId) {

	// fMovieCSV - string with semicolon separated swf filenames
	var regexpRemLastSemicolon=/^(.+);$/;
	fMovieCSV = fMovieCSV.replace(regexpRemLastSemicolon,"$1"); //odstranit strednik z konce retezece, konci-li retezec strednikem
	var fMovieArray = fMovieCSV.split(";");
	var fMovie = fMovieArray[Math.floor(Math.random()*fMovieArray.length)];

//	alert(fMovie);
	
	var reParseFMovie=/(.+?)\?clickthru=(.+)/;
	var	reGetFileExt=/(.+?)\.(.+)/;	
	
	if( parsedFMovie=fMovie.match(reParseFMovie) ) { // nazev souboru nasledovane ­ "?clickthru=odkaz"
	
//		alert("parsedFMovie: "+parsedFMovie);
		
		var bannerFile=parsedFMovie[1];
		var bannerLink=parsedFMovie[2];
	
		bannerFileExt=bannerFile.replace(reGetFileExt,"$2");
	} else {
		bannerFileExt=fMovie.replace(reGetFileExt,"$2");
	};

	
//	alert(bannerFileExt);		
	
	if(bannerFileExt=="swf") { // flash banner
		var bannerCode = '<object type="application/x-shockwave-flash"  width="'+fW+'" height="'+fH+'"  data="'+fMovie+'"';
		if (classId) {
			bannerCode += ' class="'+classId+'" ';
		}
		if (objectId) {
			bannerCode += ' id="'+objectId+'" ';
		}
		bannerCode += '>';
		bannerCode += '<param name="movie" value="'+fMovie+'" />';
		for (i=0;i<paramArray.length;i++) {
			bannerCode += '<param name="'+paramArray[i][0]+'" value="'+paramArray[i][1]+'" />';
		}
		if (document.getElementById(fId+'-noscript')) {
			bannerCode += document.getElementById(fId+'-noscript').innerHTML;
		}
		bannerCode += '</object>';
	} else { // non-flash banner (e.g. .jpg or .gif)
		var openInNewWindow=( /^http:/.test(bannerLink)  )?'target="_blank"':''; // pokud URL odkazu zacina na http:, bude se odkaz otvirat do novÄ‚?Ă‚Â©ho okna
		var bannerCode  = '<div>';
		bannerCode += '<a href="'+bannerLink+'" '+openInNewWindow+'>';
		bannerCode += '<img src="'+bannerFile+'" alt="" />';
		bannerCode += '</a></div>';
	};


	// Flash detection (requires AC_OETags.js)
	var requiredMajorVersion = 6; // Major version of Flash required
	var requiredMinorVersion = 0; // Minor version of Flash required
	var requiredRevision = 0; // Minor revision of Flash required
  var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

	if (document.getElementById(fId) && hasReqestedVersion) {
		document.getElementById(fId).innerHTML = bannerCode;
	}
}


							
							
/* Write share info in right box - temporary solution only */
function writeAkcie(targetUrl,lastText,bestBuy,bestSale,closeTrade,currency,graphAlt) {
	// Write Graph Image
	if (typeof( window[ 'averageTrading' ] ) != "undefined" && typeof( window[ 'tradeDate' ] ) != "undefined") {
		document.write('<p><a href="'+targetUrl+'"><img src="/edee/content/sys/module/chart/cs/nahled-14dnu.jpg" width="85" height="55" alt="" title="'+graphAlt+' '+averageTrading+' '+currency+'."></a>');
		document.write(tradeDate+'<br/><a href="'+targetUrl+'">');
		if (typeof( window[ 'sharesLastTrade' ] ) != "undefined") {
			document.write(lastText+'</a><a href="'+targetUrl+'" id="cena">'+sharesLastTrade+' '+currency+'</a>');
		} else if (typeof( window[ 'closingTrade' ] ) != "undefined") {
			document.write(closeTrade+'</a><a href="'+targetUrl+'" id="cena">'+closingTrade+' '+currency+'</a>');
		}
		document.write('</a></p>');
	}
	// Test variables
	if (typeof( window[ 'sharesLastTrade' ] ) != "undefined" && typeof( window[ 'sharesBestSale' ] ) != "undefined" && typeof( window[ 'sharesBestBuy' ] ) != "undefined") {
		if (sharesLastTrade != '' && sharesBestSale != '' && sharesBestBuy != '') {
			document.write('<p><ul><li>'+bestBuy+': <strong>'+sharesBestBuy+'</strong> '+currency+'</li><li>'+bestSale+': <strong>'+sharesBestSale+'</strong> '+currency+'</li>	</ul></p>');
		}
	} 
}	
function writeAkcieLarge(targetUrl,maxText,minText,currency,titleText,sourceText,closingText) {
	// Write Graph Image
	var closingDate = lastCloseDate;
	//if (typeof( window[ 'bestBuy' ] ) == "undefined") {
	//	closingDate = tradeDate;
	//}
	closingDate = closingDate.replace(/\ (..\:..)$/,"");
	if (typeof( window[ 'lastCloseDate' ] ) != "undefined" && typeof( window[ 'tradeDate' ] ) != "undefined"  && typeof( window[ 'closingMax30' ] ) != "undefined"  && typeof( window[ 'closingMin30' ] ) != "undefined") {
		document.write('<div id="graphHP"><span id="akcieTagVyvoj">'+titleText+'</span>')
		document.write('<span id="akcieTagZdroj">'+sourceText+'</span><span id="akcieTagKurz">'+closingText+' '+closingDate+' <a href="'+targetUrl+'">'+closingTrade+' '+currency+'</a></span>');
		document.write('<span id="akcieMax">max<br>'+closingMax30+'</span><span id="akcieMin">min<br>'+closingMin30+'</span>');
		document.write('<img id="akcieTagGraf" src="/edee/content/sys/module/chart/cs/nahled-mesic.jpg" width="178" height="81" alt=""/>');
		document.write('</div>');
	}

}

function writeUserName() {
    if ( isLogged ) {
        var lnk = document.getElementById("loginlinkelement");
        if ( lnk ) {
            lnk.innerHTML="Odhlásit";
            lnk.href = "/edee/odhlasit";
        }
    }
}


/*************/

// Napiste nam
function checkNapisteNam(myform) {
	errorMsg="";
	// get hidden form values (error & success msgs)
	errMsg_email=myform['errMsg_email'].value;	
	errMsg_predmet=myform['errMsg_predmet'].value;	
	errMsg_text=myform['errMsg_text'].value;	
	okMsg=myform['okMsg'].value;	
	// get form values
	email=myform['email'].value;
	predmet=myform['predmet'].value;
	textzpravy=myform['text'].value;

	regexpEmail=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
	if ( email=='' || !regexpEmail.test(email) ) {
		if(!errorMsg) { myform['email'].focus(); };
		errorMsg+=errMsg_email+"\n";
	};
	if(predmet=='') {
		if(!errorMsg) { myform['predmet'].focus(); };
		errorMsg+=errMsg_predmet+"\n";
	};
	if(textzpravy=='') {
		if(!errorMsg) { myform['text'].focus(); };
		errorMsg+=errMsg_text+"\n";
	};
	
	if(errorMsg) {
		alert(errorMsg);
		return false;
	} else {
		okMsg=okMsg.replace("\\n","\n");
		alert(okMsg);
		return true;
	};
}

// Pishete Ni
function checkPisheteNi(myform) {
	errorMsg="";

	// get form values
	email=myform['email'].value;
	subject=myform['subject'].value;
	text=myform['text'].value;

	jQuery("input[name='email']").css("border","1px solid #B3B3B3");
	jQuery("input[name='subject']").css("border","1px solid #B3B3B3");
	jQuery("textarea[name='text']").css("border","1px solid #B3B3B3");

	regexpEmail=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
	if ( email=='' || !regexpEmail.test(email) ) {
		if(!errorMsg) { myform['email'].focus(); };
		if(email=='')  {
      		errorMsg+="<span>- <strong>Пишете приятен имейл</strong>.</span><br />";
       		jQuery("input[name='email']").css("border","1px solid red");
		} else {
			errorMsg+="<span>- <strong>Неправилно имейл</strong>.</span><br />";
           		jQuery("input[name='email']").css("border","1px solid red");
		};
	};

	if(subject=='') {
		if(!errorMsg) { myform['subject'].focus(); };
      		errorMsg+="<span>- <strong>Пишете приятен tема</strong>.</span><br />";
		jQuery("input[name='subject']").css("border","1px solid red");
	};
	if(text=='') {
		if(!errorMsg) { myform['text'].focus(); };
      		errorMsg+="<span>- <strong>Пишете приятен tекст на запитването</strong>.</span><br />";
       		jQuery("textarea[name='text']").css("border","1px solid red");
	};
	
	if(errorMsg) {
		jQuery("#check").html("<div class='messageBox'><p class='alert'>"+errorMsg+"</p></div>");
		return false;
	} else {
		alert(okMsg);
		return true;
	};
}



// Pishete Ni - En
function checkPisheteNiEn(myform) {
	errorMsg="";

	// get form values
	email=myform['email'].value;
	subject=myform['subject'].value;
	text=myform['text'].value;

	jQuery("input[name='email']").css("border","1px solid #B3B3B3");
	jQuery("input[name='subject']").css("border","1px solid #B3B3B3");
	jQuery("textarea[name='text']").css("border","1px solid #B3B3B3");

	regexpEmail=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
	if ( email=='' || !regexpEmail.test(email) ) {
		if(!errorMsg) { myform['email'].focus(); };
		if(email=='')  {
      		errorMsg+="<span>- <strong>Please enter your e-mail address</strong>.</span><br />";
       		jQuery("input[name='email']").css("border","1px solid red");
		} else {
			errorMsg+="<span>- <strong>Your e-mail address is incorrect</strong>.</span><br />";
           		jQuery("input[name='email']").css("border","1px solid red");
		};
	};

	if(subject=='') {
		if(!errorMsg) { myform['subject'].focus(); };
      		errorMsg+="<span>- <strong>Please enter the subject</strong>.</span><br />";
		jQuery("input[name='subject']").css("border","1px solid red");
	};
	if(text=='') {
		if(!errorMsg) { myform['text'].focus(); };
      		errorMsg+="<span>- <strong>Please enter the message</strong>.</span><br />";
       		jQuery("textarea[name='text']").css("border","1px solid red");
	};
	
	if(errorMsg) {
		jQuery("#check").html("<div class='messageBox'><p class='alert'>"+errorMsg+"</p></div>");
		return false;
	} else {
		alert(okMsg);
		return true;
	};
}

var ffNextItem=null;
function ffCloseWindow() {
	if (confirm("Přejete si zavřít okno?")) {
		window.close();
	}
}



function Jump(theSelect){
// Fce provede odskok na adresu, obsazenou v tagu VALUE aktualne vybrane volby prvku Select 

    selindex = theSelect.selectedIndex;
    selvalue = theSelect.options[selindex].value;
    window.location.href = selvalue;

}


//jQuery(document).ready( /* jQuery no conflict block */
//	function($) {

//	$("#prikon_vypocet div").hide();    // inicialne skryje vsechny	
//	$(".rad1").click( function() {
//        $("#info_prikon"+this.value).show();			
//	} );		
						
//	}
//)


jQuery(document).ready( /* jQuery no conflict block */
	function($) {

	$("prikon_vypocet div").hide(); // inicialne skryje vsechny	
	
	$(".rad1").click( function() {
	//	$("#prikon_vypocet div").hide(); // inicialne skryje vsechny	
		clickedItemId=$(this).attr("id");
		$("#info_prikon"+clickedItemId).show();		
	} );	
	
	}
)
	
   
function toggle(_s,_h) {
  if (document.all) {
     eval("document.all."+_s+".style.visibility='visible';");
     eval("document.all."+_h+".style.visibility='hidden';"); }
  else {
    if(navigator.userAgent.indexOf("Gecko")!=-1) {                // is NS6 ?
      document.getElementById(_s).style.visibility='visible';
      document.getElementById(_h).style.visibility='hidden'; }
    else {
    eval("document.layers['"+_s+"'].visibility='show';");
    eval("document.layers['"+_h+"'].visibility='hide';"); }
  }
}



function checkDotaznikQ1() {
  result = false;
  if( jQuery("input[@name=ot4]").val() ) {
    result = true;
  } else {
    alert("Zvolte prosím alespoň jednu možnost otázky č.1 c).")  
  };
  return result;
}

function checkDotaznikQ2() {
  result = false;
  if( jQuery("input[@name=ot5]").val() ) {
    result = true;
  } else {
    alert("Zvolte prosím alespoň jednu možnost otázky č.2 b).")  
  };
  return result;
}
function checkDotaznikQ22() {
  result = false;
  if( jQuery("input[@name=ot6]").val() ) {
    result = true;
  } else {
    alert("Zvolte prosím alespoň jednu možnost otázky č.2 c).")  
  };
  return result;
}
function checkDotaznikQ22() {
  result = false;
  if( jQuery("input[@name=ot7]").val() ) {
    result = true;
  } else {
    alert("Zvolte prosím alespoň jednu možnost otázky č.2 c).")  
  };
  return result;
}




function isRadioChecked(inputObject) {
	for (i=0;i<inputObject.length;i++){
		if (inputObject[i].checked==true){
			return true;
		};
	};
	return false;
}


function checkBgrAnketa(myform) {
	errorMsg="";

	// get form values
	q1=myform['q1'];
	q2=myform['q2'];
	q3=myform['q3'];
	ot4=myform['ot4'].value;
	ot5=myform['ot5'].value;
	ot6=myform['ot6'].value;
	ot7=myform['ot7'].value;		

//  result = false;
  
  if(!isRadioChecked(q1)) {
	   errorMsg+="<span>- Моля изберете <strong>отговор на въпрос No 1.</strong></span><br />";
  };
  if(!isRadioChecked(q2)) {
	   errorMsg+="<span>- Моля изберете <strong>отговор на въпрос No 2.</strong></span><br />";
  };  
  if(!isRadioChecked(q3)) {
	   errorMsg+="<span>- Моля изберете <strong>отговор на въпрос No 3.</strong></span><br />";
  };  
  
  if( jQuery("input[@name=ot4]").val() ) {
    result = true;
  } else {
    errorMsg+="<span>- Моля изберете <strong>поне един възможен отговор на въпрос No 4.</strong></span><br />";
  };
  
  if( jQuery("input[@name=ot5]").val() ) {
    result = true;
  } else {
    errorMsg+="<span>- Моля изберете <strong>поне един възможен отговор на въпрос  No 5.</strong></span><br />";  
  };
  
  if( jQuery("input[@name=ot6]").val() ) {
    result = true;
  } else {
    errorMsg+="<span>- Моля изберете <strong>поне един възможен отговор на въпрос  No 6.</strong></span><br />";  
  };
  
  if( jQuery("input[@name=ot7]").val() ) {
    result = true;
  } else {
    errorMsg+="<span>- Моля изберете <strong>поне един възможен отговор на въпрос  No 7.</strong></span><br />";  
  };
  
  
	if(errorMsg) {
 	setTimeout ( 'jQuery("#stin-end").hide();jQuery("#stin-end").show();', 1000 );	
    jQuery("#check").html("<div class='messageBox'><p class='alert'>"+errorMsg+"</p></div>");		
		return false;
	} else {
		return true;
	};
}	

function getChkBoxesDotaznikQ4() {
  sChecked="";                                                // retezec pro zretezeni hodnot checkboxu
  jQuery("input#chbox4-").each(function(i){
    if(this.checked) {
      sChecked+=this.value+", ";
    }
  });
  jQuery("input[@name=ot4]").val(sChecked); 
}

function getChkBoxesDotaznikQ5() {
  sChecked="";                                                // retezec pro zretezeni hodnot checkboxu
  jQuery("input[@id^=chbox5-]").each(function(i){
    if(this.checked) {

      sChecked+=this.value+", ";
    }
  });
  jQuery("input[@name=ot5]").val(sChecked); 
}

function getChkBoxesDotaznikQ6() {
  sChecked="";                                               // retezec pro zretezeni hodnot checkboxu
  jQuery("input[@id^=chbox6-]").each(function(i){
    if(this.checked) {

      sChecked+=this.value+", ";
    }
  });
  jQuery("input[@name=ot6]").val(sChecked); 
}

function getChkBoxesDotaznikQ7() {
  sChecked="";                                               // retezec pro zretezeni hodnot checkboxi
  jQuery("input[@id^=chbox7-]").each(function(i){
    if(this.checked) {

      sChecked+=this.value+", ";
    }
  });
  jQuery("input[@name=ot7]").val(sChecked); 
}

/* ----------- Dotaznik - bound actions ----------- */ 
jQuery(document).ready( /* jQuery no conflict block */
	function($) {


  /* bindovani fci */
  $("input#chbox4-").click( function() { 
    getChkBoxesDotaznikQ4();
  } );
  $("input#chbox5-").click( function() { 
    getChkBoxesDotaznikQ5();
  } );
  $("input#chbox6-").click( function() { 
    getChkBoxesDotaznikQ6();
  } );
  $("input#chbox7-").click( function() { 
    getChkBoxesDotaznikQ7();
  } );

  }
)

/*********** Dotaznik 2010 *************/

function getBoxesDotaznikQ1() {
  sChecked="";                                               
  jQuery("input[@name^=q1-]").not(":disabled").each(function(i){
    if (this.checked) {
        sChecked += this.value;
    }
  });
  jQuery("input[@name=ot1]").val(sChecked);
}

function getBoxesDotaznikQ2() {
  sChecked="";                                                // retezec pro zretezeni hodnot checkboxu
  jQuery("input[@id^=checkbox2-]").not(":disabled").each(function(i){
    if (this.checked) {
	  if (this.value != 'h') {
        sChecked += this.value+", ";
	  } else if(this.value == 'h') { 
	    sChecked += this.value+": "+jQuery("textarea#q2-other").val(); 
	  }
    }
  });
  jQuery("input[@name=ot2]").val(sChecked);
}

function getBoxesDotaznikQ3() {
  sChecked="";                                                // retezec pro zretezeni hodnot checkboxu
  jQuery("input[@id^=checkbox3-]").not(":disabled").each(function(i){
    if (this.checked) {
        sChecked += this.value+", ";
    }
  });
  jQuery("input[@name=ot3]").val(sChecked);
}

function getBoxesDotaznikQ4() {
  sChecked="";                                                // retezec pro zretezeni hodnot checkboxu
  jQuery("input[@id^=ot4-]").not(":disabled").each(function(i){
    if (this.checked) {
	  if (this.value != 'a') {
        sChecked += this.value;
	  } else { 
	    sChecked += this.value+": "+jQuery("textarea#q4-more").val(); 
	  }
    }
  });
  jQuery("input[@name=ot4]").val(sChecked);
}

function getBoxesDotaznikQ5() {
  sChecked="";                                               
  jQuery("input[@name=q5]").not(":disabled").each(function(i){
    if (this.checked) {
        sChecked += this.value;
    }
  });
  jQuery("input[@name=ot5]").val(sChecked);
}

function getBoxesDotaznikQ6() {
  sChecked="";                                                // retezec pro zretezeni hodnot checkboxu
  jQuery("input[@id^=checkbox6-]").not(":disabled").each(function(i){
    if (this.checked) {
	  if (this.value != 'j') {
        sChecked += this.value+", ";
	  } else if(this.value == 'j') { 
	    sChecked += this.value+": "+jQuery("textarea#q6-other").val(); 
	  }
    }
  });
  jQuery("input[@name=ot6]").val(sChecked);
}

function getBoxesDotaznikQ7() {
  sChecked="";                                                // retezec pro zretezeni hodnot checkboxu
  jQuery("input[@id^=checkbox7-]").not(":disabled").each(function(i){
    if (this.checked) {
	  if (this.value != 'f') {
        sChecked += this.value+", ";
	  } else if(this.value == 'f') { 
	    sChecked += this.value+": "+jQuery("textarea#q7-other").val(); 
	  }
    }
  });
  jQuery("input[@name=ot7]").val(sChecked);
}
	
function checkBgrDotaznik2010(myform) {
	getBoxesDotaznikQ1(); //alert(jQuery("input[@name=ot1]").val());
	getBoxesDotaznikQ3(); //alert('3'+jQuery("input[@name=ot3]").val());
	getBoxesDotaznikQ2(); //alert('2'+jQuery("input[@name=ot2]").val());
	getBoxesDotaznikQ4(); //alert('4'+jQuery("input[@name=ot4]").val());
	getBoxesDotaznikQ5(); //alert(jQuery("input[@name=ot5]").val());
	getBoxesDotaznikQ6(); //alert('6'+jQuery("input[@name=ot6]").val());
	getBoxesDotaznikQ7(); //alert('7'+jQuery("input[@name=ot7]").val());
	
	errorMsg="";
		
	// get form values
	ot1 = myform['ot1'].value;
	q11 = myform['q1-1'];
	q12 = myform['q1-2'];
	ot2 = myform['ot2'].value;
	ot3 = myform['ot3'].value;
	ot4 = myform['ot4'].value;
	q5 = myform['q5'];
	ot6 = myform['ot6'].value;
	ot7 = myform['ot7'].value;
	q8 = myform['q8'];
	q9 = myform['q9'];

  if (jQuery("input#ot1-1:checked").length) {
	
	if(!isRadioChecked(q11)) {
	  errorMsg += "<span>- Моля изберете отговор на въпрос <strong>\"Как си плащате сметките за ток?\"</strong></span><br />";
	}
	if(jQuery("input[@name=ot2]").val()) {
	  if(jQuery("input#checkbox2-08:checked").length && !jQuery("textarea#q2-other").val()) {
		// nevyplnene povinne textarea
	  } 
    } else {
      errorMsg+="<span>- Моля изберете поне един възможен отговор на въпрос <strong>\"Моля посочете причините, поради които предпочитате този начин на плащане\"</strong></span><br />";
    };
	if(jQuery("input[@name=ot3]").val()) {
	  result = true;
    } else {
      errorMsg+="<span>- Моля изберете поне един възможен отговор на въпрос <strong>\"Кое от следните твърдения би Ви подтикнало да преминете към безкасов начин на плащане на Вашата сметка?\"</strong></span><br />";
    };
    if(jQuery("input[@name=ot4]").val()) {
      result = true;
    } else {
      errorMsg+="<span>- Моля изберете поне един възможен отговор на въпрос <strong>\"Плащали ли сте някога сметката си за електроенергия по банков път или по Интернет?\"</strong></span><br />";
    };
    if(!isRadioChecked(q5)) {
	   errorMsg+="<span>- Моля изберете отговор на въпрос <strong>\"Кой от следните начини на безкасово плащане на месечната сметка бихте предпочели\"</strong></span><br />";
    };  
	
  } else if (jQuery("input#ot1-2:checked").length) {
    if(!isRadioChecked(q12)) {
	  errorMsg += "<span>- Моля изберете <strong>отговор на въпрос \"Как си плащате сметките за ток?\"</strong></span><br />";
	}
	if( jQuery("input[@name=ot6]").val() ) {
      result = true;
    } else {
      errorMsg+="<span>- Моля изберете поне един възможен отговор на въпрос <strong>\"От къде научихте за тoзи начин за безкасово плащане на сметките за електроенергия?\"</strong></span><br />";  
    };
    if( jQuery("input[@name=ot7]").val() ) {
      result = true;
    } else {
      errorMsg+="<span>- Моля изберете поне един възможен отговор на въпрос <strong>\"Моля, посочете защо предпочетохте избрания от Вас начин на плащане?\"</strong></span><br />";  
    };
	
  } else {
	errorMsg += "<span>- Моля изберете отговор на въпрос <strong>\"Как си плащате сметките за ток?\"</strong></span><br />";
  };
  
  if(!isRadioChecked(q8)) {
	   errorMsg+="<span>- Моля изберете отговор на въпрос <strong>\"Вашата възраст\"</strong></span><br />";
  }; 
  
  if(!isRadioChecked(q9)) {
	   errorMsg+="<span>- Моля изберете отговор на въпрос <strong>\"Вие живеете в\"</strong></span><br />";
  }; 
  
  if(errorMsg) {
 	setTimeout ( 'jQuery("#stin-end").hide();jQuery("#stin-end").show();', 1000 );	
    jQuery("#check").html("<div class='messageBox'><p class='alert'>"+errorMsg+"</p></div>");		
	return false;
  } else {
	return true;
  };
}



function checkBgrFormInvoice(myform) {
	
	errorMsg="";
	// get form values
	q1 = myform['q1'];
	q2 = myform['q2'];
	
	if(!isRadioChecked(q1)) { 
		errorMsg+="<span>- Моля изберете <strong>поне един възможен отговор на въпрос No 1.</strong></span><br />";
	}; 
  
	if(!isRadioChecked(q2)) {
		errorMsg+="<span>- Моля изберете <strong>поне един възможен отговор на въпрос  No 2.</strong></span><br />";
	}; 
  
  if(errorMsg) {
 	setTimeout ( 'jQuery("#stin-end").hide();jQuery("#stin-end").show();', 1000 );	
    jQuery("#check").html("<div class='messageBox'><p class='alert'>"+errorMsg+"</p></div>");		
	return false;
  } else {
	return true;
  };
}



function nastavZatr(zatr) {
  document.form2.hodnota.value = '';
}
/*************/
function playMedia(url) {

		domena = location.hostname;
      if(domena=='iportal.cezdata.corp')
      {
        var so = new SWFObject('/edee/content/sys/swf/mediaplayer.swf','player','320','240','9.0.16.0'); 
              
      } else {
        var so = new SWFObject('http://www.cez.cz/edee/content/sys/swf/mediaplayer.swf','player','320','240','9.0.16.0');    
      }; 
      
    so.addParam("wmode","transparent");
    so.addVariable('file',url);
		so.addParam("allowfullscreen","true");
		so.addVariable('fullscreen','true');
		so.addVariable("javascriptid", "JW");
		so.addVariable("autostart","false");
		so.addVariable("width","320");
		so.addVariable("height","240");
		so.write('mediaspace');
}

function playMediaMPC(url,containerEl,embedId) {

		domena = location.hostname;
      if(domena=='iportal.cezdata.corp')
      {
        var so = new SWFObject('/edee/content/sys/swf/mediaplayer.swf',embedId,'320','240','9.0.16.0'); 
              
      } else {
        var so = new SWFObject('http://www.cez.cz/edee/content/sys/swf/mediaplayer.swf',embedId,'320','240','9.0.16.0');    
      }; 
      
    so.addParam("wmode","transparent");
    so.addVariable('file',url);
		so.addParam("allowfullscreen","true");
		so.addVariable('fullscreen','true');
		so.addVariable("javascriptid", "JW");
		so.addVariable("autostart","false");
		so.addVariable("width","320");
		so.addVariable("height","240");
		so.write(containerEl);
}

/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;


jQuery(document).ready( /* jQuery no conflict block */
	function ($) {

	    $(".flvPlay").each(function (i) {
	        url = $(this).attr("rel");
	        playMediaMPC(url, this, "player" + i);
	    });

	    /***************************************/

	    /* Zalozkovy box - tabs */
	    // prototype
	    $.prototype.makeTabs = function () {
	        var tabs = $("#" + this.attr("id") + " li a");
	        if (tabs.length == 0) return;
	        for (var ti = 0; ti < tabs.length; ti++) {
	            $("div[class*='tabs-box-" + $(tabs[ti]).attr("id").substring(1) + "']").css("visibility", "hidden");
	            $(tabs[ti]).bind("mouseover", function () {
	                for (var tiin = 0; tiin < tabs.length; tiin++) {
	                    $(tabs[tiin]).removeClass("active");
	                    $("div[class*='tabs-box-" + $(tabs[tiin]).attr("id").substring(1) + "']").css("visibility", "hidden");
	                }
	                $(this).addClass("active");
	                $("div[class*='tabs-box-" + $(this).attr("id").substring(1) + "']").css("visibility", "visible");
	                return false;
	            });
	        }
	        $("#" + this.attr("id") + " li a:eq(1)").addClass("active");
	        //$("div[class*='tabs-box-" + $(tabs[0]).attr("id").substring(1) + "']").css("visibility","visible");
	        $("#tbblok2").css("visibility", "visible");
	    }
	    // bind
	    $("#tabs-box").makeTabs();

	    /* END - Zalozkovy box - tabs */

	    /* Fivebox */

	    $('#fivebox-menu a').each(function (i) {  // nahrazeni bilych znaku za obycejne mezery
	        $(this).text($(this).text().replace(/\s/g, " "));
	    });
	    $('#fivebox-menu a:contains("ČEZ, a. s.")').css("text-transform", "none"); // ČEZ, a. s.

	    $(".fivebox-box").css("visibility", "hidden"); // skryj vsechny boxy

	    if (/^#[1-5]$/.test(location.hash)) { // pomoci kotvy #polozka1 otevrit adekvatni polozku v multiboxu
	        var i = location.hash.substr(location.hash.length - 1);
	        $("#fivebox-" + i).css("visibility", "visible");
	        i = i - 1;
	        $("#fivebox-menu a:eq(" + i + ")").addClass("current");
	    } else {
	        $("#fivebox-1").css("visibility", "visible"); // zobraz prvni
	        $("#fivebox-menu a:eq(0)").addClass("current"); // zvyrazni 1. odkaz
	    }

	    $("#fivebox-menu a").mouseover(function () {
	        var index = $("#fivebox-menu a").index(this) + 1; // item id indexed from 1
	        //        alert( index );
	        $(".fivebox-box").css("visibility", "hidden"); // skryj vsechny boxy
	        $("#fivebox-" + index).css("visibility", "visible");
	        $("#fivebox-menu a").removeClass("current");
	        $(this).addClass("current");
	    });

	    /* END - Fivebox */

	    /* Fourbox - hover change styles + add link to box */

	    $("#fourthbox .text").mouseover(function () {
	        // zapamatuji si soucasne hodnoty
	        color = $(this).css("color");
	        bgColor = $(this).css("background-color");
	        bgImage = $(this).css("background-image");
	        // nastavim hover hodnoty
	        $(this).css("cursor", "pointer");
	        $(this).find('a').css("color", "#ffffff");
	        $(this).css("color", "#ffffff");
	        $(this).css("background-color", "#F24F00");
	        $(this).css("background-image", "none");
	        //get link href
	        link = $(this).find('a').attr("href");
	        // nastavi odkaz na celem bloku
	        $(this).click(function () {
	            window.location.href = link;
	        });
	    }).mouseout(function () {
	        $(this).css("cursor", "auto");
	        $(this).find('a').css("color", "#EB4D00");
	        /*
	        $(this).css("color","#666");
	        $(this).css("background-color","#ffffff");
	        $(this).css("background-image","url(/"+ getEnvPrefix() +"/content/sys/www/img/fourthbox-bck.gif)");
	        */
	        $(this).css("color", color);
	        $(this).css("background-color", bgColor);
	        $(this).css("background-image", bgImage);
	    });


	    /* Threebox - add link to box */
	    $("#threebox .visualt").css("cursor", "pointer");
	    $("#threebox .visualt").each(function () {
	        $(this).click(function () {
	            window.location.href = $(this).find('h1 a').attr("href");
	        });

	    });

	    /* Fivebox - add link to image */
	    $(".fivebox-box .visual-image").css("cursor", "pointer");
	    $(".fivebox-box .visual-image").each(function () {
	        $(this).click(function () {
	            window.location.href = $(this).find('h2 a').attr("href");
	        });

	    });

	    /// Tooltip
	    $(document).ready(function () {
	        $(".fg-tooltip").each(function () {
	            var $term = $(this);
	            var $termClass = $term.attr("class"); // třída ve tvaru "tooltip term-x-xx-x;x" x = id, xx = pozice (vertikální, horizontální), x;x = relativní napozicování v px
	            var data = $termClass.match(/tooltip-term-([\d]+)-?([a-z]+)?-?y?(-?[\d]+)?x?(-?[\d]+)?(set)?/); // data[1] = id, data[2] = position, data[3] = relativní y k data[2], data[4] = relativní x k data[2]

	            // pomocné proměnné
	            var termX = $term.offset().left;
	            var termY = $term.offset().top;
	            var termWidth = $term.outerWidth();
	            var termHeight = $term.outerHeight();
	            var contentWidth = $(".tooltip-term-" + data[1] + "-content").outerWidth();
	            var contentHeight = $(".tooltip-term-" + data[1] + "-content").outerHeight();
	            var offsetX = 0;
	            var offsetY = 0;

	            // nastavení pozice dle uživatele a přenastavení offsetu
	            switch (data[2]) {
	                case "tl": offsetY = termY - 5 - contentHeight; offsetX = termX - 5 - contentWidth; break;
	                case "tc": offsetY = termY - 5 - contentHeight; offsetX = termX + (termWidth - contentWidth) / 2; break;
	                case "tr": offsetY = termY - 5 - contentHeight; offsetX = termX + 5 + termWidth; break;
	                case "cl": offsetY = termY + (termHeight - contentHeight) / 2; offsetX = termX - 5 - contentWidth; break;
	                case "cr": offsetY = termY + (termHeight - contentHeight) / 2; offsetX = termX + 5 + termWidth; break;
	                case "bl": offsetY = termY + 5 + termHeight; offsetX = termX - 5 - contentWidth; break;
	                case "bc": offsetY = termY + 5 + termHeight; offsetX = termX + (termWidth - contentWidth) / 2; break;
	                case "br": offsetY = termY + 5 + termHeight; offsetX = termX + 5 + termWidth; break;
	                default: offsetY = termY + 5 + termHeight; offsetX = termX + 5 + termWidth; break;
	            }

	            // nastavení offsetu dle uživatele
	            if (data[5] == "set") {
	                offsetY += parseInt(data[3]);
	                offsetX + parseInt(data[4]);
	            }

	            // napozicování obsahu tooltipu
	            if ($.browser.opera)
	                $(".tooltip-term-" + data[1] + "-content").offset({ top: offsetY, left: offsetX }).appendTo("body");
	            else
	                $(".tooltip-term-" + data[1] + "-content").offset({ top: offsetY, left: offsetX }).appendTo("body");
	            // show / hide
	            $("." + data[0]).hover(function () { $(".tooltip-term-" + data[1] + "-content").show(); }, function () { $(".tooltip-term-" + data[1] + "-content").hide(); });
	        });
	    });
	});
