$(document).ready(function() {

    $("a.del-confirm").click(function() {
    	
    	return confirm("Are you sure?");
    });
	
 
    $(".info").click(function() {
    	$(this).fadeOut(3000);
    });
    
    
    $('tr')
        .filter(':has(:checkbox:checked)')
        .addClass('selected')
        .end();
    $('tr').live("click", function(event) {
	        var $target = $(event.target);
	        if(!$target.is("img") ) {
	        	$(this).toggleClass('selected');
	        	if (event.target.type !== 'checkbox') {
	        		$(':checkbox', this).attr('checked', function() {
	        			return !this.checked;
	        		});
	        	}
	        }
        });
    
 

        // Delete buttonek v DataGridu
        $(".delete").live("click", function () {
                if (confirm("Are you sure?")) {
                	$.netteAjax(this.href);
                	var row = $(this).parents("tr");
                	row.addClass("selected-delete");
                	row.fadeOut(2000);
                }  
                return false;
        });

    
    
    $(".delete").mouseout(function () {
        var row = $(this).parents("tr");
        row.removeClass("selected-delete");
    });
    

    $('table.posts tr').hover(function() {
       $(this).addClass("highlight");
    }, function () {
       $(this).removeClass("highlight");
    });
    
   

    // Obsluha hover menu
    $('img.menu').imghover({suffix: '-hover'});


    $("#frm-title").keyup(function() {
                    
          var srch = $(this).val() 
    
          $.ajax({
            url: '/?presenter=Admin%3APage&view=searchURL',
            data: { search: srch },
            dataType: 'json',
            beforeSend: function() {},
            success: function(data) {
                if (!data) return; 
            },
            complete: function() {},
        });
          
       
        $("#page-url").html($(this).val());    
    });
    


});




