$(document).ready(function(){

var pid;
var tohide;

$("#cp_posts > li > div").each(function(i) { if(i % 2 == 0) $(this).addClass("color"); });

$(".main-content > div").each(function(i) { if (i % 2 == 0) $(this).addClass("color"); });


$('#dialog2').dialog( { 
    autoOpen: false, 
    width: 250, 
    bgiframe:true,
    buttons: {
    "Cancel": function () { $(this).dialog("close"); },
    "Ok": function() { 
	
	//alert( "/cp/deletepost/" + pid );
	$.post("/cp/deletepost/" + pid );
	//alert ( tohide );
	$(tohide) . hide();
	$(this).dialog("close"); 
	} 
    }
    });

$('.DeletePost').click( function () { 

    pid = $(this).attr('name');
    tohide = '#post-' + pid ;
    $('#dialog2').html ( 'You want to delete post ID# ' + pid + '?' );
    $('#dialog2').dialog('open'); 
    });

});