function updateCoords(c) {
	$('#x').val(c.x);
	$('#y').val(c.y);
	$('#w').val(c.w);
	$('#h').val(c.h);
};

function checkCoords() 
{ 
  if ($('#x').val() != '') return true; 
  alert('Maak eerst een selectie.'); 
  return false; 
}; 


function createSortable(id, itemsClass, handler, action, direction){
	$(id).sortable({ 
        items: itemsClass,
        delay: 10,
        distance: 0,
        axis: direction,
        opacity: 0.5,
        placeholder: 'ui-placeholder',
        handle: handler,
        change: function(event, ui) {  },
		update: function(e, ui){
            $.ajax({
                type: "POST",
                url: webroot+action,
                data: "itemId=&newOrder="+$(id).sortable('toArray'),
                error: function(msg){
                    $("#JQresult").html(msg);
                },
                success: function(msg){
                    $("#JQresult").html(msg);
                }
            });
		}
    });
}

function addlink(id) {
	$('#fragment-' + id + ' table a').bind('click', function() {
		val = '';
		val = $('#fragment-' + id + ' table input.' + $(this).attr('class')).val();
		$('#fragment-' + id + ' table input.' + $(this).attr('class')).val(val + '<a href="LINK HIER" target="blank">TEKST HIER</a>');
	});
}
