$(document).ready(
	function()
	{
		
		
		
	 	
	 	
	 	$("a.linkDeleteVideo").live("click", function(){
	 		
	 		var idVideo = $(this).attr("id");
	 		idVideo = idVideo.replace("deleteVideo","");


	 		utils.confirmBox( 
					"Confirma a exclusão do vídeo?",
					{
						buttons: {
							'Sim': function() {

									$.post("/video/remove-video/videoId/"+idVideo, { 		
										
										title: idVideo 
									},
				
									function(json){
										
										if (json.error)
										{
											utils.messageBox(json.error);
											return false;
										}
										else
										{
										
							   				msg = json.msg;
							   	        	$.ajax({
							   					url: "/profile/video-gallery-snippet/uid/"+uid+"?page="+videosPage ,
							   					cache: false,
							   					success: function(html){
							   					$("#tab-videos").html(html);
							   					}
							   				});
				
									 	}
							   			 
										//utils.messageBox(msg);
				
									}, "json"
				
								);

						
								$("#dialogConfirm").dialog('close');
							},
								
							'Não': function() {
								$(this).dialog('close');
							}
						}
					}
			);
		return false;
	 	});
	 	
	 	
		
		
		$('.deletePodcast').live(
			'click', 
			function(e){
				var url = $(this).attr('href');
				utils.confirmBox(
					'Confirma exclusão do podcast?',
					{
						buttons:
						{
							'Sim': function() {
								var config = {
								    url: url,
								    success:
									    function(json)
									    {
											if(json.error)
											{
												utils.messageBox(json.error);
											}else{
												$('#lista-podcasts').html(json.podcastList);
											}
									    },
								    dataType: 'json'
								}
								$.ajax(config);
								$(this).dialog('close');
							},
							'Não': function() {
								$(this).dialog('close');
							}
						}
					}
				);
				return false;
			}
		);
		
		$('input#publicarMsg').click(function(){
			var mensagem = $('input#pensando-agora').val();
			mensagem = mensagem.replace(/<[^>]+>/g, '<->');
			$('input#pensando-agora').attr('value',mensagem);
		});
	}
);
