﻿var helpShown = false;

// ** MasterPage Functions -- Do not Delete !!! *** //
function initMaster(descriptionArea, pageTextArea) {
    var descLength = new String(descriptionArea.innerText);
    if (descLength.length < 5) {
        pageTextArea.style.display = "none";
    }

}


//*** ROTATOR **//
var Preload = new Array("blue", "red", "gray", "green", "ltblue", "orange");
var Images = new Array();

function doPreload() { for (i = 0; i < Preload.length; i++) { Images[i] = new Image(); Images[i].src = '' + "Leftnav/leftnav_glow_" + Preload[i] + ".gif"; } }
function post() { _f = document.forms[0]; _f.action = arguments[0]; _f.target = arguments[1]; _f.method = arguments[2]; _f.submit(); }


function init() {
    document.getElementById("content").style.display = "block";
    doPreload();
}

function BM() {
    if (window.external != null) {
        window.external.AddFavorite(location.href, document.title);
    }
}
function SetCookie(name, value, expires) {
    // set time, it's in milliseconds
    var today = new Date();
    today.setTime(today.getTime());

    /*
    if the expires variable is set, make the correct 
    expires time, the current script below will set 
    it for x number of days, to make it for hours, 
    delete * 24, for minutes, delete * 60 * 24
    */
    if (expires) {
        expires = expires * 1000 * 60 * 60 * 24;
    }
    var expires_date = new Date(today.getTime() + (expires));

    document.cookie = name + "=" + escape(value)
                           + ((expires) ? ";expires=" + expires_date.toGMTString() : "");
}

function SetCharityCookie(value, expires) {
    if (document.cookie.indexOf("EmployeeMode=") != -1) return;
    SetCookie('CharityOrder', value, expires);
}
function clearDefaultText(textbox, defaultText) {
    if (typeof editingPersonalization != 'undefined' && textbox.getAttribute('RequiresPreview') == null) {
        editingPersonalization(textbox, true);
    }
    textbox.setAttribute("oldValue", textbox.value);
    if (textbox.value == defaultText) { textbox.value = ''; }

}

function setDefaultText(textbox, defaultText) {
    if (textbox.value == '') {
        var command = "document.getElementById('" + textbox.id + "').value = '" + defaultText + "'";
        setTimeout(command, 100);
        if (textbox.getAttribute('oldValue') == defaultText) {
            editingPersonalization(textbox, false);
        }
    }
    if ((typeof editingPersonalization != 'undefined') != 'undefined' && textbox.value == textbox.getAttribute('oldValue')) {
        editingPersonalization(textbox, false);
    }
}

function showHelpWindow(windowName) {

    var oWnd = radopen(null, windowName);

    oWnd.setUrl(oWnd.get_navigateUrl());
    // freeze position 
    if (!oWnd.IsPinned()) oWnd.TogglePin()
}

function savedProjectConfirmation(callType, projectId, addresses, message) {
    openSaveProject(projectId, callType, true, addresses, message);
}

function showSaveProjectWindow() {
    openSaveProject(null);
}

function openSaveProject(projectId, callType, confirm, addresses, message) {
    var w = 370;
    var h = 138;
    var url = 'saveproject.aspx';
    if (confirm) {
        url = 'saveproject.aspx?confirmation=1&i=' + projectId + '&mode=' + callType;
        if (addresses) {
            url += '&addr=' + addresses;
        }
        if (message) {
            url += '&msg=' + message;
        }
        w = 450;
    } else {
        var appender = null;
        if (projectId != null) {
            url = url + '?i=' + projectId;
            appender = '&type=';
        } else {
            appender = '?type=';
        }
        url = url + appender + callType;
    }


    var horizontalPadding = 1;
    var verticalPadding = 1;

    if ($('#dialogWindow').length == 0) {
    	$('body').append('<iframe id="dialogWindow" class="dialogFrame" allowtransparency="allowtransparency" frameborder="0" src="" /> ');
    }


    $('#dialogWindow').attr('src', url);
    $('#dialogWindow').dialog({
        title: 'Save or Share Your Project...',
        autoOpen: true,
        width: w,
        height: h,
        modal: true,
        closeOnEscape: true,
        resizable: true,
        autoResize: true,
        overlay: {
            opacity: 0.5,
            background: "black"
        },
        close: function (event, ui) {
        	$('#dialogWindow').attr('src', '');
            // Remove completely the iframe and recreate it every time
            // This allows to show the url and not display any previous page
        }
    }).width(w - horizontalPadding).height(h - verticalPadding);


}

