﻿function textWidth(text, fontsizecss) {
    var calc = '<span style="display:none; font-size:' + fontsizecss + '"><strong>' + text + '</strong></span>';
    $('body').append(calc);
    var width = $('body').find('span:last').width();
    $('body').find('span:last').remove();
    return width;
}

function redirectCounter() {

    if ($('.registration_redirect').parent().attr('class') == "active") {
        window.location = $('.registration_redirect').attr('rel');
    }

}

function sets_objectID(id) {
    s_objectID = id;
}

function clearRedirectTimer(current) {

    if ($(current).children('a').attr('class') != "registration_redirect") {
        clearTimeout(t);
    }

}

function setCountry(label, url, imagepath) {
    var COUNTRY_COOKIE = "countryLabel";
    var options = { path: '/', expires: 10 };
    $.cookie(COUNTRY_COOKIE, label, options);
    COUNTRY_COOKIE = "countryFlag";
    $.cookie(COUNTRY_COOKIE, imagepath, options);
    COUNTRY_COOKIE = "countryURL";
    $.cookie(COUNTRY_COOKIE, url, options);

    if (url.indexOf("http:") < 1)
        window.location = "http://" + location.host + url;
    else
        window.location = url;
}

function getParameter(name) {
    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 decodeURIComponent(results[1].replace(/\+/g, " "));
}

function getURL(id) {
    var url = $.ajax({
        url: "/LoginsHandler.ashx",
        data: { id: id },
        async: false
    }).responseText;
    return url;
}

function setCategoryLineWidth() {
    if ($.browser.msie && $.browser.version.substr(0, 1) < 7 && $(".login_ctas").html() != "")
        $('#utility_nav .login_menu').css('width', "450px");
    else if ($.browser.msie && $.browser.version.substr(0, 1) < 7)
        $('#utility_nav .login_menu').css('width', "275px");

    if (!($.browser.msie && $.browser.version.substr(0, 1) < 7)) {
        $(".login_menu ul").find("li.category").each(function () {
            var categorywidth = textWidth($(this).text().replace("amp;", ""), $(this).css("font-size")) + 8;
            var spanwidth = $(".login_menu ul").width() - categorywidth;

            $(this).find('span:last').css('width', spanwidth + "px");
        });
    }

    if ($(".productlogins_view").length > 0) {
        $(".productlogins_view h4").each(function () {
            if ($(this).find('span:last').css('width').replace("px", "") < 1) {
                var categorywidth = textWidth($(this).text().replace("amp;", ""), $(this).css("font-size")) + 8;

                if ($.browser.msie != undefined && $.browser.version.substr(0, 1) < 9)
                    var contentwidth = parseFloat($(this).parents(".productlogins_view").width());
                else
                    var contentwidth = parseInt($(this).parents(".content").width()) * (parseFloat($(this).parents(".productlogins_view").width()) * .01);

                var spanwidth = contentwidth - categorywidth;

                $(this).find('span:last').css('width', spanwidth + "px");
            }
        });
    }

    var lm_paddingRight = parseInt($('#utility_nav .login').css('padding-right').replace('px', '')) + 3;
    var lm_paddingLeft = parseInt($('#utility_nav .login').css('padding-left').replace('px', ''));
    var lm_width = lm_paddingRight + lm_paddingLeft;
    if ($.browser.msie && $.browser.version.substr(0, 1) < 7 && $(".login_ctas").html() != "")
        $('#utility_nav .login_menu').css('left', $('#utility_nav .login').position().left + $('#utility_nav .login').width() + lm_width + -$('#utility_nav .login_menu').css('width') + "px");
    else if (!($.browser.msie && $.browser.version.substr(0, 1) < 8))
        $('#utility_nav .login_menu').css('left', $('#utility_nav .login').position().left + $('#utility_nav .login').width() + lm_width - $("#utility_nav .login_menu").width() + "px");
    else {
        var cta_width = $(".login_ctas").width();
        if ($(".login_ctas").html() == "")
            cta_width = 0;
        $('#utility_nav .login_menu').css('left', $('#utility_nav .login').position().left + $('#utility_nav .login').width() + lm_width - $("#utility_nav .login_menu").width() - cta_width + "px");
    }
}

function setMyLogins() {
    $(".mylogin").detach();
    var LOGIN_COOKIE = "ProductLogin";
    var LOGIN_CATEGORY_COOKIE = "ProductLoginCategory";

    if ($.cookie(LOGIN_COOKIE) != null && $.cookie(LOGIN_COOKIE).length > 0) {
        var arrLogins = $.cookie(LOGIN_COOKIE).split("#");
        var category = $.cookie(LOGIN_CATEGORY_COOKIE);
        var link = "<li class='category mylogin'><span>" + category + "</span><span class='category_line'></span><div class='clear_both'></div></li>";
        var subLink = "";
        var ctaList = "";

        for (x in arrLogins) {
            var arrItem = arrLogins[x].split("*");
            var i = 0;
            var linkText, linkURL;
            for (y in arrItem) {
                if (i != 1)
                    linkText = arrItem[y];
                else {
                    linkURL = getURL(arrItem[y]);
                    for (z in loginCTAs) {
                        if ((loginCTAs[z][0] == arrItem[y] || loginCTAs[z][0] == "All") && ctaList != z.toString() && ctaList.indexOf("," + z.toString()) < 0) {
                            var expirationDate = loginCTAs[z][4];
                            var expiration = new Date(expirationDate);
                            var currentTime = new Date();
                            if ((isNaN(expiration)) || (expiration >= currentTime)) {
                                if (ctaList == "")
                                    ctaList = "," + z.toString();
                                else if (ctaList.lastIndexOf(",") == ctaList.length - 1)
                                    ctaList += z.toString() + ",";
                                else
                                    ctaList += "," + z.toString() + ",";
                            }
                        }
                    }
                }

                i++;
            }
            if (linkURL != "")
                subLink += "<li class='mylogin'><a href='" + linkURL + "' title='" + linkText + "'>" + linkText + "</a></li>\n";
        }

        if (subLink != "")
            link += subLink;

        $(".login_menu ul").prepend(link);

        $(".login_ctas").html("");
        i = 0;

        if (ctaList != "") {
            if (ctaList.length > 2)
                ctaList = ctaList.substring(1, ctaList.length - 1);
            else
                ctaList = ctaList.substring(1, ctaList.length);

            var s1, s2;
            if (ctaList.split(',').length > 2) {
                s1 = Math.floor(Math.random() * ctaList.split(',').length);
                s2 = Math.floor(Math.random() * ctaList.split(',').length);
                while (s1 == s2) {
                    s2 = Math.floor(Math.random() * ctaList.split(',').length);
                }
            }
            else {
                s1 = 0;
                s2 = 1;
            }

            for (x in ctaList.split(',')) {
                if (i == s1 || i == s2)
                    $(".login_ctas").prepend(displayLoginCTA(ctaList.split(',')[x]));
                i++;
            }
            if ($(".login_ctas").html() != "")
                $(".login_ctas").show();
        }
        else
            $(".login_ctas").hide();
    }
    else {
        $(".login_ctas").html("");
        var i = 0;
        for (x in loginCTAs) {
            if (loginCTAs[x][0] == "All") {
                if (i < 2)
                    $(".login_ctas").prepend(displayLoginCTA(x));
                i++;
            }
        }
        if ($(".login_ctas").html() == "")
            $(".login_ctas").hide();
    }

    setCategoryLineWidth();
}

