$(document).ready(function()
{
	lang = {
		cs: { print: "Vytisknout" },
		en: { print: "Print" }
	};
	langcode = $("html").attr("xml:lang");
	if(lang[langcode] == undefined) langcode = 'en';
	$(".jshook-print").append('<a href="#" onclick="window.print(); return false;" class="print">' + lang[langcode]["print"] + '</a>');

	// Init pdBox
	$('.thickbox').pdBox({minWidth: 400});

	$('#product-menu-home li').hover(function(){
		$(this).addClass('hover');
		// $('.sub-desc', this).fadeIn(500);
	}, function(){
		var that = $(this);
		var timeout = setTimeout(function(){ /*$('.sub-desc', that).fadeOut(500);*/ $(that).removeClass('hover');  }, 200);
		// $('.sub-desc', this).fadeOut(500);

	});

	$('.courses-sort-bar').each(function(){
        $(':submit', this).hide();
        $(':radio', this).click(function(){
            //alert('jj');
            $(this).parents('form').submit();
        });
    });
    
    $('#person_count').change(function(){
		if ( $(this).attr('value')=='0' || $(this).attr('value')=='' ) {
			$(this).attr('value', '1');
		}
		$('#accomodation_people_count').attr('value', $(this).attr('value'));
	});
	$('#ubytovani').each(function(){
		var $this = $(this).parent().parent();
		if ( $(this).attr('checked')==false ) {
			$('.hide', $this).hide();
		}
		$('#accomodation_people_count').attr('value', $('#person_count').attr('value'));
		$(this).click(function(){
			if ( $('.hide', $this).is(':hidden') ) {
				$('.hide', $this).slideDown('fast');
			}
			else {
				$('.hide', $this).slideUp('fast');
			}
		});
	});
    
	$('#prihlaska').each(function(){
		var $this = $(this);
		
		$('.tabs li', $this).each(function(){
			if ( $('.JShelp', this).attr('checked')==false ){
				$('.hide', this).hide();
			}
			else {
				$(this).addClass('ui-tabs-selected');				
			}
			$('.JShelp', this).parent().click(function(){
				$('.hide', $this).hide();
				$('li', $this).removeClass('ui-tabs-selected');
				$('#'+$(this).attr('class')).show();
				$(this).parent().addClass('ui-tabs-selected');
			});
		});
		
		
		if ( $('#form_select2', $this).is(':checked') ){
			$('.price span', $this).html($('#person_count', $this).attr('value') * parseInt($('#formPriceDVPP', $this).attr('value').split(',-')[0].replace(' ', ''))+',- Kč');
		}
		else {
			$('.price span', $this).html($('#person_count', $this).attr('value') * parseInt($('#formPriceDPH', $this).attr('value').split(',-')[0].replace(' ', ''))+',- Kč vč. DPH');
		}
		$('#person_count').change(function(){
			if ( $('#form_select2', $this).attr('checked')==true ){
				$('.price span', $this).html($('#person_count', $this).attr('value') * parseInt($('#formPriceDVPP', $this).attr('value').split(',-')[0].replace(' ', ''))+',- Kč');
			}
			else {
				$('.price span', $this).html($('#person_count', $this).attr('value') * parseInt($('#formPriceDPH', $this).attr('value').split(',-')[0].replace(' ', ''))+',- Kč vč. DPH');
			}
		});
		$('#form_select2').click(function(){
			$('.price span', $this).html($('#person_count', $this).attr('value') * parseInt($('#formPriceDVPP', $this).attr('value').split(',-')[0].replace(' ', ''))+',- Kč');
		});						
		$('#form_select3, #form_select1').click(function(){
			$('.price span', $this).html($('#person_count', $this).attr('value') * parseInt($('#formPriceDPH', $this).attr('value').split(',-')[0].replace(' ', ''))+',- Kč vč. DPH');
		});						
	});

    
}
);// JavaScript Document
