function chdop (val) {
  var platdop = new Array();
  platdop[1] = new Array();
  platdop[1][1] = 1;
 // platdop[1][2] = 1;
  platdop[2] = new Array();
  platdop[2][1] = 1;
 // platdop[2][2] = 1;
  platdop[3] = new Array();
  platdop[3][3] = 1;
	tmp = platdop[val];
	for (i = 1; i <= 4; i++) {
		if (document.getElementById("payment"+i)) {
			if (tmp [i]) {
				document.getElementById("payment"+i).disabled = "";
			} else {
				document.getElementById("payment"+i).disabled = "disabled";
				document.getElementById("payment"+i).checked = "";
			}
		}
	}
	if (val == 3) {
    document.getElementById("payment3").checked = "checked"
  } else {
    document.getElementById("payment3").checked = ""
  }
  if (val == 1 || val == 2) {
    document.getElementById("payment1").checked = "checked"
  } else {
    document.getElementById("payment1").checked = ""
  }
}

function set_links() {
	if($("#justfinished") != undefined) {
		var pointer;
		if((pointer = document.getElementById('lightlink1'))) pointer.link = "<br><a href='http://www.domansky.cz/' target='_blank'>www.domansky.cz</a>";
		if((pointer = document.getElementById('lightlink2'))) pointer.link = "<br><a href='http://www.cityshop.cz/' target='_blank'>www.cityshop.cz</a>";
		if((pointer = document.getElementById('lightlink3'))) pointer.link = "<br><a href='http://www.hledej-ubytovani.cz/' target='_blank'>www.hledej-ubytovani.cz</a>";
		if((pointer = document.getElementById('lightlink4'))) pointer.link = "<br><a href='http://www.chillipfeifer.cz/' target='_blank'>www.chillipfeifer.cz</a>";
		if((pointer = document.getElementById('lightlink5'))) pointer.link = "<br><a href='http://www.omd.cz/' target='_blank'>www.omd.cz</a>";
		if((pointer = document.getElementById('lightlink6'))) pointer.link = "<br><a href='http://www.lamborghinipraha.cz/' target='_blank'>www.lamborghinipraha.cz</a>";
		if((pointer = document.getElementById('lightlink7'))) pointer.link = "<br><a href='http://www.straumann.cz/' target='_blank'>www.straumann.cz</a>";
		if((pointer = document.getElementById('lightlink8'))) pointer.link = "<br><a href='http://www.proormedent.cz/' target='_blank'>www.proormedent.cz</a>";
		if((pointer = document.getElementById('lightlink9'))) pointer.link = "<br><a href='http://www.aromedica.cz/' target='_blank'>www.aromedica.cz</a>";
		if((pointer = document.getElementById('lightlink10'))) pointer.link = "<br><a href='http://www.koupelny-vany.cz/' target='_blank'>www.koupelny-vany.cz</a>";
		if((pointer = document.getElementById('lightlink11'))) pointer.link = "<br><a href='http://www.autoexner.cz/' target='_blank'>www.autoexner.cz</a>";
		if((pointer = document.getElementById('lightlink12'))) pointer.link = "<br><a href='http://www.zimni-letni-pneu.cz/' target='_blank'>www.zimni-letni-pneu.cz</a>";
		if((pointer = document.getElementById('lightlink13'))) pointer.link = "<br><a href='http://www.implantaty.cz/' target='_blank'>www.implantaty.cz</a>";
		if((pointer = document.getElementById('lightlink14'))) pointer.link = "<br><a href='http://www.ebro.cz/' target='_blank'>www.ebro.cz</a>";
		if((pointer = document.getElementById('lightlink15'))) pointer.link = "<br><a href='http://www.offroadservis.cz/' target='_blank'>www.offroadservis.cz</a>";
		if((pointer = document.getElementById('lightlink16'))) pointer.link = "<br><a href='http://www.xxx.cz/' target='_blank'>www.xxx.cz</a>";
		if((pointer = document.getElementById('lightlink17'))) pointer.link = "<br><a href='http://www.xxx.cz/' target='_blank'>www.xxx.cz</a>";
		if((pointer = document.getElementById('lightlink18'))) pointer.link = "<br><a href='http://www.djtrava.com/' target='_blank'>www.djtrava.com</a>";
		if((pointer = document.getElementById('lightlink19'))) pointer.link = "<br><a href='http://www.vrakovisteoffroad.cz/' target='_blank'>www.vrakovisteoffroad.cz</a>";
		if((pointer = document.getElementById('lightlink20'))) pointer.link = "<br><a href='http://www.rozdelovace.cz/' target='_blank'>www.rozdelovace.cz</a>";
		if((pointer = document.getElementById('lightlink21'))) pointer.link = "<br><a href='http://www.peugeot308.cz/' target='_blank'>www.peugeot308.cz</a>";
		if((pointer = document.getElementById('lightlink22'))) pointer.link = "<br><a href='http://www.9level.cz/' target='_blank'>www.9level.cz</a>";
		if((pointer = document.getElementById('lightlink23'))) pointer.link = "<br><a href='http://www.implantaty-brno.cz/' target='_blank'>www.implantaty-brno.cz</a>";
		if((pointer = document.getElementById('lightlink24'))) pointer.link = "<br><a href='http://www.ksn.cz/' target='_blank'>www.ksn.cz</a>";
		if((pointer = document.getElementById('lightlink25'))) pointer.link = "<br><a href='http://www.hotelnadrekou.cz/' target='_blank'>www.hotelnadrekou.cz</a>";
		if((pointer = document.getElementById('lightlink26'))) pointer.link = "<br><a href='http://www.staramlekarna.cz/' target='_blank'>www.staramlekarna.cz</a>";
		if((pointer = document.getElementById('lightlink27'))) pointer.link = "<br><a href='http://www.klubroxy.cz/' target='_blank'>www.klubroxy.cz</a>";
		if((pointer = document.getElementById('lightlink28'))) pointer.link = "<br><a href='http://www.centrumparfemu.cz/' target='_blank'>www.centrumparfemu.cz</a>";
		if((pointer = document.getElementById('lightlink29'))) pointer.link = "<br><a href='http://www.extrafin.cz/' target='_blank'>www.extrafin.cz</a>";
		if((pointer = document.getElementById('lightlink30'))) pointer.link = "<br><a href='http://nod.roxy.cz/' target='_blank'>nod.roxy.cz</a>";
		if((pointer = document.getElementById('lightlink31'))) pointer.link = "<br><a href='http://www.englishschool.cz/' target='_blank'>www.englishschool.cz</a>";
		if((pointer = document.getElementById('lightlink32'))) pointer.link = "<br><a href='http://www.rocktech.cz/' target='_blank'>www.rocktech.cz</a>";
		if((pointer = document.getElementById('lightlink33'))) pointer.link = "<br><a href='http://www.terramet.cz/' target='_blank'>www.terramet.cz</a>";
		if((pointer = document.getElementById('lightlink34'))) pointer.link = "<br><a href='http://www.czechtex.cz/' target='_blank'>www.czechtex.cz</a>";
		if((pointer = document.getElementById('lightlink35'))) pointer.link = "<br><a href='http://www.arrowmobile.cz/' target='_blank'>www.arrowmobile.cz</a>";
		if((pointer = document.getElementById('lightlink36'))) pointer.link = "<br><a href='http://www.stomatologiebenesov.cz/' target='_blank'>www.stomatologiebenesov.cz</a>";
		if((pointer = document.getElementById('lightlink37'))) pointer.link = "<br><a href='http://www.tattoo-alien.cz/' target='_blank'>www.tattoo-alien.cz</a>";
		if((pointer = document.getElementById('lightlink38'))) pointer.link = "<br><a href='http://www.tattoo-alien.cz/' target='_blank'>www.tattoo-alien.cz</a>";
		if((pointer = document.getElementById('lightlink39'))) pointer.link = "<br><a href='http://www.harleys.cz/harleys.php' target='_blank'>www.harleys.cz/harleys.php</a>";
		if((pointer = document.getElementById('lightlink40'))) pointer.link = "<br><a href='http://www.moto-harley.cz/' target='_blank'>www.moto-harley.cz/harleys.php</a>";
		if((pointer = document.getElementById('lightlink41'))) pointer.link = "<br><a href='http://www.eventconcept.cz/' target='_blank'>www.eventconcept.cz</a>";
		if((pointer = document.getElementById('lightlink42'))) pointer.link = "<br><a href='http://www.eventconcept.cz/' target='_blank'>www.eventconcept.cz</a>";
		if((pointer = document.getElementById('lightlink43'))) pointer.link = "<br><a href='http://www.staginprague.com/' target='_blank'>www.staginprague.com</a>";
		if((pointer = document.getElementById('lightlink44'))) pointer.link = "<br><a href='http://www.ceh.cz/' target='_blank'>www.ceh.cz</a>";
		if((pointer = document.getElementById('lightlink45'))) pointer.link = "<br><a href='http://www.speed-press.cz/' target='_blank'>www.speed-press.cz</a>";
		if((pointer = document.getElementById('lightlink46'))) pointer.link = "<br><a href='http://www.stop-korupci.cz/' target='_blank'>www.stop-korupci.cz</a>";
		if((pointer = document.getElementById('lightlink47'))) pointer.link = "<br><a href='http://www.zieleniec.eu/' target='_blank'>www.zieleniec.eu</a>";
		if((pointer = document.getElementById('lightlink48'))) pointer.link = "<br><a href='http://www.tomasmikeska.cz/' target='_blank'>www.tomasmikeska.cz</a>";
		if((pointer = document.getElementById('lightlink49'))) pointer.link = "<br><a href='http://www.pqs-rakovnik.cz/' target='_blank'>www.pqs-rakovnik.cz</a>";
		if((pointer = document.getElementById('lightlink50'))) pointer.link = "<br><a href='http://www.jankasl.cz/' target='_blank'>www.jankasl.cz</a>";
		if((pointer = document.getElementById('lightlink51'))) pointer.link = "<br><a href='http://www.janaryslinkova.cz/' target='_blank'>www.janaryslinkova.cz</a>";
		if((pointer = document.getElementById('lightlink52'))) pointer.link = "<br><a href='http://www.evropskaustava.cz/' target='_blank'>www.evropskaustava.cz</a>";
		if((pointer = document.getElementById('lightlink53'))) pointer.link = "<br><a href='http://www.ied.cz/' target='_blank'>www.ied.cz</a>";
		if((pointer = document.getElementById('lightlink54'))) pointer.link = "<br><a href='http://www.irand.cz/' target='_blank'>www.irand.cz</a>";
		if((pointer = document.getElementById('lightlink55'))) pointer.link = "<br><a href='http://www.chvalecskanoc.cz/' target='_blank'>www.chvalecskanoc.cz</a>";
		if((pointer = document.getElementById('lightlink56'))) pointer.link = "<br><a href='http://www.konopa.cz/' target='_blank'>www.konopa.cz</a>";
		if((pointer = document.getElementById('lightlink57'))) pointer.link = "<br><a href='http://www.zelenapumpa.cz/' target='_blank'>www.zelenapumpa.cz</a>";
		if((pointer = document.getElementById('lightlink58'))) pointer.link = "<br><a href='http://www.kvetnice.eu/' target='_blank'>www.kvetnice.eu</a>";
		if((pointer = document.getElementById('lightlink59'))) pointer.link = "<br><a href='http://www.chvalec.cz/' target='_blank'>www.chvalec.cz</a>";
		if((pointer = document.getElementById('lightlink60'))) pointer.link = "<br><a href='http://www.rozvojvesnice.cz/' target='_blank'>www.rozvojvesnice.cz</a>";
		if((pointer = document.getElementById('lightlink61'))) pointer.link = "<br><a href='http://www.adk-prague.cz/' target='_blank'>www.adk-prague.cz</a>";
		if((pointer = document.getElementById('lightlink62'))) pointer.link = "<br><a href='http://www.gross-stahl.cz/' target='_blank'>www.gross-stahl.cz</a>";
		if((pointer = document.getElementById('lightlink63'))) pointer.link = "<br><a href='http://www.duplex.cz/' target='_blank'>www.duplex.cz</a>";
		if((pointer = document.getElementById('lightlink64'))) pointer.link = "<br><a href='http://www.hd-fashion.cz/' target='_blank'> </a>";
		if((pointer = document.getElementById('lightlink65'))) pointer.link = "<br><a href='http://www.laprovence.cz/' target='_blank'> </a>";
		if((pointer = document.getElementById('lightlink66'))) pointer.link = "<br><a href='http://www.fandime.cz/' target='_blank'>www.fandime.cz</a>";
		if((pointer = document.getElementById('lightlink67'))) pointer.link = "<br><a href='http://www.mecca.cz/' target='_blank'>www.mecca.cz</a>";
		if((pointer = document.getElementById('lightlink68'))) pointer.link = "<br><a href='http://www.bluesystem.cz/hosting/rafty/' target='_blank'>www.bluesystem.cz/hosting/rafty/</a>";
		if((pointer = document.getElementById('lightlink69'))) pointer.link = "<br><a href='http://www.ubuldoka.cz/' target='_blank'>www.ubuldoka.cz</a>";
		if((pointer = document.getElementById('lightlink70'))) pointer.link = "<br><a href='http://www.danone.cz/' target='_blank'>www.danone.cz</a>";
		if((pointer = document.getElementById('lightlink71'))) pointer.link = "<br><a href='http://www.snked.cz/' target='_blank'>www.snked.cz</a>";
		if((pointer = document.getElementById('lightlink72'))) pointer.link = "<br><a href='http://www.usbsp.cz/' target='_blank'>www.usbsp.cz</a>";
		if((pointer = document.getElementById('lightlink73'))) pointer.link = "<br><a href='http://www.bestdevelopment.cz/' target='_blank'>www.bestdevelopment.cz</a>";
		if((pointer = document.getElementById('lightlink74'))) pointer.link = "<br><a href='http://www.tatiana.cz/' target='_blank'>www.tatiana.cz</a>";
		if((pointer = document.getElementById('lightlink75'))) pointer.link = "<br><a href='http://www.reiffeisen.cz/' target='_blank'>www.reiffeisen.cz</a>";
		if((pointer = document.getElementById('lightlink76'))) pointer.link = "<br><a href='http://www.rozdelovace.cz/' target='_blank'>www.rozdelovace.cz</a>";
		if((pointer = document.getElementById('lightlink77'))) pointer.link = "<br><a href='http://www.centrumparfemu.cz/' target='_blank'>www.centrumparfemu.cz</a>";
		if((pointer = document.getElementById('lightlink78'))) pointer.link = "<br><a href='http://www.fandime.cz/' target='_blank'>www.fandime.cz</a>";
		if((pointer = document.getElementById('lightlink79'))) pointer.link = "<br><a href='http://www.emart.cz/' target='_blank'>www.emart.cz</a>";
		if((pointer = document.getElementById('lightlink80'))) pointer.link = "<br><a href='http://www.nakupzde.cz/' target='_blank'>www.nakupzde.cz</a>";
		if((pointer = document.getElementById('lightlink81'))) pointer.link = "<br><a href='http://www.egeografie.cz/' target='_blank'>www.egeografie.cz</a>";
		if((pointer = document.getElementById('lightlink82'))) pointer.link = "<br><a href='http://www.rocenkaunievydavatelu.cz/' target='_blank'>www.rocenkaunievydavatelu.cz</a>";
		if((pointer = document.getElementById('lightlink83'))) pointer.link = "<br><a href='http://www.rocenkaunievydavatelu.cz/2008/' target='_blank'>www.rocenkaunievydavatelu.cz</a>";
		if((pointer = document.getElementById('lightlink84'))) pointer.link = "<br><a href='http://www.pneuklik.cz/' target='_blank'>www.penuklik.cz</a>";
		if((pointer = document.getElementById('lightlink85'))) pointer.link = "<br><a href='http://www.cermat.cz/' target='_blank'>www.cermat.cz</a>";
		if((pointer = document.getElementById('lightlink86'))) pointer.link = "<br><a href='http://www.finclub.cz/' target='_blank'>www.finclub.cz</a>";
		if((pointer = document.getElementById('lightlink87'))) pointer.link = "<br><a href='http://www.finclub.eu/' target='_blank'>www.finclub.eu</a>";
		if((pointer = document.getElementById('lightlink88'))) pointer.link = "<br><a href='http://eshop.finclub.cz/' target='_blank'>eshop.finclub.cz</a>";
        if((pointer = document.getElementById('lightlink89'))) pointer.link = "<br><a href='http://www.dobravina.cz/' target='_blank'>www.dobravina.cz</a>";
		if((pointer = document.getElementById('lightlink90'))) pointer.link = "<br><a href=''> </a>";
		if((pointer = document.getElementById('lightlink91'))) pointer.link = "<br><a href=''> </a>";
		if((pointer = document.getElementById('lightlink92'))) pointer.link = "<br><a href=''> </a>";
		if((pointer = document.getElementById('lightlink93'))) pointer.link = "<br><a href=''> </a>";
		if((pointer = document.getElementById('lightlink94'))) pointer.link = "<br><a href='http://www.dejtonej.cz/' target='_blank'>www.DejToNej.cz</a>";
		if((pointer = document.getElementById('lightlink95'))) pointer.link = "<br><a href='http://www.bluesystem.cz/hosting/g5plus/'  target='_blank'>www.bluesystem.cz/hosting/g5plus/</a>";
		if((pointer = document.getElementById('lightlink96'))) pointer.link = "<br><a href='http://www.bluesystem.cz/hosting/generali/index.htm' target='_blank'>www.bluesystem.cz/hosting/generali/index.htm</a>";
		if((pointer = document.getElementById('lightlink97'))) pointer.link = "<br><a href=''> </a>";
		if((pointer = document.getElementById('lightlink98'))) pointer.link = "<br><a href='http://www.bluesystem.cz/hosting/kudyn/' target='_blank'>www.bluesystem.cz/hosting/kudyn/</a>";
		if((pointer = document.getElementById('lightlink99'))) pointer.link = "<br><a href='http://www.bluesystem.cz/hosting/lillou/index_cz.htm' target='_blank'>www.bluesystem.cz/hosting/lillou/index_cz.htm</a>";
		if((pointer = document.getElementById('lightlink100'))) pointer.link = "<br><a href='http://www.novamaturita.cz/' target='_blank'>www.novamaturita.cz</a>";
	}
}


