
/* Comment Generated by Combres - Resource '~/client_Scripts/JQuery/ui/jquery.hoverIntent.minified.js' (Mode: Static) */
/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);;


/* Comment Generated by Combres - Resource '~/client_scripts/ignify.ajaxframework.js' (Mode: Static) */
/// <reference path="../../jquery-1.4.3-vsdoc.js" />

/*     
AUTHOR : Aslam Shareef

Usage : 
======        

Create an object of the framework and then call SetupFramework method in the Master file just before the </body> tag... like this :
$(function() {
var ajaxFrameworkObj = new IgnifyAjaxFramework();
ajaxFrameworkObj.SetupFramework();
});
          
FOR MAKING A GET CALL :
----------------------------------------
On the page that you want to call the on-demand Ajax get, you need to create an object and then call MakeAjaxCall like this :
            
var ajaxFrameworkObj = new IgnifyAjaxFramework();
ajaxFrameworkObj.MakeAjaxCall(eventObj.listenersid, "methodname$$gethtml_filtered_color_swatch", "param1$$" + productid, "param2$$" + str);
          
The MakeAjaxCall accepts n number of parameters. They are :
1. Id of the div whose content will be replaced by the return value of the ajax call.
2.The name of the controller to refer to.
3. The name of the action method that would be called.
4. Here you specify "param1$$param1Value", "param2$$param2Value" etc till param5. Please note that your action method MUST accept parameters named param1, param2 etc.
          
FOR MAKING A POST :
---------------------------------
On the page that you want to call ajax POST, you need to first PUSH the widgetContainerDiv like this :

ajaxWidgetList.push("idOfWidgetContainer");

then create an object and then call MakeAjaxCall like this :
          
var ajaxFrameworkObj = new IgnifyAjaxFramework();
ajaxFrameworkObj.PrepareForPOST("idOfWidgetContainer","idOfFormToSubmitForPOST","widgets-CONTROLLERNAME/ACTIONMETHOD?querystringIfAny" , callbackFunction, "idOfWidgetDiv");
ajaxFrameworkObj.MakeAjaxCall(eventObj.listenersid);
          
First you call PrepareForPOST. This method takes 4 arguments :
1. Id of the div of the container
2. Id of the form to submit. Recommendation : on the ascx page you cannot create another form. You should use ignify_utility_js.createwrapperform method.
3. URL to POST to. Be careful with the "widgets-" prefix to the controller.
4. Callback function that you want to call on success. If theres nothing you want to call, create a dummy function and pass its name.
5. idOfWidgetDiv [OPTIONAL] - Use this ONLY when there you are doing an OnDemand Post where your widget has not already been loaded on documentready.
     Recommendation is to simply pass the first four parameters for most cases. 
            eg : ajaxFrameworkObj.PrepareForPOST("widContainer","formid","widgets-product/gethtml_something" , callbackFunction);
          
Now that you have instructed the framework what to do, make the ajax call using MakeAjaxCall (duh! ). 
But here, unlike, in GET, you specify ONLY one parameter and that is the ID of the Container DIV which you used in PrepareForPost.
          
          
          
*/
var prioritylist=[];

var intervalid = 0;

function IgnifyAjaxFramework(callback) {


    this.fireajax = function () {
        if (prioritylist.length > 0) {
            prioritylist[0].obj.ajaxload({ "url": prioritylist[0].url });
            prioritylist.shift();
        }
        else {

            intervalid= clearInterval(intervalid);
            
        }
    };


    this.SetupFramework = function () {

        $.fn.extend({
            queueajax: function (options) {
                var queued = false;
                if (prioritylist.length == 0) {
                    prioritylist.push({ "obj": $(this), "url": options.url, "priority": options.priority });
                    queued = true;
                }
                else {
                    for (x = 0; x < prioritylist.length; x++) {
                        if (options.priority <= prioritylist[x].priority) {
                            prioritylist.splice(x, 0, { "obj": $(this), "url": options.url, "priority": options.priority });
                            queued = true;
                            break;
                        }
                    }
                }
                if (queued == false) {
                    prioritylist.push({ "obj": $(this), "url": options.url, "priority": options.priority });
                }

                if (typeof ajaxWidgetList_early != 'undefined') {
                    if (prioritylist.length == 0)
                        return;
                }
                else {
                    if (prioritylist.length < ajaxWidgetList.length) {
                        return;
                    }
                }

                (new IgnifyAjaxFramework()).fireajax();
                intervalid = setInterval("(new IgnifyAjaxFramework()).fireajax()", 10);



            }
        });

        $.fn.extend({
            ajaxload: function (options) {

                var returnVal = normalizeWidgetList(this, options);

                // This was added because dcMegaMenu fires document.ready twice and the ajax calls were being made multiple times.
                if (options.manualcall == undefined && !returnVal.firstLoad) {

                    if ($(this).children("#loadingdiv").length > 0)
                        $(this).remove();

                    return;
                }
                var temp;
                temp = "";
                var x = 0;


                var firstLoad = returnVal.firstLoad;

                /*
                Do not deleted the below two lines. These are used to display the rotating ajax-loading images.
                They are commented for now because we are doing jQuery animation. But let them be here for now.
                */
                //                    var h = $('<div>').append($("#loadingdiv").clone()).html();
                //                    this.html(h);


                x = returnVal.widgetIndex;
                temp = returnVal.widgeturl;

                if (temp == "") {
                    temp = options.url;
                }
                else {
                    ajaxWidgetList[x].widgeturl = refactorUrl(temp); // This is done to prepare the generic url for next ajax call
                }



                $(this).show();
                if (x >= ajaxWidgetList.length || ajaxWidgetList[x].posturl == "") {

                    //  If posturl is blank then either this is the first time OR this widget is not POST enabled
                    var h = $('<div>').append($("#loadingdiv").clone()).html();
                    if ($("#loadingdiv", this).length == 0) {
                        $(this).before(h);
                    }

                    this.load(temp, function () {


                        if (firstLoad == false) {
                            if ($(this).siblings("#loadingdiv").length > 0)
                                $(this).siblings("#loadingdiv").remove();
                            if (options.successhandler != null && options.successhandler != undefined) {
                                $(this).fadeIn(800, options.successhandler);
                            }
                            else
                                $(this).fadeIn(800);
                        }
                    });
                    $(this).show();
                    return;
                } // End of if posturl==""
                else {
                    // Else if it is POST enabled
                    var originialHtml = $("#" + ajaxWidgetList[x].formid).html();

                    var h = $('<div>').append($("#loadingdiv").clone()).html();

                    $(this).before(h);

                    $(this).hide();
                    var formoptions = {
                        url: homeUrl + ajaxWidgetList[x].posturl,
                        type: 'post',
                        target: '#' + ajaxWidgetList[x].parentid, // target element(s) to be updated with server response
                        success: function () {
                            // Reset the form to its original state.

                            //$("#" + ajaxWidgetList[x].formid).html(originialHtml)
                            $('#' + ajaxWidgetList[x].parentid).siblings("#loadingdiv").remove();
                            ajaxWidgetList[x].callback;
                            $('#' + ajaxWidgetList[x].parentid).hide().fadeIn(500);
                            return false;
                        }  // post-submit callback
                    };

                    $("#" + ajaxWidgetList[x].formid).ajaxSubmit(formoptions);



                    return;
                }
            } // end of AjaxLoad function
        });

        //$.declare("ajaxload");
        //$.declare("queueajax");

    };

    /****************************************************************************************************************************************/
    this.MakeAjaxCall = function () {
        var idOfDiv = arguments[0];
        var makeAjaxCall = false;
        var ajaxUrl = "";
        // Loop through the ajaxWidgetList
        for (var k = 0; k < ajaxWidgetList.length; k++) {
            var newUrl = "";
            // Loop through the arguments passed.
            if (ajaxWidgetList[k].parentid == idOfDiv) {

                for (var i = 1; i < arguments.length; i++) {
                    // Splitting the arguments on colon gives us an array with first element as "param1" etc... and second element as the actual value
                    var arr = arguments[i].split("$$");
                    // Then in the generic URL that we created in refactorUrl metho we simply replace the first element with second element to get the correct URL
                    // And replace it in the ajaxWidgetList array
                    ajaxWidgetList[k].widgeturl = ajaxWidgetList[k].widgeturl.replace(arr[0], arr[1]);
                } // End of FOR loop of arguments

                makeAjaxCall = true;

                ajaxUrl = ajaxWidgetList[k].widgeturl;
                break;
            }

        } // End of FOR loop for ajaxWidgetList

        if (makeAjaxCall)
            $("#" + idOfDiv).ajaxload({ url: ajaxUrl, successhandler: this.AfterSuccessfulAjaxCall, manualcall:true });
    };

    /****************************************************************************************************************************************/

    this.PrepareForPOST = function (idOfWidgetContainer, formid, action, callbackhandler, idOfWidgetDiv) {

        if (idOfWidgetDiv != undefined)
            normalizeWidgetList($("#" + idOfWidgetDiv), { url: action });

        if ($("#" + formid).length == 0)
            ignify_utility_js.createwrapperform(formid, "post", homeUrl + action, idOfWidgetContainer);

        for (var a = 0; a < ajaxWidgetList.length; a++) {
            if (idOfWidgetContainer == ajaxWidgetList[a].parentid) {
                ajaxWidgetList[a].posturl = action;
                ajaxWidgetList[a].callback = callbackhandler;
                ajaxWidgetList[a].formid = formid;
                break;
            }
        }
    };


    /****************************************************************************************************************************************/


    this.AfterSuccessfulAjaxCall = callback;
    //    this.normalize2 = normalizewidget2;

    this.manual_normalizeWidgetList = function (widget, loadOptions) {
        normalizeWidgetList(widget, loadOptions);
    }

    function normalizeWidgetList(widget, loadOptions) {
        var firstLoad = false;
        var temp = "";
        var widid = widget.attr("id");
        var x = 0;
        //alert(widid + "\n\n" + ajaxWidgetList);
        // Loop thru the ajaxWidgetList
        for (x = 0; x < ajaxWidgetList.length; x++) {

            // Check if the element at current position is an object
            if (typeof (ajaxWidgetList[x]) != "object") {
                //if its not an object then check if the element value (which will be the ID of the div being registered for on-demand Ajax)
                // is the parent of the current div.
                if (widget.parents("'div[id=" + ajaxWidgetList[x] + "]'").length > 0) {
                    //alert("parents length > 0 " + ajaxWidgetList[x]);
                    // if it is  then we create an object with ID of the current div and the URL it is curently firing. We first refactor the URL before storing it
                    ajaxWidgetList[x] = { "parentid": ajaxWidgetList[x], "widgetid": widget.attr('id'), "widgeturl": refactorUrl(loadOptions.url), "formid": "", "posturl": "", "callback": "" };
                    firstLoad = true;
                    temp = loadOptions.url;
                    break;
                } // End of if parent
            } // End of if NOT "object"
            else {
                //If it is an object then we compare the stored widget id of the object with the current DIVs ID
                if (ajaxWidgetList[x].parentid == widid) {

                    // if a match is found we fire pick the URL
                    temp = ajaxWidgetList[x].widgeturl;
                    widget.fadeOut(400);
                    firstLoad = false;
                    ajaxWidgetList[x].widgeturl = refactorUrl(ajaxWidgetList[x].widgeturl);
                    break;
                } // if of widgetid==widid
            } // else
        } //FOR

        return ({ "firstLoad": firstLoad, "widgetIndex": x, "widgeturl": temp });
    }

    // This creates a generic url as /{controllername}/{ActionMethod}/param1/param2/param3
    function refactorUrl(url) {
        var temp = url;

        url = url.replace(homeUrl, "/");
        var arr = url.split("/");

        // After splitting arr will contain the following
        /*
        arr[0]="";
        arr[1]="controllername"
        arr[2]="actionmethod"
        arr[3]="param1Value"
        arr[4]="param2Value"
        arr[5]="param3Value"
        */
        var startIndex = 3;

        // This means theres no starting '/'
        if (arr[0] != "")
            startIndex = 2;

        arr[startIndex - 2] = "widgets-controllername";
        arr[startIndex - 1] = "methodname";
        // Hence we start from index 3 .. which is the param1Value
        for (var i = startIndex; i < arr.length; i++) {
            // and subtract 2 from the index to get the parameter suffix like param1, param2 etc
            arr[i] = "param" + (i - (startIndex - 1)).toString();
        }

        // then we combine the array elements into a string using "/" to arrive at a generic URL
        url = arr.join("/");
        url = homeUrl + url.substring(1);

        return url;
    }

    this.pushajaxcallinqueue = function () {

        /**
        This function is created for the replacement of MicrosoftAjax framework library. 
        It does everything which was done previously with MS Ajax and jquery.declarative library.

        This function gets called from ignify.utility.js's getecommerce() function so that control comes to this place at the end of page rendering.
        */
        for (var i = 0; i < ajaxWidgetList.length; i++) {

            if (typeof (ajaxWidgetList[i]) != "string") {
                continue;
            }

            //getting the parent div id that we have put in ajaxWidgetList[] 
            var currentdivId = ajaxWidgetList[i];

            //here we are going to that parent div; we know that, that parent div has attribute itemtemplate= "AjaxFrameworkScript" and id = currentdivId
            var divElement = $('[itemtemplate=AjaxFrameworkScript][id=' + currentdivId + ']');

            if (divElement.length < 1) {
                continue;
            }

            //reading the attribute "data" of parent div. Here we will get datasource name in which we have kept data required for building Ajax call
            //examples are skuWidgets or customerReviewsWidget and so on...
            var datasourcename = divElement.attr("data");

            //referencing to actual JS array holding the data
            var datasourcearray = eval(datasourcename);

            //looping through array to get exact data associated with currentdivId
            var ajaxoptiondata = $.grep(datasourcearray, function (elementOfArray, idx) { return (elementOfArray.col == currentdivId); });

            if (ajaxoptiondata.length < 1)
                continue;

            //there has to be exact one to one match. currentdivId has to occure only once in document
            if (ajaxoptiondata.length == 1) {
                var ajaxurl = homeUrl + "Widgets-" + ajaxoptiondata[0].controller + "/" + ajaxoptiondata[0].action + '/' + ajaxoptiondata[0].param1 + '/' + ajaxoptiondata[0].param2
                    + '/' + ajaxoptiondata[0].param3 + '/' + ajaxoptiondata[0].param4 + '/' + ajaxoptiondata[0].param5 + '/' + ajaxoptiondata[0].param6;
                var ajaxpriority = ajaxoptiondata[0].order;

                //create the child DOM elements under the parent div to hold response coming back from server
                var ajaxcontainerid = createcontentdiv(ajaxoptiondata[0]);

                //by following line we are making ajax call in queue fashion
                $("#" + ajaxcontainerid).queueajax({ "url": ajaxurl, "priority": ajaxpriority });

            }
            else {
                //we should never get any other nuber in above if condition other than 1. 
                //If it is 0 OR more than 1 then we will display the error message inside same parent div
                $("#" + currentdivId).html($("#" + currentdivId).html() + '<br/><span class="errormsg">Found ' + ajaxoptiondata.length + ' html element having same "' + currentdivId + '" Id.');
            }

        } //end for

    };

    this.ajaxFireWidgetListQuery = function (arrayindex) {

        //getting the parent div id that we have put in ajaxWidgetList[] 
        var currentdivId = ajaxWidgetList_early[arrayindex];

        //here we are going to that parent div; we know that, that parent div has attribute itemtemplate= "AjaxFrameworkScript" and id = currentdivId
        var divElement = $('[itemtemplate=AjaxFrameworkScript_new][id=' + currentdivId + ']');

        //reading the attribute "data" of parent div. Here we will get datasource name in which we have kept data required for building Ajax call
        //examples are skuWidgets or customerReviewsWidget and so on...
        var datasourcename = divElement.attr("data");

        //referencing to actual JS array holding the data
        var datasourcearray = eval(datasourcename);

        //looping through array to get exact data associated with currentdivId
        var ajaxoptiondata = $.grep(datasourcearray, function (elementOfArray, idx) { return (elementOfArray.col == currentdivId); });

        //there has to be exact one to one match. currentdivId has to occure only once in document
        var ajaxurl = homeUrl + "Widgets-" + ajaxoptiondata[0].controller + "/" + ajaxoptiondata[0].action + '/' + ajaxoptiondata[0].param1 + '/' + ajaxoptiondata[0].param2
                    + '/' + ajaxoptiondata[0].param3 + '/' + ajaxoptiondata[0].param4 + '/' + ajaxoptiondata[0].param5 + '/' + ajaxoptiondata[0].param6;
        var ajaxpriority = ajaxoptiondata[0].order;

        //create the child DOM elements under the parent div to hold response coming back from server
        var containerDiv = createcontentdiv(ajaxoptiondata[0]);

        //alert(containerDiv);
        //normalizeWidgetList($("#" + containerDiv), { "url": ajaxurl });

        var h = $('<div>').append($("#loadingdiv").clone()).html();
        if ($("#loadingdiv", $("#" + containerDiv)).length == 0) {
            $("#" + containerDiv).before(h);
        }


        $.ajax({
            url: ajaxurl,
            success: function (data) {
                $(document).ready(function () {  //<-- Hey Guys check this out!
                    if ($("#" + containerDiv).siblings("#loadingdiv").length > 0)
                        $("#" + containerDiv).siblings("#loadingdiv").remove();

                    $("#" + containerDiv).html(data);
                    normalizeWidgetList($("#" + containerDiv), { "url": ajaxurl });
                });
            }
        });


        $("#" + containerDiv).show();
    };

        function createcontentdiv(optiondata) {

            /**
            By this function we build a completely new html element with the reference of html template already present on page. 
            This newly created element will in pumped in to the parent div element and this new element will be used as ajax response holder.
            */
            var newElem = $('#AjaxFrameworkScript').clone().attr('id', optiondata.col + 'Container');
            newElem.removeAttr("class");
            newElem.find('.widget').attr('id', optiondata.title + '_widget-' + optiondata.id);
            newElem.find('.widget-body').attr('id', optiondata.title + '_widget' + optiondata.id + 'body');
            newElem.find('.widget-content').attr('id', optiondata.title + '_widget' + optiondata.id + 'content');

            //inserting the new element as a child to parent currentdivId.
            newElem.appendTo("#" + optiondata.col);

            //returning the container div id which is actually holding the response. This container div will be child of parent currentdivId.
            return newElem.attr("id");
    }
}





// The arguments should be passed as :
// fireAjax("idOfDiv","param1:somevalue","param2:someothervalue");


/* Added for implementing POST via framework*/

/* Post ends */

                 
           
           ;


/* Comment Generated by Combres - Resource '~/client_scripts/JQuery/ui/jquery.watermark.js' (Mode: Static) */
/* http://plugins.jquery.com/project/TinyWatermark */
(function($) {
    $.fn.watermark = function(css, text) {
        return this.each(function() {
            var i = $(this), w;
            i.focus(function() {
                w && !(w = 0) && i.removeClass(css).data('w', 0).val('');
            })
			.blur(function() {
			    !i.val() && (w = 1) && i.addClass(css).data('w', 1).val(text);
			})
			.closest('form').submit(function() {
			    w && i.val('');
			});
            i.blur();
        });
    };
    $.fn.removeWatermark = function() {
        return this.each(function() {
            $(this).data('w') && $(this).val('');
        });
    };
})(jQuery);;


/* Comment Generated by Combres - Resource '~/client_scripts/Events/IgnAddToComparisonEvent.js' (Mode: Static) */

function IgnAddToComparisonEvent() {
    this.eventname = "IgnAddToComparisonEvent";
    this.listen = bindToIgnAddToComparisonEvent;
    this.fireevent = triggerIgnAddToComparisonEvent;
    return true;
}
function bindToIgnAddToComparisonEvent(idOfObjToBind, callbackfunction) {
    $("#" + idOfObjToBind).bind(this.eventname, callbackfunction);
}
function triggerIgnAddToComparisonEvent(eventarguments) {
        $.event.trigger(this.eventname, [this, eventarguments]);
    }
    var ignaddtocomparisonevent_js = new IgnAddToComparisonEvent();;


