﻿//You need an anonymous function to wrap around your function to avoid conflict  
(function($) {

    //Attach this new method to jQuery  
    $.fn.extend({

        //This is where you write your plugin's name  
        drhPaging: function() {

            //Iterate over the current set of matched elements  
            return this.each(function() {

                //code to be inserted here

                var obj = $(this);
                // obj shouldbe the div...
                obj.html("");
                var button1 = $("<button />").attr('id', 'setTable').text("List View").addClass('ui-state-default').addClass('ui-corner-all');
                var button2 = $("<button />").attr('id', 'setFlow').text("Images").addClass('ui-state-default').addClass('ui-corner-all');


                $("#setTable").live("click", (function(e) {
                $('.basicProd').removeClass("flowLayout").addClass("tableLayout");
                $('.basicSearchProd').removeClass("flowLayout").addClass("tableLayout");
                return false;
                }));
                $("#setFlow").live("click", (function(e) {
                $('.basicProd').removeClass("tableLayout").addClass("flowLayout");
                $('.basicSearchProd').removeClass("tableLayout").addClass("flowLayout");
                return false;
                }));

                $("#setFlow, #setTable").hover(
                    function() { $(this).removeClass('ui-state-default').addClass('ui-state-hover'); },
                    function() { $(this).removeClass('ui-state-hover').addClass('ui-state-default'); }
                );

                obj.append(button1).append(button2);
            });
        }
    });
    //pass jQuery to the function,   
    //So that we will able to use any valid Javascript variable name   
    //to replace "$" SIGN. But, we'll stick to $ (I like dollar sign: ) )
})(jQuery); 



//You need an anonymous function to wrap around your function to avoid conflict  
(function($) {
    $.fn.extend({
        drhDumpRightColumn: function() {
            return this.each(function() {
                var obj = $(this);
                $("#rightcolumn").attr('display', 'none');
                $("#centrecolumn").attr('border-right', 'none');
                $("#centrecontent").width(700);
                $("#centrecolumn").width(740);
            });
        }
    });
})(jQuery); 


(function($) {
    $.fn.extend({
        redirectIfSessionExpired: function() {
        var ajaxReturn = 'start';
            $.ajax({
                type: "POST",
                url: "/utilityService.asmx/redirectIfSessionExpired",
                data: "{duffString:''}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                error: function(request, status, error) { ajaxReturn = 'fail'; },
                success: function(msg) { ajaxReturn = msg.d; },  // end of success
                async:false
            });  // end of ajax
            return ajaxReturn;
        }
    });
})(jQuery); 

