

$(document).ready(function(){

	if ($("#currentTabOwnerID").html() == $("#currentUserid").html()) {
		
		$(".note").css("cursor", "e-resize");
		
		$(".note").each(
			function( intIndex ){
				var currentID = $(this).attr('id');  
				$("#"+currentID).draggable({ 
										axis: 'x',
										stop: function(event, ui)
										{
											updateNotePosition($(this).position().left, currentID);
										}
									});
			}
		);
	}
});
jQuery.fn.fadeInFadeOut = function(speed) {

	return $(this).fadeIn(speed,

	function() {

		return $(this).fadeOut(speed);

	 });
}
var updateNotePosition = function (newPosition, noteID) {

	// alert('newPosition is ' + newPosition);
	// alert('noteID is ' + noteID);
	
	$.ajax({
	   type: "GET",
	   url: "ajax-update-note-position.php",
	   data: "id="+noteID+"&position="+newPosition,
	   success: function(msg){
		  $("#saveMessage").html(msg).fadeInFadeOut(4000); 
		  //alert( msg );
	   }
	 });
}