/* Comment Generated by Combres - Resource '~/client_scripts/Events/IgnViewComparisonEvent.js' (Mode: Static) */

function IgnViewComparisonEvent() {
    this.eventname = "IgnViewComparisonEvent";
    this.listen = bindToViewComparison;
    this.fireevent = triggerViewComparison;
    return true;
}
function bindToViewComparison(idOfObjToBind, callbackfunction) {

    $("#" + idOfObjToBind).bind(this.eventname, callbackfunction);
}
function triggerViewComparison(eventarguments) {

    $.event.trigger(this.eventname, [this, eventarguments]);
}

var ignviewcomparisoneventevent_js = new IgnViewComparisonEvent();;


/* Comment Generated by Combres - Resource '~/client_scripts/JSResource.en.js' (Mode: Static) */
/* JavaScript Globalization File */
var OREDER_NUMBER_MSG="Please enter Order number.";
var QUANTITY_TO_RETURN_VALIDATION_MSG="Quantity to Return should be greater than zero.";
var RETURN_AMOUNT_VALIDATION_MSG="Please enter valid amount to return Item.";
var CARD_NAME_VALIDATION_MSG="Please enter a valid Name on Card.";
var CARD_TYPE_MSG="Please select a Card Type.";
var CARD_NUMBER_VALIDATION_MSG="Please enter Valid Card Number.";
var CREDIT_CARD_EXPIRATION_DATE_MSG="Please check your Credit Card Expiration Date.";
var ITEM_TO_RETURN_MSG="Please select at least one item to return.";
var CUSTOMER_SERVICE_MSG="Please call up Customer Service to return these items.";
var CREDIT_CARD_EXP_MSG="Please check your Credit Card expiration date.";
var CUSTOMER_PASSWORD_SEND_MSG="Your password has been mailed to your email address.";
var VALID_EMAILID_MSG="Enter valid Email ID";
var ENTER_VALUE_MSG_BLANK_SEARCH_ORDER_QUOTE="Please enter value";
var CUSTOMER_PRIMARY_ADDRESS_DELETION_MSG="Can not delete Primary address !!";
var INVOICE_RECORD_SELECTION_MSG="Please select any Invoice record";
var VALUE_FOR_NAME_ON_CARD_MSG="Please enter value for Name on Card.";
var VALUE_FOR_CARD_NUMBER_MSG="Please enter value for Card Number.";
var VALUE_FOR_CARD_SECURITY_CODE_MSG="Please enter value for Card Security Code.";
var CHARGING_INVOICE_PROCESS="Charging Invoice(s), please wait...";
var MY_INVOICES_SEARCH_MESSAGE="Please enter at least one valid search criteria for searching the invoices.";
var VALIDATE_AMOUNT_MSG="Please enter a valid amount";
var AMT_PAID_MSG="Please enter the amount to be paid.";
var AMT_LESS_THAN_PENDING_MSG="Please enter the amount less than pending amount.";
var DATE_FORMAT_NOTE="The date format should be : mm/dd/yyyy";
var VALID_MONTH_ENTRY_NOTE="Please enter a valid month";
var VALID_DAY_ENTRY_NOTE="Please enter a valid day";
var VALID_DATE_ENTRY_MSG="Please enter a valid date";
var CATALOG_JSMSG_VALID_QTY="Please enter valid quantity.";
var CONFIRM_MSG_FOR_DELETE_ADDRESS="Are you sure you want to delete addresses also or you want it to assign to Parent User?Click OK will delete the addresses and Cancel will assign it to parent user.";
var CATALOG_JSMSG_GREATER_THAN_ZERO="Enter value greater than 0";
var SUBSCRIPTION_SHIPMENT_COUNT_REQUIRED_ERROR_MESSAGE="Please enter Shipment Count. ";
var SUBSCRIPTION_SHIPMENT_COUNT_VALID_COUNT_MESSAGE="Please enter valid Shipment Count. ";
var SUBSCRIPTION_SHIPMENT_COUNT_ZERO="Please enter Shipment Count greater than 0. ";
var SUBSCRIPTION_FREQUENCY_REQUIRED_ERROR_MESSAGE="Please select Subscription Frequency. ";
var RENTAL_FREQUENCY_REQUIRED_ERROR_MESSAGE ="Please select Rental Frequency.";
var CATALOG_JSMSG_ATLEAST_ONE_PRODUCT="Please enter value against atleast one product";
var CONVERTING_TO_ORDER_MSG="Converting to order, please wait...";
var ADDRESS_DELETE_CONFIRMATION_MSG="Are you sure you want to delete this address?";
var BANK_NAME_VALUE_MSG="Please enter valid bank name.";
var ROUTING_NO_VALUE_MSG="Please enter valid rounting number.";
var ACC_HOLDER_NAME_VALUE_MSG="Please enter valid account holder name.";
var ACCOUNT_NO_VALUE_MSG="Please enter valid account number.";
var CUSTOMER_PASSWORD_BLANK="Please enter valid password.";
var CATALOG_ITEM_ADDED_SUCCESSFULLY="Item added successfully.";
var CATALOG_CHOOSEN="Choosen ";
var CATALOG_WRONG_COMBINATION="is not available in the store.Please try a different combination.";
var ALLOWED_QUANTITY_TO_RETURN="There are only {0} item(s) which can be returned. Please re-enter quantity.";
var VALID_YEAR_ALERT_MSG="Please enter a valid 4 digit year between {0} and {1}";
var VALID_AMOUNT_EXP="Please enter valid amount";
var PROPER_CODE_EXP="Please enter proper code.";
var DELETE_CONFIRMATION_MSG="Are you sure you want to delete the Item?";
var DESTROY_CONFIRMATION_MSG="Are you sure you want to destroy?";
var DELETE_ALL_ITEMS_CONFIRMATION_MSG="Are you sure you want to delete all the Items?";
var INVALID_DATE_FORMAT_MSG="Invalid Date Format. Please correct and submit again.";
var INVALID_DATE_MONTH_YEAR_FORMAT_MSG="Invalid Day, Month, or Year range detected. Please correct and submit again.";
var OPERATION_COMPLETED_MSG="Operation Completed";
var SELECT_ITEM_MSG="Please select any item to clear.";
var BACK_ORDER_MSG="Item Added is back ordered, Available quantity for item {0} is {1}";
var EVENTHANDELER_ERRORMSG="An error has occured somwhere inside your \"onclose\" event handler";
var DHTML_WINDOW_WIDGET_MSG="ERROR: Modal Window script requires all files from \"DHTML Window widget\" in order to work!";
var UNTERMINATED_COMMENT="Unterminated comment";
var SYNTAX_ERROR_MSG="Syntax error";
var BAD_STRING_MSG="Bad string";
var BAD_ARRAY_MSG="Bad array";
var BAD_OBJECT_MSG = "Bad object";
var CATALOG_KEYWORD = "Search by Keyword or Item";

//Added by pallavi ----

var ERROR_MESSAGE="An Error has Occured�";
var CATALOG_JSMSG_ADDED_TO_WISH="Item moved successfully.";
var CATALOG_JSMSG_PRODUCTEXIST_WISH="Item already exists.";
var CATALOG_JSMSG_ERROR_ADDING_WISH="An error has occurred while adding item in the Wish List.";
var PRODUCT_REVIEW_MSG="Please enter Review Message";
var PRODUCT_REVIEW_NAME_MSG="Please enter Name"; 
var PRODUCT_REVIEW_VALID_EMAILID_MSG="Please enter valid Email ID";
var QUICK_ENTRY_PRICE_LEVEL="Price level:";
var CATALOG_SC_QTY="Quantity";
var CATALOG_SC_UNIT_PRICE="Unit Price";
var GENERAL_DISCOUNT_LABEL="Discount";
var ITEM_NOT_FOUND_MSG="ITEM NOT FOUND.";
var VIEW_PRICE_LABEL="View Price";
var QUICK_ENTRY_CONFIGARABLE_PRODUCT="*CONFIGURABLE PRODUCT";
var OUT_OF_STOCK="OUT OF STOCK";
var DOWNLOAD_EXPIRED="DOWNLOAD EXPIRED";
var SHOW_PROCESS_MSG="Please Wait...";
var PRODUCT_REVIEW_FEEDBACK_MSG="Thank you for your feedback.";
var CATALOG_ITEM_ALREADY_ADDED="This item is already added in your list.";
var CATALOG_CONTEXT_TEXT="This is context from client.";
var CATALOG_QOE_ITEM_ADDED_SUCCESS="Items added/updated to the cart successfully.";
var HEADER_MODULE_LOAD_YUI_LIBRARY_MSG="\"Could not load YUI Library.\""
var IN_YOUR_CART_POPUP_MSG= "In Your Cart";
var SUB_TOTAL_LABEL="Sub Total: ";
var PROCESS_MSG_FLOATING_CART="Processing...";
var FLOATCART_ITEMCOUNT = "Item(s)";
var ITEMS_ADDED_SUCCESSFULLY_MSG="Item(s) added successfully.";
var SHOPPING_CART_EMPTY_MSG ="Your Shopping Cart is empty.";
var CATALOG_QOE_CONT_CHECKOUT ="Continue Checkout";
var REMOVE_ALL="Remove All";    
var FAST_CHECKOUT="Fast Checkout";
var PAYPAL_CHECKOUT="Pay Pal Checkout";
var ROW_EMPTY_MSG="Row {0} is empty";

var UPDATED_SUCCESSFULLY_MSG="Updated successfully";
var UPDATING_DATA_MSG="Updating data ...";
var UPDATE_FAILED_MSG="Update failed";
var SKU_LOADING_WAIT_MSG="Loading Sku, please wait...";
var NOT_APPLICABLE ="Not Applicable";
var UNRECOGNIZED_EXPRESSION_ERROR_MSG ="Syntax error, unrecognized expression: ";
var TYPE_PROPERTY_CANNOT_CHANGED_MSG ="type property can't be changed";
var CONTROLLER_MSG_ALREADY_DELETED_MSG ="controller instance has already been deleted";
var IMPLEMENT_CREATE ="Implement Create";
var JVMC_MUST_IMPLEMENT_UPDATE_FUNCTION_MSG="JMVC--! You Must Implement {0} 's \"update\" Function !--";
var JVMC_MUST_IMPLEMENT_DESTROY_FUNCTION_MSG="JMVC--! You Must Implement {0} 's \"destroy\" Function !--";
var NO_TEMPLATE_EXP_MSG="There is no template at";
var EXCEPTION="Exception:";
var NO_SUPPORTED_DELIMINATOR="is not a supported deliminator";
var WARNING_FOR_FIXTURE_PLUGIN_INCLUDED="\nWARNING! The Fixture Plugin Is Included!!!!!!\n";

//Added by kashif
//Added by Kashif ----

var CATALOG_DOWNLOAD_ALERT = "Please select minimum one download. ";
var CATALOG_JSMSG_SELECT_ATTRIBUTE = "Please select proper sku attributes !!.";
var CREDITCARD_DETAILS_SAVED_MSG = "Your Credit Card details will be saved with us If you are subscribing for an order.";
var UNSUBSCRIBE_SUBSCRIPT_ITEM_MSG = "This will unsubscribe your item subscription once saved.";
var ENTER_VALID_AMOUNT_MSG = "Please enter valid amount.";
var ENTER_PROPER_CODE_MSG = "Please enter proper code.";
var CATALOG_HAND_NOT_REMOVED= "Handler could not be removed.";
var CONFORMMSG_FOR_SUBSCIPTION_CANCLE ="Do you want continue? \nNote: This action will cancel your subscription of this order.";
var ADDING_TO_CART_MSG ="Adding to your cart, please wait...";
var CATALOG_JSMSG_ATLEAST_ONE_PRODUCT = "Please enter value against atleast one product. "; 
var CATALOG_JSMSG_GIFTWRAP_MSGLENGTH = "Message length must be less than 255 characters!.";
var CATALOG_ENTER_NUMERIC = "Please enter valid price.";
var CATALOG_JSMG_PRICE_RANGE = "Please enter valid price range.";
var CATALOG_JSMSG_ENTER_SEARCH_CRITERIA = "Please enter a keyword in search criteria."; 
var CATALOG_JSMSG_ENTER_ZIP = "Please enter zip code.";
var GENERAL_PAGE_10i = "10";
var BACK_BUTTON_TOOLTIP="Back";
var BUTTON_CLOSE_TOOLTIP = "Close";
var PAYMENT_REFERENCE_MSG = "Please enter payment reference number.";
var SEND_YOUR_NAME_EMAIL_VALIDATION_MSG = "Please enter your valid name and email.";
var SEND_NAME_EMAIL_VALIDATION_MSG = "Please enter valid name and email.";

var REVIEW_FEEDBACK_SUCCESS_MESSAGE = "Thank you! You have successfully submitted feedback for this review.";
var UPS_ADDRESS_VALIDATION_HEADER = "The address entered seems to be invalid. Please click on the address from the suggested alternatives below:";
var UPS_ADDRESS_VALIDATION_FOOTER = "We use <a   href='https://www.ups.com/upsdeveloperkit/downloadresource?loc=en_US' target='_blank' >UPS Address Validation</a> to validate the address in United States.";
var REWARD_POINT_VALIDATION_MSG = "Please enter valid number value.";;


/* Comment Generated by Combres - Resource '~/client_scripts/JQuery/ui/jquery.easing.1.3.js' (Mode: Static) */
/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2001 Robert Penner
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 */;


/* Comment Generated by Combres - Resource '~/client_scripts/JQuery/ui/jquery.overlay.min.js' (Mode: Static) */
/*
 * jQuery Tools 1.2.5 - The missing UI library for the Web
 * 
 * [overlay, overlay.apple]
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/
 * 
 * File generated: Fri Oct 01 11:56:36 GMT 2010
 */
/*!
* jQuery Tools v1.2.6 - The missing UI library for the Web
* 
* toolbox/toolbox.expose.js
* 
* NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
* 
* http://flowplayer.org/tools/
* 
*/
(function (a) { a.tools = a.tools || { version: "v1.2.6" }; var b; b = a.tools.expose = { conf: { maskId: "exposeMask", loadSpeed: "slow", closeSpeed: "fast", closeOnClick: !0, closeOnEsc: !0, zIndex: 9998, opacity: .8, startOpacity: 0, color: "#fff", onLoad: null, onClose: null} }; function c() { if (a.browser.msie) { var b = a(document).height(), c = a(window).height(); return [window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, b - c < 20 ? c : b] } return [a(document).width(), a(document).height()] } function d(b) { if (b) return b.call(a.mask) } var e, f, g, h, i; a.mask = { load: function (j, k) { if (g) return this; typeof j == "string" && (j = { color: j }), j = j || h, h = j = a.extend(a.extend({}, b.conf), j), e = a("#" + j.maskId), e.length || (e = a("<div/>").attr("id", j.maskId), a("body").append(e)); var l = c(); e.css({ position: "absolute", top: 0, left: 0, width: l[0], height: l[1], display: "none", opacity: j.startOpacity, zIndex: j.zIndex }), j.color && e.css("backgroundColor", j.color); if (d(j.onBeforeLoad) === !1) return this; j.closeOnEsc && a(document).bind("keydown.mask", function (b) { b.keyCode == 27 && a.mask.close(b) }), j.closeOnClick && e.bind("click.mask", function (b) { a.mask.close(b) }), a(window).bind("resize.mask", function () { a.mask.fit() }), k && k.length && (i = k.eq(0).css("zIndex"), a.each(k, function () { var b = a(this); /relative|absolute|fixed/i.test(b.css("position")) || b.css("position", "relative") }), f = k.css({ zIndex: Math.max(j.zIndex + 1, i == "auto" ? 0 : i) })), e.css({ display: "block" }).fadeTo(j.loadSpeed, j.opacity, function () { a.mask.fit(), d(j.onLoad), g = "full" }), g = !0; return this }, close: function () { if (g) { if (d(h.onBeforeClose) === !1) return this; e.fadeOut(h.closeSpeed, function () { d(h.onClose), f && f.css({ zIndex: i }), g = !1 }), a(document).unbind("keydown.mask"), e.unbind("click.mask"), a(window).unbind("resize.mask") } return this }, fit: function () { if (g) { var a = c(); e.css({ width: a[0], height: a[1] }) } }, getMask: function () { return e }, isLoaded: function (a) { return a ? g == "full" : g }, getConf: function () { return h }, getExposed: function () { return f } }, a.fn.mask = function (b) { a.mask.load(b); return this }, a.fn.expose = function (b) { a.mask.load(b, this); return this } })(jQuery);

(function(a){function t(d,b){var c=this,j=d.add(c),o=a(window),k,f,m,g=a.tools.expose&&(b.mask||b.expose),n=Math.random().toString().slice(10);if(g){if(typeof g=="string")g={color:g};g.closeOnClick=g.closeOnEsc=false}var p=b.target||d.attr("rel");f=p?a(p):d;if(!f.length)throw"Could not find Overlay: "+p;d&&d.index(f)==-1&&d.click(function(e){c.load(e);return e.preventDefault()});a.extend(c,{load:function(e){if(c.isOpened())return c;var h=q[b.effect];if(!h)throw'Overlay: cannot find effect : "'+b.effect+
'"';b.oneInstance&&a.each(s,function(){this.close(e)});e=e||a.Event();e.type="onBeforeLoad";j.trigger(e);if(e.isDefaultPrevented())return c;m=true;g&&a(f).expose(g);var i=b.top,r=b.left,u=f.outerWidth({margin:true}),v=f.outerHeight({margin:true});if(typeof i=="string")i=i=="center"?Math.max((o.height()-v)/2,0):parseInt(i,10)/100*o.height();if(r=="center")r=Math.max((o.width()-u)/2,0);h[0].call(c,{top:i,left:r},function(){if(m){e.type="onLoad";j.trigger(e)}});g&&b.closeOnClick&&a.mask.getMask().one("click",
c.close);b.closeOnClick&&a(document).bind("click."+n,function(l){a(l.target).parents(f).length||c.close(l)});b.closeOnEsc&&a(document).bind("keydown."+n,function(l){l.keyCode==27&&c.close(l)});return c},close:function(e){if(!c.isOpened())return c;e=e||a.Event();e.type="onBeforeClose";j.trigger(e);if(!e.isDefaultPrevented()){m=false;q[b.effect][1].call(c,function(){e.type="onClose";j.trigger(e)});a(document).unbind("click."+n).unbind("keydown."+n);g&&a.mask.close();return c}},getOverlay:function(){return f},
getTrigger:function(){return d},getClosers:function(){return k},isOpened:function(){return m},getConf:function(){return b}});a.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(e,h){a.isFunction(b[h])&&a(c).bind(h,b[h]);c[h]=function(i){i&&a(c).bind(h,i);return c}});k=f.find(b.close||".close");if(!k.length&&!b.close){k=a('<a class="close"></a>');f.prepend(k)}k.click(function(e){c.close(e)});b.load&&c.load()}a.tools=a.tools||{version:"1.2.5"};a.tools.overlay={addEffect:function(d,
b,c){q[d]=[b,c]},conf:{close:null,closeOnClick:true,closeOnEsc:true,closeSpeed:"fast",effect:"default",fixed:!a.browser.msie||a.browser.version>6,left:"center",load:false,mask:null,oneInstance:true,speed:"normal",target:null,top:"10%"}};var s=[],q={};a.tools.overlay.addEffect("default",function(d,b){var c=this.getConf(),j=a(window);if(!c.fixed){d.top+=j.scrollTop();d.left+=j.scrollLeft()}d.position=c.fixed?"fixed":"absolute";this.getOverlay().css(d).fadeIn(c.speed,b)},function(d){this.getOverlay().fadeOut(this.getConf().closeSpeed,
d)});a.fn.overlay=function(d){var b=this.data("overlay");if(b)return b;if(a.isFunction(d))d={onBeforeLoad:d};d=a.extend(true,{},a.tools.overlay.conf,d);this.each(function(){b=new t(a(this),d);s.push(b);a(this).data("overlay",b)});return d.api?b:this}})(jQuery);
(function(h){function k(d){var e=d.offset();return{top:e.top+d.height()/2,left:e.left+d.width()/2}}var l=h.tools.overlay,f=h(window);h.extend(l.conf,{start:{top:null,left:null},fadeInSpeed:"fast",zIndex:9999});function o(d,e){var a=this.getOverlay(),c=this.getConf(),g=this.getTrigger(),p=this,m=a.outerWidth({margin:true}),b=a.data("img"),n=c.fixed?"fixed":"absolute";if(!b){b=a.css("backgroundImage");if(!b)throw"background-image CSS property not set for overlay";b=b.slice(b.indexOf("(")+1,b.indexOf(")")).replace(/\"/g,
"");a.css("backgroundImage","none");b=h('<img src="'+b+'"/>');b.css({border:0,display:"none"}).width(m);h("body").append(b);a.data("img",b)}var i=c.start.top||Math.round(f.height()/2),j=c.start.left||Math.round(f.width()/2);if(g){g=k(g);i=g.top;j=g.left}if(c.fixed){i-=f.scrollTop();j-=f.scrollLeft()}else{d.top+=f.scrollTop();d.left+=f.scrollLeft()}b.css({position:"absolute",top:i,left:j,width:0,zIndex:c.zIndex}).show();d.position=n;a.css(d);b.animate({top:a.css("top"),left:a.css("left"),width:m},
c.speed, function () { a.css("zIndex", c.zIndex + 1).fadeIn(c.fadeInSpeed, function () { p.isOpened() && !h(this).index(a) ? e.call() : a.hide() }) }).css("position", n)
} function q(d) { var e = this.getOverlay().hide(), a = this.getConf(), c = this.getTrigger(); e = e.data("img"); var g = { top: a.start.top, left: a.start.left, width: 0 }; c && h.extend(g, k(c)); a.fixed && e.css({ position: "absolute" }).animate({ top: "+=" + f.scrollTop(), left: "+=" + f.scrollLeft() }, 0); e.animate(g, a.closeSpeed, d) } l.addEffect("apple", o, q)
})(jQuery);