$(document).ready(function(){

	set_links(); 

// Offering a Custom Alias suport - More info: http://docs.jquery.com/Plugins/Authoring#Custom_Alias
(function($) {
	/**
	 * $ is an alias to jQuery object
	 *
	 */
	 
	$.fn.lightBox = function(settings) {
		// Settings to configure the jQuery lightBox plugin how you like
		settings = jQuery.extend({
			// Configuration related to overlay
			overlayBgColor: 		'#000',		// (string) Background color to overlay; inform a hexadecimal value like: #RRGGBB. Where RR, GG, and BB are the hexadecimal values for the red, green, and blue values of the color.
			overlayOpacity:			0.8,		// (integer) Opacity value to overlay; inform: 0.X. Where X are number from 0 to 9
			// Configuration related to images
			imageLoading:			'/images/loading.gif',		// (string) Path and the name of the loading icon
			imageBtnPrev:			'/images/prevlabel.png',			// (string) Path and the name of the prev button image
			imageBtnNext:			'/images/nextlabel.png',			// (string) Path and the name of the next button image
			imageBtnClose:			'/images/closelabel.png',		// (string) Path and the name of the close btn
			// Configuration related to container image box
			containerBorderSize:	10,			// (integer) If you adjust the padding in the CSS for the container, #lightbox-container-image-box, you will need to update this value
			containerResizeSpeed:	400,		// (integer) Specify the resize duration of container image. These number are miliseconds. 400 is default.
			// Configuration related to texts in caption. For example: Image 2 of 8. You can alter either "Image" and "of" texts.
			txtImage:				'Obrázek',	// (string) Specify text "Image"
			txtOf:					'ze',		// (string) Specify text "of"
			// Don´t alter these variables in any way
			imageArray:				[],
			activeImage:			0
		},settings);
		// Caching the jQuery object with all elements matched
		var jQueryMatchedObj = this; // This, in this context, refer to jQuery object
		/**
		 * Initializing the plugin calling the start function
		 *
		 * @return boolean false
		 */
		function _initialize() {
			_start(this,jQueryMatchedObj); // This, in this context, refer to object (link) which the user have clicked
			return false; // Avoid the browser following the link
		}
		/**
		 * Start the jQuery lightBox plugin
		 *
		 * @param object objClicked The object (link) whick the user have clicked
		 * @param object jQueryMatchedObj The jQuery object with all elements matched
		 */
		 
		function _start(objClicked,jQueryMatchedObj) {
			// Hime some elements to avoid conflict with overlay in IE. These elements appear above the overlay.
			$('embed, object, select').hide();
			// Call the function to create the markup structure; style some elements; assign events in some elements.
			_set_interface();
			// Unset total images in imageArray
			settings.imageArray.length = 0;
			// Unset image active information
			settings.activeImage = 0;
			// We have an image set? Or just an image? Let´s see it.
			if ( jQueryMatchedObj.length == 1 ) {
				// Add an Array, with href and title atributes, inside the Array that storage the images references
				settings.imageArray.push(new Array(jQueryMatchedObj.attr('href'),jQueryMatchedObj.attr('title'),jQueryMatchedObj.getAttribute('id')));
			} else {
				// Add an Array (as many as we have), with href and title atributes, inside the Array that storage the images references		
				for ( var i = 0; i < jQueryMatchedObj.length; i++ ) {
					settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title'),jQueryMatchedObj[i].getAttribute('id')));
				}
			}
			// In some cases IE get the full path and in another get just the relative path. So, use match to verify is better instead the operator !=
			while ( !settings.imageArray[settings.activeImage][0].match(objClicked.getAttribute('href')) ) {
				settings.activeImage++;
			}
			// Call the function that prepares image exibition
			_set_image_to_view();
		}
		/**
		 * Create the jQuery lightBox plugin interface
		 *
		 * The HTML markup will be like that:
			<div id="jquery-overlay"></div>
			<div id="jquery-lightbox">
				<div id="lightbox-container-image-box">
					<div id="lightbox-container-image">
						<img src="../fotos/XX.jpg" id="lightbox-image">
						<div id="lightbox-nav">
							<a href="#" id="lightbox-nav-btnPrev"></a>
							<a href="#" id="lightbox-nav-btnNext"></a>
						</div>
						<div id="lightbox-loading">
							<a href="#" id="lightbox-loading-link">
								<img src="../images/lightbox-ico-loading.gif">
							</a>
						</div>
					</div>
				</div>
				<div id="lightbox-container-image-data-box">
					<div id="lightbox-container-image-data">
						<div id="lightbox-image-details">
							<span id="lightbox-image-details-caption"></span>
							<span id="lightbox-image-details-currentNumber"></span>
						</div>
						<div id="lightbox-secNav">
							<a href="#" id="lightbox-secNav-btnClose">
								<img src="../images/lightbox-btn-close.gif">
							</a>
						</div>
					</div>
				</div>
			</div>
		 *
		 */
		function _set_interface() {
			// Apply the HTML markup into body tag
			$('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="' + settings.imageLoading + '"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="' + settings.imageBtnClose + '"></a></div></div></div></div>');	
			// Get page sizes
			var arrPageSizes = ___getPageSize();
			// Style overlay and show it
			$('#jquery-overlay').css({
				backgroundColor:	settings.overlayBgColor,
				opacity:			settings.overlayOpacity,
				width:				arrPageSizes[0],
				height:				arrPageSizes[1]
			}).fadeIn();
			// Get page scroll
			var arrPageScroll = ___getPageScroll();
			// Calculate top and left offset for the jquery-lightbox div object and show it
			$('#jquery-lightbox').css({
				top:	arrPageScroll[1] + (arrPageSizes[3] / 10),
				left:	arrPageScroll[0]
			}).show();
			// Assigning click events in elements to close overlay
			$('#jquery-overlay,#jquery-lightbox').click(function() {
				_finish();									
			});
			// Assign the _finish function to lightbox-loading-link and lightbox-secNav-btnClose objects
			$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function() {
				_finish();
				return false;
			});
			// If window was resized, calculate the new overlay dimensions
			$(window).resize(function() {
				// Get page sizes
				var arrPageSizes = ___getPageSize();
				// Style overlay and show it
				$('#jquery-overlay').css({
					width:		arrPageSizes[0],
					height:		arrPageSizes[1]
				});
				// Get page scroll
				var arrPageScroll = ___getPageScroll();
				// Calculate top and left offset for the jquery-lightbox div object and show it
				$('#jquery-lightbox').css({
					top:	arrPageScroll[1] + (arrPageSizes[3] / 10),
					left:	arrPageScroll[0]
				});
			});
		}
		/**
		 * Prepares image exibition; doing a image´s preloader to calculate it´s size
		 *
		 */
		function _set_image_to_view() { // show the loading
			// Show the loading
			$('#lightbox-loading').show();
			// Hide some elements
			$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();
			// Image preload process
			var objImagePreloader = new Image();
			objImagePreloader.onload = function() {
				$('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);
				// Perfomance an effect in the image container resizing it
				_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);
				//	clear onLoad, IE behaves irratically with animated gifs otherwise
				objImagePreloader.onload=function(){};
			}
			objImagePreloader.src = settings.imageArray[settings.activeImage][0];
		};
		/**
		 * Perfomance an effect in the image container resizing it
		 *
		 * @param integer intImageWidth The image´s width that will be showed
		 * @param integer intImageHeight The image´s height that will be showed
		 */
		function _resize_container_image_box(intImageWidth,intImageHeight) {
			// Get current width and height
			var intCurrentWidth = $('#lightbox-container-image-box').width();
			var intCurrentHeight = $('#lightbox-container-image-box').height();
			// Get the width and height of the selected image plus the padding
			var intWidth = (intImageWidth + (settings.containerBorderSize * 2)); // Plus the image´s width and the left and right padding value
			var intHeight = (intImageHeight + (settings.containerBorderSize * 2)); // Plus the image´s height and the left and right padding value
			// Diferences
			var intDiffW = intCurrentWidth - intWidth;
			var intDiffH = intCurrentHeight - intHeight;
			// Perfomance the effect
			$('#lightbox-container-image-box').animate({ width: intWidth, height: intHeight },settings.containerResizeSpeed,function() { _show_image(); });
			if ( ( intDiffW == 0 ) && ( intDiffH == 0 ) ) {
				if ( $.browser.msie ) {
					___pause(250);
				} else {
					___pause(100);	
				}
			}
			$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({ height: intImageHeight + (settings.containerBorderSize * 2) }); 
			$('#lightbox-container-image-data-box').css({ width: intImageWidth });
		};
		/**
		 * Show the prepared image
		 *
		 */
		function _show_image() {
			$('#lightbox-loading').hide();
			$('#lightbox-image').fadeIn(function() {
				_show_image_data();
				_set_navigation();
			});
			_preload_neighbor_images();
		};
		/**
		 * Show the image information
		 *
		 */
		function _show_image_data() {
			$('#lightbox-container-image-data-box').slideDown('fast');
			$('#lightbox-image-details-caption').hide();
			if ( settings.imageArray[settings.activeImage][1] ) {
				//alert(settings.imageArray[settings.activeImage][2]);
				//var link = settings.imageArray[settings.activeImage][1] + document.getElementById("lightlink"+(settings.activeImage+1)).link;
				var link = settings.imageArray[settings.activeImage][1] + document.getElementById(settings.imageArray[settings.activeImage][2]).link;
				$('#lightbox-image-details-caption').html(link).show();
				//$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();
			}
			// If we have a image set, display 'Image X of X'
			if ( settings.imageArray.length > 1 ) {
				$('#lightbox-image-details-currentNumber').html(settings.txtImage + ' ' + ( settings.activeImage + 1 ) + ' ' + settings.txtOf + ' ' + settings.imageArray.length).show();
			}		
		}
		/**
		 * Display the button navigations
		 *
		 */
		function _set_navigation() {
			$('#lightbox-nav').show();
			
			// Show the prev button, if not the first image in set
			if ( settings.activeImage != 0 ) {
				// Show the images button for Next buttons
				$('#lightbox-nav-btnPrev').unbind().hover(function() {
					$(this).css({ 'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' });
				},function() {
					$(this).css({ 'background' : 'transparent url(___just-anything-here.gif) no-repeat' });
				}).show().bind('click',function() {
					settings.activeImage = settings.activeImage - 1;
					_set_image_to_view();
					return false;
				});
			}
			
			// Show the next button, if not the last image in set
			if ( settings.activeImage != ( settings.imageArray.length -1 ) ) {
				// Show the images button for Next buttons
				$('#lightbox-nav-btnNext').unbind().hover(function() {
					$(this).css({ 'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat' });
				},function() {
					$(this).css({ 'background' : 'transparent url(___just-anything-here.gif) no-repeat' });
				}).show().bind('click',function() {
					settings.activeImage = settings.activeImage + 1;
					_set_image_to_view();
					return false;
				});
			}
		}
		/**
		 * Preload prev and next images being showed
		 *
		 */
		function _preload_neighbor_images() {
			if ( (settings.imageArray.length -1) > settings.activeImage ) {
				objNext = new Image();
				objNext.src = settings.imageArray[settings.activeImage + 1][0];
			}
			if ( settings.activeImage > 0 ) {
				objPrev = new Image();
				objPrev.src = settings.imageArray[settings.activeImage -1][0];
			}
		}
		/**
		 * Remove jQuery lightBox plugin HTML markup
		 *
		 */
		function _finish() {
			$('#jquery-lightbox').remove();
			$('#jquery-overlay').fadeOut(function() { $('#jquery-overlay').remove(); });
			// Show some elements to avoid conflict with overlay in IE. These elements appear above the overlay.
			$('embed, object, select').show();
		}
		/**
		 / THIRD FUNCTION
		 * getPageSize() by quirksmode.com
		 *
		 * @return Array Return an array with page width, height and window width, height
		 */
		function ___getPageSize() {
			var xScroll, yScroll;
			if (window.innerHeight && window.scrollMaxY) {	
				xScroll = window.innerWidth + window.scrollMaxX;
				yScroll = window.innerHeight + window.scrollMaxY;
			} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
				xScroll = document.body.scrollWidth;
				yScroll = document.body.scrollHeight;
			} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
				xScroll = document.body.offsetWidth;
				yScroll = document.body.offsetHeight;
			}
			var windowWidth, windowHeight;
			if (self.innerHeight) {	// all except Explorer
				if(document.documentElement.clientWidth){
					windowWidth = document.documentElement.clientWidth; 
				} else {
					windowWidth = self.innerWidth;
				}
				windowHeight = self.innerHeight;
			} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
				windowWidth = document.documentElement.clientWidth;
				windowHeight = document.documentElement.clientHeight;
			} else if (document.body) { // other Explorers
				windowWidth = document.body.clientWidth;
				windowHeight = document.body.clientHeight;
			}	
			// for small pages with total height less then height of the viewport
			if(yScroll < windowHeight){
				pageHeight = windowHeight;
			} else { 
				pageHeight = yScroll;
			}
			// for small pages with total width less then width of the viewport
			if(xScroll < windowWidth){	
				pageWidth = xScroll;		
			} else {
				pageWidth = windowWidth;
			}
			arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
			return arrayPageSize;
		};
		/**
		 / THIRD FUNCTION
		 * getPageScroll() by quirksmode.com
		 *
		 * @return Array Return an array with x,y page scroll values.
		 */
		function ___getPageScroll() {
			var xScroll, yScroll;
			if (self.pageYOffset) {
				yScroll = self.pageYOffset;
				xScroll = self.pageXOffset;
			} else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
				yScroll = document.documentElement.scrollTop;
				xScroll = document.documentElement.scrollLeft;
			} else if (document.body) {// all other Explorers
				yScroll = document.body.scrollTop;
				xScroll = document.body.scrollLeft;	
			}
			arrayPageScroll = new Array(xScroll,yScroll) 
			return arrayPageScroll;
		};
		 /**
		  * Stop the code execution from a escified time in milisecond
		  */
		 function ___pause(ms) {
			var date = new Date(); 
			curDate = null;
			do { var curDate = new Date(); }
			while ( curDate - date < ms);
		 };
		// Return the jQuery object for chaining
		return this.click(_initialize);
	};
})(jQuery); // Call and execute the function immediately passing the jQuery object


	$("#good-subpage > ul").tabs();
	
	//-------------------------------------------------
	// login
