var agregarTema = function(){
	new Ajax.Updater('tabla_resultados','../lib_2.0/ajax/agregarTema.php', {
						  		method: 'post',
						  		insertion: Insertion.Top,
						    	parameters: {
						  		referencia : $F('referencia'),
						  		},
								onSuccess: function(transport){
					      			var response = transport.responseText || "no response text";
			   				 	},
							 	//onLoading: function(transport) {
								//	$('tabla_resultados').innerHTML = "<img src='../lib_2.0/img/ajax-loader.gif' align='absmiddle' /> Procesando ...";
								//},      	
								onFailure: function(){
									alerta('Error al gestionar la informacion: Consulte a servicio tecnico')
								},
		    	 	
						insertion: Insertion.Before

					});
		 	}
		 	
		 	
		 	
function editarTema(id){
	new Ajax.Updater('titulo_'+id,'../lib_2.0/ajax/editarTema.php', {
						  		method: 'post',
						  		parameters: {
						    	id : id,
						  		referencia : $F('referencia_'+id),
								},
								onSuccess: function(transport){
					      			var response = transport.responseText || "no response text";
			   				 	},
							 	onLoading: function(transport) {
									$('titulo_'+id).innerHTML = "<img src='../lib_2.0/img/ajax-loader.gif' align='absmiddle' /> Procesando ...";
								},      	
								onFailure: function(){
									alerta('Error al gestionar la informacion: Consulte a servicio tecnico')
								},
		    	 	
						
					});
		 	}		 	
		 	

		 	
function eliminarTema(id){
			
	
	Dialog.confirm("<br><img src='img/alert-icon.jpg' align='absmiddle' style='height:28px; width:28px; margin o auto;'/> Esta seguro de eliminar este tema<br>",
 			{
 				className: "alphacube",
 				width:450,
 				height:100,
 				okLabel: "Si",
 				id: "myDialogId",
 				cancel:function(win)
 					{
 						debug("cancel confirm panel")
 					},
 				ok:function(win)
 					{  
	
	
	new Ajax.Updater('renglon_'+id,'../lib_2.0/ajax/eliminarTema.php', {
						  		method: 'post',
						  		parameters: {
						    	id : id,
								},
								onSuccess: function(transport){
					      			var response = transport.responseText || "no response text";
					      			Effect.Puff('renglon_'+id);
			   				 	},
							 	onLoading: function(transport) {
									$('renglon_'+id).innerHTML = "<img src='../lib_2.0/img/ajax-loader.gif' align='absmiddle' /> Procesando ...";
								},      	
								onFailure: function(){
									alerta('Error al gestionar la informacion: Consulte a servicio tecnico')
 			}

 			
						});
						return true;
 					}
	 	
	});
} 			
		 	

var agregarMensaje = function(){
	new Ajax.Updater('tabla_resultados','../lib_2.0/ajax/agregarMensaje.php', {
						  		method: 'post',
						  		insertion: Insertion.Top,
						    	parameters: {
						  		nota : $F('nota'),
						  		id_tema : $F('id_tema'),
						  		id_suscripto : $F('id_suscripto'),
						  		youtube_url : $F('youtube_url'),
								},
								onSuccess: function(transport){
					      			var response = transport.responseText || "no response text";
			   				 	},
							 	//onLoading: function(transport) {
								//	$('tabla_resultados').innerHTML = "<img src='../lib_2.0/img/ajax-loader.gif' align='absmiddle' /> Procesando ...";
								//},      	
								onFailure: function(){
									alerta('Error al gestionar la informacion: Consulte a servicio tecnico')
								},
		    	 	
						insertion: Insertion.Before

					});
		 	}		 	
		 	
		 	