;


/* Comment Generated by Combres - Resource '~/client_scripts/ignify.utility.js' (Mode: Static) */

if (!ignify)
    ignify = {};

var currencycultureMap = [
{"culture":"ar-SA","currencycode":"SAR"},
{"culture":"bg-BG","currencycode":"BGN"},
{"culture":"ca-ES","currencycode":"EUR"},
{"culture":"zh-TW","currencycode":"TWD"},
{"culture":"cs-CZ","currencycode":"CZK"},
{"culture":"da-DK","currencycode":"DKK"},
{"culture":"de-DE","currencycode":"EUR"},
{"culture":"el-GR","currencycode":"EUR"},
{"culture":"en-US","currencycode":"USD"},
{"culture":"fi-FI","currencycode":"EUR"},
{"culture":"fr-FR","currencycode":"EUR"},
{"culture":"he-IL","currencycode":"ILS"},
{"culture":"hu-HU","currencycode":"HUF"},
{"culture":"is-IS","currencycode":"ISK"},
{"culture":"it-IT","currencycode":"EUR"},
{"culture":"ja-JP","currencycode":"JPY"},
{"culture":"ko-KR","currencycode":"KRW"},
{"culture":"nl-NL","currencycode":"EUR"},
{"culture":"nb-NO","currencycode":"NOK"},
{"culture":"pl-PL","currencycode":"PLN"},
{"culture":"pt-BR","currencycode":"BRL"},
{"culture":"rm-CH","currencycode":"CHF"},
{"culture":"ro-RO","currencycode":"RON"},
{"culture":"ru-RU","currencycode":"RUB"},
{"culture":"hr-HR","currencycode":"HRK"},
{"culture":"sk-SK","currencycode":"EUR"},
{"culture":"sq-AL","currencycode":"ALL"},
{"culture":"sv-SE","currencycode":"SEK"},
{"culture":"th-TH","currencycode":"THB"},
{"culture":"tr-TR","currencycode":"TRY"},
{"culture":"ur-PK","currencycode":"PKR"},
{"culture":"id-ID","currencycode":"IDR"},
{"culture":"uk-UA","currencycode":"UAH"},
{"culture":"be-BY","currencycode":"BYR"},
{"culture":"sl-SI","currencycode":"EUR"},
{"culture":"et-EE","currencycode":"EEK"},
{"culture":"lv-LV","currencycode":"LVL"},
{"culture":"lt-LT","currencycode":"LTL"},
{"culture":"tg-Cyrl-TJ","currencycode":"TJS"},
{"culture":"fa-IR","currencycode":"IRR"},
{"culture":"vi-VN","currencycode":"VND"},
{"culture":"hy-AM","currencycode":"AMD"},
{"culture":"az-Latn-AZ","currencycode":"AZN"},
{"culture":"eu-ES","currencycode":"EUR"},
{"culture":"hsb-DE","currencycode":"EUR"},
{"culture":"mk-MK","currencycode":"MKD"},
{"culture":"tn-ZA","currencycode":"ZAR"},
{"culture":"xh-ZA","currencycode":"ZAR"},
{"culture":"zu-ZA","currencycode":"ZAR"},
{"culture":"af-ZA","currencycode":"ZAR"},
{"culture":"ka-GE","currencycode":"GEL"},
{"culture":"fo-FO","currencycode":"DKK"},
{"culture":"hi-IN","currencycode":"INR"},
{"culture":"mt-MT","currencycode":"EUR"},
{"culture":"se-NO","currencycode":"NOK"},
{"culture":"ms-MY","currencycode":"MYR"},
{"culture":"kk-KZ","currencycode":"KZT"},
{"culture":"ky-KG","currencycode":"KGS"},
{"culture":"sw-KE","currencycode":"KES"},
{"culture":"tk-TM","currencycode":"TMT"},
{"culture":"uz-Latn-UZ","currencycode":"UZS"},
{"culture":"tt-RU","currencycode":"RUB"},
{"culture":"bn-IN","currencycode":"INR"},
{"culture":"pa-IN","currencycode":"INR"},
{"culture":"gu-IN","currencycode":"INR"},
{"culture":"or-IN","currencycode":"INR"},
{"culture":"ta-IN","currencycode":"INR"},
{"culture":"te-IN","currencycode":"INR"},
{"culture":"kn-IN","currencycode":"INR"},
{"culture":"ml-IN","currencycode":"INR"},
{"culture":"as-IN","currencycode":"INR"},
{"culture":"mr-IN","currencycode":"INR"},
{"culture":"sa-IN","currencycode":"INR"},
{"culture":"mn-MN","currencycode":"MNT"},
{"culture":"bo-CN","currencycode":"CNY"},
{"culture":"cy-GB","currencycode":"GBP"},
{"culture":"km-KH","currencycode":"KHR"},
{"culture":"lo-LA","currencycode":"LAK"},
{"culture":"gl-ES","currencycode":"EUR"},
{"culture":"kok-IN","currencycode":"INR"},
{"culture":"syr-SY","currencycode":"SYP"},
{"culture":"si-LK","currencycode":"LKR"},
{"culture":"iu-Cans-CA","currencycode":"CAD"},
{"culture":"am-ET","currencycode":"ETB"},
{"culture":"ne-NP","currencycode":"NPR"},
{"culture":"fy-NL","currencycode":"EUR"},
{"culture":"ps-AF","currencycode":"AFN"},
{"culture":"fil-PH","currencycode":"PHP"},
{"culture":"dv-MV","currencycode":"MVR"},
{"culture":"ha-Latn-NG","currencycode":"NIO"},
{"culture":"yo-NG","currencycode":"NIO"},
{"culture":"quz-BO","currencycode":"BOB"},
{"culture":"nso-ZA","currencycode":"ZAR"},
{"culture":"ba-RU","currencycode":"RUB"},
{"culture":"lb-LU","currencycode":"EUR"},
{"culture":"kl-GL","currencycode":"DKK"},
{"culture":"ig-NG","currencycode":"NIO"},
{"culture":"ii-CN","currencycode":"CNY"},
{"culture":"arn-CL","currencycode":"CLP"},
{"culture":"moh-CA","currencycode":"CAD"},
{"culture":"br-FR","currencycode":"EUR"},
{"culture":"ug-CN","currencycode":"CNY"},
{"culture":"mi-NZ","currencycode":"NZD"},
{"culture":"oc-FR","currencycode":"EUR"},
{"culture":"co-FR","currencycode":"EUR"},
{"culture":"gsw-FR","currencycode":"EUR"},
{"culture":"sah-RU","currencycode":"RUB"},
{"culture":"qut-GT","currencycode":"GTQ"},
{"culture":"rw-RW","currencycode":"RWF"},
{"culture":"wo-SN","currencycode":"XOF"},
{"culture":"prs-AF","currencycode":"AFN"},
{"culture":"gd-GB","currencycode":"GBP"},
{"culture":"ar-IQ","currencycode":"IQD"},
{"culture":"zh-CN","currencycode":"CNY"},
{"culture":"de-CH","currencycode":"CHF"},
{"culture":"en-GB","currencycode":"GBP"},
{"culture":"es-MX","currencycode":"MXN"},
{"culture":"fr-BE","currencycode":"EUR"},
{"culture":"it-CH","currencycode":"CHF"},
{"culture":"nl-BE","currencycode":"EUR"},
{"culture":"nn-NO","currencycode":"NOK"},
{"culture":"pt-PT","currencycode":"EUR"},
{"culture":"sr-Latn-CS","currencycode":"CSD"},
{"culture":"sv-FI","currencycode":"EUR"},
{"culture":"az-Cyrl-AZ","currencycode":"AZN"},
{"culture":"dsb-DE","currencycode":"EUR"},
{"culture":"se-SE","currencycode":"SEK"},
{"culture":"ga-IE","currencycode":"EUR"},
{"culture":"ms-BN","currencycode":"BND"},
{"culture":"uz-Cyrl-UZ","currencycode":"UZS"},
{"culture":"bn-BD","currencycode":"BDT"},
{"culture":"mn-Mong-CN","currencycode":"CNY"},
{"culture":"iu-Latn-CA","currencycode":"CAD"},
{"culture":"tzm-Latn-DZ","currencycode":"DZD"},
{"culture":"quz-EC","currencycode":"USD"},
{"culture":"ar-EG","currencycode":"EGP"},
{"culture":"zh-HK","currencycode":"HKD"},
{"culture":"de-AT","currencycode":"EUR"},
{"culture":"en-AU","currencycode":"AUD"},
{"culture":"es-ES","currencycode":"EUR"},
{"culture":"fr-CA","currencycode":"CAD"},
{"culture":"sr-Cyrl-CS","currencycode":"CSD"},
{"culture":"se-FI","currencycode":"EUR"},
{"culture":"quz-PE","currencycode":"PEN"},
{"culture":"ar-LY","currencycode":"LYD"},
{"culture":"zh-SG","currencycode":"SGD"},
{"culture":"de-LU","currencycode":"EUR"},
{"culture":"en-CA","currencycode":"CAD"},
{"culture":"es-GT","currencycode":"GTQ"},
{"culture":"fr-CH","currencycode":"CHF"},
{"culture":"hr-BA","currencycode":"BAM"},
{"culture":"smj-NO","currencycode":"NOK"},
{"culture":"ar-DZ","currencycode":"DZD"},
{"culture":"zh-MO","currencycode":"MOP"},
{"culture":"de-LI","currencycode":"CHF"},
{"culture":"en-NZ","currencycode":"NZD"},
{"culture":"es-CR","currencycode":"CRC"},
{"culture":"fr-LU","currencycode":"EUR"},
{"culture":"bs-Latn-BA","currencycode":"BAM"},
{"culture":"smj-SE","currencycode":"SEK"},
{"culture":"ar-MA","currencycode":"MAD"},
{"culture":"en-IE","currencycode":"EUR"},
{"culture":"es-PA","currencycode":"PAB"},
{"culture":"fr-MC","currencycode":"EUR"},
{"culture":"sr-Latn-BA","currencycode":"BAM"},
{"culture":"sma-NO","currencycode":"NOK"},
{"culture":"ar-TN","currencycode":"TND"},
{"culture":"en-ZA","currencycode":"ZAR"},
{"culture":"es-DO","currencycode":"DOP"},
{"culture":"sr-Cyrl-BA","currencycode":"BAM"},
{"culture":"sma-SE","currencycode":"SEK"},
{"culture":"ar-OM","currencycode":"OMR"},
{"culture":"en-JM","currencycode":"JMD"},
{"culture":"es-VE","currencycode":"VEF"},
{"culture":"bs-Cyrl-BA","currencycode":"BAM"},
{"culture":"sms-FI","currencycode":"EUR"},
{"culture":"ar-YE","currencycode":"YER"},
{"culture":"en-029","currencycode":"USD"},
{"culture":"es-CO","currencycode":"COP"},
{"culture":"sr-Latn-RS","currencycode":"RSD"},
{"culture":"smn-FI","currencycode":"EUR"},
{"culture":"ar-SY","currencycode":"SYP"},
{"culture":"en-BZ","currencycode":"BZD"},
{"culture":"es-PE","currencycode":"PEN"},
{"culture":"sr-Cyrl-RS","currencycode":"RSD"},
{"culture":"ar-JO","currencycode":"JOD"},
{"culture":"en-TT","currencycode":"TTD"},
{"culture":"es-AR","currencycode":"ARS"},
{"culture":"sr-Latn-ME","currencycode":"EUR"},
{"culture":"ar-LB","currencycode":"LBP"},
{"culture":"en-ZW","currencycode":"ZWL"},
{"culture":"es-EC","currencycode":"USD"},
{"culture":"sr-Cyrl-ME","currencycode":"EUR"},
{"culture":"ar-KW","currencycode":"KWD"},
{"culture":"en-PH","currencycode":"PHP"},
{"culture":"es-CL","currencycode":"CLP"},
{"culture":"ar-AE","currencycode":"AED"},
{"culture":"es-UY","currencycode":"UYU"},
{"culture":"ar-BH","currencycode":"BHD"},
{"culture":"es-PY","currencycode":"PYG"},
{"culture":"ar-QA","currencycode":"QAR"},
{"culture":"en-IN","currencycode":"INR"},
{"culture":"es-BO","currencycode":"BOB"},
{"culture":"en-MY","currencycode":"MYR"},
{"culture":"es-SV","currencycode":"USD"},
{"culture":"en-SG","currencycode":"SGD"},
{"culture":"es-HN","currencycode":"HNL"},
{"culture":"es-NI","currencycode":"NIO"},
{"culture":"es-PR","currencycode":"USD"},
{"culture":"es-US","currencycode":"USD"}
];