function initDialogs() {

	jQuery.each($('.dialog'), function (i, val) {
		$(val).click(function (e) {
            e.preventDefault();
            var $this = $(this);
            showDialog(this.href,
            ($this.attr('title')) ? $this.attr('title') : 'CardsDirect');

        });
    });

}
function closeDialog() {
    if (window.parent != null) {
    	window.parent.$('#dialogWindow').dialog('close');
    } else {
    	$('#dialogWindow').dialog('close');
    }


}
function showDialog(url, title, w, h) {
    if (!w) w = 560;
    if (!h) h = 560;
    var horizontalPadding = 30;
    var verticalPadding = 30;

    if ($('#dialogWindow').length == 0) {
    	$('body').append('<iframe id="dialogWindow" allowtransparency="allowtransparency" class="dialogFrame" frameborder="0" src="" /> ');
    }
    $('#dialogWindow').attr('src', url);
    var dl = $('#dialogWindow').dialog({
        title: title,
        autoOpen: true,
        position: [100, 100], // Top left
        width: w,
        height: h,
        modal: true,
        closeOnEscape: true,
        resizable: true,
        autoResize: true,
        overlay: {
            opacity: 0.5,
            background: "black"
        },
        close: function (event, ui) {
        	$('#dialogWindow').attr('src', '');
            // Remove completely the iframe and recreate it every time
            // This allows to show the url and not display any previous page
        }
    }).width(w - horizontalPadding).height(h - verticalPadding);

    return dl;
}
function showOrderPreview(thumbId, orderlineId) {
    var dl = showDialog("/orderpreviewdialog.aspx?id=" + thumbId + "&oid=" + orderlineId, "", 983, 760);
    dl.dialog('option', 'position', 'center');
    //    dl.dialog('option', 'resize', 'auto');
    //    setTimeout(function () {
    //        dl.dialog().height(
    //    $("#dialogWindow").contents().find("html").height());
    //    }, 800);

    //    dl.dialog('option', 'position', 'center');

}
function showExternalWindow(url) {
    var oWindow = window.radopen(url, null);
    oWindow.SetSize(560, 560);
    var theTop = 40;
    if (document.documentElement && document.documentElement.scrollTop) {
        theTop += document.documentElement.scrollTop;
    }
    else if (document.body) {
        theTop += document.body.scrollTop;
    }
    oWindow.MoveTo(40, theTop);
    // freeze position 	
    if (document.body.clientWidth > 800 && document.body.clientHeight > 600
    && !oWindow.isPinned()) {
        oWindow.togglePin();
    }
    return oWindow;
}

function showHelp(divId, img) {
    var helpDiv = document.getElementById(divId);
    helpDiv.innerHTML = '<img src=\"' + img + '\" />';
    opacity(divId, 0, 100, 500);
    setTimeout('hideHelp( \'' + divId + '\' );', 7000);
}