// 	$("#login").click(function () {
// 		if($(".login").css("display")=='none') {
// 			$(".login").slideDown("slow");
// 		} else {
// 			setTimeout('$(".login").slideUp("slow")',1000);
// 		}
//     return false;
//   });
  $("#login").mouseover(function () {
		$(".login").slideDown("fast");
  });
  $("#login").mouseout(function () {
  	$(".login").hover(
			function () {
      }, 
      function () {
        setTimeout('$(".login").slideUp("fast")',1000);
      }
		);
  });
  
	// nastavi vysku stranky
	function autoHeight() {
		var left = $('#left').height();
		var main = $('#main').height();
		var right = $('#right').height();
		var help;
		if(left > right) {
			help = left;
		} else {
			help = right;
		}
		//	alert('main: '+main+'| help: '+help);
		if(main < help) {
			var x = (help-main-50)+"px";
			$('#main').css("margin-bottom",x)
			//	$('#main').height(help);
		}
	}
	autoHeight();
	
	// funkce orderby
	$("#orderby").change(function () {
		var url = location.pathname + $(this).val();
		window.location.href = url;
	});
	$("#orderbysort").click(function () {
		var url = location.pathname + $(this).val();
		window.location.href = url;
	});
	// Lightbox
	$('a[@rel=lightbox]').lightBox();
	
	// dialog
	$('a[@rel=dialog]').dialog();

});