ignify.utility = function () {

    this.defaultdigitsafterdecimal = "";
    this.defaultuseparensfornegativenumbers = "";
    this.defaultusecommaformat = "";
    this.defaultcurrencycode = "";
    this.culture = "";
    this.defaultculture = "";
    /// <summary>
    ///     Returns the max zOrder in the document (no parameter)
    ///     Sets max zOrder +inc to the obj if passed
    /// </summary>    

    /// <param name="opt" type="object">
    ///     inc: increment value, 
    ///     group: selector for zIndex elements to find max for
    /// </param>

    ///<example>
    ///        ignify_utility_js.setzindex($("#divid")); 
    ///        OR 
    ///        ignify_utility_js.setzindex($("#divid"), {inc:5});  
    ///        OR 
    ///       ignify_utility_js.setzindex($("#divid"), {inc:5, group:".classname"});
    ///</example>

    /// <returns type="jQuery" />

    //This method is being used to format the html.
    // On category listing template of GadgetsOnline categories are listed in 3X3 grid. 
    // First category should be left aligned and 3rd category should be right aligned in each row. Following method is used to assign specific classes.
    this.justifyhtml = function (classname, gridlength) {
        if (gridlength == undefined)
            gridlength = 3;
        $("." + classname).each(function (counter) {
            if (gridlength == 3) {
                if (counter % 3 == 0) {
                    $(this).addClass("leftalign");
                }
                else if (counter % 3 == 2) {
                    $(this).addClass("rightalign");
                }
                else
                    $(this).addClass("centeralign");
            }
            if (gridlength == 4) {
                if (counter % 4 == 0) {
                    $(this).addClass("leftalign");
                }
            }
        });
    };

    this.setzindex = function (obj, opt) {

        var def = { inc: 10, group: "*" };
        $.extend(def, opt);
        var zmax = 0;
        $(def.group).each(function () {
            var cur = parseInt($(this).css('z-index'));
            zmax = cur > zmax ? cur : zmax;
        });

        if (obj != null && obj != undefined) {
            zmax += def.inc;
            obj.css("z-index", zmax);

        }

        return zmax;
    };

    this.validateforintegernumber = function (evt) {
        var charCode = (evt.which) ? evt.which : event.keyCode
        if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

        return true;
    };

    this.validateforpositivenumbers = function (value) {
        if ($.trim(value) == "")
            value = "1";
        if (this.isnumeric(value) && (parseInt(value) >= 0 || parseFloat(value) >= 0.0))
            return true;
        else
            return false;
    };

    this.validatefornonzero = function (value) {
        if ($.trim(value) == "")
            value = "1";
        if (this.isnumeric(value) && (parseInt(value) > 0 || parseFloat(value) > 0.0))
            return true;
        else
            return false;
    };
    this.searchforkeyword = function (SearchValue, searchUrl, searchCategory, AlertMsg, searchKeywordOption, searchincategory) {
        SearchValue = this.formatsearchvalue(SearchValue);
        if (SearchValue != null) {
            if (((SearchValue == "") && (SearchValue.length == 0)) || SearchValue == CATALOG_KEYWORD) {
                return;
            }
            else {
                url = this.formaturl(searchUrl, searchincategory, SearchValue, 'q', searchKeywordOption, searchCategory, "", SearchValue, searchCategory)
                window.location.href = url;
            }
        }
    };
    this.searchproductsandarticles = function (articlesearch, SearchValue, searchUrl, searchCategory) {
        SearchValue = this.formatsearchvalue(SearchValue);
        if (SearchValue != null) {
            if ((SearchValue == "") && (SearchValue.length == 0)) {
                return;
            }
            else {
                url = this.formaturl(searchUrl, SearchValue, searchCategory, "", SearchValue, 'q', 'ALL', searchCategory, "", articlesearch)
                window.location.href = url;
            }
        }
    };

    this.isnumeric = function (obj) {
        return !isNaN(obj);
    };

    // This function gets any parameter you want from the query string
    // if the param does not exist in the query strign it returns an empty string.
    this.querystring = function QueryString(name) {

        if (name == "" || name == undefined) {
            //return the entire query string without the "?"
            return (window.location.href.split(/\?/)[1]);
        }

        name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
        var regexS = "[\\?&]" + name + "=([^&#]*)";
        var regex = new RegExp(regexS);
        var results = regex.exec(window.location.href);
        if (results == null)
            return "";
        else
            return results[1];
    };

    this.createwrapperform = function (formId, actionType, formAction, divContainerId) {
        var frm = document.createElement("form");

        var temp = document.createAttribute("id");
        temp.value = formId;
        frm.attributes.setNamedItem(temp);

        temp = document.createAttribute("method");
        temp.value = actionType;
        frm.attributes.setNamedItem(temp);

        temp = document.createAttribute("action");
        temp.value = formAction;
        frm.attributes.setNamedItem(temp);

        var parent = document.getElementById(divContainerId).parentNode;
        var next = document.getElementById(divContainerId).nextSibling;

        frm.appendChild(document.getElementById(divContainerId));
        parent.insertBefore(frm, next);

    };

    this.removedefaultvalue = function (objControl, objDefaultValue) {
        if (objControl != null) {
            if (objControl.value == objDefaultValue) {
                objControl.value = "";
            }
        }
    }

    this.setdefaultvalue = function (objControl, objDefaultValue) {
        if (objControl != null) {
            if ($.trim(objControl.value) == "") {
                objControl.value = objDefaultValue;
            }
        }
    };

    this.formatsearchvalue = function (searchtext) {
        //removing unneccessory chars from the keyword input
        searchtext = searchtext.replace(/[^-a-zA-Z0-9_,.\s;]/g, '');

        //replacing consicutive chars with single char in the keyword input
        searchtext = searchtext.replace(/[\-]+/g, "-");
        searchtext = searchtext.replace(/[\.]+/g, ".");
        searchtext = searchtext.replace(/[\,]+/g, ",");
        searchtext = searchtext.replace(/[\_]+/g, "_");
        searchtext = searchtext.replace(/[\;]+/g, ";");

        //trimming the keyword input
        searchtext = $.trim(searchtext);
        return searchtext;
    };

    this.formaturl = function (str) {
        //arguments is an in-built JS variable which indicates all arguments (array list of arguments) in the function
        //So, str is a comma seperated array of arguments
        //Example: how to call this function: formaturl('Hello {0} & {1} & {2} & {3}', 'John','Jane','Kristina','Alex'); 
        //Output will be: 'Hello John & Jane & Kristina & Alex'

        for (i = 1; i < arguments.length; i++) {
            str = str.replace('{' + (i - 1) + '}', arguments[i]);
        }

        return str;
    };

    this.movetowishlist = function (ItemCode, idofsuccessmessage) {
        $(".addtocart_errormsg").each(function (i) {
            $(this).hide();
        });
        $(".addtocart_successmsg").each(function (i) {
            $(this).hide();
        });

        $.get(homeUrl + "product/addskutowishlist/" + ItemCode, function (data) { $(".wishlistmsg").html(""); $("#" + idofsuccessmessage).html(data.returnMessage); });
    }

    this.getecommerce = function (widgetTemplateID,
                                        widgetCssClass,
                                        widgetBodyCssClass,
                                        widgetContentCssClass) {
        /*
        widgetTemplateHtml = " \n  <div id=\"" + widgetTemplateID + "\" class=\"sys-template\"> " +
        "\n\t         <div code:if=\"col==$element.id\" id=\"{{title + '_widget-' + id}}\" class=\"" + widgetCssClass + "\"> " +
        "\n\t         <!-- Start of  widget --> " +
        "\n\t\t             <div class=\"" + widgetBodyCssClass + "\" id=\"{{title + '_widget' + id + 'body'}}\"> " +
        "\n\t\t\t                 <div  id=\"{{$id('ecomwidget_')}}\" sys-key=\"self\" class=\"" + widgetContentCssClass + "\" sys:attach=\"queueajax\" queueajax:priority={{order}}" +
        "\n                     queueajax:url=\"{{'" + homeUrl + "Widgets-' + controller + '/' + action + '/' + param1+ '/' + param2+ '/' + param3+ '/' + param4+ '/' + param5+ '/' + param6}}\"> " +
        "\n\t\t\t\t                     <div id='loadingdiv' style=\"text-align: center; padding: 20px; margin: 5px;\"> " +
        "\n                         <img src=\"" + mc_ThemeBase + "images/loading.gif\" alt=\"loading widget\" /> " +
        "\n\t\t\t\t                     </div> " +
        "\n\t\t\t                 </div> " +
        "\n\t\t             </div> " +
        "\n\t         <!-- End of  widget --> " +
        "\n\t         </div> " +
        "\n     </div> ";

        */
        this.inserttemplate(widgetTemplateID,
                                        widgetCssClass,
                                        widgetBodyCssClass,
                                        widgetContentCssClass);

        var ajaxFrameworkObj = new IgnifyAjaxFramework();
        ajaxFrameworkObj.pushajaxcallinqueue();
    }

    this.inserttemplate = function (widgetTemplateID, widgetCssClass, widgetBodyCssClass, widgetContentCssClass) {

        widgetTemplateHtml = " \n  <div id=\"" + widgetTemplateID + "\" class=\"sys-template\"> " +
                                         "\n\t         <div id=\"{{title + '_widget-' + id}}\" class=\"" + widgetCssClass + "\"> " +
                                         "\n\t         <!-- Start of  widget --> " +
                                         "\n\t\t             <div class=\"" + widgetBodyCssClass + "\" id=\"{{title + '_widget' + id + 'body'}}\"> " +
                                         "\n\t\t\t                 <div  id=\"{{title + '_widget' + id + 'content'}}\" class=\"" + widgetContentCssClass + "\" >" +
                                         "\n\t\t\t\t                     <div id='loadingdiv' style=\"text-align: center; padding: 20px; margin: 5px;\"> " +
                                         "\n                         <img src=\"" + mc_ThemeBase + "images/loading.gif\" alt=\"loading widget\" /> " +
                                         "\n\t\t\t\t                     </div> " +
                                         "\n\t\t\t                 </div> " +
                                         "\n\t\t             </div> " +
                                         "\n\t         <!-- End of  widget --> " +
                                         "\n\t         </div> " +
                                         "\n     </div> ";

        if ($("#" + widgetTemplateID).length <= 0) {
            $("body").append(widgetTemplateHtml);
        }
    };

    this.refreshzoom = function () {
        try { MagicZoom_stopZooms(); } catch (e) { }
        try { MagicThumb.stop(); } catch (e) { }
        setTimeout(function () { MagicZoom_findZooms(); }, 200);
        setTimeout(function () { MagicThumb.refresh(); }, 300);
    };

    this.getcurrencysymbol = function (currencycode) {
        return this.getspecificcurrency('0.00', undefined, undefined, undefined, currencycode).replace('0.00', '');
    };

    this.getformattedcurrency = function (amount, digitsafterdecimal, useparensfornegativenumbers, usecommaformat) {
        // Set the optional parameter digitsafterdecimal
        if (digitsafterdecimal == undefined) {
            digitsafterdecimal = this.defaultdigitsafterdecimal; //2
        }
        ;
        // Set the optional parameter useparensfornegativenumbers
        //        if (useparensfornegativenumbers == undefined) {
        //            useparensfornegativenumbers = '-2';
        //        }
        // Set the optional parameter usecommaformat
        if (usecommaformat == undefined) {
            usecommaformat = this.defaultusecommaformat; //','
        }
        var c = $("<input>");
        c.attr("type", "text");
        c.val(amount);
        if (this.defaultculture.length <= 0 || this.defaultculture == null)
            this.defaultculture = this.getculturenamefromcurrencycode(this.defaultcurrencycode);

        var formattedamount;

        if (digitsafterdecimal.length > 0)
            formattedamount = c.formatCurrency({ roundToDecimalPlace: digitsafterdecimal, digitGroupSymbol: usecommaformat, region: this.defaultculture }).val();
        else
            formattedamount = c.formatCurrency({ digitGroupSymbol: usecommaformat, region: this.defaultculture }).val();
        return formattedamount;
    };

    this.getspecificcurrency = function (amount, digitsafterdecimal, useparensfornegativenumbers, usecommaformat, currencycode) {
        /* 
        Null handling of currencycode is removed from this 'getspecificcurrency' (Transaction API) as Transaction API should always 
        have currencycode. Previously if currencycode was not passed to this API then it was internally calling 'getformattedcurrency' 
        (non- transaction API) which was the wrong scenario
        WI# 6986
        */

        // Set the optional parameter digitsafterdecimal
        if (digitsafterdecimal == undefined) {
            digitsafterdecimal = this.defaultdigitsafterdecimal; //2                   
        }

        // Set the optional parameter useparensfornegativenumbers
        //        if (useparensfornegativenumbers == undefined) {
        //            useparensfornegativenumbers = '-2';
        //        }
        // Set the optional parameter usecommaformat
        if (usecommaformat == undefined) {
            usecommaformat = this.defaultusecommaformat; //','            
        }

        currencycode = $.trim(currencycode);
        var c = $("<input>");
        c.attr("type", "text");
        c.val(amount);
        if (this.culture.length <= 0 || this.culture == null)
            this.culture = this.getculturenamefromcurrencycode(currencycode);
        var formattedamount;
        
        if (digitsafterdecimal.length > 0)
            formattedamount = c.formatCurrency({ roundToDecimalPlace: digitsafterdecimal, digitGroupSymbol: usecommaformat, region: this.culture }).val();
        else
            formattedamount = c.formatCurrency({ digitGroupSymbol: usecommaformat, region: this.culture }).val();
        return formattedamount;

    };
    this.getculturenamefromcurrencycode = function (currencycode) {
        var returnvalue = "";
        currencycode = $.trim(currencycode);
        $.each(currencycultureMap, function (idx, obj) {
            if (obj.currencycode == currencycode) {
                returnvalue = obj.culture;
                return false; /* This is to break the loop when first match is found. Because there are multiple entries for cultures for a single currencycode. */
            } // end of if
        }
        ); // End of each loop
        return returnvalue;
    }; // End of getculturenamefromcurrencycode

    this.amounttonumber = function (amount) {
        var c = $("<input>");
        c.attr("type", "text");
        c.val(amount);
        var unformattedamount = c.toNumber().val();
        return unformattedamount;
    };

    this.isEnterPressed = function (e) {
        var keycode = null;
        if (e != null) {
            if (window.event != undefined) {
                if (window.event.keyCode) keycode = window.event.keyCode;
                else if (window.event.charCode) keycode = window.event.charCode;
            } else {
                keycode = e.keyCode;
            }
        }
        return (keycode == 13);
    };

};

var ignify_utility_js = new ignify.utility();
// No Special Characeters method is adding into JQery From Validations
if ($.validator != null && $.validator != undefined)
    $.validator.addMethod("nospecialcharacters", function (value, element) { return this.optional(element) || /^[a-z0-9\_ ]+$/i.test(value); }, "Please do not enter any special characters.");


  ;


/* Comment Generated by Combres - Resource '~/client_scripts/JQuery/ui/jquery.ui.widget.js' (Mode: Static) */
/*
 * jQuery UI Widget 1.8.5
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,
a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.substring(0,1)===
"_")return h;e?this.each(function(){var g=b.data(this,a);if(!g)throw"cannot call methods on "+a+" prior to initialization; attempted to call method '"+d+"'";if(!b.isFunction(g[d]))throw"no such method '"+d+"' for "+a+" widget instance";var i=g[d].apply(g,f);if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",
widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,b.metadata&&b.metadata.get(c)[this.widgetName],a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._init()},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+
"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a,e=this;if(arguments.length===0)return b.extend({},e.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}b.each(d,function(f,h){e._setOption(f,h)});return e},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},enable:function(){return this._setOption("disabled",
false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
;;


/* Comment Generated by Combres - Resource '~/client_scripts/Events/IgnItemAddedToCartEvent.js' (Mode: Static) */
function IgnItemAddedToCartEvent() {
    this.eventname = "IgnItemAddedToCartEvent";
    this.listen = bindToItemAddedToCartEvent;
    this.fireevent = triggerItemAddedToCartEvent;

    return true;
}
function bindToItemAddedToCartEvent(idOfObjToBind, callbackfunction) {
    
    $("#" + idOfObjToBind).bind(this.eventname, callbackfunction);
}
function triggerItemAddedToCartEvent(eventarguments) {

    $.event.trigger(this.eventname, [this, eventarguments]);
};


/* Comment Generated by Combres - Resource '~/client_scripts/ignify.cart.ops.js' (Mode: Static) */
/*
    Usage :
    Each item that can be added to the shopping cart must be wrapped in some HTML container like LI, DIV, SPAN anything. 
    The CLASS of the container should be "cartline". This cartline container(s) should be wrapped within another HTML container with class= "cartlinescontainer"
    Within the "cartline" container you may declare all the input fields that you want while following the below standard :
        1. All input fields will have NAME equal to the names of shopping cart fields. Pls contact the dev for reference.
        2. There should be atleast one input field which can help decide whether to add the item to cart or not.. So a checkbox, qty textbox etc will do fine.
        3. This primary input box (mentioned in point 2 above ) should have a class as 'cartlineaddtrigger'.
        4. If you always want a particular item to be added to cart even if the user has not selected it (like packaging material), you could create the primary input field as a hidden field and set some value to it.
        5. There is also a facility to add a default value which you could use for things like quantity textboxes. To use this, you must add a new attribute to the input field called 'defaultvalue' and set it.
        6. Inlcude this script on the page  and do the following :
            To the  ADDTOCART <A> tag, assign the following function to its onclick event. For example : 
                    <a href="javascript:void(0);" onclick="addtocart($(this),productid,preclickfunctionname, successhandlerfunctionname);" > 
            and the last two parameters above would be defined as such :
            <script>
                function preclickfunctionname()
                {
                    // Do somethign before the item is submitted for addign to cart.
                }

                function successhandlerfunctionname()
                {
                    // Do something here after successful add to cart.
                 }
            </script>

                    If you do not want to specify any one or both handlers then just pass null as the value.

            

IMPORTANT : The "Add To Cart" button/anchor should be within the HTML container whose class is "cartline".  

Example Usage:
*******************


    <ul class="cartlinescontainer">
        <li class="cartline">                                                                                                                            <--------------------- Note the <LI > CLASS
                                                                                                                               
                           <a href="javascript:void(0);" onclick="addtocart($(this),productid,null, null);" > 
      
                <b>ACCESSORY ITEM 1 : </b>                                                                                                                  
                <input class='cartlineaddtrigger' type="checkbox" value="SKU123" name="skucode" />           <---- Note the CLASS
                SKU123 &nbsp;&nbsp;&nbsp;&nbsp; QTY :
                <input type="textbox" name="qty">
        </li>
        <li class="cartline"><b>ACCESSORY ITEM 2 : </b>
                <input type="hidden" name="skucode" value="SKU999" />
                QTY :<input type="textbox" name="qty" class='cartlineaddtrigger' /> for SKU999                           <---- Note the CLASS
        </li>
        <li class="cartline"><b>ACCESSORY ITEM 3 : </b>
                <input type="checkbox" class='cartlineaddtrigger' value="SKU001" name="skucode"  />       <---- Note the CLASS
                SKU001<br>Qty for SKU001 :<input type="textbox" name="qty" defaultvalue='10' />                 <---- Note the "defaultvalue" usage                      
        </li>
    </ul>

     
*/
var g_cart_productid ;
// 1. this
// 2. CartController
//3. Make Shopping Cart URL can be a global variable in master template and web.config
// move productid to initcart
// remove showinventory
// remove hasalternate products
// Move addnewline to method
// remove themeimagesurl.
// Create a error controller and use ajax to log the error occuring in exception conditions. Also get the error id from server.




if (!ignify.cart)
    ignify.cart = {};