function displayLoginCTA(id) {
    var cid = loginCTAs[id][1];
    var link = loginCTAs[id][2];
    var imagePath = loginCTAs[id][3];
    var expirationDate = loginCTAs[id][4];
    var title = loginCTAs[id][5];
    var desc = loginCTAs[id][6];
    var moreText = loginCTAs[id][7];

    var expiration = new Date(expirationDate);
    var currentTime = new Date();
    var cta = "";
    var show = true;

    if ((isNaN(expiration)) || (expiration >= currentTime)) {
        $(".hd_cta").each(function () {
            if ($(this).text() == cid)
                show = false;
        });
        if (show) {
            cta = '<a href="' + link + '" title="' + title + '" onclick="recordCTAclick(this, \'CTA\', \'' + title + '\');"><img src="' + imagePath + '" alt="' + title + '" /></a>\n';
            cta += '<a href="' + link + '" title="' + title + '" onclick="recordCTAclick(this, \'CTA\', \'' + title + '\');"><h4>' + title + '</h4><span class="hd_cta" style="display:none;">' + cid + '</span></a>\n';
            cta += '<p>' + desc + ' <a class="more" href="' + link + '" title="' + title + '" onclick="recordCTAclick(this, \'CTA\', \'' + title + '\');">' + moreText + '</a></p><br />\n';
        }
    }
    return cta;
}

// Shows the resizes page popup by click the the smaller/enlarger button
function ShowResizePagePopup(theDivName)
{
    $("#divResizeInfo").css('display', 'block');
    var obj = $("#divResizeInfo");
    var paddingLeftValue = 10;
    var leftVal = ($("#larger_text").position().left + $("#larger_text").innerWidth() - paddingLeftValue - $(obj).width()) + "px";
    var topVal = ($(".breadcrumb").position().top + 50) + "px";
    $(obj).css({ "top": topVal, "left": leftVal });

    if (theDivName == "resizeFirstPopup")
    {
        $('#divResizeInfo .confirmationControlInfo').html($('#resizeFirstPopup').html());
        $('#divResizeInfo').show();
    }
    else
    {
        $('#divResizeInfo .confirmationControlInfo').html($('#resizeSecondPopup').html());
        this.hide();
    }

    //Create a new div with ID popupMask
    $("<div id='popupMask'></div>").insertAfter($(obj));

    //Set height and width to popupMask to fill up the whole screen
    var maskHeight = $(document).height();
    var maskWidth = $(window).width();
    $('#popupMask').css({ 'width': maskWidth, 'height': maskHeight });

    //transition effect		
    $('#popupMask').fadeIn("fast");
    $('#popupMask').fadeTo("slow", 0.8);
    $(obj).fadeIn("fast");

    //if close button is clicked
    $(".confirmationControl a[class='close']").click(function (e)
    {
        $(obj).hide();
        $('#popupMask').hide();
        return false;
    });
}