function editarMensaje(id){
	new Ajax.Updater('titulo_'+id,'../lib_2.0/ajax/editarMensaje.php', {
						  		method: 'post',
						  		parameters: {
						    	id : id,
						  		nota : $F('nota_'+id),
						  		id_tema : $F('id_tema_'+id),
						  		youtube_url : $F('youtube_url_'+id),
								},
								onSuccess: function(transport){
					      			var response = transport.responseText || "no response text";
			   				 	},
							 	onLoading: function(transport) {
									$('titulo_'+id).innerHTML = "<img src='../lib_2.0/img/ajax-loader.gif' align='absmiddle' /> Procesando ...";
								},      	
								onFailure: function(){
									alerta('Error al gestionar la informacion: Consulte a servicio tecnico')
								},
		    	 	
						
					});
		 	}

		 	
 	function actualizarEstadoMensaje(estado,id){
		
	new Ajax.Updater('estado_'+id,'../lib_2.0/ajax/actualizarEstadoMensaje.php', {
						  		method: 'post',
						  		parameters: {
						    	estado : estado,
						    	id : id,
								},
								onSuccess: function(transport){
					      			var response = transport.responseText || "no response text";
			   				 	},
							 	onLoading: function(transport) {
									$('estado_'+id).innerHTML = "<img src='../lib_2.0/img/ajax-loader.gif' align='absmiddle' /> Procesando ...";
								},      	
								onFailure: function(){
									alerta('Error al gestionar la informacion: Consulte a servicio tecnico')
								},
		    	 	
						
					});
				
		 	}

		 	
function eliminarMensaje(id){

			Dialog.confirm("<br><img src='img/alert-icon.jpg' align='absmiddle' style='height:28px; width:28px; margin o auto;'/> Esta seguro de eliminar este mensaje<br>",
 			{
 				className: "alphacube",
 				width:450,
 				height:100,
 				okLabel: "Si",
 				id: "myDialogId",
 				cancel:function(win)
 					{
 						debug("cancel confirm panel")
 					},
 				ok:function(win)
 					{    
			
	
						new Ajax.Updater('renglon_'+id,'../lib_2.0/ajax/eliminarMensaje.php', {
						  		method: 'post',
						  		parameters: {
						    	id : id,
								},
								onSuccess: function(transport){
					      			var response = transport.responseText || "no response text";
					      			Effect.Puff('renglon_'+id);
			   				 	},
							 	onLoading: function(transport) {
									$('renglon_'+id).innerHTML = "<img src='../lib_2.0/img/ajax-loader.gif' align='absmiddle' /> Procesando ...";
								},      	
								onFailure: function(){
									alerta('Error al gestionar la informacion: Consulte a servicio tecnico')
								}
		    	 	
						
						});
						return true;
 					}
	 	
	});
}


function agregarMensajeDesdeWeb(id) {
	
	new Ajax.Updater('mensaje_'+id,'../lib_2.0/ajax/agregarMensajeWeb.php', {
						  		method: 'post',
						    	parameters: {
						  		nota : $F('nota_'+id),
						  		id_tema : id,
						  		nombre : $F('nombre_'+id),
						  		apellido : $F('apellido_'+id),
						  		email : $F('email_'+id),
						  		},
								onSuccess: function(transport){
					      			var response = transport.responseText || "no response text";
					      			hidediv('muestro_'+id);
					      			
			   				 	},
							 	onLoading: function(transport) {
									$('mensaje_'+id).innerHTML = "<img src='../lib_2.0/img/ajax-loader.gif' align='absmiddle' /> Procesando ...";
								},      	
								onFailure: function(){
									alerta('Error al gestionar la informacion: Consulte a servicio tecnico')
								},
		    	 	
						

					});
}

/*
document.observe("dom:loaded", function() {
	new Ajax_upload('#button2', {
		action: '../lib_2.0/ajax/upload.php',
		//action: 'upload.htm', // I disabled uploads in this example for security reaaons
		data : {
			'key1' : "This data won't",
			'key2' : "be send because",
			'key3' : "we will overwrite it"
		},
		onSubmit : function(file , ext){
			//if (ext && new RegExp('^(' + allowed.join('|') + ')$').test(ext)){
			if (ext && /^(jpg|png|jpeg|gif)$/.test(ext)){
				this.setData({
					'key': 'This string will be send with the file'
				});
				
				$$('#example2 .text')[0].update('Uploading ' + file);	
			} else {
				
				// extension is not allowed
				$$('#example2 .text')[0].update('Error: only images are allowed');
				// cancel upload
				return false;				
			}
	
		},
		onComplete : function(file, response){
			$$('#example2 .text')[0].update('Uploaded ' + file);				
		}		
	});
	
});
*/