ignify.cart.ops = function () {

    /*  private variable */
    var linteitems = [];

    /* Private method */

    /**************************************************************************************************************************************************************/


    var gelineitemstoupdatecart = function (contentid) {
        var lineitemarray = "[";
        $('#' + contentid + '  li').each(function (i) {
            var oldqty = $("input[name=Quantity]", $(this)).attr("oldqty");
            if ($("input[name=Quantity]", $(this)).val() == oldqty)
                return;

            var templineitems = "";

            $("input", $(this)).each(function (x) {

                if ($(this).attr("type") == "button" || $(this).attr("type") == "submit")
                    return;

                var skufieldname = $(this).attr("name");
                var skufieldvalue = $(this).val();

                var skufielddefaultvalue = $(this).attr("defaultvalue");
                // Check if a default value is specified
                if (skufielddefaultvalue != undefined && skufielddefaultvalue != "") {
                    // If it is then check if both, the value and default value are either both numeric or both are non-numeric
                    // If one of them is numeric and the other is not then use a default value because the value could be a watermark text like "Qty".
                    if (skufieldvalue == "")//isNaN(skufieldvalue) != isNaN(skufielddefaultvalue) || 
                    {
                        skufieldvalue = skufielddefaultvalue;
                    }
                }
                if (skufieldname == "Personalization") {
                    if (templineitems == "") {
                        templineitems = "{";
                        templineitems += '"' + skufieldname + '":' + skufieldvalue;
                    }
                    else
                        templineitems += ',"' + skufieldname + '":' + skufieldvalue;
                }
                else {
                    if (templineitems == "") {
                        templineitems = "{";
                        templineitems += '"' + skufieldname + '":"' + skufieldvalue + '"';
                    }
                    else
                        templineitems += ',"' + skufieldname + '":"' + skufieldvalue + '"';
                }
            });
            if (lineitemarray == "[")
                lineitemarray += templineitems + "}";
            else
                lineitemarray += "," + templineitems + "}";

        });
        lineitemarray += "]";

        return lineitemarray;

    }


    var getlineitemstoaddtocart = function (addtocartbtn, idofaddtocartmessage) {

        var lineitemarray = "[";
        // Make only IF and ELSE only
        if (addtocartbtn.parents(".cartlinescontainer").length == 0 || addtocartbtn.parents(".cartlinescontainer").length > 1) {
            //            alert("Cant add to cart. None or too many cartlinecontainer(s) found. \n cartlinecontainer(s) count : " + addtocartbtn.parents(".cartlinescontainer").length);
            $.get(protocol + "//" + hostName + homeUrl + "error/logajaxerror?errormessage=" + "Cant add to cart. None or too many cartlinecontainer(s) found. \n cartlinecontainer(s) count : " + addtocartbtn.parents(".cartlinescontainer").length,
            function (response) { $("#" + idofaddtocartmessage).html(response).hide().fadeIn(1500); }
            );
            return "";
        }
        var cartlinescontainer = addtocartbtn.parents(".cartlinescontainer")[0];
        $(".cartline .cartlineaddtrigger", cartlinescontainer).each(function (c) {
            //debugger;
            if ($(this).hasClass("watermark")) return;
            if ($(this).attr("type") == "checkbox" || $(this).attr("type") == "radio") {
                if (!$(this).attr("checked"))
                    return;
            }
            else {
                if (($(this).val() == "" || $(this).val() == null) && ($(this).attr("defaultvalue") == "" || $(this).attr("defaultvalue") == null))
                    return;
            }
            var templineitems = "";
            var skuqty;


            var cartlinecontainer = $(this).parents(".cartline")[0];
            $("input", cartlinecontainer).each(function (x) {
                if ($(this).attr("type") == "button" || $(this).attr("type") == "submit")
                    return;

                var skufieldname = $(this).attr("name");
                var skufieldvalue = $(this).val();

                if ($(this).hasClass("watermark")) {
                    skufieldvalue = "";
                }
                var skufielddefaultvalue = $(this).attr("defaultvalue");
                // Check if a default value is specified
                if (skufielddefaultvalue != undefined && skufielddefaultvalue != "") {
                    // If it is then check if both, the value and default value are either both numeric or both are non-numeric
                    // If one of them is numeric and the other is not then use a default value because the value could be a watermark text like "Qty".
                    if (skufieldvalue == "")//isNaN(skufieldvalue) != isNaN(skufielddefaultvalue) || 
                    {
                        skufieldvalue = skufielddefaultvalue;
                    }
                }
                if (skufieldname == "Personalization") {
                    if (templineitems == "") {
                        templineitems = "{";
                        templineitems += '"' + skufieldname + '":' + skufieldvalue;
                    }
                    else
                        templineitems += ',"' + skufieldname + '":' + skufieldvalue;
                }
                else {
                    if (templineitems == "") {
                        templineitems = "{";
                        templineitems += '"' + skufieldname + '":"' + skufieldvalue + '"';
                    }
                    else
                        templineitems += ',"' + skufieldname + '":"' + skufieldvalue + '"';
                }
            });
            if (lineitemarray == "[")
                lineitemarray += templineitems + "}";
            else
                lineitemarray += "," + templineitems + "}";
        });
        lineitemarray += "]";
        return lineitemarray;
    };                          // End of getlineitemstoaddtocart


    /**************************************************************************************************************************************************************/

    this.googlecheckout = function () {
        $.get(shoppingcartactionurl + "googlecheckout", function (response) { window.location.href = response; });
    }
    this.paypalcheckout = function () {
        $.get(shoppingcartactionurl + "paypalcheckout", function (response) { window.location.href = response; });
    }

    this.removeitem = function (closeButton, renderdivid, viewname) {
        var remainingItems = 0;
        var itemDivToRemove = closeButton.parentNode;
        var cartlineID = closeButton.siblings('.cartlineid').html();
        var loadingicon = " <div id='loadingdiv' style=\"text-align: center; padding: 20px; margin: 5px;\"> <img src=\"" + themeimagesurl + "loading.gif\" alt=\"loading widget\" /> </div> ";
        $("#" + renderdivid).html(loadingicon);
        $.get(homeUrl + "widgets-cart/removecartitem/" + cartlineID + "/" + viewname + "/True",
         function (response) {
             $("#" + renderdivid).html(response);
             if ($(".cartlineid", $("#cartcontent")).length == 0) {
                 $(".cartitem_linecount").html("0 Item(s)");
                 $(".cartitem_linesubtotal").html(formatAmount("0.0"));
                 $(".cartbuttons").css("display", "none");
             }


         });

    };

    /**************************************************************************************************************************************************************/

    this.removeallitems = function (renderdivid, viewname) {

        var sc_loading = " <div id='loadingdiv' style=\"text-align: center; padding: 20px; margin: 5px;\"> <img src=\"" + themeimagesurl + "loading.gif\" alt=\"loading widget\" /> </div> ";
        $("#" + renderdivid).html(sc_loading);
        $.get(homeUrl + "widgets-cart/removeallitems/" + viewname,
         function (response) {
             $("#" + renderdivid).html(response);
             if ($(".cartlineid", $("#cartcontent")).length == 0) {
                 $(".cartitem_linecount").html("0 Items");
                 $(".cartitem_linesubtotal").html(formatAmount("0.0"));
                 $(".cartbuttons").css("display", "none");
                 $("#floatingcartcontainer").html("");
             }
         });
    };

    function formatAmount(amt) {
        return ignify_utility_js.getspecificcurrency(amt, undefined, undefined, undefined, ignify_utility_js.defaultcurrencycode);
    }
    /**************************************************************************************************************************************************************/

    this.addtocart = function (addtocartbtn, idofaddtocartmessage, beforeaddtocart, afteraddtocart) {
        $(".addtocart_errormsg").each(function (i) {
            $(this).hide();
        });
        $(".addtocart_successmsg").each(function (i) {
            $(this).hide();
        });
        $(".wishlistmsg").each(function (i) {
            $(this).html("");
        });
        // If preclickhandler returns false, do not add to cart.
        if (beforeaddtocart != null && beforeaddtocart != undefined && beforeaddtocart != "") {
            if (!beforeaddtocart()) {
                return;
            }
        }
        //debugger;
        if (afteraddtocart == null || afteraddtocart == undefined || afteraddtocart == "") {
            afteraddtocart = function () { };
        }
        if ($(addtocartbtn).attr('disabled') != 'disabled')
            add(addtocartbtn, shoppingcartactionurl + "addtocart", afteraddtocart, idofaddtocartmessage);
        else
            return;



    }      // end of addtocart

    this.updatecart = function (contentid, renderdivid, viewname) {
        var skusinfo_json = '';
        skusinfo_json = gelineitemstoupdatecart(contentid);
        var postcartlines = {
            error: function (msg, x, y) {
                //       errorhandler(y);
                // Make ajax xcall here for logging
            },
            type: "POST",
            url: shoppingcartactionurl + "updatecart?viewname=" + viewname,
            data: skusinfo_json,
            async: true, // check the value if it is false 
            success: function (response) {
                $("#" + renderdivid).html(response);
            }
        };
        $.ajax(postcartlines);
    }




    /**************************************************************************************************************************************************************/


    var add = function (addtocartbtn, posturl, afteraddtocart, idofaddtocartmessage) {

        var skusinfo_json = '';


        $('.addtocart_successmsg').each(function (i) {
            $(this).attr("style", "");
            $(this).removeClass("displaysuccessmsg");
            $(this).removeClass("addtocart_errormsg");
            $(this).addClass("displaynone");
        });
        //        $('.displaysuccessmsg').each(function (i) {

        //            $(this).removeClass("displaysuccessmsg");
        //            $(this).addClass("displaynone");
        //            $(this).attr("style", "");
        //        });

        $(idofaddtocartmessage).removeClass("displaynone");
        // change class to addtocart_successmsg
        $(idofaddtocartmessage).addClass("displaysuccessmsg");

        // Make please wait as a function parameter - waitmessage
        // $("#loadingMessage_" + g_cart_productid).hide().html("Please wait...").fadeIn("slow");
        addtocartbtn.attr("src", themeimagesurl + "addtocart-loader.gif");

        skusinfo_json = getlineitemstoaddtocart(addtocartbtn, idofaddtocartmessage);

        if (skusinfo_json == "") {
            $(idofaddtocartmessage).attr("class", "");
            $(idofaddtocartmessage).hide();
            return;
        }


        /**************************************************************************************************************************************************************/

        var postcartlines = {
            error: function (msg, x, y) {
                //       errorhandler(y);
                // Make ajax xcall here for logging
            },
            type: "POST",
            url: posturl,
            data: skusinfo_json,
            async: true, // check the value if it is false 
            success: function (response) {
                afteraddtocart(response);
                postaddtocartprocessing(response, idofaddtocartmessage, addtocartbtn);
            }
        };
        $.ajax(postcartlines);
    };            // end of addtocart function

    /**************************************************************************************************************************************************************/

    this.getshippingquoutes = function (country, state, zip, containerid, actionmethod, shippingformname, aftersuccessfulajaxcall) {

        var sc_loading = " <div id='loadingdiv' style=\"text-align: center; padding: 20px; margin: 5px;\"> <img src=\"" + themeimagesurl + "loading.gif\" alt=\"loading widget\" /> </div> ";

        var options = {
            target: '#' + containerid,
            url: homeUrl + "widgets-cart/" + actionmethod + "/",
            success: function () {
                aftersuccessfulajaxcall();
            }
        };

        $("#" + shippingformname).ajaxSubmit(options);
        $("#" + containerid).html(sc_loading);

        //var ajaxFrameworkObj = new IgnifyAjaxFramework();        
        //ajaxFrameworkObj.PrepareForPOST(containerid, "shippingcalcform", "widgets-cart/" + actionmethod + "/", function () { });
        //ajaxFrameworkObj.MakeAjaxCall(containerid);
    };

    /**************************************************************************************************************************************************************/

    this.initializeshippingquoutes = function (idofdivtoloadinto, urlofshippingqoutes) {

        $.get(urlofshippingqoutes, function (response) { $("#" + idofdivtoloadinto).html(response) });
    };

    /**************************************************************************************************************************************************************/

    this.initializeshoppingcart = function (idofdivtoloadinto, urlofshoppingcart) {
        var loadingicon = " <div id='loadingdiv' style=\"text-align: center; padding: 20px; margin: 5px;\"> <img src=\"" + protocol + "//" + hostName + homeUrl + "images/loading.gif\" alt=\"loading widget\" /> </div> ";
        $("#" + idofdivtoloadinto).html(loadingicon);

        $.get(urlofshoppingcart, function (response, afterloadhandler) {
            $("#" + idofdivtoloadinto).html(response);
            if (IsFloatingCartEnabled == 'True') {

                $('#shoppingcartpopup').overlay().load();
            }
        });

    };


    this.refreshshoppingcart = function (containerid, actionmethod, shoppingformname, aftersuccessfulajaxcall) {

        var sc_loading = " <div id='loadingdiv' style=\"text-align: center; padding: 20px; margin: 5px;\"> <img src=\"" + protocol + "//" + hostName + homeUrl + "images/loading.gif\" alt=\"loading widget\" /> </div> ";

        var options = {
            target: '#' + containerid,
            url: homeUrl + "widgets-cart/" + actionmethod + "/",
            success: function () {
                aftersuccessfulajaxcall();
            }
        };

        $("#" + shoppingformname).ajaxSubmit(options);
        $("#" + containerid).html(sc_loading);

        //var ajaxFrameworkObj = new IgnifyAjaxFramework();        
        //ajaxFrameworkObj.PrepareForPOST(containerid, "shippingcalcform", "widgets-cart/" + actionmethod + "/", function () { });
        //ajaxFrameworkObj.MakeAjaxCall(containerid);
    };


    this.generateshoppingcartdiv = function () {

        /*
        This function adds the floating cart container div Ids dynamically. This happens on 2 occasions, first if user hover over the item count shown in header
        OR secondly if user adds the product to shopping cart and floating cart is enabled. 
        */
        if (!$("#header > #shoppingcartpopup").length > 0) {

            $("#header").append("<div class='shoppingcartpopup' id='shoppingcartpopup'></div>");
            $("#shoppingcartpopup").append("<div id='shoppingcartcontent'></div>");

            var subscriber = new IgnItemAddedToCartEvent();
            var ignify_cart_view_js = new ignify.cart.view();
            subscriber.listen("shoppingcartpopup", ignify_cart_view_js.getfloatingcartitem);

        }

    }; //end of generateshoppingcartdiv function

}                                                      // End of shoppingcart class

function postaddtocartprocessing(cartviewmodel, idofaddtocartmessage, addtocartbtn) {
    
    // calling the private function which checks for existance of floating shopping cart div, and creats it if its not there 
    callshoppingcartdiv();

    var postUrl = cartviewmodel.ReturnUrl;
    if (postUrl != "" && postUrl != null) {
        window.location.href = postUrl;
        return;
    }
 
    //  rwemove the if condition and remove the delays
    if (Minitemplate == true) {
        if (Boolean(IsFloatingCartEnabled) == true) {
            window.scrollTo(0, 0);
            var event_trigger = new IgnItemAddedToCartEvent();
            event_trigger.fireevent();
            //setTimeout("fireAddToCartEvent()", 1000);
        }
     
    }
    else {
       
        if (IsFloatingCartEnabled == 'True') {
         
            window.scrollTo(0, 0);
            var event_trigger = new IgnItemAddedToCartEvent();
            event_trigger.fireevent();
            addtocartbtn.hide().attr("src", themeimagesurl + "add-to-cart.gif").fadeIn("slow"); 
            //setTimeout("fireAddToCartEvent()", 1000);
        }
        else {
          
            var event_trigger = new IgnItemAddedToCartEvent();
            event_trigger.fireevent();
            addtocartbtn.hide().attr("src", themeimagesurl + "add-to-cart.gif").fadeIn("slow");
        }
    }

    addtocartbtn.hide().attr("src", themeimagesurl + "add-to-cart.gif").fadeIn("slow");

    $("#"+idofaddtocartmessage).html(cartviewmodel.Message).hide().fadeIn(1500);

}

function callshoppingcartdiv() {
    var cart = new ignify.cart.ops();
    cart.generateshoppingcartdiv();
}





;


/* Comment Generated by Combres - Resource '~/client_scripts/ignify.cart.view.js' (Mode: Static) */
/*
****************************************************************************
Ignify eCommerce Catalog Views
Ignify, Inc
http://www.ignify.com
****************************************************************************
Last Modified: August 6, 2010

Purpose
=======
The purpose of this file is to generate Ignify eCommerce cart content. It has the HTML for the cart line items which are 
called inside the floating cart HTML file. 

HTML Wrapper Element
=====================
The cart line items HTML here, has only <LI>s which are wrapped inside the <UL> in the floating cart HTML file.

*/
//Call shoppingCart conrtrollers RemoveItem method to remove specified item

if (!ignify)
    ignify= {};

    if (!ignify.cart)
        ignify.cart = {};

    ignify.cart.view = function () {
        var cart = new ignify.cart.ops();
        this.viewname = 'html_cartmini1';
        this.contollermethodname = "getcartitems";
        this.processcartcalculations = "False";
        this.floatingcartpositiontop;
        this.floatingcartpositionleft;


        this.isaddtocartallowed = function (idofaddtocartbutton) {

            if ($("#" + idofaddtocartbutton).hasClass("addtocart_disabled"))
                return false;
            else
                return true;
        };

        /**************************************************************************************************************************************************************/

        // Added by ASLAM - This is for the show all feature where we want the user to compulsarily input some value in the qty textbox for that line to be added to the cart.
        this.verifybulkaddtocartqty = function (idofquantitytextbox, errormsgelementid) {
            var qtyvalue = $.trim($("#" + idofquantitytextbox).val());

            // This is so that the watermark will be treated as not being selected for adding to cart
            if (isNaN(qtyvalue)) {
                if (qtyvalue.toLowerCase() != "qty") {
                    $("#" + errormsgelementid).fadeIn("fast");
                    return false;
                }
                else
                    return true;
            }
            else {
                if (ignify_utility_js.validateforpositivenumbers(qtyvalue) && ignify_utility_js.validatefornonzero(qtyvalue)) {
                    $("#" + idofquantitytextbox).removeClass("watermark");
                    return true;
                }
                else {
                    $("#" + errormsgelementid).fadeIn("fast");
                    return false;
                }
            }
        }

        /**************************************************************************************************************************************************************/

        this.verifyquantityvalue = function (idofquantitytextbox, errormsgelementid) {


            var qtyvalue = $.trim($("#" + idofquantitytextbox).val());
            if (isNaN(qtyvalue)) {
                if ($.trim($("#" + idofquantitytextbox).attr("defaultvalue")) == "" || $("#" + idofquantitytextbox).attr("defaultvalue") == undefined || $("#" + idofquantitytextbox).attr("defaultvalue") == null) {
                    $("#" + idofquantitytextbox).val("1");
                    qtyvalue = "1";
                    $("#" + idofquantitytextbox).removeClass("watermark");
                }
                else {
                    $("#" + idofquantitytextbox).val($("#" + idofquantitytextbox).attr("defaultvalue"));
                    qtyvalue = $("#" + idofquantitytextbox).attr("defaultvalue");
                    $("#" + idofquantitytextbox).removeClass("watermark");

                }
            }
            if (ignify_utility_js.validateforpositivenumbers(qtyvalue) && ignify_utility_js.validatefornonzero(qtyvalue)) {

                return true;
            }
            else {
                $("#" + errormsgelementid).fadeIn("fast");

                return false;
            }

        };

        /**************************************************************************************************************************************************************/

        this.loadshippingcalc = function () {

            var ignify_cart_ops_js = new ignify.cart.ops();
            ignify_cart_ops_js.initializeshippingquoutes("shippingcalccontent", homeUrl + "widgets-cart/gethtml_a_shippingcalculator");
        }


        this.getshoppingcartitems = function () {
            getshoppingcart("html_cart1", "getcartitems", "True");
        }


        this.getfloatingcartitem = function () {
            getshoppingcart(ignify_cart_view_js.viewname, ignify_cart_view_js.contollermethodname, ignify_cart_view_js.processcartcalculations);
        };


        function getshoppingcart(viewname, controllermethod, isdiscountallowed) {
            var ignify_cart_ops_js = new ignify.cart.ops();
            if (IsFloatingCartEnabled == 'True') {
                // calling the function which checks for existance of floating shopping cart div, and creats it if its not there 
                cart.generateshoppingcartdiv();

                //following line added to set the zIndex of the element on the fly. So that this popup will be always on top
                if (!$("#shoppingcartpopup").data("onloadzindex")) {
                    //saving the initial onload zIndex of this element for later use. The idea is to set zIndex back to initial value on overlay close, so that it doenst keep going high
                    $("#shoppingcartpopup").data("onloadzindex", $("#shoppingcartpopup").css('z-index'));
                }

                ignify_utility_js.setzindex($("#shoppingcartpopup"));

                $('#shoppingcartpopup').overlay({ oneInstance: false, top: floatingcartpositiontop, left: floatingcartpositionleft,
                    onClose: function () {
                        //setting zIndex back to initial value on overlay close
                        $("#shoppingcartpopup").css('z-index', $("#shoppingcartpopup").data("onloadzindex"));
                    }
                });
            }

            ignify_cart_ops_js.initializeshoppingcart("shoppingcartcontent", homeUrl + "widgets-cart/" + controllermethod + "/" + viewname + "/" + isdiscountallowed);
        }

        /**************************************************************************************************************************************************************/

        this.fastcheckout = function () {
            fastchkoutUrl = fastchkoutUrl.replace("~/", "");
            parent.document.location.href = fastchkoutUrl;
        };

        /**************************************************************************************************************************************************************/

        this.continuecheckout = function () {
            shoppingcartUrl = shoppingcartUrl.replace("~/", "");
            parent.document.location.href = shoppingcartUrl; // protocol + "//" + hostName + homeUrl + shoppingcartUrl;
        };

        /**************************************************************************************************************************************************************/

        this.removeallitems = cart.removeallitems;

        /**************************************************************************************************************************************************************/

        this.removeitem = cart.removeitem;

        this.updatecart = cart.updatecart;
        this.googlecheckout = cart.googlecheckout;
        this.paypalcheckout = cart.paypalcheckout;

        /**************************************************************************************************************************************************************/

        this.closecart = function () {
            var temp;
            try {
                if ($("#floatingcart") != temp)
                    $("#floatingcart").jqpopup_close();
            }
            catch (x) {
                //Do nothing
            }
        };

        /**************************************************************************************************************************************************************/

        //var subscriber = new IgnItemAddedToCartEvent();
        //subscriber.listen("shoppingcartpopup", this.getfloatingcartitem);

    };

    var ignify_cart_view_js = new ignify.cart.view();
;


/* Comment Generated by Combres - Resource '~/client_scripts/jquery/ui/ui.selectmenu.js' (Mode: Static) */
/*
* jQuery UI selectmenu
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* Edited by Dominik
* Edited by Aslam for fixing issue with jQuery 1,.6.1
*
* http://docs.jquery.com/UI
*/