$(document).ready(function ()
{
    var COUNTRY_COOKIE = "countryLabel";
    var FLAG_COOKIE = "countryFlag";
    var URL_COOKIE = "countryURL";
    var newLoc = window.location.toString().replace(location.host, '').replace('http://', '');

    if ($(".country").find("a").find("img").attr('src') == "")
    {
        var newLoc = window.location.toString().replace(location.host, '').replace('http://', '');
        if (newLoc.indexOf($.cookie(URL_COOKIE)) < 0 || $.cookie(URL_COOKIE).length == 1)
            $(".country").find("a img").hide();
        else if ($.cookie(COUNTRY_COOKIE) != null)
        {
            var flag = "<img src='" + $.cookie(FLAG_COOKIE) + "' alt='" + $.cookie(COUNTRY_COOKIE) + "' style='padding-right:3px;' />";
            $(".country").find("a").html(flag + $.cookie(COUNTRY_COOKIE));
        }
    }
    $(".country").find("a").show();

    //**************** Begin Carousel Functionality ********************************//
    if ($(".carousel").length > 0)
    {
        var pwmodules = [];
        var currModule = 0;
        function setCarousel()
        {
            var i = $("#featcontrol li").index(".on");
            $("#pwmodule" + i).parent().css("background", $("#pwmodule" + i).css("background"))
        }
        function promo_widget_init()
        {
            for (var Y = 0; Y < 7; Y++)
            {
                var V = document.getElementById("pwmodule" + Y);
                if (V)
                {
                    var X = "<img src='" + $("#pwmodule" + Y).css("background-image").replace(/"/g, "").replace(/url\(|\)$/ig, "") + "' style='display:none' />";
                    $("#pwmodule" + Y).append(X);
                    pwmodules.push(V)
                } else
                {
                    break
                }
            }
            var W = $("#featmodcontrols ul");
            for (var Y = 0; Y < pwmodules.length; Y++)
            {
                $("#modlink" + Y).mouseover(jumpToModule)
            }

            var Z = $("#featcontrol").parents(".carousel").attr("id");

            var selectedIndex = $("#selectedIndex").text();
            if ($.cookie(Z) == null || $.cookie(Z).length < 1)
            {
                if (null == selectedIndex || "" == selectedIndex)
                {
                    var U = getRandomIndex();
                    switchModule(0, U);
                }
                else
                {
                    currModule = selectedIndex;
                    $("#button" + selectedIndex).addClass("on");
                    $("#pwmodule" + selectedIndex).parent().css("background-image", $("#pwmodule" + i).css("background-image"));
                    $("#pwmodule" + selectedIndex).show();
                    switchModule(0, selectedIndex);
                }
            }
            else
            {
                switchModule(0, $.cookie(Z));
            }
        }
        function switchModule(V, i)
        {
            $("#pwmodule" + i).parent().css("background-image", $("#pwmodule" + i).css("background-image"));
            $("#pwmodule" + i).show();
            $("#button" + V).removeClass("on");
            $("#button" + i).addClass("on");
            for (var U = 0; U < pwmodules.length; U++)
            {
                if (U != i)
                {
                    $("#pwmodule" + U).hide()
                }
            }
            var W = $("#pwmodule" + i).parents(".carousel").attr("id");
            $.cookie(W, i)
        }
        function getRandomIndex()
        {
            var U = 5;
            var i = 0;
            return parseInt(Math.random() * (U - i + 1) + i)
        }
        function jumpToModule()
        {
            var U = currModule;
            var i = parseInt(this.id.replace(/modlink/, ""));
            currModule = i;
            $("#featmodcontrols ul li").removeClass("on");
            switchModule(U, i)
        }
        promo_widget_init()
    }
    //**************** End Carousel Functionality ********************************//

    // ******************* Begin Utility Nav Functionality **************************//
    if ($('#utility_nav').length > 0)
    {
        setMyLogins();

        //Display Utility nav dropdowns
        function setMouseDisplayEvents(hoverElement, showElement, isLogin)
        {
            $(hoverElement).mouseover(function ()
            {
                $(showElement).show();
                if (isLogin)
                {
                    $(".hd_cta").each(function ()
                    {
                        var currentTime = new Date();
                        recordCTAview('CTA', $(this).siblings("h4").text(), currentTime.valueOf());
                    });
                }
            }).mouseout(function ()
            {
                $(showElement).hide();
            });
        }

        setMouseDisplayEvents(".country a", ".country_menu", false);
        setMouseDisplayEvents(".country_menu", ".country_menu", false);
        setMouseDisplayEvents(".login a", ".login_menu", true);
        setMouseDisplayEvents(".login_menu", ".login_menu", false);
    }
    // ******************* End Utility Nav Functionality **************************//

    // ******************* Begin Add white paper download pdf info *******************//
    $("a[href$='.pdf']").each(function ()
    {
        if ($(this).find("img").length < 1)
        {
            var afterSize = "<span>";

            if ($(this).attr("fileSize") != undefined)
            {
                var size = parseInt($(this).attr("fileSize") / 1048576);
                size = size == 0 ? 1 : size;
                afterSize += " (PDF, " + size + " MB)</span>";
            }
            else
                afterSize += " (PDF)</span>";

            $(this).addClass("pdf_download_icon");
            $(this).append(afterSize);
        }
    });
    // ******************* End Add white paper download pdf info ********************//

    // ******************* Begin Show Ads *********************************************//
    $(".advertisement_container").each(function ()
    {
        if ($(this).find("img").length != 0 || $(this).find("object").length != 0)
        {
            $(this).show();
            $(this).parents(".ad_middle").show();
        }
    });
    // ******************* End Show Ads***********************************************//    

    if (getParameter("scs") == "1")
        $(".country_menu").show();

    //**************** Begin Common Page Components Functionality ********************************/
    window.onUnload = $.cookie("fontSizeValue", null, { path: '/', expires: 10 });
    window.onUnload = $.cookie("carouselVerticalNavigationHeight", null, { path: '/', expires: 10 });
    window.onUnload = $.cookie("carouselBlockContentHeight", null, { path: '/', expires: 10 });
    window.onUnload = $.cookie("carouselVerticalNavigationPaddingBottom", null, { path: '/', expires: 10 });
    if ($('#common_page_components').length > 0)
    {
        function resize(element, direction)
        {
            var tab_menu = $(".tab_menu").css('fontSize');
            var ourText = $(element);
            var currFontSize = ourText.css('fontSize');
            var finalNum = parseFloat(currFontSize, 10);
            var adjustSize = 0;
            var stringEnding = currFontSize.slice(-2);
            var SIZE_COOKIE = "fontSizeValue";
            var options = { path: '/', expires: 10 };
            var objCarousel = $(".carousel_block");
            var maxCarouselText = parseFloat(objCarousel.css('fontSize'), 10);

            var CarouselVerticalNav_Height_Cookie = "carouselVerticalNavigationHeight";
            var CarouselBlockContent_Height_Cookie = "carouselBlockContentHeight";
            var CarouselVerticalNav_PaddingBottom_Cookie = "carouselVerticalNavigationPaddingBottom";
            if (finalNum == 12)
            {
                var fixedCarouselVerticalNavHeight = parseFloat(objCarousel.children('.vertical_nav').height(), 10);
                var fixedCarouselBlockContentHeight = parseFloat(objCarousel.children('.carousel_block_content').height(), 10);
                var fixedCarouselVerticalNavPaddingBottom = parseFloat(objCarousel.children('.vertical_nav').css('padding-bottom'), 10);
                $.cookie(CarouselVerticalNav_Height_Cookie, fixedCarouselVerticalNavHeight, options);
                $.cookie(CarouselBlockContent_Height_Cookie, fixedCarouselBlockContentHeight, options);
                $.cookie(CarouselVerticalNav_PaddingBottom_Cookie, fixedCarouselVerticalNavPaddingBottom, options);
            }

            if (direction == 'larger' && finalNum < 17)
            {
                if ($.cookie(SIZE_COOKIE) == null)
                {
                    finalNum *= 1.2;
                }
                else
                {
                    finalNum = $.cookie(SIZE_COOKIE) * 1.2;
                }
                $.cookie(SIZE_COOKIE, finalNum, options);

                if (finalNum > 12)
                    adjustSize = 1.06;
                if (finalNum > 19)
                {
                    if ($.browser.msie && $.browser.version.substr(0, 1) < 9)
                        adjustSize = 1.06;
                    else
                        adjustSize = 1.1;
                }
            }
            else if (direction == 'smaller' && finalNum > 9)
            {
                if ($.cookie(SIZE_COOKIE) == null)
                {
                    finalNum /= 1.2;
                }
                else
                {
                    finalNum = $.cookie(SIZE_COOKIE) / 1.2;
                }
                $.cookie(SIZE_COOKIE, finalNum, options);

                if (finalNum >= 12)
                    adjustSize = .99;
            }
            ourText.css('fontSize', finalNum + stringEnding);
            $(".tab_menu").css('fontSize');
            if (finalNum > 18)
            {
                objCarousel.css('fontSize', maxCarouselText + stringEnding);
            }
            else
            {
                objCarousel.css('fontSize', finalNum + stringEnding);
            }
            if ((finalNum < 18 && direction == 'larger') || (finalNum < 17 && direction == 'smaller'))
            {
                setCarouselBlock(adjustSize);
            }

            if (finalNum == 12)
            {
                objCarousel.children('.vertical_nav').css('height', $.cookie(CarouselVerticalNav_Height_Cookie) + stringEnding)
                objCarousel.children('.carousel_block_content').css('height', $.cookie(CarouselBlockContent_Height_Cookie) + stringEnding);
                objCarousel.children('.vertical_nav').css('padding-bottom', $.cookie(CarouselVerticalNav_PaddingBottom_Cookie) + stringEnding);
            }
        }

        $('#print_icon').click(function ()
        {
            window.print();
            return false;
        });

        $('#email_icon').click(function ()
        {
            $("#form_email").load("form_email_page.html");
            $("#form_email").show();
            var leftVal = ($(window).width() / 2 - $("#form_email").width() / 2) + "px";
            $("#form_email").css('left', leftVal);
            return false;
        });

        $('#form_email_submit').live('click', function ()
        {
            $("#form_email_page").hide();
            $("#form_email_thankyou").show();
            return false;
        });

        $('#close_form_email_page').live('click', function ()
        {
            $("#form_email").hide();
            $("#form_email_page").show();
            $("#form_email_thankyou").hide();
            return false;
        });

        $('#larger_text').click(function ()
        {
            ShowResizePagePopup('resizeFirstPopup');
            $('.openSecondPopup').click(function ()
            {
                ShowResizePagePopup('resizeSecondPopup');
            });
            return false;
        });

        $('#smaller_text').click(function ()
        {
            ShowResizePagePopup('resizeFirstPopup');
            $('.openSecondPopup').click(function ()
            {
                ShowResizePagePopup('resizeSecondPopup');
            });
            return false;
        });
    }
    //**************** End Common Page Components Functionality ********************************/

    // ******************* Ajax Popup Functionality **************************//
    $("a.hover_box_link").mouseover(function ()
    {
        if ($(this).parent().next(".hover_box").length > 0)
        {
            var sPosition = $(this).parent().next(".hover_box").find("span.placement").text();

            if (sPosition == "Left")
            {
                $(this).parent().next(".hover_box").css({ 'top': $("#accordion").position().top + $(this).position().top, 'left': $("#accordion").position().left - $(this).parent().next(".hover_box").css("width").replace("px", "") });
            }
            else if (sPosition == "Right")
            {
                $(this).parent().next(".hover_box").css({ 'top': $("#accordion").position().top + $(this).position().top, 'left': $("#accordion").position().left + $(this).width() });
            }
            else if (sPosition == "Top")
            {
                $(this).parent().next(".hover_box").css({ 'top': $("#accordion").position().top + $(this).position().top - $(this).parent().next(".hover_box").height(), 'left': $("#accordion").position().left + 10 });
            }
            else if (sPosition == "Bottom")
            {
                $(this).parent().next(".hover_box").css({ 'top': $("#accordion").position().top + $(this).position().top + 40, 'left': $("#accordion").position().left + 10 });
            }
            $(document.body).append($(this).parent().next(".hover_box").detach().show());
        }
        else
        {
            var guid = "." + $(this).find(".guid").text();
            $(guid).show();
        }
    });
    // ******************* End Ajax Popup Functionality **************************//

    // ******************* Begin Interactive Functionality **************************//
    if ($('#interactive_map').length > 0)
    {
        $('#interactive_map .map_menu li:last').addClass('last');
        var interactive_map_count = 0;
        $('#interactive_map .map_menu li').each(function ()
        { //Set Map Menu Item href attributes
            interactive_map_count++;
            $(this).find('a').attr('href', '#map-' + interactive_map_count);
        });

        interactive_map_count = 0;
        $('#interactive_map .map_content').each(function ()
        { //Set Map Content id attributes                
            interactive_map_count++;
            $(this).attr('id', 'map-' + interactive_map_count);
            $(this).hide();
        });

        $('#interactive_map .map_content:first').show();

        $('#interactive_map .map_menu li a').mouseover(function ()
        { //When any menu link is clicked  
            var currentMap = $(this).attr('href');
            $('#interactive_map .map_menu').siblings(".map_content").hide(); // Hide all divs in top level of .map_content
            $(currentMap).show(); // Show div with id equal to variable currentMap        
            return false;
        });
    }
    //**************** End Interactive Map Functionality ********************************//

    if ($('.nav_left').length > 0)
    {
        $(this).find(".nav_left li.category").each(function ()
        {
            var categorywidth = textWidth($(this).text().replace("amp;", ""), $(this).css("font-size")) + 7;
            var maxwidth = 167;
            if ($(this).parents("li").length > 0)
                maxwidth = 147;
            var spanwidth = maxwidth - categorywidth;
            $(this).find('span:last').css('width', spanwidth + "px");
        });
    }

    //**************** Begin Carousel Block Functionality ********************************//
    if ($('.carousel_block').first().parents('.tab_container').length <= 0)
    {
        setCarouselBlock(0);
    }
    else if ($('.carousel_block').first().parents('.tab_container').length > 0 && $('.carousel_block').first().parents('.tab_container').css('display') == "block")
    {
        setCarouselBlock(0);
    }

    var carouselIdCounter = 0;
    var carouselHref = 0;

    addCarouselIds();

    function addCarouselIds()
    {
        $('.carousel_block').each(function ()
        {
            var vertNav = $(this).children('.vertical_nav');
            $(vertNav).children('div').each(function ()
            {
                var href = $(this).children('a').attr('href');
                if (href != undefined)
                    $(this).children('a').attr('href', href + '#cb-content-' + carouselHref);
                else
                    $(this).children('a').attr('href', '#cb-content-' + carouselHref);
                carouselHref++;
            });

            $(this).children('.carousel_block_content').each(function ()
            {
                $(this).attr('id', 'cb-content-' + carouselIdCounter);
                carouselIdCounter++;
            });
        });
    }

    function setCarouselBlock(adjustSize)
    {
        $('.carousel_block').each(function ()
        {
            var setC = true;
            if ($(this).parents(".tab_container").length > 0)
            {
                if ($(this).parents(".tab_container").css("display") != "block")
                    setC = false;
            }

            if (setC)
            {
                var parentCarousel = $(this);
                var vertNav = $(this).children('.vertical_nav');
                var vertical_nav_height = $(this).children('.vertical_nav').height();
                var carousel_block_content_padding = parseInt($(this).children('.carousel_block_content').css('padding-top').replace('px', '')) + parseInt($(this).children('.carousel_block_content').css('padding-bottom').replace('px', ''));
                var carousel_block_content_height = 0;

                $(this).children('.carousel_block_content').each(function ()
                {
                    var adjust = 2;
                    if ($.browser.msie && $.browser.version.substr(0, 1) < 7)
                    {
                        adjust += parseInt($('.carousel_block_content').css('padding-left').replace('px', '')) / 2;
                    }
                    $(this).css('width', $(parentCarousel).width() - $(parentCarousel).children('.vertical_nav').width() - carousel_block_content_padding - adjust);

                    if (adjustSize > 0)
                        carousel_block_content_height *= adjustSize;

                    if (carousel_block_content_height < $(this).height())// && (adjustSize == 0 || adjustSize > 1))
                        carousel_block_content_height = $(this).height();
                });
                vertical_nav_height -= carousel_block_content_padding;

                if (adjustSize > 0 && adjustSize < 1)
                    vertical_nav_height += carousel_block_content_padding / 2;

                if (carousel_block_content_height < vertical_nav_height)
                {
                    $(this).children('.carousel_block_content').each(function ()
                    {
                        $(this).css('height', vertical_nav_height + 'px');
                    });

                    if (adjustSize > 0 && adjustSize < 1)
                        $(this).children('.vertical_nav').css('padding-bottom', carousel_block_content_padding / 2);
                }
                else
                {
                    if (adjustSize > 0 && adjustSize < 1)
                        carousel_block_content_height -= carousel_block_content_padding;

                    $(this).children('.carousel_block_content').each(function ()
                    {
                        $(this).css('height', carousel_block_content_height);
                    });

                    var diff = carousel_block_content_height - vertical_nav_height;

                    //eliminate the different between left column and right column.
                    if (adjustSize > 0 && adjustSize < 1 && carousel_block_content_height < 200)
                        diff += 20;

                    if (diff > 5)
                        $(this).children('.vertical_nav').css('padding-bottom', diff);
                    else
                    {
                        if ($(this).find('.vertical_nav div').css('padding-bottom') != null && $(this).find('.vertical_nav div').css('padding-bottom') != '')
                        {
                            diff += parseInt($(this).find('.vertical_nav div').css('padding-bottom').replace('px', ''));
                        }
                        $(this).children('.vertical_nav div:last').css({ 'padding-bottom': diff });
                    }
                }

                $(vertNav).children('div').mouseover(function ()
                { //When any link is clicked
                    $(vertNav).children('div').removeClass('active'); // Remove active class from all links    
                    $(this).addClass('active'); // Add active class to current vtab    
                    $(parentCarousel).children('.carousel_block_content').removeClass('active'); // Remove active class from all vtabs				
                    var currentTab = $(this).find('a').attr('href'); // Set variable currentTab to value of href attribute of clicked link
                    var arrTab = currentTab.split("#");
                    currentTab = "#" + arrTab[1];
                    $(currentTab).addClass('active'); // Show div with id equal to variable currentTab                
                    return false;
                });

                $(vertNav).children('div').click(function ()
                {
                    if ($(this).find('a').attr('href').indexOf("#") == 0)
                        return false;
                });
                //console.log($(parentCarousel).children('.vertical_nav').width());
            }
        });
    }
    //**************** End Carousel Block Functionality ********************************//

    //**************** Begin Gridview Functionality ********************************//
    if ($('.gridview').length > 0)
    {
        function gridviewHoverOver(e)
        {
            $(this).parents().siblings().find('.fly_out').hide();
            var columns = $(this).siblings().length + 1;
            if ($(this).index() + 1 > Math.ceil(columns / 2))
                $(this).find('.fly_out').addClass('fly_out_left');
            var y = $(this).find('.topic img').position().top;
            $(this).find('.fly_out').css('top', y - 12);
            if ($(this).parents('.bottom').length > 0)
                $(this).find('.fly_out').css('top', $(this).siblings().position().top - 30);
            $(this).find('.fly_out').fadeIn(250);
        }

        function gridviewHoverOut()
        {
            $('.fly_out').hide();
        }

        var gridview_config = {
            sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)    
            interval: 25, // number = milliseconds for onMouseOver polling interval    
            over: gridviewHoverOver, // function = onMouseOver callback (REQUIRED)    
            timeout: 0, // number = milliseconds delay before onMouseOut    
            out: gridviewHoverOut // function = onMouseOut callback (REQUIRED)    
        };

        $('.gridview ul li').hoverIntent(gridview_config);

    }
    //**************** End Gridview Functionality ********************************//

    //**************** Begin Middle Column Accordion Unit Functionality ********************************//
    if ($('.expandable').length > 0)
    {
        var openUpIndex = $('.expandable .openUpIndex').text();
        if (openUpIndex != null && openUpIndex != "")
        {
            $('.expandable').find("h4:eq(" + openUpIndex + ")").addClass('expanded');
        }

        $('.expandable').find("h4").siblings().hide();
        $('.expandable').find("h4.expanded").next().show();

        if (getParameter("id") != "")
        {
            var elem = '.expandable h4#a_' + getParameter("id");
            $(elem).addClass("expanded");
            $(elem).next().show();
            if ($(elem).parents(".tab_container").siblings(".tab_menu").length > 0)
            {
                $(elem).parents(".tab_container").show();
                $(elem).parents(".tab_container").siblings(".tab_container").hide();
                var tab_id = $(elem).parents(".tab_container").attr("id");
                $(elem).parents(".tab_container").siblings(".tab_menu").find("li").removeClass("active");
                $(elem).parents(".tab_container").siblings(".tab_menu").find("li").each(function ()
                {
                    if ($(this).find("a").attr("href").replace("#", "") == tab_id)
                        $(this).addClass("active");
                    if ($(this).hasClass("last"))
                        $(this).removeClass("last");
                });
            }
        }

        $('.expand_control').click(function ()
        {
            if ($.browser.msie && $.browser.version.substring(0, 1) < '8')
            {
                $('.expand_container li div').each(function ()
                { //Set Map Menu Item href attributes
                    if ($(this).find('img').length > 0)
                    {
                        var height = parseInt($(this).find('img').attr('height').toString().replace('px', ''));
                        var margin = parseInt($(this).find('img').css('margin-top').toString().replace('px', ''));
                        if ($.browser.version.substring(0, 1) < '7')
                        {
                            $(this).css('height', height + margin);
                            $(this).find('.clear_both').removeClass('clear_both');
                        }
                        else
                            $(this).css('min-height', height + margin);
                    }
                });
            }
            $(this).parents('.expandable').find("h4").next().slideDown();
            $(this).parents('.expandable').find("h4").addClass('expanded');
            return false;
        });

        $('.collapse_control').click(function ()
        {
            $(this).parents('.expandable').find("h4").siblings().slideUp();
            $(this).parents('.expandable').find("h4").removeClass('expanded');
            return false;
        });

        $(".expandable").find("h4").click(function ()
        {
            if ($(this).hasClass('expanded'))
            {
                $(this).next().slideUp();
                $(this).removeClass('expanded');
            }
            else
            {
                if ($.browser.msie && $.browser.version.substring(0, 1) < '8')
                {
                    if ($(this).next().find('img').length > 0)
                    {
                        var height = parseInt($(this).next().find('img').attr('height').toString().replace('px', ''));
                        var margin = parseInt($(this).next().find('img').css('margin-top').toString().replace('px', ''));
                        if ($.browser.version.substring(0, 1) < '7')
                        {
                            $(this).next().css('height', height + margin);
                            $(this).next().find('.clear_both').removeClass('clear_both');
                        }
                        else
                            $(this).next().css('min-height', height + margin);
                    }
                }
                $(this).next().slideDown();
                $(this).addClass('expanded');

                AJAXclick($(this), $(this).text());
            }
        });
    }

    $('a[canBuyOnlineAttr="Yes"]').each(function ()
    {
        $(this).html($(this).html() + "<span class='buyonline'>Buy Online</span>");
    });
    //**************** End Middle Column Accordion Unit Functionality ********************************//

    if ($(".ADD_PARAM").length > 0)
    {
        $(".ADD_PARAM").each(function ()
        {
            $(this).attr("href", $(this).attr("href") + "?id=" + $(this).attr("id"));
        });
    }

    //**************** Begin Popup Functionality ********************************//
    if ($('#popup_modals').length > 0 && getParameter("pu") != "" && getParameter("rd") != "")
    {

        var referrer = getParameter("rd");

        var COOKIE_NAME = referrer + "_popup";

        var options = { path: '/', expires: 10 };

        //$.cookie(COOKIE_NAME, null, options);

        if ($.cookie(COOKIE_NAME) == null && referrer != "")
        {
            // set cookie by number of days    
            $.cookie(COOKIE_NAME, 'True', options);

            //Get the A tag
            var id = "." + referrer;
            if (Date.parse($(id + " span:last").text()) > Date.parse(Date()))
            {
                //Get the screen height and width
                var maskHeight = $(document).height();
                var maskWidth = $(window).width();
                if ($.browser.msie && $.browser.version.substring(0, 1) == '6')
                {
                    $('select').hide();
                }
                $('iframe').hide();
                //Set height and width to mask to fill up the whole screen
                $('#mask').css({ 'width': maskWidth, 'height': maskHeight });

                var i = 0;
                $(id + " .desc").each(function ()
                {
                    i++;
                    if (getParameter("pu") == i)
                        $(this).show();
                    else
                        $(this).hide();
                });

                //transition effect		
                $('#mask').fadeIn(100);
                $('#mask').fadeTo("slow", 0.8);

                //Get the window width	
                var winW = $(window).width();

                //Set the popup window to center
                $(id).css('top', 50);
                $(id).css('left', winW / 2 - $(id).width() / 2);

                //transition effect
                $(id).fadeIn(1000);
            }
        }

        //if close button is clicked
        $('.popup_modal a').click(function (e)
        {
            $('#mask').hide();
            $('#popup_modals').hide();
            $('select').show();
            $('iframe').show();
        });

        //if mask is clicked
        $('#mask').click(function ()
        {
            $(this).hide();
            $('#popup_modals').hide();
            $('select').show();
            $('iframe').show();
        });
    }
    //**************** End Popup Functionality ********************************//


    //**************** Start Accordion Functionality ********************************//
    if ($("#accordion").length > 0)
    {
        var accordion_index = 0;
        var accordion_counter = 0;
        $('#accordion h3').each(function ()
        { //Set Tab Menu Item href attributes        
            if ($(this).hasClass("expanded"))
                accordion_index = accordion_counter;
            accordion_counter++;
        });
        $("#accordion").accordion({ active: accordion_index, autoHeight: false });
    }
    //**************** End Accordion Functionality ********************************//


    //**************** Start Form Default Values Functionality ********************************//
    if ($(".elq_form").length > 0 || $('.search_input').length > 0)
    {
        //$('.elq_form input[type="text"]').addClass("defaultvalue");
        $('.elq_form input[type="text"]').addClass("textbox");
        $('.search_input').addClass("defaultvalue");
        $('input[type="text"].defaultvalue').css("color", "#999");
        $('input[type="text"].defaultvalue').focus(function ()
        {
            $(this).css("color", "#000");
            if (this.value == this.defaultValue)
            {
                this.value = '';
            }
            if (this.value != this.defaultValue)
            {
                this.select();
            }
        });
        $('input[type="text"].defaultvalue').blur(function ()
        {
            if ($.trim(this.value) == '')
            {
                //this.value = this.defaultValue;
                $(this).css("color", "#ccc");
            }
        });
    }
    //**************** End Form Default Values Functionality ********************************//		

    //**************** Start Hover Box Functionality ********************************//		
    if ($(".hover_box").length > 0)
    {
        $('.hover_box').hide();

        $('.title').mouseover(function (e)
        {
            $('.hover_box').hide();
            $('.close_control').click(function () { $('.hover_box').hide(); });
            $(this).next().show();
            $(this).next().css({ 'top': $(this).position().top, 'left': $(this).position().left + 50 });
            if ($(this).parent(".upward").length > 0)
                $(this).next().css({ 'top': $(this).position().top - $(this).next().height() });
            if ($(this).parents('.right_justified').length > 0)
                $(this).next().css({ 'left': $(this).position().left - $(this).next().width() - 15 });
            else if ($(this).parents('.business_needs_matrix').length > 0)
            {
                var vtop = 0;
                if ($.browser.msie && $.browser.version.substr(0, 1) < 8)
                    vtop = $(this).parents('.business_needs_matrix').position().top;
                else
                    vtop = $(this).parents('.business_needs_matrix').position().top - 5;

                $(this).next().css({ 'top': vtop, 'left': $(this).parents('.business_needs_matrix').position().left + $(this).parents('.business_needs_matrix').width() + 5 });

                if ($(this).parents('.business_needs_matrix').height() < $(this).next().height())
                {
                    var bnm_height = 10;
                    var hover_height_diff = $(this).next().height() - $(this).parents('.business_needs_matrix').height();
                    if (hover_height_diff >= 10)
                        bnm_height += hover_height_diff;
                    $(this).parents('.business_needs_matrix').css("margin-bottom", bnm_height);
                }

                if ($(this).next().offset().top < $(window).scrollTop())
                {
                    if ($(this).parents("tr").offset().top > $(window).scrollTop())
                    {
                        vtop = $(this).parents("tr").offset().top;
                        if ($.browser.msie && $.browser.version.substr(0, 1) < 8)
                            vtop -= 5;
                        else
                            vtop -= 10;

                        $(this).next().offset({ top: vtop, left: $(this).next().offset().left });
                    }
                    else
                        $(this).next().offset({ top: $(window).scrollTop() + 5, left: $(this).next().offset().left });

                    var diff = ($(this).next().offset().top + $(this).next().height()) - ($(this).parents('.business_needs_matrix').offset().top + $(this).parents('.business_needs_matrix').height());
                    if (diff > 0)
                        $(this).parents('.business_needs_matrix').css("margin-bottom", diff + 10);
                }
            }
        });
    }
    //**************** End Hover Box Functionality ********************************//		

    //*********************** Begin Registration Re-direct **********************//
    var t;

    if ($('.registration_redirect').length > 0)
    {

        $('.registration_redirect').click(function () { t = setTimeout("redirectCounter()", 15000); });
        $('.tab_menu li').click(function () { clearRedirectTimer(this); });

    }

    //*********************** End Registration Re-direct **********************//

    // ******************* Begin Tabs Functionality **************************//
    if ($('.tabs').length > 0)
    {
        var defaultTabIndex = 0;
        if ($(".defaultTab").text() != "")
        {
            defaultTabIndex = parseInt($(".defaultTab").text()) - 1;
        }

        function configTabs(tab_menu)
        {
            var tab_menu_width = 0;
            var paddingRight = 0;
            var paddingLeft = 0;
            var addPadding = 40;
            $(tab_menu + ' li').each(function ()
            {
                tab_menu_width += $(this).find('a').width();
                paddingRight = parseInt($(this).find('a').css('padding-right').replace('px', ''));
                paddingLeft = parseInt($(this).find('a').css('padding-left').replace('px', ''));
                tab_menu_width += paddingLeft + paddingRight;
            });
            //$(tab_menu + ' li:first').addClass('first active');
            $(tab_menu + ' li:eq(' + defaultTabIndex + ')').addClass('first active');
            $(tab_menu + ' li:last').addClass('last');

            if (tab_menu_width > 550)
                addPadding = 75;
            if ($(tab_menu).siblings('h3').length > 0)
            {
                addPadding = 60;
                $(tab_menu).siblings('h3').addClass('menu_header');
                $(tab_menu).css('margin-left', $(tab_menu).siblings('h3').width() + 15 + 'px');
            }
            $(tab_menu).css('width', tab_menu_width + addPadding + 'px');
        }

        function setActiveTab(current, tab_menu, isClick)
        {
            $(tab_menu + ' li').removeClass('active'); // Remove active class from all links    
            if ($(current).parent('.last').length > 0)
                $(tab_menu + ' li').removeClass('last');
            else
                $(tab_menu + ' li:last').addClass('last');
            $(current).parent().addClass('active'); //Set clicked link class to active
            var currentTab = $(current).attr('href'); // Set variable currentTab to value of href attribute of clicked link    
            $(tab_menu).siblings(".tab_container").hide(); // Hide all divs in top level of .tab_container
            $(currentTab).show(); // Show div with id equal to variable currentTab   
            if ($(currentTab + ' .carousel_block').length > 0)
            {
                setCarouselBlock(0); // Set a carousel block if one exists in the tab
            }
            var bnmCounter = 0;
            $('.business_needs_matrix').each(function ()
            {
                if ($.browser.msie && $.browser.version.substr(0, 1) < 8)
                    $(this).find(".hover_box:first").css({ 'top': $(this).position().top, 'left': $(this).position().left + $(this).width() + 5 });
                else
                    $(this).find(".hover_box:first").css({ 'top': $(this).position().top - 5, 'left': $(this).position().left + $(this).width() + 5 });
                $(this).find(".hover_box:first").show();
                var bnm_height = 10;
                var hover_height_diff = $(this).find(".hover_box:first").height() - $(this).height()
                if (hover_height_diff >= 10)
                    bnm_height += hover_height_diff;
                $(this).css("margin-bottom", bnm_height);
            });
        }

        var tab_count = 0;
        $('.tab_menu li').each(function ()
        { //Set Tab Menu Item href attributes
            tab_count++;
            $(this).find('a').attr('href', '#tab-' + tab_count);
            $(this).find('a').attr('id', 'tabmenu-' + tab_count);
            var id = $(this).find('a').attr("href").replace("#", "");
            document.getElementById($(this).find('a').attr('id')).onclick = function (event) { sets_objectID(id); };
            if (!$.browser.msie || ($.browser.msie && $.browser.version.substr(0, 1) > 7))
                $(this).find('a').attr("onclick", "s_objectID = '" + id + "';");
        });

        tab_count = 0;
        $('.tabs .tab_container').each(function ()
        { //Set Tab Container id attributes        
            if ($(this).siblings("#page_tab_menu").length < 1)
            {
                tab_count++;
                $(this).attr('id', 'tab-' + tab_count);
                $(this).hide();
            }
        });

        tab_count = 0;
        $('.tab_menu').each(function ()
        { //Config Tab Menus
            tab_count++;
            var tab_menu_id = 'tab_menu' + tab_count;
            $(this).attr('id', tab_menu_id);
            configTabs('#' + tab_menu_id);
            //$(this).parents().find('.tab_container:first').show();
            $(this).parents().find('.tab_container:eq(' + defaultTabIndex + ')').show();

            if (getParameter("tid") != "")
            {
                var current = $('#' + tab_menu_id + ' li a[href="#' + $(this).siblings("." + getParameter('tid')).attr('id') + '"]');
                if (current.length > 0)
                    setActiveTab(current, '#' + tab_menu_id, false);
            }
        });

        $('.tab_menu li a').click(function ()
        { //When any tab menu link is clicked
            var tab_menu = '#' + $(this).parents('.tab_menu').attr('id');
            var current = $(this);
            setActiveTab(current, tab_menu, true);
            AJAXclick(this, $(current).text());
            return false;
        });

        if ($('#page_tab_menu').length > 0) //Config Page Tabs
        {
            configTabs('#page_tab_menu');
            $('#page_tab_menu li').removeClass('active');
        }

        $('.tab_container a.showTab').click(function ()
        { //When any tab menu link is clicked
            var tab_menu = '#' + $(this).parents('.tab_container').siblings('.tab_menu').attr('id');
            var current = $(tab_menu + ' li a[href="#' + $(this).parents(".tab_container").siblings('.' + $(this).attr('href').replace('#', '')).attr('id') + '"]');
            if (current.length > 0)
                setActiveTab(current, tab_menu, true)
            return false;
        });
    }
    //**************** End Tabs Functionality ********************************//

    //**************** End Accordion Click Tracking Functionality ********************************//
    if ($('#accordion').length > 0)
    {
        var accordion_count = 0;
        $('#accordion h3 a').each(function ()
        {
            accordion_count++;
            $(this).attr('href', '#accordion-' + accordion_count);
            $(this).attr('id', 'accordionmenu-' + accordion_count);
            var id = $(this).attr("href").replace("#", "");
            document.getElementById($(this).attr('id')).onclick = function (event) { sets_objectID(id); };
            if (!$.browser.msie || ($.browser.msie && $.browser.version.substr(0, 1) > 7))
                $(this).attr("onclick", "s_objectID = '" + id + "';");
        });

        $('#accordion h3 a').click(function ()
        {
            var current = $(this);
            AJAXclick(this, $(current).text());
        });
    }
    //**************** End Accordion Click Tracking Functionality ********************************//

    // ******************* Begin Confirmation Functionality **************************//
    if ($('.confirmation').length > 0)
    {

        $(document.body).append($('.confirmation').detach());
        var leftVal = ($(window).width() / 2 - $(".confirmation").width() / 2) + "px";
        var topVal = ($(window).height() / 2 - $(".confirmation").height() / 2) + "px";

        /*
        if($('.confirmation').parents('.tab_container').length > 0)
        {
        leftVal = ($('.confirmation').parents('.tab_container').width()/2 - $(".confirmation").width()/2) + "px";
        topVal = 130 + "px";
        }*/

        $('.confirmation').css({ "top": topVal, "left": leftVal });

        $('.confirmation').show();
        $('.confirmation a.close').click(function ()
        { //When close link is clicked
            $('.confirmation').hide();
            return false;
        });
    }
    // ******************* End Confirmation Functionality **************************//

    // ******************* Begin recordCTAsuccess Functionality **************************//
    if (getParameter("rcs") != "")
    {
        recordCTAsuccess(getParameter("rcs"));
    }
    // ******************* End recordCTAsuccess Functionality **************************//

    // ******************* Search Input Functionality **************************//
    $("#global_search_form").submit(function ()
    {// Check the value of the global search box
        var strInput = $("#globalsearchinput").val();

        // Check if the value is empty or if the value equals " Search" 
        //if (strInput == " Search" || strInput == "")
        if (strInput == " Search")
        {
            return false; // Does not allow search
        }
    });

    $("#searchform").submit(function ()
    {// Check the value of the search box
        var strInput = $("#searchinput").val();

        // Check if the value is empty or if the value equals " Search" 
        //if (strInput == " New Search" || strInput == "")
        if (strInput == " New Search")
        {
            return false; // Does not allow search
        }

        var inputParam = "";

        if (getParameter("searchinput") != null)
        {
            inputParam = getParameter("searchinput");
        }

        if (inputParam != "" && inputParam != strInput)
        {
            $("input[name=PrimaryNavigator]").val("");
            $("input[name=SecondaryNavigator]").val("");
            $("input[name=offsets]").val("");
            $("input[name=showtab]").val("0");
        }
    });

    var searchText = "";

    $("#searchinput").focus(function ()
    {
        searchText = $("#searchinput").val();
        $("#searchinput").val("");
    });

    $("#searchinput").blur(function ()
    {
        if ($("#searchinput").val() == "")
        {
            $("#searchinput").val(searchText);
        }
    });
    // ******************* End Global Search Funtionality *************************//

    // ******************* Begin Janes Logo Update Functionality **************************//
    if ($("#logo").length > 0 && window.location.hostname.indexOf("janes") != -1)
    {
        if ($("#logo").attr('href') == "/")
        {
            $("#logo").attr('href', "http://" + window.location.hostname.replace("janes", "ihs"));
            $("#global_nav").find("#menu_item1 a").attr('href', "http://" + window.location.hostname.replace("janes", "ihs"));
            $(".breadcrumb").find("ul li:first a").attr('href', "http://" + window.location.hostname.replace("janes", "ihs"));
        }
    }
    else if ($("#logo").length > 0 && $("#logo").attr('href') == "")
    {
        $("#logo").attr('href', "/");
    }
    // ******************* End Janes Logo Update Functionality **************************//

    // ******************* Start Remove Character Functionality **************************//
    if ($(".events td").length > 0)
    {
        $('.events td').each(function ()
        {
            var $this = $(this);
            var t = $this.text();
            var nv = '';

            if (t.indexOf('�') > -1)
            {
                for (var i = 0; i < t.length; i++)
                {
                    nv += t[i].replace('�', ' - ');
                }
                $this.text(nv);
            }
        });
    }
    // ******************* End Remove Character Functionality **************************//

    // ******************* Start Hide and show Call Us Page - Product Links Functionality **************************//
    $(".productLinks_view").each(function ()
    {
        var sChildClassName = $(this).find("div").attr("class");
        var nVisibleLinksNumber = sChildClassName.slice(-1);
        $(this).find("li").slice(nVisibleLinksNumber, -1).hide();

        if ($(this).find("li").length - nVisibleLinksNumber == 1)
            $(this).find("li:last").hide();

        $(this).find("li:last").click(function ()
        {
            $(this).parent().find("li").slice(nVisibleLinksNumber).slideDown();
            $(this).hide();
            return false;
        });
    });
    // ******************* End Hide and show Call Us Page - Product Links Functionality **************************//

    //**************** Begin Confirmation Popup Functionality ********************************//
    if ($('.confirmation').length > 0)
    {
        //Create a new div with ID popupMask
        $("<div id='popupMask'></div>").insertAfter(".confirmation");

        //Set height and width to popupMask to fill up the whole screen
        var maskHeight = $(document).height();
        var maskWidth = $(window).width();
        $('#popupMask').css({ 'width': maskWidth, 'height': maskHeight });

        //transition effect		
        $('#popupMask').fadeIn(100);
        $('#popupMask').fadeTo("slow", 0.8);

        //if close button is clicked
        $('.confirmation a').click(function (e)
        {
            $('#popupMask').hide();
        });
    }
    //**************** End Confirmation Popup Functionality ********************************//

    //**************** Begin Change Product expend & summary view layout Functionality ********************************//
    $('.clear_both.intro_border_top').prev().children().css('margin-right', '0');
    //**************** End Change Product expend & summary view layout Functionality ********************************//   
});

