jQuery(document).ready(function() {

	
	// editing
	if( jQuery(".editable").length )
	jQuery(".editable").editable(root_adress+"php/ajax_gall_edit.php", {
		
		//id		: jQuery(this).attr('class'),
		//name	: this.value,
		type   	: "text",
		width		: 250,
		//height	: 12,
		submit 	: "OK",
		cancel 	: "Anuluj",
		tooltip	: "Zmień",
		indicator 	: "<img src='"+root_adress+"images/indicator4.gif'>"
    	
	}, function(value, settings) {
		
		val = jQuery.parseJSON(value);
		jQuery(this).html( val.new_value );
    	
	}).mouseover( function() {
		jQuery(this).css( 'cursor', 'pointer' );
	});
	
	// calendar
	if( jQuery(".calendar_icon").length ) {
		jQuery(".calendar_icon").mouseover( function() {
			jQuery(this).css( 'cursor', 'pointer' );
		});	
	}
});

function del_ensure( id ) {
	
	if( confirm('Czy na pewno chcesz usun±ć?')) {
		jQuery.post( root_adress+"php/ajax_img_del.php", 
			{'id':id}, 
			function (value, settings) {
				val = jQuery.parseJSON(value);
				if( val.result == 1 ) {
					jQuery('#item_'+id).remove();
				}
			});
	}
}

function del_gall_ensure( id, title ) {
	
	if( confirm('Czy na pewno chcesz usun±ć galerię?')) {
		if( confirm("Usuwasz cał± galerię '"+title+"' ! Jeste¶ pewnien?")) {
			jQuery.post( "php/ajax_gall_del.php", 
				{'gall_id':id}, 
				function (value, settings) {
					val = jQuery.parseJSON(value);
					if( val.result == 1 ) {
						jQuery('#gallitem_'+id).remove();
					}
				});
		}
	}
}

function hide_me(username, server) {
	document.write(username + '\@' + server);
	//jQuery('#here').setAttribute('href', 'mailto:'+username + '\@' + server);
}