(function ($) {

    $.widget("ui.selectmenu", {
        widgetEventPrefix: "selectmenu",
        options: {
            transferClasses: true,
            style: 'popup',
            width: null,
            menuWidth: null,
            handleWidth: 26,
            maxHeight: null,
            icons: null,
            format: null,
            errorClass: 'ui-state-error ui-selectmenu-error'
        },
        _create: function () {
            var self = this, o = this.options;

            //quick array of button and menu id's
            var num = Math.round(Math.random() * 1000);
            this.ids = [this.element.attr('id') + '_' + 'button' + '_' + num, this.element.attr('id') + '_' + 'menu' + '_' + num];

            //define safe mouseup for future toggling
            this._safemouseup = true;

            //create menu button wrapper
            this.newelement = $('<a class="' + this.widgetBaseClass + ' ui-widget ui-state-default ui-corner-all" id="' + this.ids[0] + '" role="button" href="#" aria-haspopup="true" aria-owns="' + this.ids[1] + '" aria-expanded="false"></a>')
			.insertAfter(this.element);

            //transfer tabindex
            var tabindex = this.element.attr('tabindex') || '0';
            this.newelement.attr('tabindex', tabindex);

            //save reference to select in data for ease in calling methods
            this.newelement.data('selectelement', this.element);

            //menu icon
            this.selectmenuIcon = $('<span class="' + this.widgetBaseClass + '-icon ui-icon"></span>')
			.prependTo(this.newelement)
			.addClass((o.style == "popup") ? 'ui-icon-triangle-2-n-s' : 'ui-icon-triangle-1-s');


            //make associated form label trigger focus
            $('label[for=' + this.element.attr('id') + ']')
			.attr('for', this.ids[0])
			.bind('click', function () {
			    self.newelement.focus();
			    return false;
			});

            // Added  the following  condition by Aslam to fix issue with jQuery 1.6.1
            // this.element.attr('disabled')==undefined

            //click toggle for menu visibility
            if (this.element.attr('disabled') == false || this.element.attr('disabled') == undefined) {
                this.newelement
			    .bind('mousedown', function (event) {
			        self._toggle(event);
			        //make sure a click won't open/close instantly
			        if (o.style == "popup") {
			            self._safemouseup = false;
			            setTimeout(function () { self._safemouseup = true; }, 300);
			        }
			        return false;
			    });
            }
            this.newelement
			.bind('click', function () {
			    return false;
			})
			.keydown(function (event) {
			    var ret = true;
			    switch (event.keyCode) {
			        case $.ui.keyCode.ENTER:
			            ret = true;
			            break;
			        case $.ui.keyCode.SPACE:
			            ret = false;
			            self._toggle(event);
			            break;
			        case $.ui.keyCode.UP:
			        case $.ui.keyCode.LEFT:
			            ret = false;
			            self._moveSelection(-1);
			            break;
			        case $.ui.keyCode.DOWN:
			        case $.ui.keyCode.RIGHT:
			            ret = false;
			            self._moveSelection(1);
			            break;
			        case $.ui.keyCode.TAB:
			            ret = true;
			            break;
			        default:
			            ret = false;
			            self._typeAhead(event.keyCode, 'mouseup');
			            break;
			    }
			    return ret;
			})
			.bind('mouseover focus', function () {

			    $(this).addClass(self.widgetBaseClass + '-focus ui-state-hover');
			})
			.bind('mouseout blur', function () {
			    $(this).removeClass(self.widgetBaseClass + '-focus ui-state-hover');
			});

            //document click closes menu
            $(document)
			.mousedown(function (event) {
			    self.close(event);
			});

            //change event on original selectmenu
            this.element
			.click(function () { this._refreshValue(); })
			.focus(function () { this.newelement.focus(); });

            //create menu portion, append to body
            var cornerClass = (o.style == "dropdown") ? " ui-corner-bottom" : " ui-corner-all"
            this.list = $('<ul class="' + self.widgetBaseClass + '-menu ui-widget ui-widget-content' + cornerClass + '" aria-hidden="true" role="listbox" aria-multiselectable="false" aria-labelledby="' + this.ids[0] + '" id="' + this.ids[1] + '"></ul>').appendTo('body');

            //serialize selectmenu element options	
            var selectOptionData = new Array();
            this.element
			.find('option')
			.each(function () {
			    selectOptionData.push({
			        value: $(this).attr('value'),
			        text: self._formatText(jQuery(this).text()),
			        selected: $(this).attr('selected'),
			        classes: $(this).attr('class'),
			        parentOptGroup: $(this).parent('optgroup').attr('label')
			    });
			});

            //active state class is only used in popup style
            var activeClass = (self.options.style == "popup") ? " ui-state-active" : "";

            //write li's
            for (var i in selectOptionData) {
                //dominik
                //http://stackoverflow.com/questions/1570572/mootools-strange-bug-conflict-with-jquery
                if (selectOptionData.hasOwnProperty(i)) {

                    var thisLi = $('<li><a href="#" tabindex="-1" role="option" aria-selected="false">' + selectOptionData[i].text + '</a></li>')
				.data('index', i)
				.addClass(selectOptionData[i].classes)
				.data('optionClasses', selectOptionData[i].classes || '')
				.mouseup(function (event) {
				    if (self._safemouseup) {
				        var changed = $(this).data('index') != self._selectedIndex();
				        self.value($(this).data('index'));
				        self.select(event);
				        if (changed) { self.change(event); }
				        self.close(event, true);
				    }
				    return false;
				})
				.click(function () {
				    return false;
				})
				.bind('mouseover focus', function () {
				    
				    self._selectedOptionLi().addClass(activeClass);
				    self._focusedOptionLi().removeClass(self.widgetBaseClass + '-item-focus ui-state-hover');
				    $(this).removeClass('ui-state-active').addClass(self.widgetBaseClass + '-item-focus ui-state-hover');
				})
				.bind('mouseout blur', function () {
				    if ($(this).is(self._selectedOptionLi())) { $(this).addClass(activeClass); }
				    $(this).removeClass(self.widgetBaseClass + '-item-focus ui-state-hover');
				});

                    //optgroup or not...
                    if (selectOptionData[i].parentOptGroup) {
                        var optGroupName = self.widgetBaseClass + '-group-' + selectOptionData[i].parentOptGroup;
                        if (this.list.find('li.' + optGroupName).size()) {
                            this.list.find('li.' + optGroupName + ':last ul').append(thisLi);
                        }
                        else {
                            $('<li class="' + self.widgetBaseClass + '-group ' + optGroupName + '"><span class="' + self.widgetBaseClass + '-group-label">' + selectOptionData[i].parentOptGroup + '</span><ul></ul></li>')
						.appendTo(this.list)
						.find('ul')
						.append(thisLi);
                        }
                    }
                    else {
                        thisLi.appendTo(this.list);
                    }

                    //this allows for using the scrollbar in an overflowed list
                    this.list.bind('mousedown mouseup', function () { return false; });

                    //append icon if option is specified
                    if (o.icons) {
                        for (var j in o.icons) {
                            if (thisLi.is(o.icons[j].find)) {
                                thisLi
							.data('optionClasses', selectOptionData[i].classes + ' ' + self.widgetBaseClass + '-hasIcon')
							.addClass(self.widgetBaseClass + '-hasIcon');
                                var iconClass = o.icons[j].icon || "";

                                thisLi
							.find('a:eq(0)')
							.prepend('<span class="' + self.widgetBaseClass + '-item-icon ui-icon ' + iconClass + '"></span>');
                            }
                        }
                    }
                }
            }

            //add corners to top and bottom menu items
            this.list.find('li:last').addClass("ui-corner-bottom");
            if (o.style == 'popup') { this.list.find('li:first').addClass("ui-corner-top"); }

            //transfer classes to selectmenu and list
            if (o.transferClasses) {
                var transferClasses = this.element.attr('class') || '';
                this.newelement.add(this.list).addClass(transferClasses);
            }

            //original selectmenu width
            var selectWidth = this.element.width();

            //set menu button width
            this.newelement.width((o.width) ? o.width : selectWidth);

            //set menu width to either menuWidth option value, width option value, or select width 
            if (o.style == 'dropdown') { this.list.width((o.menuWidth) ? o.menuWidth : ((o.width) ? o.width : selectWidth)); }
            else { this.list.width((o.menuWidth) ? o.menuWidth : ((o.width) ? o.width - o.handleWidth : selectWidth - o.handleWidth)); }

            //set max height from option 
            if (o.maxHeight && o.maxHeight < this.list.height()) { this.list.height(o.maxHeight); }

            //save reference to actionable li's (not group label li's)
            this._optionLis = this.list.find('li:not(.' + self.widgetBaseClass + '-group)');

            //transfer menu click to menu button
            this.list
			.keydown(function (event) {
			    var ret = true;
			    switch (event.keyCode) {
			        case $.ui.keyCode.UP:
			        case $.ui.keyCode.LEFT:
			            ret = false;
			            self._moveFocus(-1);
			            break;
			        case $.ui.keyCode.DOWN:
			        case $.ui.keyCode.RIGHT:
			            ret = false;
			            self._moveFocus(1);
			            break;
			        case $.ui.keyCode.HOME:
			            ret = false;
			            self._moveFocus(':first');
			            break;
			        case $.ui.keyCode.PAGE_UP:
			            ret = false;
			            self._scrollPage('up');
			            break;
			        case $.ui.keyCode.PAGE_DOWN:
			            ret = false;
			            self._scrollPage('down');
			            break;
			        case $.ui.keyCode.END:
			            ret = false;
			            self._moveFocus(':last');
			            break;
			        case $.ui.keyCode.ENTER:
			        case $.ui.keyCode.SPACE:
			            ret = false;
			            self.close(event, true);
			            $(event.target).parents('li:eq(0)').trigger('mouseup');
			            break;
			        case $.ui.keyCode.TAB:
			            ret = true;
			            self.close(event);
			            break;
			        case $.ui.keyCode.ESCAPE:
			            ret = false;
			            self.close(event, true);
			            break;
			        default:
			            ret = false;
			            self._typeAhead(event.keyCode, 'focus');
			            break;
			    }
			    return ret;
			});

            //selectmenu style
            if (o.style == 'dropdown') {
                this.newelement
				.addClass(self.widgetBaseClass + "-dropdown");
                this.list
				.addClass(self.widgetBaseClass + "-menu-dropdown");
            }
            else {
                this.newelement
				.addClass(self.widgetBaseClass + "-popup");
                this.list
				.addClass(self.widgetBaseClass + "-menu-popup");
            }

            //append status span to button
            this.newelement.prepend('<span class="' + self.widgetBaseClass + '-status">' + selectOptionData[this._selectedIndex()].text + '</span>');

            //hide original selectmenu element
            this.element.hide();

            //transfer disabled state
            if (this.element.attr('disabled') == true) { this.disable(); }

            //update value
            this.value(this._selectedIndex());
        },
        destroy: function () {
            this.element.removeData(this.widgetName)
			.removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled')
			.removeAttr('aria-disabled');

            //unbind click on label, reset its for attr
            $('label[for=' + this.newelement.attr('id') + ']')
			.attr('for', this.element.attr('id'))
			.unbind('click');
            this.newelement.remove();
            this.list.remove();
            this.element.show();
        },
        _typeAhead: function (code, eventType) {
            var self = this;
            //define self._prevChar if needed
            if (!self._prevChar) { self._prevChar = ['', 0]; }
            var C = String.fromCharCode(code);
            c = C.toLowerCase();
            var focusFound = false;
            function focusOpt(elem, ind) {
                focusFound = true;
                $(elem).trigger(eventType);
                self._prevChar[1] = ind;
            };
            this.list.find('li a').each(function (i) {
                if (!focusFound) {
                    var thisText = $(this).text();
                    if (thisText.indexOf(C) == 0 || thisText.indexOf(c) == 0) {
                        if (self._prevChar[0] == C) {
                            if (self._prevChar[1] < i) { focusOpt(this, i); }
                        }
                        else { focusOpt(this, i); }
                    }
                }
            });
            this._prevChar[0] = C;
        },
        _uiHash: function () {
            return {
                value: this.value()
            };
        },
        open: function (event) {
            var self = this;
            this._refreshPosition();
            this._closeOthers(event);
            this.newelement
			.attr('aria-expanded', true)
			.addClass('ui-state-active');

            this.list
			.appendTo('body')
			.addClass(self.widgetBaseClass + '-open')
			.attr('aria-hidden', false)
			.find('li:not(.' + self.widgetBaseClass + '-group):eq(' + this._selectedIndex() + ') a').focus();
            if (this.options.style == "dropdown") { this.newelement.removeClass('ui-corner-all').addClass('ui-corner-top'); }
            this._refreshPosition();
            this._trigger("open", event, this._uiHash());
        },
        close: function (event, retainFocus) {
            if (this.newelement.is('.ui-state-active')) {
                this.newelement
				.attr('aria-expanded', false)
				.removeClass('ui-state-active');
                this.list
				.attr('aria-hidden', true)
				.removeClass(this.widgetBaseClass + '-open');
                if (this.options.style == "dropdown") { this.newelement.removeClass('ui-corner-top').addClass('ui-corner-all'); }
                if (retainFocus) { this.newelement.focus(); }
                this._trigger("close", event, this._uiHash());
            }
        },
        change: function (event) {
            this.element.trigger('change');
            this._trigger("change", event, this._uiHash());
        },
        select: function (event) {
            this._trigger("select", event, this._uiHash());
        },
        _closeOthers: function (event) {
            $('.' + this.widgetBaseClass + '.ui-state-active').not(this.newelement).each(function () {
                $(this).data('selectelement').selectmenu('close', event);
            });
            $('.' + this.widgetBaseClass + '.ui-state-hover').trigger('mouseout');
        },
        _toggle: function (event, retainFocus) {
            if (this.list.is('.' + this.widgetBaseClass + '-open')) { this.close(event, retainFocus); }
            else { this.open(event); }
        },
        _formatText: function (text) {
            return this.options.format ? this.options.format(text) : text;
        },
        _selectedIndex: function () {
            return this.element[0].selectedIndex;
        },
        _selectedOptionLi: function () {
            return this._optionLis.eq(this._selectedIndex());
        },
        _focusedOptionLi: function () {
            return this.list.find('.' + this.widgetBaseClass + '-item-focus');
        },
        _moveSelection: function (amt) {
            var currIndex = parseInt(this._selectedOptionLi().data('index'), 10);
            var newIndex = currIndex + amt;
            return this._optionLis.eq(newIndex).trigger('mouseup');
        },
        _moveFocus: function (amt) {
            if (!isNaN(amt)) {
                var currIndex = parseInt(this._focusedOptionLi().data('index'), 10);
                var newIndex = currIndex + amt;
            }
            else { var newIndex = parseInt(this._optionLis.filter(amt).data('index'), 10); }

            if (newIndex < 0) { newIndex = 0; }
            if (newIndex > this._optionLis.size() - 1) {
                newIndex = this._optionLis.size() - 1;
            }
            this._focusedOptionLi().find('a:eq(0)').blur();
            this._optionLis.eq(newIndex).find('a:eq(0)').focus();
        },
        _scrollPage: function (direction) {
            var numPerPage = Math.floor(this.list.outerHeight() / this.list.find('li:first').outerHeight());
            numPerPage = (direction == 'up') ? -numPerPage : numPerPage;
            this._moveFocus(numPerPage);
        },
        _setOption: function (key, value) {
            this.options[key] = value;
            if (key == 'disabled') {
                this.element
				.add(this.newelement)
				.add(this.list)
					[value ? 'addClass' : 'removeClass'](
						this.widgetBaseClass + '-disabled' + ' ' +
						this.namespace + '-state-disabled')
					.attr("aria-disabled", value);
            }
        },
        value: function (newValue) {
            if (arguments.length) {
                this.element[0].selectedIndex = newValue;
                this._refreshValue();
                this._refreshPosition();
            }
            return this.element[0].selectedIndex;
        },
        _refreshValue: function () {
            var activeClass = (this.options.style == "popup") ? " ui-state-active" : "";
            //deselect previous
            this.list
			.find('.' + this.widgetBaseClass + '-item-selected')
			.removeClass(this.widgetBaseClass + "-item-selected" + activeClass)
			.find('a')
			.attr('aria-selected', 'false');
            //select new
            this._selectedOptionLi()
			.addClass(this.widgetBaseClass + "-item-selected" + activeClass)
			.find('a')
			.attr('aria-selected', 'true');
            //toggle any class brought in from option
            var currentOptionClasses = this.newelement.data('optionClasses') ? this.newelement.data('optionClasses') : "";
            var newOptionClasses = this._selectedOptionLi().data('optionClasses') ? this._selectedOptionLi().data('optionClasses') : "";
            this.newelement
			.removeClass(currentOptionClasses)
			.data('optionClasses', newOptionClasses)
			.addClass(newOptionClasses)
			.find('.' + this.widgetBaseClass + '-status')
			.html(
				this._selectedOptionLi()
					.find('a:eq(0)')
					.html()
			);
        },
        _refreshPosition: function () {
            //set left value
            this.list.css('left', this.newelement.offset().left);

            //set top value
            var menuTop = this.newelement.offset().top;
            var scrolledAmt = this.list[0].scrollTop;
            this.list.find('li:lt(' + this._selectedIndex() + ')').each(function () {
                scrolledAmt -= $(this).outerHeight();
            });

            if (this.newelement.is('.' + this.widgetBaseClass + '-popup')) {
                menuTop += scrolledAmt;
                this.list.css('top', menuTop);
            }
            else {
                menuTop += this.newelement.height();
                this.list.css('top', menuTop);
            }
        }
    });

    $.extend($.ui.selectmenu, {
        version: "@VERSION"
    });

})(jQuery);;


/* Comment Generated by Combres - Resource '~/client_scripts/jquery/ui/jquery.ui.autocomplete.js' (Mode: Static) */
/*
 * jQuery UI Autocomplete 1.8.13
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Autocomplete
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *	jquery.ui.position.js
 */
