//no conflict jquery
jQuery.noConflict();
//jquery stuff
(function($) {
    $(document).ready(function(){
        $(".report-author-image").click(function(event){
            $(".loading").removeClass("hidden");
            var authorid = $(this).attr("rel");
            param = "authorid="+authorid;
            $.ajax({
                type: "POST",
                url: "send-bad-author-image-mail.php",
                data: param,
                cache: false,
                success: function(data)
                {
                    $.fn.colorbox({
                        onLoad:function(){  
                            $(".loading").addClass("hidden");
                            $("#msg-bad-author-image").html(data);   
                        },
                        onClosed:function(){ $("#msg-bad-author-image").html(""); },
                        width:"50%", inline:true, href:"#msg-bad-author-image", title:""
                    });
                }
            });

            event.preventDefault();
        });

        $(".report-image").click(function(event){
            $(".loading").removeClass("hidden");
            var isbn = $(this).attr("rel");
            var param = "isbn="+isbn;

            $.ajax({
                type: "POST",
                url: "send-bad-image-mail.php",
                data: param,
                cache: false,
                success: function(data)
                {
                    $.fn.colorbox({
                        onLoad:function(){  
                            $(".loading").addClass("hidden");
                            $("#msg-bad-image").html(data);   
                        },
                        onClosed:function(){ $("#msg-bad-image").html(""); },
                        width:"50%", inline:true, href:"#msg-bad-image", title:""
                    });
                }
            });

            event.preventDefault();
        });


        $(".request-review-copy").click(function(event){
            $(".loading").removeClass("hidden");
            //~ var url = $(this).attr("href");
            var isbn = $(this).attr("title");
            var booktype = $(this).attr("rel");
            var param = "isbn="+isbn+"&booktype="+booktype;

            $.ajax({
                type: "get",
                url: "request-review-copy.php",
                data : param,
                success: function(msg){
                    $("#div-request-review-copy-success").html(msg);
                    $.fn.colorbox({
                        onLoad:function(){  
                            $(".loading").addClass("hidden");
                            //$("#div-request-review-copy-success").html(msg);   
                        },
                        onClosed:function(){ $("#div-request-review-copy-success").html(""); },
                        width:"50%", inline:true, href:"#div-request-review-copy-success", title:""});
                }
            });

            event.preventDefault();
        });

        $("a.request-sample").click(function(event){
            $(".loading").removeClass("hidden");
            //~ var url = $(this).attr("href");
            var isbn = $(this).attr("title");
            var param = "isbn="+isbn;

            $.ajax({
                type: "post",
                url: "request-sample.php",
                data : param,
                success: function(msg){
                    $("#div-request-sample-success").html(msg);
                    $.fn.colorbox({
                        onLoad:function(){  
                            $(".loading").addClass("hidden");
                        },
                        onClosed:function(){ $("#div-request-sample-success").html(""); },
                        width:"50%", inline:true, href:"#div-request-sample-success", title:""});
                }
            });

            event.preventDefault();
        });
        
        $("a.author-no-desc").click(function(event){
            $(".loading").removeClass("hidden");
            //~ var url = $(this).attr("href");
            var authorid = $(this).attr("rel");
            var param = "authorid="+authorid;

            $.ajax({
                type: "post",
                url: "request-author-info.php",
                data : param,
                success: function(msg){
                    $("#div-author-info-success").html(msg);
                    $.fn.colorbox({
                        onLoad:function(){  
                            $(".loading").addClass("hidden");
                        },
                        onClosed:function(){ $("#div-author-info-success").html(""); },
                        width:"50%", inline:true, href:"#div-author-info-success", title:""});
                }
            });

            event.preventDefault();
        });

    });
})(jQuery);
 
