function cameraDetect(message){if(message=='1'){$('#videoresponse_2 .videoresponse_select_webcam').show();$('#videoresponse_2 .videoresponse_select_offwebcam').hide()}else{$('#videoresponse_2 .videoresponse_select_offwebcam').show();$('#videoresponse_2 .videoresponse_select_webcam').hide()}}function recordingDone(){$('#videoresponse_4_webcam').hide();$('#videoresponse_5_ready').show();$('#js_submit_button input').get(0).disabled=false}function uploadVideoresponseFinished(){$('#videoresponse_4_file').hide();$('#videoresponse_5_ready').show();$('#js_submit_button input').get(0).disabled=false}$(document).click(function(e){var target=$(e.target);if(target.is('.js_comments_paging')){e.preventDefault();e.stopPropagation();$.get(target.attr('href'),function(data){$('#ajax_discussion_container').html(data)})}if(target.is('.js_comments_reply')){e.preventDefault();e.stopPropagation();var data=target.attr('rel').split('|');$('#ajax_discussion_parent_id').val(data[0]);$('#ajax_discussion_id').val(data[1]);$('#ajax_reply_to').html(data[2]);$('#ajax_reply').show();$('#ajax_discussion_body').focus()}if(target.is('.js_comments_delete')){e.preventDefault();e.stopPropagation();$.get(target.attr('href'),function(data){target.parents('.comment').html(data).parent().fadeOut(streamOptions.infoFadeOut)})}if(target.is('.js_comments_parent')){e.preventDefault();e.stopPropagation();$.get(target.attr('href'),function(data){target.removeClass('js_comments_parent').addClass('js_comments_parent_shown').parents('.comment').parent().append(data)})}if(target.is('.js_comments_parent_shown')){e.preventDefault();e.stopPropagation();$.get(target.attr('href'),function(data){target.removeClass('js_comments_parent_shown').addClass('js_comments_parent').parents('.comment').parent().children('.reaction').remove()})}if(target.is('.js_comments_rating img, .js_comments_rating span')){e.preventDefault();e.stopPropagation();$.get(target.parent().attr('href'),function(data){target.parent().parent().parent().html(data)})}if(target.is('.js_comments_lowq')){e.preventDefault();e.stopPropagation();target.hide().prev().show()}if(target.is('#videoresponse_1, #videoresponse_1 *')){e.preventDefault();e.stopPropagation();$('#videoresponse_2').show();$('#videoresponse_3_video, #videoresponse_3_webcam, #videoresponse_3_disc').hide();$('#js_submit_button input').get(0).disabled=true;$.get('/?m=upload&a=get_upload_cat_data',function(data){$('.js_category_list').html(data)})}if(target.is('#ajax_discussion_form span.videoresponse_close')){e.preventDefault();e.stopPropagation();target.parent().parent().hide();$('#js_videoresponse_id').val('');$('#js_submit_button input').get(0).disabled=false}if(target.is('.js_videoresponse_small_link')){e.preventDefault();e.stopPropagation();target.closest('.comment_video').hide().next().show()}if(target.is('.comment_player .videoresponse_close')){e.preventDefault();e.stopPropagation();target.closest('.comment_player').hide().prev().show()}if(target.is('.videoresponse_select_disc, .videoresponse_select_disc *')){e.preventDefault();e.stopPropagation();$('#videoresponse_2').hide();$('#videoresponse_3_disc').show()}if(target.is('#videoresponse_3_disc #js_submit_file')){e.preventDefault();e.stopPropagation();$.ajax({type:'POST',data:$('#videoresponse_3_disc :input').serialize(),success:function(data){var jData=$.evalJSON(data);if(jData.video_id>0){$('#js_submit_button input').get(0).disabled=true;$('#js_videoresponse_id').val(jData.video_id);$('#videoresponse_3_disc').hide();$('#videoresponse_4_file').show();$('#js_videoresponse_upload_form').attr('src','/?m=upload&a=upload_videoresponse_form&sid='+jData.sid)}else{alert('Buď nejsou vyplněna všechna povinná pole nebo nebyla zvolena žádná kategorie. Povinná pole jsou označena tučným názvem.')}},url:'/'})}if(target.is('.videoresponse_select_video, .videoresponse_select_video *')){e.preventDefault();e.stopPropagation();$('#videoresponse_2').hide();$.get('/?m=profile&a=get_user_video_list_ajax&page_user_id='+$('#js_user_id').attr('title')+'&videoresponse=1',function(data){$('#videoresponse_your_videos').html(data);$('#videoresponse_3_video').show()})}if(target.is('#videoresponse_your_videos .detail_video_one, #videoresponse_your_videos .detail_video_one *')){var tar=target.closest('.detail_video_one');if(tar.hasClass('videoresponse_selectedvideo')){tar.removeClass('videoresponse_selectedvideo');$('#js_videoresponse_id').val('');$('#videoresponse_your_selected_title').html('&mdash;');$('#js_submit_button input').get(0).disabled=true}else{tar.addClass('videoresponse_selectedvideo').siblings().removeClass('videoresponse_selectedvideo');$('#js_videoresponse_id').val(tar.find('.js_videoresponse_id').attr('title'));$('#videoresponse_your_selected_title').html(tar.find('.js_videoresponse_title').attr('title'));$('#js_submit_button input').get(0).disabled=false}}if(target.is('.videoresponse_select_webcam, .videoresponse_select_webcam *')){e.preventDefault();e.stopPropagation();$('#videoresponse_2').hide();$('#videoresponse_3_webcam').show()}if(target.is('#videoresponse_3_webcam #js_submit_file')){e.preventDefault();e.stopPropagation();$.ajax({type:'POST',data:$('#videoresponse_3_webcam :input').serialize(),success:function(data){var jData=$.evalJSON(data);if(jData.video_id>0){$('#js_submit_button input').get(0).disabled=true;$('#js_videoresponse_id').val(jData.video_id);camcorderFlashvars.rtmpTarget=jData.sid+'_X';$('#videoresponse_3_webcam').hide();$('#videoresponse_4_webcam').show();var cam=$('#camcorder');cam.flash({src:cam.attr('title'),width:'100%',height:'100%',name:'single',id:'single',allowscriptaccess:'always',allowfullscreen:'true',wmode:'transparent',flashvars:camcorderFlashvars}).attr('title','')}else{alert('Buď nejsou vyplněna všechna povinná pole nebo nebyla zvolena žádná kategorie. Povinná pole jsou označena tučným názvem.')}},url:'/'})}}).ready(function(e){var cam=$('#js_camtest');cam.flash({src:cam.attr('title'),width:'1',height:'1',name:'camdetect',id:'camdetect',allowscriptaccess:'always',allowfullscreen:'true',wmode:'transparent'}).attr('title','');$('#ajax_discussion_form').submit(function(e){e.preventDefault();e.stopPropagation();var $this=$(this);var sData=$this.serialize();var empty=/^\s*$/i;if(!empty.test($('#ajax_discussion_body').get(0).value)||$('#js_videoresponse_id').val()){$.post('/?m=discussion&a=validate_input_ajax',{body:$('#ajax_discussion_body').get(0).value},function(data){var vData=$.evalJSON(data);if(vData.status>0){alert(vData.msg)}else{$('#js_comment_loader').show();$('#js_submit_button').hide();$.post($this.attr('action'),sData,function(data){$('#ajax_discussion_container').html(data);$('#ajax_discussion_parent_id').val('');$('#ajax_discussion_body').val('');$('#ajax_reply').hide();$('#js_comment_loader').hide();$('#js_submit_button').show();$('#js_videoresponse_id').val('');$('.videoresponse_form').hide();countCommentChars()},'html')}})}});$('#ajax_discussion_body').focus(function(e){this.charTimer=setInterval('countCommentChars();',250)}).blur(function(e){if(this.charTimer){clearInterval(this.charTimer)}});countCommentChars()});function countCommentChars(){if($('#ajax_discussion_body').get(0)){var chCount=streamOptions.maxChars-$('#ajax_discussion_body').get(0).value.length;$('#js_comment_char_count').html(chCount);if(chCount<0){$('#js_submit_button').hide();$('#js_comment_warning').show()}else{$('#js_submit_button').show();$('#js_comment_warning').hide()}}}