(function( $, undefined ) {

// used to prevent race conditions with remote data sources
var requestIndex = 0;

$.widget( "ui.autocomplete", {
	options: {
		appendTo: "body",
		autoFocus: false,
		delay: 300,
		minLength: 1,
		position: {
			my: "left top",
			at: "left bottom",
			collision: "none"
		},
		source: null
	},

	pending: 0,

	_create: function() {
		var self = this,
			doc = this.element[ 0 ].ownerDocument,
			suppressKeyPress;

		this.element
			.addClass( "ui-autocomplete-input" )
			.attr( "autocomplete", "off" )
			// TODO verify these actually work as intended
			.attr({
				role: "textbox",
				"aria-autocomplete": "list",
				"aria-haspopup": "true"
			})
			.bind( "keydown.autocomplete", function( event ) {
				if ( self.options.disabled || self.element.attr( "readonly" ) ) {
					return;
				}

				suppressKeyPress = false;
				var keyCode = $.ui.keyCode;
				switch( event.keyCode ) {
				case keyCode.PAGE_UP:
					self._move( "previousPage", event );
					break;
				case keyCode.PAGE_DOWN:
					self._move( "nextPage", event );
					break;
				case keyCode.UP:
					self._move( "previous", event );
					// prevent moving cursor to beginning of text field in some browsers
					event.preventDefault();
					break;
				case keyCode.DOWN:
					self._move( "next", event );
					// prevent moving cursor to end of text field in some browsers
					event.preventDefault();
					break;
				case keyCode.ENTER:
				case keyCode.NUMPAD_ENTER:
					// when menu is open and has focus
					if ( self.menu.active ) {
						// #6055 - Opera still allows the keypress to occur
						// which causes forms to submit
						suppressKeyPress = true;
						event.preventDefault();
					}
					//passthrough - ENTER and TAB both select the current element
				case keyCode.TAB:
					if ( !self.menu.active ) {
						return;
					}
					self.menu.select( event );
					break;
				case keyCode.ESCAPE:
					self.element.val( self.term );
					self.close( event );
					break;
				default:
					// keypress is triggered before the input value is changed
					clearTimeout( self.searching );
					self.searching = setTimeout(function() {
						// only search if the value has changed
						if ( self.term != self.element.val() ) {
							self.selectedItem = null;
							self.search( null, event );
						}
					}, self.options.delay );
					break;
				}
			})
			.bind( "keypress.autocomplete", function( event ) {
				if ( suppressKeyPress ) {
					suppressKeyPress = false;
					event.preventDefault();
				}
			})
			.bind( "focus.autocomplete", function() {
				if ( self.options.disabled ) {
					return;
				}

				self.selectedItem = null;
				self.previous = self.element.val();
			})
			.bind( "blur.autocomplete", function( event ) {
				if ( self.options.disabled ) {
					return;
				}

				clearTimeout( self.searching );
				// clicks on the menu (or a button to trigger a search) will cause a blur event
				self.closing = setTimeout(function() {
					self.close( event );
					self._change( event );
				}, 150 );
			});
		this._initSource();
		this.response = function() {
			return self._response.apply( self, arguments );
		};
		this.menu = $( "<ul></ul>" )
			.addClass( "ui-autocomplete" )
			.appendTo( $( this.options.appendTo || "body", doc )[0] )
			// prevent the close-on-blur in case of a "slow" click on the menu (long mousedown)
			.mousedown(function( event ) {
				// clicking on the scrollbar causes focus to shift to the body
				// but we can't detect a mouseup or a click immediately afterward
				// so we have to track the next mousedown and close the menu if
				// the user clicks somewhere outside of the autocomplete
				var menuElement = self.menu.element[ 0 ];
				if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
					setTimeout(function() {
						$( document ).one( 'mousedown', function( event ) {
							if ( event.target !== self.element[ 0 ] &&
								event.target !== menuElement &&
								!$.ui.contains( menuElement, event.target ) ) {
								self.close();
							}
						});
					}, 1 );
				}

				// use another timeout to make sure the blur-event-handler on the input was already triggered
				setTimeout(function() {
					clearTimeout( self.closing );
				}, 13);
			})
			.menu({
				focus: function( event, ui ) {
					var item = ui.item.data( "item.autocomplete" );
					if ( false !== self._trigger( "focus", event, { item: item } ) ) {
						// use value to match what will end up in the input, if it was a key event
						if ( /^key/.test(event.originalEvent.type) ) {
							self.element.val( item.value );
						}
					}
				},
				selected: function( event, ui ) {
					var item = ui.item.data( "item.autocomplete" ),
						previous = self.previous;

					// only trigger when focus was lost (click on menu)
					if ( self.element[0] !== doc.activeElement ) {
						self.element.focus();
						self.previous = previous;
						// #6109 - IE triggers two focus events and the second
						// is asynchronous, so we need to reset the previous
						// term synchronously and asynchronously :-(
						setTimeout(function() {
							self.previous = previous;
							self.selectedItem = item;
						}, 1);
					}

					if ( false !== self._trigger( "select", event, { item: item } ) ) {
						self.element.val( item.value );
					}
					// reset the term after the select event
					// this allows custom select handling to work properly
					self.term = self.element.val();

					self.close( event );
					self.selectedItem = item;
				},
				blur: function( event, ui ) {
					// don't set the value of the text field if it's already correct
					// this prevents moving the cursor unnecessarily
					if ( self.menu.element.is(":visible") &&
						( self.element.val() !== self.term ) ) {
						self.element.val( self.term );
					}
				}
			})
			.zIndex( this.element.zIndex() + 1 )
			// workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
			.css({ top: 0, left: 0 })
			.hide()
			.data( "menu" );
		if ( $.fn.bgiframe ) {
			 this.menu.element.bgiframe();
		}
	},

	destroy: function() {
		this.element
			.removeClass( "ui-autocomplete-input" )
			.removeAttr( "autocomplete" )
			.removeAttr( "role" )
			.removeAttr( "aria-autocomplete" )
			.removeAttr( "aria-haspopup" );
		this.menu.element.remove();
		$.Widget.prototype.destroy.call( this );
	},

	_setOption: function( key, value ) {
		$.Widget.prototype._setOption.apply( this, arguments );
		if ( key === "source" ) {
			this._initSource();
		}
		if ( key === "appendTo" ) {
			this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] )
		}
		if ( key === "disabled" && value && this.xhr ) {
			this.xhr.abort();
		}
	},

	_initSource: function() {
		var self = this,
			array,
			url;
		if ( $.isArray(this.options.source) ) {
			array = this.options.source;
			this.source = function( request, response ) {
				response( $.ui.autocomplete.filter(array, request.term) );
			};
		} else if ( typeof this.options.source === "string" ) {
			url = this.options.source;
			this.source = function( request, response ) {
				if ( self.xhr ) {
					self.xhr.abort();
				}
				self.xhr = $.ajax({
					url: url,
					data: request,
					dataType: "json",
					autocompleteRequest: ++requestIndex,
					success: function( data, status ) {
						if ( this.autocompleteRequest === requestIndex ) {
							response( data );
						}
					},
					error: function() {
						if ( this.autocompleteRequest === requestIndex ) {
							response( [] );
						}
					}
				});
			};
		} else {
			this.source = this.options.source;
		}
	},

	search: function( value, event ) {
		value = value != null ? value : this.element.val();

		// always save the actual value, not the one passed as an argument
		this.term = this.element.val();

		if ( value.length < this.options.minLength ) {
			return this.close( event );
		}

		clearTimeout( this.closing );
		if ( this._trigger( "search", event ) === false ) {
			return;
		}

		return this._search( value );
	},

	_search: function( value ) {
		this.pending++;
		this.element.addClass( "ui-autocomplete-loading" );

		this.source( { term: value }, this.response );
	},

	_response: function( content ) {
		if ( !this.options.disabled && content && content.length ) {
			content = this._normalize( content );
			this._suggest( content );
			this._trigger( "open" );
		} else {
			this.close();
		}
		this.pending--;
		if ( !this.pending ) {
			this.element.removeClass( "ui-autocomplete-loading" );
		}
	},

	close: function( event ) {
		clearTimeout( this.closing );
		if ( this.menu.element.is(":visible") ) {
			this.menu.element.hide();
			this.menu.deactivate();
			this._trigger( "close", event );
		}
	},
	
	_change: function( event ) {
		if ( this.previous !== this.element.val() ) {
			this._trigger( "change", event, { item: this.selectedItem } );
		}
	},

	_normalize: function( items ) {
		// assume all items have the right format when the first item is complete
		if ( items.length && items[0].label && items[0].value ) {
			return items;
		}
		return $.map( items, function(item) {
			if ( typeof item === "string" ) {
				return {
					label: item,
					value: item
				};
			}
			return $.extend({
				label: item.label || item.value,
				value: item.value || item.label
			}, item );
		});
	},

	_suggest: function( items ) {
		var ul = this.menu.element
			.empty()
			.zIndex( this.element.zIndex() + 1 );
		this._renderMenu( ul, items );
		// TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate
		this.menu.deactivate();
		this.menu.refresh();

		// size and position menu
		ul.show();
		this._resizeMenu();
		ul.position( $.extend({
			of: this.element
		}, this.options.position ));

		if ( this.options.autoFocus ) {
			this.menu.next( new $.Event("mouseover") );
		}
	},

	_resizeMenu: function() {
		var ul = this.menu.element;
		ul.outerWidth( Math.max(
			ul.width( "" ).outerWidth(),
			this.element.outerWidth()
		) );
	},

	_renderMenu: function( ul, items ) {
		var self = this;
		$.each( items, function( index, item ) {
			self._renderItem( ul, item );
		});
	},

	_renderItem: function( ul, item) {
		return $( "<li></li>" )
			.data( "item.autocomplete", item )
			.append( $( "<a></a>" ).text( item.label ) )
			.appendTo( ul );
	},

	_move: function( direction, event ) {
		if ( !this.menu.element.is(":visible") ) {
			this.search( null, event );
			return;
		}
		if ( this.menu.first() && /^previous/.test(direction) ||
				this.menu.last() && /^next/.test(direction) ) {
			this.element.val( this.term );
			this.menu.deactivate();
			return;
		}
		this.menu[ direction ]( event );
	},

	widget: function() {
		return this.menu.element;
	}
});

$.extend( $.ui.autocomplete, {
	escapeRegex: function( value ) {
		return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
	},
	filter: function(array, term) {
		var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
		return $.grep( array, function(value) {
			return matcher.test( value.label || value.value || value );
		});
	}
});

}( jQuery ));

/*
 * jQuery UI Menu (not officially released)
 * 
 * This widget isn't yet finished and the API is subject to change. We plan to finish
 * it for the next release. You're welcome to give it a try anyway and give us feedback,
 * as long as you're okay with migrating your code later on. We can help with that, too.
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Menu
 *
 * Depends:
 *	jquery.ui.core.js
 *  jquery.ui.widget.js
 */
(function($) {

$.widget("ui.menu", {
	_create: function() {
		var self = this;
		this.element
			.addClass("ui-menu ui-widget ui-widget-content ui-corner-all")
			.attr({
				role: "listbox",
				"aria-activedescendant": "ui-active-menuitem"
			})
			.click(function( event ) {
				if ( !$( event.target ).closest( ".ui-menu-item a" ).length ) {
					return;
				}
				// temporary
				event.preventDefault();
				self.select( event );
			});
		this.refresh();
	},
	
	refresh: function() {
		var self = this;

		// don't refresh list items that are already adapted
		var items = this.element.children("li:not(.ui-menu-item):has(a)")
			.addClass("ui-menu-item")
			.attr("role", "menuitem");
		
		items.children("a")
			.addClass("ui-corner-all")
			.attr("tabindex", -1)
			// mouseenter doesn't work with event delegation
			.mouseenter(function( event ) {
				self.activate( event, $(this).parent() );
			})
			.mouseleave(function() {
				self.deactivate();
			});
	},

	activate: function( event, item ) {
		this.deactivate();
		if (this.hasScroll()) {
			var offset = item.offset().top - this.element.offset().top,
				scroll = this.element.scrollTop(),
				elementHeight = this.element.height();
			if (offset < 0) {
				this.element.scrollTop( scroll + offset);
			} else if (offset >= elementHeight) {
				this.element.scrollTop( scroll + offset - elementHeight + item.height());
			}
		}
		this.active = item.eq(0)
			.children("a")
				.addClass("ui-state-hover")
				.attr("id", "ui-active-menuitem")
			.end();
		this._trigger("focus", event, { item: item });
	},

	deactivate: function() {
		if (!this.active) { return; }

		this.active.children("a")
			.removeClass("ui-state-hover")
			.removeAttr("id");
		this._trigger("blur");
		this.active = null;
	},

	next: function(event) {
		this.move("next", ".ui-menu-item:first", event);
	},

	previous: function(event) {
		this.move("prev", ".ui-menu-item:last", event);
	},

	first: function() {
		return this.active && !this.active.prevAll(".ui-menu-item").length;
	},

	last: function() {
		return this.active && !this.active.nextAll(".ui-menu-item").length;
	},

	move: function(direction, edge, event) {
		if (!this.active) {
			this.activate(event, this.element.children(edge));
			return;
		}
		var next = this.active[direction + "All"](".ui-menu-item").eq(0);
		if (next.length) {
			this.activate(event, next);
		} else {
			this.activate(event, this.element.children(edge));
		}
	},

	// TODO merge with previousPage
	nextPage: function(event) {
		if (this.hasScroll()) {
			// TODO merge with no-scroll-else
			if (!this.active || this.last()) {
				this.activate(event, this.element.children(".ui-menu-item:first"));
				return;
			}
			var base = this.active.offset().top,
				height = this.element.height(),
				result = this.element.children(".ui-menu-item").filter(function() {
					var close = $(this).offset().top - base - height + $(this).height();
					// TODO improve approximation
					return close < 10 && close > -10;
				});

			// TODO try to catch this earlier when scrollTop indicates the last page anyway
			if (!result.length) {
				result = this.element.children(".ui-menu-item:last");
			}
			this.activate(event, result);
		} else {
			this.activate(event, this.element.children(".ui-menu-item")
				.filter(!this.active || this.last() ? ":first" : ":last"));
		}
	},

	// TODO merge with nextPage
	previousPage: function(event) {
		if (this.hasScroll()) {
			// TODO merge with no-scroll-else
			if (!this.active || this.first()) {
				this.activate(event, this.element.children(".ui-menu-item:last"));
				return;
			}

			var base = this.active.offset().top,
				height = this.element.height();
				result = this.element.children(".ui-menu-item").filter(function() {
					var close = $(this).offset().top - base + height - $(this).height();
					// TODO improve approximation
					return close < 10 && close > -10;
				});

			// TODO try to catch this earlier when scrollTop indicates the last page anyway
			if (!result.length) {
				result = this.element.children(".ui-menu-item:first");
			}
			this.activate(event, result);
		} else {
			this.activate(event, this.element.children(".ui-menu-item")
				.filter(!this.active || this.first() ? ":last" : ":first"));
		}
	},

	hasScroll: function() {
		return this.element.height() < this.element[ $.fn.prop ? "prop" : "attr" ]("scrollHeight");
	},

	select: function( event ) {
		this._trigger("selected", event, { item: this.active });
	}
});

}(jQuery));
;


/* Comment Generated by Combres - Resource '~/client_Scripts/ignify.category.productlist.js' (Mode: Static) */
if(!ignify)
ignify = {};

if(!ignify.category)
  ignify.category = {};
