function checkall()
{  
	$("INPUT[type='checkbox']").attr('checked', true);
};

function uncheckall()
{  
	$("INPUT[type='checkbox']").attr('checked', false);
};

function delete_users(username)//DELETE USER
{  

		if (typeof username != 'undefined'){
			var data = "&username=" + username;
			$( "#dialog_users" ).dialog({
					resizable: false,
					height:140,
					modal: true,
					buttons: {
						"Ok": function() {
						$.ajax({
						  type: "POST",
						  url: "php/db_users.php",
						  data: data,
						    error: function(html){ // Sull'errore invoco una funzione
							alert("Si è verificato un errore. Riprovare più tardi, se il problema persiste contattare il webmaster alla seguente email marco17669@inwind.it");
						    },
						  success: function(html){							
							var num_pag = "#num_pag";
							username='#'+username;
							$(username).fadeOut('slow');
							$(num_pag).fadeOut('slow');
							//alert(html); 

		
						  }
						});
						$( this ).dialog( "close" );
					},
					Cancel: function() {
						$( this ).dialog( "close" );
					}
				}
			});
		}else{//DELETE CHECKBOX ITEMS
			var data = new Array();
			$("input[@name='itemSelect[]']:checked").each(function() {data.push($(this).val());});
			$( "#dialog_users" ).dialog({
					resizable: false,
					height:140,
					modal: true,
					buttons: {
						"Ok": function() {
						$.ajax({
						  type: "POST",
						  url: "php/db_users.php",
						  data: "delete="+data,
						  dataType: "text",
						    error: function(html){ // Sull'errore invoco una funzione
							alert("Si è verificato un errore. Riprovare più tardi, se il problema persiste contattare il webmaster alla seguente email marco17669@inwind.it");
						    },
						  success: function(html){
							for (a in data ) {
							data[a] = "#" + data[a];
							$(data[a]).fadeOut('slow');
							}							
							var num_pag = "#num_pag";
							//$(username).fadeOut('slow');
							$(num_pag).fadeOut('slow');
							//alert(html); 

		
						  }
						});
						$( this ).dialog( "close" );
					},
					Cancel: function() {
						$( this ).dialog( "close" );
					}
				}
			});
		};
};