function hideHelp(divId) {
	var helpDiv = $(divId);
	if ($(helpDiv).css('opacity') == "0")
        return;

    if (helpShown) {
        helpShown = false;
        opacity(divId, 100, 0, 500);
    }
}

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame 
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens 
    if (opacStart > opacEnd) {
        for (i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')", (timer * speed));
            timer++;
        }
    } else if (opacStart < opacEnd) {
        for (i = opacStart; i <= opacEnd; i++) {
            setTimeout("changeOpac(" + i + ",'" + id + "')", (timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers 
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    helpShown = (object.opacity != "0");
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
    if (opacity == 0) {
        object.display = 'none';
    }
    else if (object.display == 'none') {
        object.display = '';
    }
}

function showReorderAlert(msg) {
    reorderAlert("Reorder Alert", msg);
}

function reorderAlert(title, html) {
    jAlert(html, title);
}
var AreaType = { DieCut: 1, FrontImprint: 2, InsideVerse: 3, InsideImprint: 4, Envelope: 5 };
var _areaErrors = { DieCut: false, FrontImprint: false, InsideVerse: false, InsideImprint: false, Envelope: false };
var _plateErrorsFound = false;
function plateCutOff(areaType, bReducedText) {

    switch (areaType) {
        case AreaType.InsideImprint:
            _areaErrors.InsideImprint = bReducedText;
            break;
        case AreaType.InsideVerse:
            _areaErrors.InsideVerse = bReducedText;
            break;
        case AreaType.FrontImprint:
            _areaErrors.FrontImprint = bReducedText;
            break;
        case AreaType.DieCut:
            _areaErrors.DieCut = bReducedText;
            break;
        case AreaType.Envelope:
            _areaErrors.Envelope = bReducedText;
            break;
        default:
            break;
    }

    showAreaError();
}

function showAreaError() {
    var input = null;

    if (_areaErrors.DieCut) {
        _plateErrorsFound = true;
        showHelp('divDieCutHelp', 'images/customize/popup_reduce_lines.gif');
        input = $('.diecutAreaText')[0];
        document.getElementById('diecutImprintArea').scrollIntoView();

    } else if (_areaErrors.FrontImprint) {
        _plateErrorsFound = true;
        showHelp('fi_customizationHelp', 'images/customize/popup_reduce_lines.gif');
        input = $('.frontImprintTxt')[0];
        document.getElementById('customizeCardPage').scrollIntoView();

    } else if (_areaErrors.InsideVerse) {
        _plateErrorsFound = true;
        showHelp('divPersonalizationHelp', 'images/customize/popup_reduce_lines.gif');
        input = $('.insideVerseTxt')[0];
        document.getElementById('insideImprintArea').scrollIntoView();
    } else if (_areaErrors.InsideImprint) {
        _plateErrorsFound = true;
        showHelp('divPersonalizationHelp', 'images/customize/popup_reduce_lines.gif');
        input = $('.insideImprintTxt')[0];
        document.getElementById('insideImprintArea').scrollIntoView();
    } else if (_areaErrors.Envelope) {
        _plateErrorsFound = true;
        showHelp('envelopeTextHelp', 'images/customize/popup_reduce_lines.gif');
        input = $('.envelopeTxtArea')[0];
        document.getElementById('envelopeImprintArea').scrollIntoView();
    }

    if (_plateErrorsFound) {
    	$('#ctl00_ctl00_MasterContentPlaceHolder1_ContentPlaceHolder1_hdnPlateError').val("true");
        if (input != null) {
        	$(input).css({ 'border': '2px solid #FF0000' });
        }
    } else {
       	$('#ctl00_ctl00_MasterContentPlaceHolder1_ContentPlaceHolder1_hdnPlateError').val("false");
        return true; // continue. No Errors
    }
    return false;
}

function openChat() {

    window.open('https://livechat.boldchat.com/aid/2171902647633990906/bc.chat?cwdid=2146978496011812354&amp;wdid=3575483228672027881&amp;url=' + escape(document.location.href), 'Chat3634712143070692881', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=640,height=480');
    return false;
}

/**********************
Card Details Page
/**********************/
function ConfirmSampleRequest() {
    return confirm("NOTICE:  All sample cards will have a large ink “SAMPLE” stamped on them and do not include envelopes.\n\n"
      + "Samples are available only in the default size and paper type.\n\n"
      + "There is a limit of 3 free samples per customer.\r\nPlease contact our customer support team to make special arrangements for larger orders.");
}

function setupAltViews(productName, thumbnailUrl, maxViews) {

    if (maxViews <= 0) {
        $('#MoreViews').hide();
        return;
    }

    $('#MoreViews').show();

    for (var i = 0; i < maxViews + 1; i++) {

        var url = thumbnailUrl;

        if (i > 0) {
            url = url.replace("_T.jpg", "_T" + i + ".jpg");
        }

        var imgElement = $("<img src='" + url + "' width='45px' height='45px' title=' " + productName + "' alt='" + productName + ' Click to Zoom' + "' />");
        //        var imgElement = new Element('img', {
        //            width: '45px',
        //            height: '45px',
        //            alt: productName + ' Click to Zoom',
        //            title: productName,
        //            src: url
        //        });

        var urlZ = url.replace('_T', '_Z');
        var urlD = url.replace('_T', '_D');
        urlD = urlD.replace('/christmascards/', '/christmascards/D/');
        //        var zoomLink = new Element('a', {
        //            'href': urlZ,
        //            'rev': urlD,
        //            'rel': 'zoom1'
        //        });
        var zoomLink = $("<a rel='zoom1' href='" + urlZ + "' rev='" + urlD + "' />")
        if (i === 0) {
            //zoomLink.addClassName("selected");
            zoomLink.addClass('selected');
        }

        //zoomLink.appendChild(imgElement);
        $(zoomLink).append(imgElement);

        //        zoomLink.observe("click", function (evt) {
        //            var zoom1 = document.getElementById('zoom1');
        //            var zoombtn = document.getElementById('zoomButton');
        //            selectThumb(this);
        //            zoombtn.href = zoom1.href = this.href; //zoom image
        //            zoom1.children[0].src = this.rev; // large image
        //            MagicThumb.refresh(); //Must refresh to show Z on the expanded view
        //            Event.stop(evt);
        //        });

        zoomLink.click(function (event) {
            event.preventDefault();
            var zoom1 = document.getElementById('zoom1');
            selectThumb(this);
            zoom1.href = this.href; //zoom image
            zoom1.children[0].src = this.rev; // large image
            MagicThumb.refresh(); //Must refresh to show Z on the expanded view


        });

        $('#altViews').append(zoomLink);
    }
}

function selectThumb(element) {
    var siblings = $(element).siblings('.selected');
    siblings.each(function () { $(this).removeClass('selected'); });
    $(element).addClass('selected');

}


var sopener;
function vrsn_splash() {
    var v_splash_url = "https://trustsealinfo.verisign.com";
    var verisignUrl = v_splash_url + "/splash?form_file=fdf/splash.fdf&dn=www.cardsdirect.com&lang=en";

    if (sopener && !sopener.closed) {
        sopener.focus();
    }
    else {
        tbar = "location=yes,status=yes,resizable=yes,scrollbars=yes,width=560,height=500";
        var sw = window.open(verisignUrl, 'VRSN_Splash', tbar);
        if (sw) {
            sw.focus();
            sopener = sw;
        }
    }
}

$(document).ready(function () {
	$('.default-value').each(function () {
        var default_value = this.value;
        $(this).focus(function () {
            if (this.value == default_value) {
                this.value = '';
            }
        });
            $(this).blur(function () {
            if (this.value == '') {
                this.value = default_value;
            }
        });
    });
});

function disableButton(btn, validationGroup) {
    if (Page_ClientValidate(validationGroup)) { btn.style.display = 'none'; }
}

var _searchErr = "Please Enter Search Term";

/******** SEARCH ******/
$(document).ready(function () {
	$('#txtSearch').focus(function () {
		var $this = $(this);
        if ($this.val().indexOf(_searchErr) >= 0) { $this.val(""); }
        $this.removeClass('error');
    });
       //    $('#txtSearch').keypress(function (e) {
       //        if (e.keyCode == 13) { e.preventDefault(); $('#btnSearch').click(); }
    //    });
    $('#btnSearch').mouseout(function (event) {
       	$('#search').removeClass("spnav-search_sel");
       	$('#search').addClass("spnav-search");
    });
    $('#btnSearch').mouseover(function (event) {
    	$('#search').removeClass("spnav-search");
    	$('#search').addClass("spnav-search_sel");
    });
    //    $('#btnSearch').click(function (event) {
    //        console.log("doing search on click: " + event);
    //        var txtInput = $('#txtSearch');
    //        event.preventDefault();
    //        if (search(txtInput.val()) == false) {
    //            //txtInput.css({ "border": "1px solid #f00200", "color": "#f00200" });
    //            txtInput.addClass("error");
    //        }
    //    });
});
function doSearch(e) {
    if (e.keyCode == 13) {
        search();
        return false;
    }
    return true;
}
function search() {
	var txtInput = $('#txtSearch');
    var words = txtInput.val();
    var valid = true;
    // Do Validation
    var v = words.replace(/ /g, '');
    v = v.replace('*', '');
    v = v.replace('%', '');
    if (v.length <= 1 || v.toUpperCase() == "SEARCHOURSITE" || v.toUpperCase() == "SEARCH" || words == _searchErr) {
        txtInput.val(_searchErr);
        txtInput.addClass("error"); $('#btnSearch').focus();
        return false;
    }

    // Track search terms
    _gaq.push(['_trackEvent', 'Navigation', 'Search', v]);

    // submit search
    document.forms[0].method = 'post'; //form.target = '_self';
    document.forms[0].action = "/search.aspx?keywords=" + escape(words);
    document.forms[0].submit();
}
function initCategory() {

	$("#aQuickStick").click(function (event) {
        event.preventDefault();
        categoryHelp(event, '/help/whatarequickstickenvelopes.aspx', 'Quick Stick Envelopes');
    });
    $("#aFullColor").click(function (event) {
        event.preventDefault();
        categoryHelp(event, '/help/fullcolorprinting.aspx', 'Full Color Printing', 400, 400);
    });
}
function categoryHelp(event, url, title, w, h) {
    if (!w) w = 420;
    if (!h) h = 370;
    var dlg = showDialog(url, title, w, h);
    dlg.width(w - 10);
    dlg.height(h);

    dlg.dialog("option", "position", {
        my: "right top",
        at: "left bottom",
        of: event,
        offset: "20 20"
    });

}
function ga(source, a) {
    // Push async tracking event 
    var action = "MegaMenu";
    switch (source) {
        case 1:
            action = "LeftNav";
            break;
        case 2:
            action = "MegaMenu";
            break;
    }

    _gaq.push(['_trackEvent', 'Navigation', action, $(a).attr("href")]);
}
function confirmDelete() {
    return confirm("Are you sure you want to remove this item?");
}

// Copyright 2011 Google Inc. All Rights Reserved.

/**
* @fileoverview A simple script to automatically track Facebook and Twitter
* buttons using Google Analytics social tracking feature.
* @author api.nickm@google.com (Nick Mihailovski)
*/


/**
* Namespace.
* @type {Object}.
*/
var _ga = _ga || {};


/**
* Ensure global _gaq Google Anlaytics queue has be initialized.
* @type {Array}
*/
var _gaq = _gaq || [];


/**
* Helper method to track social features. This assumes all the social
* scripts / apis are loaded synchronously. If they are loaded async,
* you might need to add the nextwork specific tracking call to the
* a callback once the network's script has loaded.
* @param {string} opt_pageUrl An optional URL to associate the social
*     tracking with a particular page.
* @param {string} opt_trackerName An optional name for the tracker object.
*/
_ga.trackSocial = function (opt_pageUrl, opt_trackerName) {
    _ga.trackFacebook(opt_pageUrl, opt_trackerName);
    _ga.trackTwitter(opt_pageUrl, opt_trackerName);
};


/**
* Tracks Facebook likes, unlikes and sends by suscribing to the Facebook
* JSAPI event model. Note: This will not track facebook buttons using the
* iFrame method.
* @param {string} opt_pageUrl An optional URL to associate the social
*     tracking with a particular page.
* @param {string} opt_trackerName An optional name for the tracker object.
*/
_ga.trackFacebook = function (opt_pageUrl, opt_trackerName) {
    var trackerName = _ga.buildTrackerName_(opt_trackerName);
    try {
        if (FB && FB.Event && FB.Event.subscribe) {
            FB.Event.subscribe('edge.create', function (targetUrl) {
                _gaq.push([trackerName + '_trackSocial', 'facebook', 'like',
            targetUrl, opt_pageUrl]);
            });
            FB.Event.subscribe('edge.remove', function (targetUrl) {
                _gaq.push([trackerName + '_trackSocial', 'facebook', 'unlike',
            targetUrl, opt_pageUrl]);
            });
            FB.Event.subscribe('message.send', function (targetUrl) {
                _gaq.push([trackerName + '_trackSocial', 'facebook', 'send',
            targetUrl, opt_pageUrl]);
            });
        }
    } catch (e) { }
};


/**
* Returns the normalized tracker name configuration parameter.
* @param {string} opt_trackerName An optional name for the tracker object.
* @return {string} If opt_trackerName is set, then the value appended with
*     a . Otherwise an empty string.
* @private
*/
_ga.buildTrackerName_ = function (opt_trackerName) {
    return opt_trackerName ? opt_trackerName + '.' : '';
};


/**
* Tracks everytime a user clicks on a tweet button from Twitter.
* This subscribes to the Twitter JS API event mechanism to listen for
* clicks coming from this page. Details here:
* http://dev.twitter.com/pages/intents-events#click
* This method should be called once the twitter API has loaded.
* @param {string} opt_pageUrl An optional URL to associate the social
*     tracking with a particular page.
* @param {string} opt_trackerName An optional name for the tracker object.
*/
_ga.trackTwitter = function (opt_pageUrl, opt_trackerName) {
    var trackerName = _ga.buildTrackerName_(opt_trackerName);
    try {
        if (twttr && twttr.events && twttr.events.bind) {
            twttr.events.bind('tweet', function (event) {
                if (event) {
                    var targetUrl; // Default value is undefined.
                    if (event.target && event.target.nodeName == 'IFRAME') {
                        targetUrl = _ga.extractParamFromUri_(event.target.src, 'url');
                    }
                    _gaq.push([trackerName + '_trackSocial', 'twitter', 'tweet',
            targetUrl, opt_pageUrl]);
                }
            });
        }
    } catch (e) { }
};


/**
* Extracts a query parameter value from a URI.
* @param {string} uri The URI from which to extract the parameter.
* @param {string} paramName The name of the query paramater to extract.
* @return {string} The un-encoded value of the query paramater. underfined
*     if there is no URI parameter.
* @private
*/
_ga.extractParamFromUri_ = function (uri, paramName) {
    if (!uri) {
        return;
    }
    var uri = uri.split('#')[0];  // Remove anchor.
    var parts = uri.split('?');  // Check for query params.
    if (parts.length == 1) {
        return;
    }
    var query = decodeURI(parts[1]);

    // Find url param.
    paramName += '=';
    var params = query.split('&');
    for (var i = 0, param; param = params[i]; ++i) {
        if (param.indexOf(paramName) === 0) {
            return unescape(param.split('=')[1]);
        }
    }
    return;
};

function trackEmailSignUp(elm) {
    if (elm.checked) {
        _gaq.push(['_trackEvent', 'EmailSignup', 'OptInCheckbox', 'Checked']);
    } else {
        _gaq.push(['_trackEvent', 'EmailSignup', 'OptInCheckbox', 'Unchecked']);
    }

}

// category sort dropdown

function initSortDropdown() {
	$("#sort-link").click(function (event) {
        event.preventDefault();

        var ddPosition = $("#sort-dd").offset();
        $("#sort-list").css('top', ddPosition.top).css('left', ddPosition.left);

        var finalTopVal = ddPosition.top + itemHeight;

        $("#sort-list").css('display', 'inline').css('top', finalTopVal).css('left', ddPosition.left);

        var areaWidth = $(this).width();
        var areaHeight = $(this).height() + $("#sort-list").height();

        $(document).mousemove(function (event) {
            if ((event.pageX > (ddPosition.left + areaWidth))
                        || (event.pageX < ddPosition.left)) {
                hideList();
                $(document).unbind('mousemove');
                return;
            }
            if ((event.pageY > (ddPosition.top + areaHeight))
                       || (event.pageY < ddPosition.top)) {
                hideList();
                $(document).unbind('mousemove');
                return;
            }
        });
    });

}

function hideList() {
	$("#sort-list").css('display', 'none');
}

function initSortList() {
	$("#sort-list a").click(function (event) {
        event.preventDefault();
        var thisId = $(this).attr('id');
        setSelectedImgSrc(thisId);
        $("#sort-list").css('display', 'none');
        __doPostBack("SortDropDown", "");
    });
}

function setSelectedImgSrc(selectedName) {
    selLinkSelector = "#" + selectedName;

    var selText = $(selLinkSelector).html();
    var selLinkRef = $(selLinkSelector).attr("href");

    $("#sort-dd").html(selText);
    $(hidClientId).val(selLinkRef);
}

// end category sort dropdown