/********************************************************************************************************************************************************************************************************/
ignify.category.productlist = function () {

    this.changeview = function (newvalue, oldvalue, obj) {
        $("#productlisting").removeClass(oldvalue);
        $("#productlisting").addClass(newvalue);
        $("#" + newvalue).addClass("selectedviewmode");
        $("#" + oldvalue).removeClass("selectedviewmode");
        $("#hdnDisplayType").val(newvalue);
    };
    /********************************************************************************************************************************************************************************************************/
    this.productssperpage = function (prodsperpage, queryString) {
        var addAmpersand = false;
        if (queryString.indexOf("?") == -1) {
            queryString += "?";
            addAmpersand = false;
        }
        else
            addAmpersand = true;
        queryString = queryString.replace(/ppp=[0-9]+/, 'ppp=' + prodsperpage);
        queryString = queryString.replace(/pn=[0-9]+/, 'pn=' + 1);
        if (queryString.indexOf("ppp=") == -1) {
            if (addAmpersand)
                queryString += "&";
            queryString += "ppp=" + prodsperpage;
        }
        parent.document.location.href = queryString;
    };
    /********************************************************************************************************************************************************************************************************/
    this.productssperpageusingajax = function (prodsperpage, queryString) {

        queryString = $("#productlistform").attr("action");
        queryString = $.trim(queryString);

        var addAmpersand = false;
        if (queryString.indexOf("?") == -1) {
            queryString += "?";
            addAmpersand = false;
        }
        else {
            if (queryString.indexOf("?") == queryString.length - 1)
                addAmpersand = false;
            else
                addAmpersand = true;
        }

        queryString = queryString.replace(/ppp=[0-9]+/, 'ppp=' + prodsperpage);
        queryString = queryString.replace(/ppp=null+/, 'ppp=' + prodsperpage);
        queryString = queryString.replace(/ppp=&+/, 'ppp=' + prodsperpage + '&');

        queryString = queryString.replace(/pn=[0-9]+/, 'pn=1');
        queryString = queryString.replace(/pn=&+/, 'pn=1&');
        queryString = queryString.replace(/pn=null+/, 'pn=1');

        if (queryString.indexOf("ppp=") == -1) {

            if (addAmpersand)
                queryString += "&";

            queryString += "ppp=" + prodsperpage;
        }

        if (queryString.indexOf("pn=") == -1) {

            if (addAmpersand)
                queryString += "&";

            queryString += "pn=1";
        }

        queryString = queryString.replace(/\#\?/, '?');

        var temphtml = "";
        $("#narrowSearchForm  input[type='hidden']").each(function (index) {
            temphtml += $('<div>').append($(this).clone()).html();
        });
        $("#runtimefieldsContainer").html(temphtml);
        var ajaxFrameworkObj = new IgnifyAjaxFramework();

        ajaxFrameworkObj.PrepareForPOST("productlistcontainer", "productlistform", queryString, function () { });
        ajaxFrameworkObj.MakeAjaxCall("productlistcontainer");
    };
    /********************************************************************************************************************************************************************************************************/
    this.showallusingajax = function (totalproductcount) {

        queryString = $("#productlistform").attr("action");
        queryString = $.trim(queryString);

        var addAmpersand = false;
        if (queryString.indexOf("?") == -1) {
            queryString += "?";
            addAmpersand = false;
        }
        else {
            if (queryString.indexOf("?") == queryString.length - 1)
                addAmpersand = false;
            else
                addAmpersand = true;
        }

        queryString = queryString.replace(/ppp=[0-9]+/, 'ppp=' + totalproductcount);
        queryString = queryString.replace(/ppp=null+/, 'ppp=' + totalproductcount);
        queryString = queryString.replace(/ppp=&+/, 'ppp=' + totalproductcount + '&');

        queryString = queryString.replace(/pn=[0-9]+/, 'pn=1');
        queryString = queryString.replace(/pn=&+/, 'pn=1&');
        queryString = queryString.replace(/pn=null+/, 'pn=1');

        if (queryString.indexOf("ppp=") == -1) {

            if (addAmpersand)
                queryString += "&";

            queryString += "ppp=" + totalproductcount;
        }

        if (queryString.indexOf("pn=") == -1) {

            if (addAmpersand)
                queryString += "&";

            queryString += "pn=1";
        }


        queryString = queryString.replace(/\#\?/, '?');

        var temphtml = "";
        $("#narrowSearchForm  input[type='hidden']").each(function (index) {
            temphtml += $('<div>').append($(this).clone()).html();
        });
        $("#runtimefieldsContainer").html(temphtml);
        var ajaxFrameworkObj = new IgnifyAjaxFramework();

        ajaxFrameworkObj.PrepareForPOST("productlistcontainer", "productlistform", queryString, function () { });
        ajaxFrameworkObj.MakeAjaxCall("productlistcontainer");
    };
    /********************************************************************************************************************************************************************************************************/
    this.sendtofriend = function (ProductCode) {
        var win = window.open(protocol + "//" + hostName + homeUrl + "Profile/SendToFriend.aspx?Id=" + ProductCode, "SendToFriend", "location=no,resizable=yes,top=20,left=70,height=700,width=860,status=no,toolbar=no,scrollbars=yes");
        win.focus();
    };
    /********************************************************************************************************************************************************************************************************/
    /*Dependency : need a global js variable called homeUrl pointing to the root. */
    this.addtocomparisonlist = function (productid, productname, catalogthumbimage, avgrating, ratingcount, retailprice, listprice, aslowas, attributeclass, totalvariations, afteraddtocomparisonlist) {
        $.get(homeUrl + "widgets-cart/gethtml_productcomparisonlist/x/?prodid=" + $.trim(productid.toString()) + "&prodname=" + productname + "&image=" + catalogthumbimage + "&rating=" + avgrating + "&ratingcount=" + ratingcount + "&retailprice=" + retailprice + "&listprice=" + listprice + "&aslowas=" + aslowas + "&attributeclass=" + attributeclass + "&totalvariations=" + totalvariations, function (response) { afteraddtocomparisonlist(response); });
    };
    /********************************************************************************************************************************************************************************************************/
    this.removefromcomparison = function (productid, afterremovefromcomparisonlist) {
        $.get(homeUrl + "widgets-cart/removefromcomparison/x/?prodid=" + productid, function (response) { afterremovefromcomparisonlist(response, productid); });
    };

    /********************************************************************************************************************************************************************************************************/

    this.viewcomparison = function (afterviewcomparison) {
        if (compareviewlaunch == 'popup') {
            $.get(homeUrl + "widgets-cart/gethtml_viewcomparison/x/?compareviewname=" + compareviewname, function (response) { afterviewcomparison(response); });
        }
        if (compareviewlaunch == 'window') {
            window.location.href = homeUrl + "cart/productcomparison?compareviewname=" + compareviewname;
        }
    };

    this.hidetabifempty = function (idoftabtohide) {
        var thispaneid = $("." + idoftabtohide).parents(".productlistpane").attr("id");
        obj = $("." + idoftabtohide).parents(".productlistpane");

        // this is for themes that do not use tabs. 
        //Please ensure that you wrap all HTML of that special products (newarrivals, featured products, mostpopular etc)... 
        //in a div having a class "productlistpane"
        if (obj.parents(".panes").length == 0) {
            $("." + idoftabtohide).parents(".productlistpane").remove();
        }
        // This else is for UI themes which use jQuery TABs to display newarrivals etc...
        else {
           
            $(".tabs #" + thispaneid).remove();
            $(".panes #" + thispaneid).remove();
        }
    };

    this.showtabifnotempty = function (idoftabtohide) {
        var thispaneid = $("." + idoftabtohide).parents(".productlistpane").attr("id");
        $(".tabs #" + thispaneid).show("fast");
        $(".panes").show();


    };
    /********************************************************************************************************************************************************************************************************/

    this.validateitemquantity = function (modelid) {

        // If you return a false from here then the item will not get added to cart.
        var qtyvalue = $.trim($("#txtQty_" + modelid).val());
        if (ignify_utility_js.validateforpositivenumbers(qtyvalue) && ignify_utility_js.validatefornonzero(qtyvalue)) {
            return true;
        }
        else {
            $("#errorMessage_" + modelid).fadeIn("fast");
            return false;
        }

    };

    /********************************************************************************************************************************************************************************************************/

};

var ignify_category_productlist_js = new ignify.category.productlist();;


/* Comment Generated by Combres - Resource '~/client_scripts/Events/IgnAttributeChangedEvent.js' (Mode: Static) */
function IgnAttributeChangedEvent() {
    this.eventname = "IgnAttributeChanged";
    this.parentidOfDivThatFiredEvent = "";
    this.listenersid = "";
    this.selectedoptionsarray = [];
    this.listen = bindToAttributeChangedEvent;
    this.fireevent = triggerAttributeChangedEvent;
    this.productid = "";
    return true;
}
function bindToAttributeChangedEvent(idOfObjToBind, callbackfunction) {

    $("#" + idOfObjToBind).bind(this.eventname, function (e, attrchangedeventobj) {
        if (attrchangedeventobj.parentidOfDivThatFiredEvent == idOfObjToBind) {
            // This will prevent Ajax firing of the swatch that was clicked.
            return false;
        }
        else {
               attrchangedeventobj.listenersid = idOfObjToBind;
               callbackfunction(e, attrchangedeventobj);
        }
    });
}
function triggerAttributeChangedEvent() {
    $.event.trigger(this.eventname, [this]);
};


/* Comment Generated by Combres - Resource '~/client_scripts/Events/IgnSkuLoadedEvent.js' (Mode: Static) */
function IgnSkuLoadedEvent() {
    this.eventname = "IgnSkuLoaded";
    this.listen = bindToSkuLoadedEvent;
    this.fireevent = triggerSkuLoadedEvent;
    this.productid = "";
    return true;
}
function bindToSkuLoadedEvent(idOfObjToBind, callbackfunction) {

    $("#" + idOfObjToBind).bind(this.eventname, callbackfunction);
}
function triggerSkuLoadedEvent(eventarguments) {

    $.event.trigger(this.eventname, [this,eventarguments]);
};


/* Comment Generated by Combres - Resource '~/client_scripts/ignify.product.productdetails.js' (Mode: Static) */
if (!ignify.product)
    ignify.product = {};

ignify.product.productdetails = function () {
    this.getselectedoptionvalue = function (nameofoption) {
        var returnvalue = "";
        for (var i = 0; i < selectedoptions.length; i++) {
            if (selectedoptions[i].attribute == nameofoption) {
                returnvalue = selectedoptions[i].attributevalue;
                break;
            }
        }
        return returnvalue;
    };
    this.alternateproductpopup_oos = function (SkuId, productid, StockQty, ShowInventory, hasAlternateProducts, addNewLine) {
        var Override = false;
        if (ShowInventory && hasAlternateProducts) {
            Override = true;
        }
        //set default to 1
        var EnteredQty = 1;
        var QtyDisabled = false;

        if (document.getElementById("txtQty_" + productid) != null) {
            //If Quantity textbox is enabled then read quantity otherwise assume it as 1
            QtyDisabled = document.getElementById("txtQty_" + productid).disabled;
            if (!QtyDisabled) {
                //Read entered quantity
                EnteredQty = document.getElementById("txtQty_" + productid).value;
                //If not blank
                if (EnteredQty != "") {
                    if (EnteredQty == 'Qty')
                        EnteredQty = 1;
                    if (!ignify_utility_js.isnumeric(EnteredQty)) {
                        //close the modal dialog

                        $("#btnAddToCart_" + productid).attr("src", themeimagesurl + "add-to-cart.gif");
                        //alert("CATALOG_JSMSG_VALID_QTY");   //This will get replaced later once this branch gets merged
                        alert("Please enter valid quantity.");
                        document.getElementById("txtQty_" + productid).focus();
                        return false;
                    }
                    if (EnteredQty <= 0) {

                        $("#btnAddToCart_" + productid).attr("src", themeimagesurl + "add-to-cart.gif");
                        //alert("CATALOG_JSMSG_GREATER_THAN_ZERO"); //This will get replaced later once this branch gets merged
                        alert("Enter value greater than 0.");
                        document.getElementById("txtQty_" + productid).focus();
                        return false;
                    }
                }
                else
                    EnteredQty = 1;
            }

        }

        var rentalfreq = "";
        //If rental container is visible then only do rental freq. validation and add it
        if ($("#rentalfreqcontainer_" + productid).css("display") == "block") {
            rentalfreq = document.getElementById("RentalFreq_" + productid).value;
            if (rentalfreq == "" || rentalfreq == "0") {
                $("#btnAddToCart_" + productid).attr("src", themeimagesurl + "add-to-cart.gif");
                alert("RENTAL_FREQUENCY_REQUIRED_ERROR_MESSAGE");   //This will get replaced later once this branch gets merged
                $("#loadingMessage_" + productid).removeClass("displaysuccessmsg");
                return false;
            }
        }

        if (Override == true) {
            //Verify stock quantity & entered quantity
            if (StockQty != "" && eval(EnteredQty) > eval(StockQty)) {
                if (allowbackorder == false) {
                    EnteredQty = StockQty;
                }
                if (hasAlternateProducts == true && SkuId != "") {

                    $("#btnAddToCart_" + productid).attr("src", themeimagesurl + "add-to-cart.gif");
                    window.open(protocol + "//" + hostName + homeUrl + "catalog/productcrossselling.aspx?id=" + productid + "&amp;skuid=" + SkuId + "&amp;stkqty=" + StockQty + "&amp;qty=" + EnteredQty + "&amp;newline=" + addNewLine, "SimilarProducts", "location=center,resizable=no,height=310,width=720,status=no,toolbar=no,scrollbars=no");
                    return false;
                }
            } // end of qty check
        } // end of if override


        return true;
    };
    /********************************************************************************************************************************************************************************************************/
    var shouldmakeajaxcall = function (attributename, selectedValue, enabled) {
        var returnvalue = true;
        for (var i = 0; i < selectedoptions.length; i++) {
            if (selectedoptions[i].attribute == attributename) {
                returnvalue = !(selectedValue == selectedoptions[i].attributevalue);
            }
        }
        return returnvalue;
    };
    /********************************************************************************************************************************************************************************************************/
    this.markselectedoptions = function (attributename, selector, htmlattribute, cssClassToApply) {
        var selectedOptionObject;
        var selectedval;
        //    if (selectedoptions == undefined || selectedoptions.length == 0) {
        //        return undefined;
        //    }
        for (var i = 0; i < selectedoptions.length; i++) {
            if (selectedoptions[i].attribute == attributename) {
                selectedOptionObject = selectedoptions[i];
                break;
            }
        }
        if (selectedOptionObject != undefined) {
            $(selector).each(function (index) {
                if ($(this).attr(htmlattribute) == selectedOptionObject.attributevalue) {
                    $(this).addClass(cssClassToApply);
                    selectedval = $(this).attr(htmlattribute);
                }
            });
        }
        return ({ "attributename": attributename, "attributevalue": selectedval });
    };
    /********************************************************************************************************************************************************************************************************/
    this.serializeselectedoptions = function (arrayToSerialize, productid) {
        var str = "";
        for (var i = 0; i < arrayToSerialize.length; i++) {
            if (arrayToSerialize[i].productid == productid) {
                str += arrayToSerialize[i].attribute + "$" + encodeURI(arrayToSerialize[i].attributevalue) + "$" + arrayToSerialize[i].enabled;
            }
            if (i < arrayToSerialize.length - 1)
                str += ",";
        }
        return str;
    };

    /********************************************************************************************************************************************************************************************************/
    this.storeattributevalues = function (attributeName, attributeValue, isEnabled, productid) {
        var foundAttribute = false;
        var makeAjaxCall = shouldmakeajaxcall(attributeName, attributeValue, isEnabled);
        for (var i = 0; i < selectedoptions.length; i++) {
            if (selectedoptions[i].attribute == attributeName) {
                foundAttribute = true;
                selectedoptions[i].attributevalue = attributeValue;
                selectedoptions[i].enabled = isEnabled;
                selectedoptions[i].productid = productid;
                break;
            }
        }

        if (!foundAttribute) {
            selectedoptions.push({ "attribute": attributeName, "attributevalue": attributeValue, "enabled": isEnabled, "productid": productid });
        }
        return makeAjaxCall;
    };

    /********************************************************************************************************************************************************************************************************/
    // This needs to be called on load or document.ready of options files
    // callBackFunction should be defined on the options file as :
    //  example : function loadSizes(idOfDiv, eventArgs){  }
    this.bindforondemandloading = function (idOfDivToBindForLoading, callBackFunction) {
        $("#" + idOfDivToBindForLoading).bind("IgnAjaxEvent", function (e, selectedOptionsArray, parentidOfDivThatFiredEvent) {
            if (parentidOfDivThatFiredEvent == idOfDivToBindForLoading) {
                // This will prevent Ajax firing of the swatch that was clicked.
                return;
            }
            else {
                $("#" + idOfDivToBindForLoading).unbind("IgnAjaxEvent");
                callBackFunction($(this).attr("id"), arguments);
            }
        });
    };

    /********************************************************************************************************************************************************************************************************/
    this.opentab = function (tabtoopen) {
        $("#productreviews a").each(function (index) {
            $(this).removeClass("current");
        })
        $("#" + tabtoopen).addClass("current");
        $("#" + tabtoopen).click();
        $("#" + tabtoopen).focus();
    };

    /********************************************************************************************************************************************************************************************************/
    this.sendtofriend = function (productId, ProductCode, imgUrl, ProductName) {
        var win = window.open(protocol + "//" + hostName + homeUrl + "Profile/SendToFriend.aspx?Id=" + productId + "&code=" + ProductCode + "&imgurl=" + imgUrl + "&prodname=" + ProductName, "SendToFriend", "location=no,resizable=yes,top=20,left=70,height=700,width=980,status=no,toolbar=no,scrollbars=yes");
        //var url = "../Profile/SendToFriend.aspx?Id=" + productId + "&code=" + ProductCode + "&imgurl=" + imgUrl + "&prodname=" + ProductName;
        win.focus();

    }
    this.sendtofriendarticle = function (productId, ProductCode, imgUrl, ProductName) {
        var win = window.open(protocol + "//" + hostName + homeUrl + "Profile/SendToFriend.aspx?event=article&Id=" + productId + "&code=" + ProductCode + "&imgurl=" + imgUrl + "&prodname=" + ProductName, "SendToFriend", "location=no,resizable=yes,top=20,left=70,height=700,width=980,status=no,toolbar=no,scrollbars=yes");
        win.focus();
    }

    this.addtofavorite = function (title, url) {
        // if (navigator.appName == "Netscape") 

            var useragent=  navigator.userAgent;
            var re = new RegExp("Chrome");
            if (useragent.match(re))
         
        {
            alert("Press CTRL-D to bookmark");
        }
        if (window.sidebar) { // Mozilla Firefox Bookmark
            window.sidebar.addPanel(title, url, "");
        } else if (window.external) { // IE Favorite
            window.external.AddFavorite(url, title);
        }
        else if (window.opera && window.print) { // Opera Hotlist
            var elem = document.createElement('a');
            elem.setAttribute('href', url);
            elem.setAttribute('title', title);
            elem.setAttribute('rel', 'sidebar');
            elem.click();
            //return true;
        }
    }
    /********************************************************************************************************************************************************************************************************/
    this.subscribewantlist = function (popupid, formname, wrapperdivid) {

        //Initiate the notify me popup
        $('#' + popupid).overlay();
        $('#' + popupid).overlay().load();
        try {
            ignify_utility_js.setzindex($('#' + popupid));
        } catch (x) { }
        //Create wrapper form for notify me div

        if ($('#' + formname).html() == null)
            ignify_utility_js.createwrapperform(formname, "post", homeUrl + "product/subscribetowantlist", wrapperdivid);

        //attach validations to the form.
        $("#" + formname).validate();

        //Options to be sent to the form post
        var options = {
            success: successcallback  // post-submit callback 
        };

        //Register the form into Ajax form
        $('form#' + formname).ajaxForm(options);
    };

    this.togglevideodisplay = function (obj) {
        if (obj.attr("currentdisplay") == "Pictures") {
            $("#prodimages").hide();
            $("#prodvideos").show();
        }
        else {
            $("#prodimages").show();
            $("#prodvideos").hide();
        }
    };
}
var ignify_product_productdetails_js = new ignify.product.productdetails();
;


/* Comment Generated by Combres - Resource '~/client_scripts/ignify.nav.js' (Mode: Static) */
var splitChar = "^";

function sortproductlistwithreload(sortvalue, currenturl) {

    var addampersand = currenturl.indexOf("?") > 0;
    if (currenturl.indexOf("hdnSortType") > 0) {

        var newurl = currenturl.replace(/hdnSortType=[A-Z_]+/, 'hdnSortType=' + sortvalue);

        window.location.href = newurl.replace(/hdnSortType=null+/, 'hdnSortType=' + sortvalue);
    }
    else {

        if (addampersand)
            window.location.href += "&hdnSortType=" + sortvalue;
        else
            window.location.href += "?hdnSortType=" + sortvalue;
    }
}

function gotopageusingajax(pageno, queryString, obj) {
    queryString = obj.closest("form").attr("action");
    queryString = $.trim(queryString);
 
    var addAmpersand = false;
    if (queryString.indexOf("?") == -1) {
        queryString += "?";
        addAmpersand = false;
    }
    else {
        if (queryString.indexOf("?")==queryString.length-1)
            addAmpersand = false;
        else
            addAmpersand = true;
    }

    queryString = queryString.replace(/pn=[0-9]+/, 'pn=' + pageno);

    if (queryString.indexOf("pn=") == -1) {

        if (addAmpersand)
            queryString += "&";

        queryString += "pn=" + pageno;
    }
    queryString = queryString.replace(/\#\?/, '?');

    var temphtml = "";
    $("#narrowSearchForm  input[type='hidden']").each(function (index) {
        temphtml += $('<div>').append($(this).clone()).html();
    });
    $("#runtimefieldsContainer").html(temphtml);
    var ajaxFrameworkObj = new IgnifyAjaxFramework();
   
    ajaxFrameworkObj.PrepareForPOST("productlistcontainer", obj.closest("form").attr("id"), queryString, function () { });
    ajaxFrameworkObj.MakeAjaxCall("productlistcontainer");
    
    //parent.document.location.href = queryString;
}

function gotopage(pageno, queryString) {
    
    var addAmpersand = false;
    if (queryString.indexOf("?") == -1) {
        queryString += "?";
        addAmpersand = false;
    }
    else
        addAmpersand = true;

    queryString = queryString.replace(/pn=[0-9]+/, 'pn=' + pageno);

    if (queryString.indexOf("pn=") == -1) {

        if (addAmpersand)
            queryString += "&";

        queryString += "pn=" + pageno;
    }
    queryString = queryString.replace(/\#\?/, '?');



    parent.document.location.href = queryString;
}





function SetPrevNextCookies(StoreId, CacheKey, CurrentUrl, CookieName, Source) {
    
    if (CacheKey == "")
        CacheKey = "Null";

    var expiredays = 1;
    var value;
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);

    var exdate_del = new Date();
    exdate_del.setDate(exdate.getDate() - 2);

    if (Source == "PD") {
            value = GetCookeyValue(CookieName, "PDCacheKey_", "PDPrevNextReffer_", StoreId, CurrentUrl, CacheKey);
            document.cookie = CookieName + "=" + escape(value) + "; expires=" + exdate.toUTCString() + "; path=/";
    }
    else if (Source == "QV") {
        value = GetCookeyValue(CookieName, "QVCacheKey_", "QVPrevNextReffer_", StoreId, CurrentUrl, CacheKey);
        document.cookie = CookieName + "=" + escape(value) + "; expires=" + exdate.toUTCString() + "; path=/";
    }
}


function GetCookeyValue(CookieName, CacheKeyInitial, PrevNextRefferInitial, StoreId, CurrentUrl, CacheKey) {
    var value;
    var cookieVal = ReadCookie(CookieName);
    if (cookieVal != false && cookieVal != "") {

        var tempCacheKey = ReadSubKeyValue(CookieName, CacheKeyInitial + StoreId, splitChar);
        if (tempCacheKey != false && tempCacheKey != "") {
            cookieVal = cookieVal.replace(CacheKeyInitial + StoreId + "=" + tempCacheKey + splitChar, "");
        }
        var tempPrevNextReffer = ReadSubKeyValue(CookieName, PrevNextRefferInitial + StoreId, splitChar);
        if (tempPrevNextReffer != false && tempPrevNextReffer != "") {
            cookieVal = cookieVal.replace(PrevNextRefferInitial + StoreId + "=" + tempPrevNextReffer + splitChar, "");
        }
        value = CacheKeyInitial + StoreId + "=" + CacheKey + splitChar + PrevNextRefferInitial + StoreId + "=" + CurrentUrl + splitChar;

        if (cookieVal.length > 0) {
            value = value + cookieVal;
        }

    }
    else {
        value = CacheKeyInitial + StoreId + "=" + CacheKey + splitChar + PrevNextRefferInitial + StoreId + "=" + CurrentUrl + splitChar;
    }

    return value;
}

function GeneratePrevNextCookey(cookieName,StoreId) {
    var cookieVal = ReadCookie(cookieName);
    var tempCacheKey = ReadSubKeyValue(cookieName, "QVCacheKey_" + StoreId, splitChar);
    var tempPrevNextReffer = ReadSubKeyValue(cookieName, "QVPrevNextReffer_" + StoreId, splitChar);
    SetPrevNextCookies(StoreId, tempCacheKey, tempPrevNextReffer, cookieName, 'PD')
}

//This function returns the value of the Cookie
function ReadCookie(cookieName) {
    var ind, c_name, ARRcookies = document.cookie.split(";");
    var c_value = "";
    var retValue = "";
    for (ind = 0; ind < ARRcookies.length; ind++) {
        
        c_name = ARRcookies[ind].substr(0, ARRcookies[ind].indexOf("="));
        c_value = ARRcookies[ind].substr(ARRcookies[ind].indexOf("=") + 1);
        c_name = c_name.replace(/^\s+|\s+$/g, "");
        if (c_name == cookieName) {
            c_value = unescape(c_value);
            retValue = c_value;
            break;
        }
    }

    var value_length = retValue.length;
    if (value_length > 2500) {
        retValue = "";
    }

    return retValue;
}

//This function returns the SubKey Value in the Cookie
function ReadSubKeyValue(cookieName,subKeyName, delimit) {
    if (document.cookie == '') {
        return false;
    }
    else {
        var ind, c_name, ARRcookies = document.cookie.split(";");
        var c_value = "";
        for (ind = 0; ind < ARRcookies.length; ind++) {
            c_name = ARRcookies[ind].substr(0, ARRcookies[ind].indexOf("="));
            c_value = ARRcookies[ind].substr(ARRcookies[ind].indexOf("=") + 1);
            c_name = c_name.replace(/^\s+|\s+$/g, "");
            if (c_name == cookieName) {
                c_value = unescape(c_value);
                break;
            }
        }

        if (c_value == '')
            return false;
        else {
            ind = c_value.indexOf(subKeyName);
            if (ind == -1) return false;
            var ind1 = c_value.indexOf(delimit, ind);
            if (ind1 == -1) ind1 = c_value.length;
            return c_value.substring(ind + subKeyName.length + 1, ind1)
        }
    }
}

function DeleteCookie(CookieName, value) {

    document.cookie = CookieName + "=" + escape(value) + "; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/";
}

