function print_r(arr, level) {
    var print_red_text = "";
    if(!level) level = 0;
    var level_padding = "";
    for(var j=0; j<level+1; j++) level_padding += "    ";
    if(typeof(arr) == 'object') {
        for(var item in arr) {
            var value = arr[item];
            if(typeof(value) == 'object') {
                print_red_text += level_padding + "'" + item + "' :\n";
                print_red_text += print_r(value,level+1);
		} 
            else 
                print_red_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
        }
    } 

    else  print_red_text = "===>"+arr+"<===("+typeof(arr)+")";
    return print_red_text;
}

$(document).ready(function(){
	$(".filmline_del1").click(function(){
		if (confirm("Удалить фильм из избранного?")){
			$(this).parent().hide(500);
			$.ajax({
				type: "POST",   
				url: "/ajax/favorites.php",
				data: "film="+$(this).attr("id")+"&action=silentdel",   
				success: function(){
				}
			});  
		}
	});
	
	$(".filmline_del2").click(function(){
		if (confirm("Удалить оценку фильма?")){
			$(this).parent().hide(500);
			$.ajax({
				type: "POST",   
				url: "/ajax/rating.php",
				data: "film="+$(this).attr("id")+"&silentdel=1",   
				success: function(){
				}
			});  
		}
	});
	

	
	$("#zachemregistracia").hide();
	$("#zachemregistraciab").click(function(){	
		$("#zachemregistracia").toggle(300);
	});
	
	
	$("#searchform").submit(function(){   
		$.ajax({   
			type: "POST",   
			url: "/ajax/search.php",   
			data: "search="+$("#search").val(),   
			success: function(html){   
				$("#searchresult").html(html);   
			}   
		});   
		return false;   
	});   
	
});




