var result_popup = '';
	        jQuery(document).ready(function(){
			jQuery('body').append('<div class="jqmWindow" id="popup-results"></div><div class="jqmWindow" id="popup-question"></div>');
			jQuery('#popup-facebook').html('<div id="content" class="popup"><div class="fb-like" data-href="http://www.osobniasistentka.cz" data-send="true" data-width="450" data-show-faces="true" data-font="arial"></div></div>')
			jQuery('#content.hp .test .questions .question').hover(function() {
				jQuery(this).addClass('hover');
			}, function() {
				jQuery(this).removeClass('hover');
			});
			
			if (jQuery('.slideshow').length)
			jQuery('.slideshow').before('<div class="nav">').cycle({
				fx:     'fade',
				speed: 700,
				timeout: 7000,
				pager:  '.nav',
				cleartype: true,
				cleartypeNoBg: true
			});
			jQuery('.question').click(function() {
				jQuery(this).toggleClass('selected');
			});

			// height of HP columns
			var h = 0;
			jQuery('.hp .column-wrapper .column a.more').each(function() {
				var this_h = jQuery(this).parents('.column').height();
				if (this_h > h) h = this_h;
			});
			jQuery('.hp .column-wrapper .column a.more').each(function() {
				var this_h = jQuery(this).parents('.column').height();
				if (this_h < h) jQuery(this).css({marginTop: (8+h-this_h)+'px'});
			});

			jQuery('#content.hp .test a.results').click(function() {
				var c_selected = jQuery('#content.hp .test .questions .selected').length;
				if (c_selected > 0) jQuery('#popup-results').jqm({ajax: this_url+'/popup-vysledky-dotazniku/'});
				else jQuery('#popup-results').jqm({ajax: this_url+'/popup-prazdny-dotaznik/'});
				jQuery('#popup-results').jqmShow();
				return false;
			});
			
			var open_contact = function(hash){ hash.w.show(); };
			var myLoad = function(hash){
				//jQuery('form',hash.w).ajaxForm();

			jQuery(function() {
				try {
					if (typeof _wpcf7 == 'undefined' || _wpcf7 === null)
						_wpcf7 = {};

					_wpcf7 = jQuery.extend({ cached: 0 }, _wpcf7);

					jQuery('div.wpcf7 > form').ajaxForm({
						beforeSubmit: function(formData, jqForm, options) {
							jqForm.wpcf7ClearResponseOutput();
							jqForm.find('img.ajax-loader').css({ visibility: 'visible' });
							return true;
						},
						beforeSerialize: function(jqForm, options) {
							jqForm.find('.wpcf7-use-title-as-watermark.watermark').each(function(i, n) {
								jQuery(n).val('');
							});
							return true;
						},
						data: { '_wpcf7_is_ajax_call': 1 },
						dataType: 'json',
						success: function(data) {
							var ro = jQuery(data.into).find('div.wpcf7-response-output');
							jQuery(data.into).wpcf7ClearResponseOutput();

							if (data.invalids) {
								jQuery.each(data.invalids, function(i, n) {
									jQuery(data.into).find(n.into).wpcf7NotValidTip(n.message);
								});
								ro.addClass('wpcf7-validation-errors');
							}

							if (data.captcha)
								jQuery(data.into).wpcf7RefillCaptcha(data.captcha);

							if (data.quiz)
								jQuery(data.into).wpcf7RefillQuiz(data.quiz);

							if (1 == data.spam)
								ro.addClass('wpcf7-spam-blocked');

							if (1 == data.mailSent) {
								jQuery(data.into).find('form').resetForm().clearForm();
								ro.addClass('wpcf7-mail-sent-ok');

								if (data.onSentOk)
									jQuery.each(data.onSentOk, function(i, n) { eval(n) });
							} else {
								ro.addClass('wpcf7-mail-sent-ng');
							}

							if (data.onSubmit)
								jQuery.each(data.onSubmit, function(i, n) { eval(n) });

							jQuery(data.into).find('.wpcf7-use-title-as-watermark.watermark').each(function(i, n) {
								jQuery(n).val(jQuery(n).attr('title'));
							});

							ro.append(data.message).slideDown('fast');
						}
					});

					jQuery('div.wpcf7 > form').each(function(i, n) {
						if (_wpcf7.cached)
							jQuery(n).wpcf7OnloadRefill();

						jQuery(n).wpcf7ToggleSubmit();

						jQuery(n).find('.wpcf7-acceptance').click(function() {
							jQuery(n).wpcf7ToggleSubmit();
						});

						jQuery(n).find('.wpcf7-exclusive-checkbox').each(function(i, n) {
							jQuery(n).find('input:checkbox').click(function() {
								jQuery(n).find('input:checkbox').not(this).removeAttr('checked');
							});
						});

						jQuery(n).find('.wpcf7-use-title-as-watermark').each(function(i, n) {
							var input = jQuery(n);
							input.val(input.attr('title'));
							input.addClass('watermark');

							input.focus(function() {
								if (jQuery(this).hasClass('watermark'))
									jQuery(this).val('').removeClass('watermark');
							});

							input.blur(function() {
								if ('' == jQuery(this).val())
									jQuery(this).val(jQuery(this).attr('title')).addClass('watermark');
							});
						});
					});

				} catch (e) {
				}
			});


			};

			jQuery('#popup-question').jqm({ajax: this_url+'/popup-mate-dotaz/', trigger: '#testimonials #contact a.contact', onShow: open_contact, onLoad:myLoad});
			var open_facebook = function(hash){ hash.w.show();hash.w.css({visibility: 'visible'}); };
			jQuery('#popup-facebook').jqm({ trigger: '#box a.facebooklike', onShow:open_facebook});

        });

