<div class="module">


<script type="text/javascript">

jQuery(document).ready(function() {

	jQuery('.remove_sidebar').click(function(){
			var el =jQuery(this);
			var id = el.attr("id");
											 
			jQuery.ajax({
				url: '<?php echo TMP_ADMIN.'/ajax/remove_sidebar.php';  ?>',
				cache: false,
				type: "POST",
				data: ({
						id : id,
						nonce : '<?php echo $nonce = wp_create_nonce('sidebar_remove'); ?>',
					}),
				success: function(data) {
				
				
					if (jQuery.trim(data)=="OK"){
						el.parent('.grid').remove();
					}else if (jQuery.trim(data)=="ERROR") {
						alert('Cannot Removed');
					}
				
				}  
								
								
			});	
			
			return false;
		
		});
	
	}
);


</script>

<?php 
	foreach ((array) $_opt[PFIX."_custom_sidebars"] as $sidebar_id => $sidebar ) {
		if ( ! $sidebar_id )
			continue;
		?>

    <div class="grid oneof2 last">

        <?php echo '<a href="#" id="'.$sidebar_id.'" class="remove_sidebar small-button small-grey"><span>'.__('Remove','cloudfw').'</span></a> '.$sidebar["name"].'';?>

    </div>

<?php  } ?>
<div class="clear"></div>
    	
</div>