if (!console) {
    var console = {
        log: function() { },
        group: function() { },
        dir: function() { },
        groupEnd: function() { }
    }
}

//safari needs this
try {
    function log_dir(s, obj) {
        console.group(s);
        console.dir(obj);
        console.groupEnd();
    }
} catch (ex) {
    function log_dir(s, obj) {
    }
}

var chfGlobalPublic = (function($) {
    $(document).ready(function() {

        //add browser class to document - helps with CSS browser targeting
        var msie = ($.browser.msie) ? "ie" : false;
        var mozilla = ($.browser.mozilla) ? "mozilla" : false;
        var safari = ($.browser.safari) ? "safari" : false;
        var browser = (msie || mozilla || safari);
        var browserVer = browser + parseInt(jQuery.browser.version);
        var fullVersion = parseFloat($.browser.version);
        var ff = null;


        $('#flPlayer').jqm();



        $('body')
				.addClass(browser)
				.addClass(browserVer);

        if (navigator.platform.substr(0, 3).toLowerCase() !== "win") {
            $('.bgWrapper').addClass('macOS');
        }

        if ($.browser.mozilla) {
            if (fullVersion == 1.8) {
                ff = 'ff2';
            } else {
                ff = 'ff3';
            }
            $('.bgWrapperInner').addClass(ff);
        }
        //If we are not on the homepage, add the sub Category class to the primaryContent div
        var pathArr = location.pathname.split('/');
        var subPage = null;

        if (pathArr.length > 2) {
            subPage = pathArr[1];
            $('.primaryContent').addClass(subPage);
            $('.secondaryContent').addClass(subPage);

        } else if (pathArr[1] == '' || pathArr[1] == 'Default.aspx') {
            //alert(pathArr[1]);
            //$('.pageHeader').addClass('homePage');
        }

        //Sizing for PullQuotes (this is not really used anymore. 
        if ($('.headerContent .pullQuote')) {
            var H = $('.headerContent .pullQuote p').height();
            var W = $('.headerContent .pullQuote p').width();

            if ((H < 19) && (W > 300)) {
                $('.headerContent .festivalQuotes cite').css('margin-top', '15px');
            }
        }

        //No Touchy! this initializes Google map when needed
        $('#smMap').show(10, function() { chfGlobalPublic.GM.initialize('sm'); });
        $('#map').show(10, function() { chfGlobalPublic.GM.initialize(); });
        $('.largeMap').toggle(function() { $('#lgMap').slideDown(300, function() { chfGlobalPublic.GM.lgMap(); }); return false; }, function() { $('#lgMap').slideUp(300, function() { $(this).empty(); }); return false; });


        try {
            if (chfGlobal != undefined) {
                chfGlobal.start();
            } else {
                alert("[SEVERE ERROR] chfGlobal is undefined!");
            }
        } catch (e) { }
    });

    var chfGlobal = {
        start: function() {
            if ($(".printPage").length && $("#ducWrapper").length) {
                this.chfPrintDucSet();
                return;
            }
            if ($('.printPage').length && $('.itinPane').length) {
                this.chfPrintItinSet();
            }

            $("input[name='check_cc']").click(function() {
                if ($(this).val() == 'check') {
                    $('#cType, #ccNum, #month, #year, #ccv').attr('DISABLED', 'TRUE');
                    $('#ccDetails').fadeOut(120);
                } else {
                    $('#cType, #ccNum, #month, #year, #ccv').removeAttr('DISABLED');
                    $('#ccDetails').slideDown(150);
                }
            });

            //CHF Disable disabled links
            this.chfDisableDisabledLinks();

            //CHF User Agreement
            this.chfPopupLinks();

            //CHF Blog Setter
            this.chfBlogSetter.init();

            //CHF Text Area Setter
            this.chfSetTextAreas();

            //CHF Text Size Changer
            this.chfTextSizeChanger.init();

            //CHF File Upload
            this.chfEventsList();

            //CHF File Upload
            this.chfFileUpload();

            //CHF Calendars
            this.chfCalendar.init();

            //CHF Sharing Menu
            this.chfSharingMenu.init();

            //CHF Clickability Menu
            this.chfClickabilityMenu.init();

            //CHF Features Menu 
            this.chfFeaturesMenu();

            //Rotate sponsor images
            this.chfSponsors.init();

            //Load all SWF files
            this.chfSWFObject.init();

            //Top Five 
            this.chfTopFive();

            //Fix any PNG images for ie6
            $("img[src$=png]").fixPNG();

            //Fix Genre Headers
            this.chfGenreHeader();

            //Tout Scroller
            if ($('body').hasClass('printPage')) {
                this.chfToutScroller.init('noAnim');
            } else {
                this.chfToutScroller.init();
            }

            //CHF Paginator
            this.chfPaginator.init();

            //CHF Donate
            this.chfDonate.init();

            //CHF Press Room
            this.chfPressRoom();

            //CHF Board of Directors
            this.chfBoardOfDirectors();

            //CHF Accordion
            this.chfAccordion.init();

            //CHF Share Itinerary
            this.chfShareItin();

            //CHF gPop (global pop)
            this.chfGPop();

            //CHF mediaPop
            this.chfMediaPop();

            //CHF Enter Key Handler
            this.chfEnterFocus();
        },

        chfDisableDisabledLinks: function() {
            $(".linkDisabled, .inItinerary").click(function(mEvent) {
                mEvent.preventDefault();
            });
        },

        chfEnterFocus: function() {
            $('input').focus(function(e) {
                var currentInput = null;
                currentInput = $(this).parent().attr('class');

                //alert(currentInput);
                switch (currentInput) {

                    case 'search':
                        $('#google_q').keydown(function(e) {
                            //alert(e.keyCode);
                            if (e.keyCode == 13) {

                                GoogleRedirect();
                                e.preventDefault();
                                //alert('search');

                            }
                        });
                        break;

                    /*case 'inline_signin':
                    $(window).keydown(function(e){
                    if(e.keyCode == 13){
                    //$('#go_search_site').trigger('click');
                    alert('inline signin');
                    }
                    });
                    break;*/ 
                }
            });
        },

        chfPrintDucSet: function() {
            $(".bgWrapper").addClass("printPageDuc");
            $(".source").after("<div class='printNote'>*Note: This page is for planning purposes only. It is not a ticket or a receipt for tickets purchased and cannot be used to gain admittance to an event. Please refer to your order history for a receipt of previous order.</div>");
        },

        chfPrintItinSet: function() {
            $('.primaryContent .twoWide').removeClass('twoWide column').addClass('twoWideItin');
        },

        chfBlogSetter: {
            init: function() {
                var blogSetter = this;
                var editDelay = ($.browser.msie) ? 5000 : 1000;
                var mainBlogDelay = ($.browser.safari) ? 500 : 0;

                $("a:eq(0)", ".ViewEditList_TableRight").mouseup(function() {
                    window.setTimeout(blogSetter.addElements, editDelay);
                    if (($('.bio') > 1) /*&& ($('.bio:visible') > 1)*/) {
                        alert('hello');
                    }
                });

                window.setTimeout(this.addElements, mainBlogDelay);

            },

            addElements: function() {
                var insertAvatar = function() {
                    $("#pluckblog #BlogNav_Persona_WriteNewPost").html("Post An Entry").clone().appendTo("#pluckblog .bio").addClass("blogLink");
                    $("#pluckblog #BlogNav_Persona_EditPost").html("Edit Posts").clone().appendTo("#pluckblog .bio").addClass("blogLink");
                    $("#pluckblog #BlogNav_Persona_ViewComments").html("Approve Comments").clone().appendTo("#pluckblog .bio").addClass("blogLink");
                    $(".blogLink").wrapAll("<div class='blogLinks clearfix'></div>");
                }

                var insertBlogMenu = function() {
                    $("#pluckblog > #clones > .bio").clone().prependTo("#pluckblog .PersonaBlog_TableLeft");
                    $("#pluckblog > #clones > .bio").clone().prependTo("#pluckblog .PersonaStyle_ItemContainer");
                    $("#pluckblog .Persona_NullContent").remove().clone().appendTo("#pluckblog .PersonaBlog_TableLeft");
                }

                var insertEditItems = function() {
                    insertBlogMenu();

                    $(".BlogMain_EntryContent").addClass("clearfix");

                    $("#pluckblog .ViewEditList_Options").before("<div class='ViewEditList_OptionsTemp'><b>Show</b></div>");
                    $("#pluckblog .ViewEditList_OptionsTemp b").after("<div class='editPostsRadios'></div>");
                    $("#pluckblog .ViewEditList_Options input:eq(0)").clone().prependTo($("#pluckblog .ViewEditList_OptionsTemp .editPostsRadios")).after("All").addClass("firstRadio");
                    $("#pluckblog .ViewEditList_Options input:eq(1)").clone().appendTo($("#pluckblog .ViewEditList_OptionsTemp .editPostsRadios")).after("Drafts Only");

                    $("#pluckblog .ViewEditList_OptionsTemp .editPostsRadios").after("<div class='editPostsDropdown'></div>");
                    $("#pluckblog .ViewEditList_Options input:eq(2)").clone().prependTo($("#pluckblog .ViewEditList_OptionsTemp .editPostsDropdown")).after("Published only for last").addClass("firstRadio");
                    $("#pluckblog .ViewEditList_Options select").clone().appendTo($("#pluckblog .ViewEditList_OptionsTemp .editPostsDropdown")).after("Days");
                    $("#pluckblog .ViewEditList_Options input.PersonaStyle_Refresh").clone().appendTo($("#pluckblog .ViewEditList_OptionsTemp .editPostsDropdown"));

                    $("#pluckblog .ViewEditList_Options").remove();
                    $("#pluckblog .ViewEditList_OptionsTemp").addClass("ViewEditList_Options").removeClass("ViewEditList_OptionsTemp");

                    $("#pluckblog .ViewEditList_Options").after("<div class='editPostsHeader'>POSTS</div>");
                    $("#pluckblog .ViewEditList_Table tr:gt(0)").each(function() {
                        $("#pluckblog .ViewEditList_Table").before("<div class='editPost'></div>");
                        $("#pluckblog .editPost:last").append("<div class='editPostDate'>" + $(this).find(".ViewEditList_TableLeft").html() + "</div>");
                        $("#pluckblog .editPost:last").append("<div class='editPostTitle'>" + $(this).find(".ViewEditList_TableMiddle").html() + "</div>");
                        $(this).find(".ViewEditList_TableRight a:last").clone().appendTo("#pluckblog .editPost:last").wrap("<div class='editPostOptions'></div>");
                        $(this).find(".ViewEditList_TableRight a:first").clone().appendTo("#pluckblog .editPostOptions:last").addClass("editPostLink");
                    });
                    $(".ViewEditList_Table").remove();
                    $('.BlogEntryForm_table td:last-child').addClass('last');
                }

                insertAvatar();
                insertEditItems();

                //If thwere are 2 VISIBLE .bio els...
                if ($('.bio').length > 2 && ($('.bio:visible').length > 2)) {
                    //Hide the second one (b/c the 1st one is a clone and is already hidden
                    $('.bio:eq(1)').hide();
                }

                // Main Page
                $("#pluckblog .Blog_RightSideContainer:eq(0)").before("<div class='topLines'></div>");

                $(".BlogMain_EntryPost, .BlogEntry_Container").each(function() {
                    $(this).find(".BlogMain_EntryDate").remove().clone().insertAfter($(this).find(".BlogMain_EntryContent"));
                    comments = $(this).find(".BlogMain_EntryDetails a:eq(0)").addClass("comments");
                    permalink = $(this).find(".BlogMain_EntryDetails a:eq(1)").addClass("permalink");
                    permalink.text("Permalink").prependTo($(this).find(".BlogMain_EntryDetails").html(""));
                    comments.appendTo($(this).find(".BlogMain_EntryDetails"));
                    $(".BlogMain_EntryDetails").addClass("clearfix");
                });

                // Right Links
                $("#pluckblog .Blog_RightSideContainer:eq(0)").after($("#pluckblog .Blog_RightSideContainer:eq(2)").remove());
                $("#pluckblog .Blog_RightSideContainer:eq(1)").find(".Blog_RightSideSectionHead").text("Recent Tags");
                $("#pluckblog .SiteLife_RSS").before("<div class='Blog_RightSideSectionHead'>Subscribe</div>").wrap("<div class='BlogArchiveList_Entries'></div>");
                $("#pluckblog .SiteLife_RSS").text("");
                $("#pluckblog .Blog_RightSideContainer").wrapAll("<div class='rightLinksHolder clearfix'></div>");


                // View Entry Page
                $("#pluckblog .BlogEntry_Container .BlogMain_EntryDate").remove().clone().insertAfter($("#pluckblog .BlogEntry_Container #postBody"));
                $("#pluckblog .BlogEntry_Container #postTags").remove().clone().insertAfter($("#pluckblog .BlogEntry_Container #postBody"));

                $("#pluckblog .Comments_Table").remove().clone().appendTo("#pluckblog #Comments_OuterContainer");

                var numberOfComments = (($("#pluckblog .BlogMain_EntryDetails .comments").text() || "").match(/\d+/) || [0])[0];
                var numberOfCommentsText = (numberOfComments == 1) ? " COMMENT" : " COMMENTS";

                $("#pluckblog .Comments_Table").before("<div class='commentsHeader'>" + numberOfComments + numberOfCommentsText + "</div>");

                $("#pluckblog img.PluckUserAvatar").each(function() {
                    var theImageTagJQueryObj = $(this);
                    var rhsUserId = theImageTagJQueryObj.parent().attr('href').split("=")[1].split("&")[0];
                    jQuery.ajax({
                        type: "GET",
                        async: false,
                        url: "/Handlers/AvatarUrl.ashx?userid=" + rhsUserId,
                        dataType: "json",
                        success: function(json) {
                            theImageTagJQueryObj.attr('src', json.imageurl);
                        }
                    });
                });

                // Edit Posts Page
                $(".PersonaStyle_Refresh").click(function(event) {
                    window.setTimeout(insertEditItems, 500);
                });

                // Rookie Page
                $("#pluckblog .Persona_NullContent").empty().addClass("clearfix");
                $("#pluckblog .Persona_NullContent").append("<div class='rookieHeader'>Welcome to your blog.</div>");
                $("#pluckblog .Persona_NullContent").append("<div class='rookieText'>Use the button below to being posting.</div>");
                $("#pluckblog .Persona_NullContent").append("<a href='#' class='singleBtn submitAnchor floatRight'>Post Now</a>");
                $("#pluckblog .Persona_NullContent .submitAnchor").click(function(event) {
                    $("#pluckblog #BlogNav_Persona_WriteNewPost").click();
                    event.preventDefault();
                });
            }

        },

        chfTextSizeChanger: {
            mTextSizeBoxes: ".longSecondaryArticle .output, .longSecondaryArticle .source, .bioBody:not(:has('.greyForm')), .volunteers .article:eq(0) .body, .proposePresentation .article:eq(0) .body, .presentorProfile .bioBody, .genrePage #primaryArticle .body, .packageLanding #primaryArticle .paragraphTitle, .packageLanding #primaryArticle .body, .ducContent #primaryArticle .body, .eventsList .abstract, .chfSponsors p, .donateHeader, .aboutChf, .pressReleases, .chfJobs .body, .internApplicationInfo .body, .contribution .body, .shoppingCart .body:eq(0), .itinPane p, .body p",

            init: function() {
                mTextSizeChanger = this;

                $(".textSizeChanger .small a").click(function(mEvent) {
                    $(mTextSizeChanger.mTextSizeBoxes).removeClass("sixteenPx").removeClass("eighteenPx").addClass("defaultPx");
                    mTextSizeChanger.setText(this, "defaultPx");
                    mEvent.preventDefault();
                });

                $(".textSizeChanger .medium a").click(function(mEvent) {
                    $(mTextSizeChanger.mTextSizeBoxes).removeClass("defaultPx").removeClass("eighteenPx").addClass("sixteenPx");
                    mTextSizeChanger.setText(this, "sixteenPx");
                    mEvent.preventDefault();
                });

                $(".textSizeChanger .large a").click(function(mEvent) {
                    $(mTextSizeChanger.mTextSizeBoxes).removeClass("defaultPx").removeClass("sixteenPx").addClass("eighteenPx");
                    mTextSizeChanger.setText(this, "eighteenPx");
                    mEvent.preventDefault();
                });

                this.getCurrentTextSize();
            },

            getCurrentTextSize: function() {
                var mTextSize = unescape(document.cookie).replace(/textSizeIsThis=([^;]+).*/, "$1");
                var mSelector;

                switch (mTextSize) {
                    case "defaultPx":
                        mSelector = ".textSizeChanger .small a";
                        break;
                    case "sixteenPx":
                        mSelector = ".textSizeChanger .medium a";
                        break;
                    case "eighteenPx":
                        mSelector = ".textSizeChanger .large a";
                        break;
                }

                $(this.mTextSizeBoxes).addClass(mTextSize);
                $(mSelector).addClass("textSizeIsThis");
            },

            setCurrentTextSize: function(mSize) {
                var mDate = new Date();
                mDate.setYear(mDate.getYear() + 1901);

                document.cookie = "textSizeIsThis=" + mSize + ";expires=" + mDate.toGMTString() + ";";
            },

            setText: function(textSizerToolbar, mSize) {
                $(textSizerToolbar).addClass("textSizeIsThis");
                $(textSizerToolbar).parent().siblings().find("a").removeClass("textSizeIsThis");

                this.setCurrentTextSize(mSize);

                if ($(".longSecondaryArticle .output"))
                    this.reloadPaginator();
            },

            reloadPaginator: function() {
                $(".longSecondaryArticle .output").html("<div  class='paginatorWaiter'>Reloading Article<img src='/Assets/img/ajax-loader.gif'/></div>");
                $(".longSecondaryArticle .paginator").show();
                $(".longSecondaryArticle #paginatorPageNo").html("1");
                $(".longSecondaryArticle .paginator .prev").unbind("click").addClass("disabled");
                $(".longSecondaryArticle .paginator .next").unbind("click").removeClass("disabled");

                //                if ($.browser.safari)
                window.setTimeout('chfGlobalPublic.mLoadPaginator(true)', 500);
                //                else
                //                    chfGlobalPublic.mLoadPaginator(true);
            }
        },

        chfEventsList: function() {
            $(".festivalEvents .event").hover(
					function() {
					    $(this).find(".abstract").removeClass("hidden");
					},
					function() {
					    $(this).find(".abstract").addClass("hidden");
					}
				);
        },

        chfFileUpload: function() {
            if ($(".imageUpload").length) {
                $(".newImage").change(function() {
                    if (!/.gif|.jpg|.png|.bmp$/i.test(this.value)) {
                        alert("Please upload an image file only");
                        $(".imageValue").html("no file is selected");
                        this.value = "";
                    } else {
                        iValue = this.value.split("\\");
                        $(".imageValue").html(iValue[iValue.length - 1].substr(0, 30));
                    }
                });

                $(".bioEdit .clearBtn").click(function() {
                    $(".imageValue").html("");
                });
            }
        },

        chfCalendar: {
            // yearly events object
            _mMonths: [
					{ name: 'January', days: 31, events: [] },
					{ name: 'February', days: 28, events: [] },
					{ name: 'March', days: 31, events: [] },
					{ name: 'April', days: 30, events: [] },
					{ name: 'May', days: 31, events: [] },
					{ name: 'June', days: 30, events: [] },
					{ name: 'July', days: 31, events: [] },
					{ name: 'August', days: 31, events: [] },
					{ name: 'September', days: 30, events: [] },
					{ name: 'October', days: 31, events: [] },
					{ name: 'November', days: 30, events: [] },
					{ name: 'December', days: 31, events: [] }
				],
            _mMonth: 0,
            _mYear: 2112,
            _mToday: "",

            //These three variables determine how the calendar renders.
            //  If nothing is selected, these vars are populated with date/day/month from mDate
            //  If a date HAS been selected
            _selectionInMonth: null,
            _selectedDay: null,
            _selectedDate: null,

            _currentMonth: null,
            _mDayOne: { previous: 0, next: 0 },

            init: function() {
                if ($(".calendar").length) {
                    mDate = new Date();
                    this._mYear = $.browser.msie ? mDate.getYear() : mDate.getYear() + 1900;
                    this._mMonth = mDate.getMonth();

                    this._selectionInMonth = mDate.getMonth();
                    this._selectedDay = mDate.getDay() + 1;
                    this._selectedDate = mDate.getDate() % 7;

                    this._mToday = this._mMonth + "/" + mDate.getDate() + "/" + this._mYear;
                    //this._selected = false;
                    mCalendar = this;

                    this.loadYearsEvents();

                    if (this._selectedDate == 0) this._selectedDate = 7;

                    //This is where the Calendar majick happens!
                    this.displayMonth({ thisMonth: this._selectionInMonth, dayOne: (this._selectedDay - this._selectedDate + 7) % 7 });

                    $(".nMonth").click(function() {
                        if (mCalendar._selectionInMonth == 11)
                            mCalendar.loadYearsEvents(++mCalendar._mYear);

                        mCalendar._selectionInMonth = (mCalendar._selectionInMonth + 1) % 12;
                        mCalendar.displayMonth({ thisMonth: mCalendar._selectionInMonth, dayOne: mCalendar._mDayOne.next }, 'true');
                    });

                    $(".pMonth").click(function() {
                        if (mCalendar._selectionInMonth == 0)
                            mCalendar.loadYearsEvents(--mCalendar._mYear);

                        mCalendar._selectionInMonth = (mCalendar._selectionInMonth == 0) ? 11 : mCalendar._selectionInMonth - 1;
                        mCalendar.displayMonth({ thisMonth: mCalendar._selectionInMonth, dayOne: mCalendar._mDayOne.previous }, 'true');
                    });
                }
            },

            // load events for current year only
            loadYearsEvents: function() {
                if (this._mYear % 4 == 0)
                    this._mMonths[1].days = 29;
                else
                    this._mMonths[1].days = 28;

                yJson = eval($(".days").attr("json"));

                $(this._mMonths).each(function() {
                    this.events = [];
                });
                var _this = this;
                $(yJson).each(function(i, e) {
                    //Params from json
                    var yJsonDate = e.date;

                    var url = e.url;
                    var selected = e.selected;
                    //parse date from json
                    var yJsonMonth = parseInt(yJsonDate.split('/')[0]);
                    yJsonMonth--;
                    var yJsonDay = yJsonDate.split('/')[1];
                    var yJsonYear = yJsonDate.split('/')[2];

                    //create new Date Obj from the json date string. 
                    //Without this _selected Day and _selectedDate won't populate correctly below!
                    var d = new Date(parseInt(yJsonYear, 10), parseInt(yJsonMonth, 10), parseInt(yJsonDay, 10));
                    //populate events array for ea. month
                    for (var yMonthI = 0; yMonthI < 12; yMonthI++) {
                        if ((yJsonYear == _this._mYear) && (yJsonMonth == yMonthI)) {
                            _this._mMonths[yMonthI].events.push({ day: yJsonDay, link: url, selected: selected });
                        }

                    }

                    //IF a json event date returns w/ selected param = 'True', set _selectionInMonth,
                    // _selectedDay and _selectedDate.
                    for (var yMonthI = 0; yMonthI < 12; yMonthI++) {
                        if (selected == 'True') {
                            _this._selectionInMonth = yJsonMonth;
                            _this._selectedDay = d.getDay() + 1;
                            _this._selectedDate = d.getDate() % 7;
                            if (_this._selectedDate == 0) _this._selectedDate = 7;
                            break;
                        }

                    }
                });
            },

            // display current month
            displayMonth: function(scopeDate) {
                //var mon = type == 'true' ? scopeDate.thisMonth : this._selectionInMonth;
                var mon = this._selectionInMonth;

                mDays = this._mMonths[mon].days;
                mEvents = this._mMonths[mon].events;
                $(".days").html("<span>S</span><span>M</span><span>T</span><span>W</span><span>T</span><span>F</span><span>S</span>");
                $(".thisMonth").html(this._mMonths[mon].name + " " + this._mYear);

                mMonthLoop:
                for (counterI = 0, dayDateI = 1; counterI < 42; counterI++) {
                    if (counterI < scopeDate.dayOne) {
                        $(".days").append("<span></span>");
                        continue mMonthLoop;
                    }

                    for (mEvent in mEvents) {
                        if (mEvents[mEvent].day == dayDateI) {
                            if (mEvents[mEvent].selected == 'True')
                                $(".days").append("<span><a href='" + mEvents[mEvent].link + "' class='today'>" + dayDateI++ + "</a></span>");
                            else
                                $(".days").append("<span><a href='" + mEvents[mEvent].link + "'>" + dayDateI++ + "</a></span>");
                            continue mMonthLoop;
                        }
                    }

                    if (dayDateI <= mDays)
                        if (mEvents.selected == 'True')
                        $(".days").append("<span><span class='today'>" + dayDateI++ + "</span></span>");
                    else
                        $(".days").append("<span><span>" + dayDateI++ + "</span></span>");
                    else {
                        this._mDayOne.next = (counterI) % 7;
                        break;
                    }
                }

                mPreviousLastDaySpot = (scopeDate.dayOne == 0) ? 6 : scopeDate.dayOne - 1;
                mPreviousMonth = (scopeDate.thisMonth == 0) ? 11 : scopeDate.thisMonth - 1;
                mPreviousLastDayDate = this._mMonths[mPreviousMonth].days % 7;

                this._mDayOne.previous = mPreviousLastDaySpot - mPreviousLastDayDate + 1;
                if (this._mDayOne.previous < 0)
                    this._mDayOne.previous = 7 + this._mDayOne.previous;
            }
        },

        chfSharingMenu: {

            init: function() {
                var mShare = this;

                $("a:eq(1)", "#sharePopupContent").click(function() {
                    if (window.sidebar)// firefox
                        window.sidebar.addPanel(document.title, location.href, "");
                    else if (document.all)// ie
                        window.external.AddFavorite(location.href, document.title);
                });

                $("a:gt(1)", "#sharePopupContent").each(function() {
                    $(this).click(function(event) {
                        mShare.shareArticle(event.target.id);
                    });
                });

            },

            shareArticle: function(website) {
                url = encodeURIComponent(location.href);
                title = encodeURIComponent(document.title);

                if (website == 'Facebook') {
                    url = 'http://www.facebook.com/sharer.php?u=' + url + '&t=' + title;
                }
                else
                    if (website == 'Mixx It') {
                    url = 'http://mini.mixx.com/submit/story?page_url=' + url + '&title=' + title;
                }
                else
                    if (website == 'Digg') {
                    url = 'http://digg.com/submit?url=' + url + '&title=' + title + '&bodytext=himanny';
                }
                else
                    if (website == 'Del.icio.us') {
                    url = 'http://del.icio.us/post?url=' + url + '&title=' + title;
                }
                else
                    if (website == 'Reddit') {
                    url = "http://reddit.com/submit?url=" + url + '&title=' + title;
                }

                window.open(url, 'Sharer', 'toolbar=0,status=0,width=750,height=550,scrollbars=1');
                return false;
            }
        },

        chfSetTextAreas: function() {
            $("textarea[maxlength]").keypress(
					function(event) {
					    mMax = $(this).attr("maxlength");
					    if (this.value.length > mMax)
					        this.value = this.value.substr(0, mMax);
					}
				);
        },

        chfPopupLinks: function() {
            $(".userAgreement").click(function(event) {
                $("#userAgreementPopup").show();
                event.preventDefault();
            });

            $(".agreementCloseButton", "#userAgreementPopup").click(function(event) {
                $("#userAgreementPopup").hide();
                event.preventDefault();
            });

            $(".securityCodeLink").click(function(event) {
                $(".securityCodePopup").show();
                event.preventDefault();
            });

            $(".securityCodePopup .closeBtn").click(function(event) {
                $(".securityCodePopup").hide();
                event.preventDefault();
            });

            $(".thanksForTheOrder .thanksPrint").click(function(event) {
                chfGlobalPublic.summonPrintFriendly();
                event.preventDefault();
            });
        },


        chfShareItin: function() {
            $('#shareItin').click(function(e) {
                if ($('#shItinRes:visible')) {
                    //$('#shInit').show();
                    //$('#shItinRes').hide();
                }
                $('#shareItinPop, #shareItinConf').show();
                //e.preventDefault();
            });

            this.chfShareItinClose();

        },

        chfShareItinClose: function() {
            $('.shareItinClose').click(function(e) {
                $('#shareItinPop, #shareItinConf').fadeOut(100, function() {
                    //$('#shInit').show();
                    //$('#shItinRes').hide();
                });
                e.preventDefault();
            });
        },


        // To make a close BTN that is not associated with a gPop open el, give an a tag the .miniClose class where the rel attr refers to the target element.
        chfGPop: function() {
            $.each($('.gPop'), function(i, item) {
                $(this).attr('id', 'gPop' + i);
                $('#gPop' + i).click(function(e) {
                    window.scrollTo(0, 300);
                    var el = $(this).attr('rel');
                    $('#' + el).show();
                    e.preventDefault();
                });
            });

            $('.miniClose').click(function(e) {
                var el = $(this).attr('rel');
                $('#' + el).fadeOut(100);
                e.preventDefault();
            });
        },
        chfMediaPop: function() {
            $.each($('.mediaPop'), function(i, item) {
                $(this).attr('id', 'mediaPop' + i);
                $('#mediaPop' + i).click(function(e) {
                    var el = $(this).attr('rel');
                    $('#' + el).show();
                    e.preventDefault();
                });
            });

            $('.mediaClose').click(function(e) {
                var el = $(this).attr('rel');
                $('#' + el).hide();
                e.preventDefault();
            });

        },

        chfClickabilityMenu: {
            _emailValue: "",

            init: function() {
                clickabilityMenu = this;

                /*$("a:eq(0)", "#emailContainer").click(
                function(event) {
                $(".shareCloseBtn a").click();
                $("#emailPopup").show();
                //							$(":input[name=txtEmailAddress]", this).focus();
                event.preventDefault();
                }
                );

                $(".emailCloseBtn a, #emailPopupContent .emailCancelBtn").click(
                function(event) {
                $("#emailPopup").hide();
                $("#emailPopupContent .chfError").html("");
                clickabilityMenu.populateEmailFields();
                resetEmailPopup();
                event.stopPropagation();
                event.preventDefault();
                }
                );

                var resetEmailPopup = function() {
                $("#emailPopup")
                .find("#emailPopupContent")
                .removeClass("hidden")
                .end()
                }

                $(".emailMessageCloseBtn a, #emailMessagePopupContent .emailCancelBtn").click(
                function(event) {
                $("#emailMessagePopup").hide();
                resetEmailPopup();
                event.stopPropagation();
                event.preventDefault();
                }
                );

                var resetEmailMessagePopup = function() {
                $("#emailMessagePopup")
                .find("#emailMessagePopupContent")
                .removeClass("hidden")
                .end()
                }


                */

                $("a:eq(0)", "#shareContainer").click(
						function(event) {
						    $("#sharePopup").show();
						    //$(":input[name=txtEmailAddress]", this).focus();
						    event.preventDefault();
						}
					);

                var resetSharePopup = function() {
                    $("#sharePopup")
							.find("#sharePopupContent")
							.removeClass("hidden")
							.end()
                }
                $(".shareCloseBtn a").click(
						function(event) {
						    $(".emailCloseBtn").click();
						    $("#sharePopup").hide();
						    resetSharePopup();
						    event.stopPropagation();
						    event.preventDefault();
						}
					);

            },

            populateEmailFields: function() {
                $(":input:eq(0)", "#emailPopupContent").val($(":input:eq(1)", "#emailContainer").val());
                $(":input:eq(1)", "#emailPopupContent").val($(":input:eq(0)", "#emailContainer").val());
                $(":input:eq(2)", "#emailPopupContent").val("");
                $("#emailPopupContent .red").html("");
                $("#emailPopupContent .red").hide();
            }
        },

        chfFeaturesMenu: function() {

            //Features Overlay
            $('#chfFeaturesContainer').hide();

            //Very nice fade effect that causes Flash SWFs to flicker on Mac (commented out)
            //$('.chfFeaturesTool:first').overlayInPlace('#chfFeaturesContainer');

            $('.chfFeaturesTool:first')
					.toggle
					(
						function() {
						    $('#chfFeaturesContainer').show();
						    $('.textSizeChanger').hide();
						},

						function() {
						    $('#chfFeaturesContainer').hide();
						    $('.textSizeChanger').show();
						}
					);

            /**
            * Popup overlays - prevent event bubbling
            * else links with not work and only close popup
            **/
            $("a", ".chfFeatures")
					.click(
						function(event) {
						    event.stopPropagation();
						}
					);


            //Sign in Overlay (Handles Sign in & Forgot Password)
            var resetSigninPopup = function() {
                $("#signinPopup")
						.find("#signinPopupContent")
						.removeClass("hidden")
						.end()
						.find("#signinForgotPwd")
						.addClass("hidden");
            }

            /*$("a:eq(0)", "#registerB h4")
            .click(
            function(event) {
            $("#signinPopup").show();
            $(":input[name=txtEmailAddress]", this).focus();
            event.preventDefault();
            }
            );*/

            $(".formSignIn")
				.click(
					function(event) {
					    $("#signinPopup").show();
					    $(":input[name=txtEmailAddress]", this).focus();
					    event.preventDefault();
					}
				);

            //Sign In popup functionality
            /*$(".closeBtn").click(
            function(event) {
            $("#signinPopup").hide();
            $("#signinPopup .chfError").html("");
            //$("#signinPopup .textbox").removeClass("textbox");
            resetSigninPopup();
            event.stopPropagation();
            event.preventDefault();
            }
            );*/

            $("#signinForgotPwd .closeBtn").click(
					function(event) {
					    $("#signinForgotPwd .body").html("Please enter your e-mail address. Your password will be e-mailed to you shortly.");
					    $("#signinPopupContent .closeBtn").click();
					    $(".forgotForm").show();
					}
				);

            $(".forgotPassword").click(
					function(event) {
					    $("#signinPopup")
						.find("#signinPopupContent")
						.addClass("hidden")
						.end()
						.find("#signinForgotPwd")
						.removeClass("hidden")
						.find(":input[name=txtForgotPwd]")
						.focus();
					    event.stopPropagation();
					    event.preventDefault();
					}
				);
        },

        chfSWFObject: {
            /**
            * Note: _disableDefaultFlashInstall = true; Will allow alternate content to show instead of default flash install
            *
            * Loads flash movies on page ready. Searches for any object (i.e. DIV) that contains
            * the following attribute: fsrc.
            * fsrc			- flash movie source
            * fwidth		- width
            * fheight		- height
            * fContainerID	- ID of element to replace with flash movie.
            **/

            _flashMovies: [],
            _placeholderSelector: "[fsrc]",
            _disableDefaultFlashInstall: true,

            init: function() {
                //save scope of 'this' to variable since jQuery maps over 'this' when using .each function
                var parentObj = this;

                //Find and save each movie placeholder for later processing
                $(this._placeholderSelector)
					.each(function() {
					    var movie = $(this);
					    parentObj._flashMovies.push(movie);
					}
					);

                //load Flash movies
                this.loadAll();
            },

            loadAll: function() {
                var flashInfo = null;
                var $movie = null;
                var moviePath = null;
                var movieContainerID = null;
                var movieWidth = null;
                var movieHeight = null;
                var movieFlashvars = null;
                var movieParams = null;
                var movieAttributes = null;
                var flashVersion = "9.0.0";
                var totalMovies = this._flashMovies.length;

                for (i = 0; i < totalMovies; i++) {
                    $movie = this._flashMovies[i];

                    try {
                        moviePath = $movie.attr("fsrc");
                        movieContainerID = $movie.attr("id");
                        movieWidth = $movie.attr("fwidth");
                        movieHeight = $movie.attr("fheight");

                        movieFlashvars = this._createObject($movie.attr("fflashvars"));
                        movieParams = this._createObject($movie.attr("fparams"));
                        movieAttributes = this._createObject($movie.attr("fattributes"));

                        var flashInstallPath = ($movie.attr("fShowAltContent") || this._disableDefaultFlashInstall) ? "" : "//Assets//swf//expressInstall.swf";

                        swfobject.embedSWF(
									moviePath,
									movieContainerID,
									movieWidth,
									movieHeight,
									flashVersion,
									flashInstallPath,
									movieFlashvars,
									movieParams,
									movieAttributes

							);

                    }
                    catch (e) { }
                } //endf for

                $movie = null;
                this._flashMovies = null;

                delete $movie;

            },

            _createObject: function(json) {
                /**
                * Used to create json objects from text string for SWFObject script	
                **/
                try {
                    eval("var obj = " + json);
                    return obj;
                }
                catch (e) {
                    return false;
                }
            }
        },

        chfSponsors: {
            _id: "#festivalSponsors",
            _imageClass: ".sponsorImg",
            _$sponsorContainer: null,
            _maxCount: null,
            _index: -1,
            _imgs: [],
            pause: 3000,
            fTime: 400,

            init: function() {
                var $sponsorContainer = $(this._id);
                var $sponsorImgs = $(this._imageClass);
                this._maxCount = $sponsorImgs.size();
                //CPU spike in IE on slow fades, interrupts large flash video player
                if ($.browser.msie) { this.fTime = 5; this.pause = 4000; }
                if (this._maxCount) {
                    //Add sponsor images to memory
                    $sponsorImgs.each(
							function() {
							    var newImage = this;
							    chfGlobal.chfSponsors._imgs.push(newImage);
							}
						);

                    //Remove all sponsors from DOM
                    $sponsorImgs.remove();

                    //show & add image wrapper
                    $sponsorContainer
						.removeClass("hidden")
						.append("<div></div>");

                    this._$sponsorContainer = $sponsorContainer.find("div");

                    delete $sponsorImgs;

                    //Start the image rotation
                    this.rotate();

                    //Do not rotate if only one sponsor
                    if (chfGlobal.chfSponsors._maxCount == 1) {
                        this.rotate = function() { };
                    }
                }
            },

            rotate: function() {
                var $sponsorContainer = this._$sponsorContainer;
                var t = this.fTime;
                var pause = this.pause;

                //loop through sponsor images
                if (this._index >= this._maxCount - 1) {
                    this._index = 0;
                } else {
                    ++this._index;
                }

                //fade out visible image
                $sponsorContainer
					.fadeOut(
							t,
							function() {
							    /**
							    * Callback function, gets executed when fade out is complete.
							    * Wait till image has been completely faded out, then fade in new sponsor image
							    **/
							    //var newSponsorImg = chfGlobal.chfSponsors._imgs[chfGlobal.chfSponsors._index];

							    //Fade in new sponsor image
							    $sponsorContainer
								.html(chfGlobal.chfSponsors._imgs[chfGlobal.chfSponsors._index])
								.fadeIn(
									t,
									function() {
									    //Pause, repeat process.

									    //Allow chfGlobal to be accessed since window.setTimeout runs in global scope
									    var func = function() {
									        chfGlobal.chfSponsors.rotate();
									    }
									    window.setTimeout(func, pause);
									}
								);
							}
					);
            }
        }, //endof: chfSponsors

        chfTopFive: function() {
            //CHF Top Five
            var $chfTopFive = $(".chfTopFive");
            $chfTopFive
				.find(".tab")
				.each(function(index) {
				    $tab = $(this);
				    $tab.click(function(event) {
				        $topFiveContainer = $(this).parents(".chfTopFive");

				        $topFiveContainer
								.find(".tab")
								.removeClass("selected")
								.eq(index)
								.addClass("selected");

				        $topFiveContainer
								.find(".tabContent")
								.addClass("hidden")
								.eq(index)
								.removeClass("hidden");


				        event.preventDefault();
				        event.stopPropagation()
				    }
						);
				}
				); //endof each
        },

        chfGenreHeader: function() {
            $("#genreHeaderDialog")
					.each(
						function() {
						    //Fix IE width for Genre Headers (js version of CSS max-width)
						    var width = parseInt($(this).width());
						    if (width > 404) {
						        $(this).width("404px");
						    }

						    //Add extra padding for single words, wont break long paragraphs
						    var text = $(this).text();
						    var wordCount = text.split(" ").length;
						    var maxWords = 5;

						    if (wordCount <= maxWords) {
						        $(this)
									.find(".content")
									.addClass("extraPadding");
						    }
						}
					);
        },

        chfToutScroller: {
            _currentDuc: null,
            mDucrotator: function() { chfGlobal.chfToutScroller.ducRotator(); },
            printPage: null,

            init: function(printPage) {
                if (printPage) this.printPage = true;
                var ducToutScrollerExist = $(this._id).size();

                if (ducToutScrollerExist) {
                    //load Dimensions plugin
                    chfGlobal.plugins.load("dimensions");

                    //load Mousewheel plugin
                    chfGlobal.plugins.load("mousewheel");

                    //load Scroller plugin
                    chfGlobal.plugins.load("jsScrollPane");

                    //give plugins time to load
                    window.setTimeout(chfGlobal.chfToutScroller.runCode, 500);

                    this._currentDuc = $("#ducToutScroller .bottom li:eq(0)");
                    this.showNewDuc();
                    //var mDucrotator = function() { chfGlobal.chfToutScroller.ducRotator(); }
                    if (!printPage) {
                        dtrTime = window.setTimeout(this.mDucrotator, 5000);
                    }
                    //New Mouseover Feature
                    //1. clear the Timeout
                    //2. set the _currentDuc to the LI being moused over
                    //3. show the json data embedded in the li tag in the top area
                    //4. on mouseOUt, restart the timeout starting from currentDuc
                    $('#ducToutScroller .bottom li').mouseover(function(e) {
                        var _this = chfGlobal.chfToutScroller;
                        var prev = $(this).prev();

                        if (!printPage) clearTimeout(dtrTime);

                        _this._currentDuc = null;
                        _this._currentDuc = $(this);

                        chfGlobal.chfToutScroller.showNewDuc();
                    });
                    $('#ducToutScroller .bottom li').mouseout(function(e) {
                        var _this = chfGlobal.chfToutScroller;
                        if (!printPage) {
                            dtrTime = window.setTimeout(_this.mDucrotator, 5000);
                        }
                    });
                    /*
                    if ($(".festivalEvents #ducToutScroller").length)
                    this.truncateEventLinks();
                    else
                    window.setTimeout(this.assignClickEvnt, 500);
                    */
                }
            },

            truncateEventLinks: function() {
                $(".festivalEvents #ducToutScroller li a").each(function() {
                    mText = $(this).text().replace(/^\s+|\s+$/g, "");
                    mText = mText.substring(0, 117);

                    if (mText.length == 117 && /\S/.test(mText))
                        mText = mText.substring(0, mText.lastIndexOf(" "));

                    $(this).text(mText);
                });
            },

            runCode: function() {
                // alert(parseInt($("#ducToutScroller .content ul").height()));
                if (parseInt($("#ducToutScroller .content ul").height()) < 201)
                    $("#ducToutScroller .bottom").addClass("rightBorder");
                //$(".latestConversations #ducToutScroller .bottom").removeClass("rightBorder");
                else {
                    $("#ducToutScroller")
						.each(
							function() {
							    $(this)
									.find(".content")
									.jScrollPane(
										{
										    scrollbarWidth: 15,
										    scrollbarMargin: 1,
										    showArrows: true,
										    arrowSize: 15
										}
									);
							}
						);
                }
            },

            ducRotator: function() {
                var mAnimator = $("#ducToutScroller .animator");

                mAnimator.fadeOut("slow", function() {
                    if (chfGlobal.chfToutScroller._currentDuc.next().length)
                        chfGlobal.chfToutScroller._currentDuc = chfGlobal.chfToutScroller._currentDuc.next();
                    else
                        chfGlobal.chfToutScroller._currentDuc = $("#ducToutScroller .bottom li:eq(0)");
                    chfGlobal.chfToutScroller.showNewDuc();
                    mAnimator.fadeIn("slow", function() {
                        if (!this.printPage) {
                            dtrTime = window.setTimeout(chfGlobal.chfToutScroller.mDucrotator, 5000);
                        }
                    });
                });
            },

            showNewDuc: function() {
                var mDuc = this._currentDuc;

                mDuc.addClass("selected");
                mDuc.siblings().removeClass("selected");

                $ToutScoller = $("#ducToutScroller");
                json = eval("var json = " + mDuc.attr("json"));

                if (typeof json != "object") {
                    json = {};
                }

                json.header = $(".header a", mDuc).html();

                $ToutScoller
					.find(".linkIcon")
					.remove();

                $ToutScoller
                //Top of Scroller
					.find(".top")

                //Update the image
					.find("img")
					.attr("src", (json.img || ""))

                //Restart DOM search
					.end()

                //Event Type
					.find(".flyingHead")
					.html((json.eventType || ""))

                //Restart DOM search
					.end()

                //Header
					.find(".header")
					.html((json.header || ""))

                //Restart DOM search
					.end()

                //Event Date Time
					.find(".eventDateTime")
					.html((json.eventDateTime || ""));

                //Link Head & subHead
                var hyperlink = document.createElement("a");
                $(hyperlink)
					.attr("href", json.url);

                $ToutScoller
					.find(".top .header")
					.wrapInner(hyperlink);

                if (json.links) {
                    var $ToutContainer = $ToutScoller.find(".top .details");
                    for (var i = 0; i < json.links.length; i++) {
                        var linkType = json.links[i][0];
                        var url = json.links[i][1];
                        var text = json.links[i][2];
                        var imgUrl = "";
                        var imgClass = "";

                        switch (linkType) {
                            case "article":
                                imgClass = "iconArticle";
                                break;
                            case "audio":
                                imgClass = "iconAudio";
                                break;
                            case "itinerary":
                                imgClass = "iconItinerary";
                                break;
                            case "tickets":
                                imgClass = "iconTickets";
                                break;
                            case "video":
                                imgClass = "iconVideo";
                                break;
                            case "text":
                                imgClass = "iconText";
                                break;
                            case "slideshow":
                                imgClass = "iconSlideshow";
                                break;
                            case "conversation":
                                imgClass = "iconConversation";
                                break;
                            default:
                        }

                        //Add tout links to bottom of tout
                        var toutLink = document.createElement("a");
                        var $toutLink = $(toutLink);
                        $toutLink.text(text);
                        $toutLink.addClass("linkIcon");
                        $toutLink.addClass(imgClass);
                        $toutLink.attr("href", url);
                        $ToutContainer.append(toutLink);
                    } //end for
                } //end if
            },

            changeTout: function() {

            },

            assignClickEvnt: function() {
                // Limit characters in each section
                //                $("#ducToutScroller .bottom li h3 a").each(function() {
                //                   mHeader = $(this).html().replace(/<span.*/i, "").replace(/^\s+|\s+$/g, "");
                //                 mSubHead = $(this).find(".subHead").html();

                //                    mSubHead = mSubHead.substring(0, 133 - mHeader.length);

                //                    if (mSubHead.length + mHeader.length == 133 && /\S/.test(mSubHead.charAt(mSubHead.length - 1)))
                //                      mSubHead = mSubHead.substring(0, mSubHead.lastIndexOf(" "));

                //                    $(this).html(mHeader).append(" <span class='subHead'>" + mSubHead + "</span>");
                //              });

                $("#ducToutScroller")
						.find(".bottom li")
						.click(
							function(event) {
							    $(this).addClass("selected");
							    $(this).siblings().removeClass("selected");

							    $ToutScoller = $("#ducToutScroller");
							    json = eval("var json = " + $(this).attr("json"));

							    if (typeof json != "object") {
							        json = {};
							    }

							    json.header = $(".header a", this).html();

							    //							    json.header = $(".header a", this).html().replace(/<span.*/i, "").replace(/^\s+|\s+$/g, "");

							    //							    json.subHead = $(".header a .subHead", this).html();
							    //						    json.subHead = json.subHead.substring(0, 110 - json.header.length);

							    //							    mLastSpace = json.subHead.lastIndexOf(" ");
							    //						    mSecondToLastSpace = json.subHead.substring(0, mLastSpace - 1).lastIndexOf(" ");

							    //							    if (json.subHead.length - mLastSpace > 7 && mLastSpace - mSecondToLastSpace > 7)
							    //						        json.subHead = json.subHead.substring(0, mLastSpace);

							    //							    if (json.subHead.length + json.header.length == 110 && /\S/.test(json.subHead.charAt(json.subHead.length - 1)))
							    //						        json.subHead = json.subHead.substring(0, json.subHead.lastIndexOf(" "));

							    $ToutScoller
									.find(".linkIcon")
									.remove();

							    $ToutScoller
							    //Top of Scroller
									.find(".top")

							    //Update the image
									.find("img")
									.attr("src", (json.img || ""))

							    //Restart DOM search
									.end()

							    //Event Type
									.find(".flyingHead")
									.html((json.eventType || ""))

							    //Restart DOM search
									.end()

							    //Header
									.find(".header")
									.html((json.header || ""))
							    //									.html((json.header + " <span class='subHead'>" + json.subHead + "</span>" || ""))

							    //Restart DOM search
									.end()

							    //SubHead
							    //									.find(".subHead")
							    //									.html((json.subHead || ""))

							    //Restart DOM search
									.end()

							    //Event Date Time
									.find(".eventDateTime")
									.html((json.eventDateTime || ""));


							    //Link Head & subHead
							    var hyperlink = document.createElement("a");
							    $(hyperlink)
									.attr("href", json.url);

							    $ToutScoller
									.find(".top .header")
									.wrapInner(hyperlink);


							    if (json.links) {
							        var $ToutContainer = $ToutScoller.find(".top .details");
							        for (var i = 0; i < json.links.length; i++) {
							            var linkType = json.links[i][0];
							            var url = json.links[i][1];
							            var text = json.links[i][2];
							            var imgUrl = "";
							            var imgClass = "";

							            switch (linkType) {
							                case "article":
							                    imgClass = "iconArticle";
							                    break;
							                case "audio":
							                    imgClass = "iconAudio";
							                    break;
							                case "itinerary":
							                    imgClass = "iconItinerary";
							                    break;
							                case "tickets":
							                    imgClass = "iconTickets";
							                    break;
							                case "video":
							                    imgClass = "iconVideo";
							                    break;
							                case "text":
							                    imgClass = "iconText";
							                    break;
							                case "slideshow":
							                    imgClass = "iconSlideshow";
							                    break;
							                case "conversation":
							                    imgClass = "iconConversation";
							                    break;
							                default:
							            }

							            //Add tout links to bottom of tout
							            var toutLink = document.createElement("a");
							            var $toutLink = $(toutLink);
							            $toutLink.text(text);
							            $toutLink.addClass("linkIcon");
							            $toutLink.addClass(imgClass);
							            $toutLink.attr("href", url);
							            $ToutContainer.append(toutLink);

							        } //end for									
							    } //end if

							    event.stopPropagation();
							    event.preventDefault();

							} //end func
						); //end ducToutScroller click


                //load first Tout in the list
                $("#ducToutScroller")
							.find(".bottom li:eq(0)")
							.click();

            }
        },

        plugins: {
            _loadedPlugins:
					[
            //jsScrollerPane - Scrollbar plugin
						{
						name: "jsScrollPane",
						src: "jScrollPane.js",
						loaded: false
		},

            //Dimensions - Gets cross-browser height, width, top, left etc..
						{
						name: "Dimensions",
						src: "dimensions.pack.js",
						loaded: false
		},

            //Mousewheel - Allows scrollbar (jsScrollerPane) to be scrolled using the mouse wheel
						{
						name: "Mousewheel",
						src: "mousewheel.pack.js",
						loaded: false
		}
					],

            _jsFolderPath: "/Assets/js/",

            load: function(sPlugin) {
                //loop through plugins
                for (i = 0; i < this._loadedPlugins.length; i++) {
                    var plugin = this._loadedPlugins[i];

                    if (plugin.name.toLowerCase() == sPlugin.toLowerCase()) {
                        if (!plugin.loaded) {
                            //Load javascript plugin
                            var jsPlugin = document.createElement("script");
                            jsPlugin.type = "text/javascript";
                            jsPlugin.language = "javascript"
                            jsPlugin.src = this._jsFolderPath + plugin.src;

                            $("head").get(0).appendChild(jsPlugin);

                            plugin.loaded = true;
                        }
                    }
                } //endof for
            }
        },


        chfPaginator: {
            _id: ".paginator",
            _index: null,
            _collection: [],
            _maxCount: null,

            init: function() {

                var parentObj = this;

                $(this._id)
						.each(
							function() {
							    //Detect mode
							    var runMode = $(this).attr("mode");

							    switch (runMode) {
							        case "duc":
							            //							            parentObj.articleMode(this);
							            //							            if ($.browser.safari)
							            window.setTimeout('chfGlobalPublic.mLoadPaginator(false)', 500);
							            //							            else
							            //							                chfGlobalPublic.mLoadPaginator(false);
							            break;
							        case "features":
							            parentObj.featuresMode(this);
							            break;
							        case "profiles":
 //							            parentObj.profileMode(this);
							            window.setTimeout('chfGlobalPublic.mLoadProfileMode(".ducSidebar .paginator")', 500);
							            break;
							        case "list":
							            parentObj.listMode(this);
							            break;
							        case "followLinks":
							            parentObj.followLinksMode(this);
							            break;
							    }
							}
						);
            },

            articleMode: function(currPager) {

                var paginatorParent = this;

                var paginator = {
                    _source: ".longSecondaryArticle .source",
                    _container: ".output",
                    _currDivElem: null,
                    _content: [],
                    _testElem: null,
                    _pageClass: "page",

                    init: function() {
                        var parentObj = this;

                        $(this._source)
								.children()
								.each(function() {
								    parentObj._content.push(this);
								});

                        //Create a test container
                        var $testContainer = $("<div class='pageTest'></div>");

                        this._testElem = $(".longSecondaryArticle").get(0).appendChild($testContainer.get(0));

                        this.manners();
                    },

                    findProperEnd: function(mHtml, mChars) {
                        var mNewMChars = mChars;
                        var mFoundEndTag = false;

                        for (mI = mChars - 1; mI > -1; mI--) {
                            if (mHtml.charAt(mI) == ">")
                                mFoundEndTag = true;

                            if (mFoundEndTag)
                                if (mHtml.charAt(mI) == "/")
                                break;
                            else if (mHtml.charAt(mI) == "<")
                                mNewMChars = mI;
                        }

                        return mNewMChars;
                    },

                    manners: function() {
                        mPaginator = this;
                        var mMax = 680; //$(".output").outerHeight();
                        var mThisPageSize = 0;
                        var mCharsPerPixel = $(".source p:first").html().length / $(".source p:first").innerHeight();

                        $(".output").append("<div class='page visible first' style='overflow: auto'></div>");

                        $(this._source).children().each(function() {
                            var mThisBlockSize = $(this).outerHeight();

                            if (mThisPageSize + mThisBlockSize < mMax) {
                                mThisPageSize += mThisBlockSize;
                                $(this).clone().appendTo(".output .page:last");
                            } else {
                                if (this.nodeName == "P") {
                                    $(".output .page:last").append("<p class='outputLast'></p>");
                                    var mParagraph = $(".outputLast:last");
                                    var mSpaceLeft = mMax - mThisPageSize;
                                    var mCharsAvailable = Math.floor(mSpaceLeft * mCharsPerPixel) - 30;

                                    $(this).contents().each(function() {
                                        var mImageE;
                                        var mTag;
                                        var mSetImageDimensions = function(mImageElement) {
                                            mTag = "<img src='" + mImageElement.src + "'/>";

                                            if ($(mImageElement).outerHeight() >= mSpaceLeft) {
                                                $(".output").append("<div class='page' style='overflow: auto'><p></p></div>");
                                                mParagraph = $(".output .page p:last");
                                            } else {
                                                mImageSpacePercentage = 1 - (($(mImageElement).outerWidth() * $(mImageElement).outerHeight()) / (351 * mSpaceLeft));
                                                mCharsAvailable = Math.floor(mCharsAvailable * mImageSpacePercentage);
                                            }
                                        }

                                        if (this.nodeName == "#text")
                                            mTag = "<span>" + this.data + "</span>";
                                        else if (this.nodeName == "IMG") {
                                            if ($.browser.safari) {
                                                mImageE = this;
                                                setTimeout(chfGlobal.chfPaginator.mSetImageDimensionsS(this), 1000);
                                            } else
                                                mSetImageDimensions(this);
                                        } else
                                            mTag = "<" + this.nodeName + ">" + $(this).html() + "</" + this.nodeName + ">";

                                        var mLength = $(mTag).text().length;

                                        if (mLength > mCharsAvailable && mParagraph.hasClass("outputLast")) {
                                            if (this.nodeName == "#text") {
                                                var mText = $(mTag).text();
                                                var mCharsLast = mText.charAt(mCharsAvailable);

                                                for (mI = mCharsAvailable; mI > 0; mI--) {
                                                    if (/\s/.test(mText.charAt(mI)))
                                                        break;
                                                    else
                                                        mCharsAvailable--;
                                                }

                                                mParagraph.append("<span>" + mText.substr(0, mCharsAvailable) + "</span>");
                                                mTag = "<span>" + mText.substr(mCharsAvailable, mLength) + "</span>";
                                            }

                                            $(".output").append("<div class='page' style='overflow: auto'><p></p></div>");
                                            mParagraph = $(".output .page p:last");
                                        }

                                        mParagraph.append(mTag);
                                        mCharsAvailable -= mLength;
                                    });
                                } else {
                                    $(".output").append("<div class='page' style='overflow: auto'></div>");
                                    $(".output .page:last").append($(this));
                                }

                                mThisPageSize = $(".output .page:last *:first").outerHeight();
                            }
                        });

                        this.mAddPager();
                    },

                    mAddPager: function(action) {
                        var updatePageNumber = function(action) {
                            var currPage = $("#paginatorPageNo", currPager).html();
                            var value = 1;

                            switch (action) {
                                case "increase":
                                    value = ++currPage;
                                    break;
                                case "decrease":
                                    value = --currPage;
                                    break;
                            }

                            $("#paginatorPageNo", currPager).html(value);
                        }

                        $(this._container).children(":first-child").addClass("visible").addClass("first");
                        $(this._container).children(":last-child").addClass("last");
                        $(this._container).children(":gt(0)").addClass("hidden");

                        $("#paginatorPagesTotal", currPager).html($(this._container).children().size());

                        $(".next", currPager).click(function(event) {
                            var $currPage = $(this._container).find(".visible");

                            if (!$currPage.hasClass("last")) {
                                $currPage.removeClass("visible").addClass("hidden").next().addClass("visible").removeClass("hidden");

                                updatePageNumber("increase");

                                $currPage = $(this._container).find(".visible");

                                if ($currPage.hasClass("last"))
                                    $(this).addClass("disabled");

                                $(".prev", currPager).removeClass("disabled");
                            }

                            event.preventDefault();
                        });

                        $(".prev", currPager).click(function(event) {
                            var $currPage = $(this._container).find(".visible");

                            if (!$currPage.hasClass("first")) {
                                $currPage.removeClass("visible").addClass("hidden").prev().addClass("visible").removeClass("hidden");

                                updatePageNumber("decrease");

                                $currPage = $(this._container).find(".visible");

                                if ($currPage.hasClass("first"))
                                    $(this).addClass("disabled");

                                $(".next", currPager).removeClass("disabled");
                            }

                            event.preventDefault();
                        });

                        $(".page").css("overflow", "auto");

                        var totalPages = parseInt($("#paginatorPagesTotal", currPager).html());

                        if (totalPages == 1) {
                            var border = document.createElement("hr");
                            $(border).addClass("borderStyleDouble");
                            $(border).insertBefore(currPager);
                            $(currPager).remove();
                        }
                    },

                    checkTime: function() {
                        var d = new Date();
                        return d.getTime();
                    },

                    createNewElement: function() {
                        var newDiv = document.createElement("div");
                        $(newDiv).addClass(this._pageClass);
                        return $(this._container).get(0).appendChild(newDiv);
                    },

                    breakupContent: function(elem) {
                        var index = 0;
                        var htmlPlaceholders = {};
                        var totalWordCount = 0;
                        var paragraphWords = [];
                        var htmlTags = /(\<[^\>]+\>)([^\>]*\<\/[^\>]+\>)*/g;
                        var replacementTag = /\{{2}#[\d]*#\}{2}/g;
                        var digits = /[\d]*/g;

                        //Replace all images, flash etc.
                        var innerHTML = elem.innerHTML;
                        htmlPlaceholders = innerHTML.match(htmlTags);

                        if (htmlPlaceholders) {
                            for (var i = 0; i < htmlPlaceholders.length; i++) {
                                var placeHolder = "{{#" + i + "#}}";
                                innerHTML = innerHTML.replace(htmlPlaceholders[i], placeHolder)
                            }
                        }

                        paragraphWords = innerHTML.split(" ");
                        totalWordCount = paragraphWords.length;

                        for (var j = 0; j < totalWordCount; j++) {
                            var currWord = paragraphWords[j];

                            if (replacementTag.test(currWord)) {
                                tagId = currWord.match(replacementTag);
                                tagId = String(tagId).replace(/[\{\}#]*/g, "");

                                currWord = currWord.replace("{{#" + tagId + "#}}", htmlPlaceholders[tagId]);
                            }

                            $(this._testElem).html("");
                            $(this._testElem).html($(this._currDivElem).html() + currWord);

                            //If overflow
                            if (this._testElem.scrollHeight > this._testElem.offsetHeight) {
                                this._currDivElem = this.createNewElement();
                                $(this._currDivElem).append(currWord);
                            }
                            else {
                                $(this._currDivElem).append(" " + currWord);
                            }


                        }
                    }, //end breakupContent

                    run: function() {

                        var startTime = this.checkTime();

                        this._currDivElem = this.createNewElement();

                        for (var i = 0; i < this._content.length; i++) {

                            //Abort script
                            var currTime = this.checkTime();
                            var lapseTime = currTime - startTime;
                            var timeOut = 5000; //10 secs
                            if (lapseTime >= timeOut) {
                                //Abort loop, stop script
                                break;
                            }

                            //Clear test container
                            $(this._testElem).html("");

                            var paragraph = this._content[i];

                            $(this._testElem).append(paragraph);
                            //is this paragraph too big to fit by itself?
                            if (this._testElem.scrollHeight > this._testElem.offsetHeight) {
                                this.breakupContent(paragraph);
                                continue;
                            }
                            else {
                                $(this._testElem).html("");
                                $(this._testElem).html($(this._currDivElem).html());
                                $(this._testElem).append(paragraph);
                                if (this._testElem.scrollHeight > this._testElem.offsetHeight) {
                                    this.breakupContent(paragraph);
                                }
                                else {
                                    $(this._currDivElem).append(paragraph);
                                }

                            }
                        } //end for


                        $(this._container)
								.children(":first-child")
								.addClass("visible")
								.addClass("first");

                        $(this._container)
								.children(":last-child")
								.addClass("last");

                        $(this._container).children(":gt(0)").addClass("hidden");


                        var updatePageNumber = function(action) {

                            var currPage = $("#paginatorPageNo", currPager).html();
                            var value = 1;


                            switch (action) {
                                case "increase":
                                    value = ++currPage;
                                    break;
                                case "decrease":
                                    value = --currPage;
                                    break;
                            }

                            $("#paginatorPageNo", currPager).html(value);
                        }



                        $("#paginatorPagesTotal", currPager).html($(this._container).children().size());


                        $(".next", currPager).click(function(event) {
                            var $currPage = $(this._container).find(".visible");
                            if (!$currPage.hasClass("last")) {
                                $currPage
										.removeClass("visible")
										.addClass("hidden")
										.next()
										.addClass("visible")
										.removeClass("hidden");

                                updatePageNumber("increase");

                                //check again after moving to next page
                                $currPage = $(this._container).find(".visible");
                                if ($currPage.hasClass("last")) {
                                    $(this).addClass("disabled");
                                }
                                $(".prev", currPager).removeClass("disabled");
                            }

                            event.preventDefault();
                        });

                        $(".prev", currPager).click(function(event) {
                            var $currPage = $(this._container).find(".visible");
                            if (!$currPage.hasClass("first")) {
                                $currPage
										.removeClass("visible")
										.addClass("hidden")
										.prev()
										.addClass("visible")
										.removeClass("hidden");

                                updatePageNumber("decrease");

                                $currPage = $(this._container).find(".visible");
                                if ($currPage.hasClass("first")) {
                                    $(this).addClass("disabled");
                                }
                                $(".next", currPager).removeClass("disabled");
                            }

                            event.preventDefault();
                        });

                        $(".page").css("overflow", "auto");

                        //Remove pager? 
                        var totalPages = parseInt($("#paginatorPagesTotal", currPager).html());
                        if (totalPages == 1) {
                            var border = document.createElement("hr");
                            $(border).addClass("borderStyleDouble");
                            $(border).insertBefore(currPager);
                            $(currPager).remove();
                        }


                    } //end run

}//end paginator										

                    paginator.init();
                },

                featuresMode: function(currPager) {

                    /**
                    *Page specific info. Total 6 features allowed on page.
                    */
                    var maxNumOfItems = 6;
                    this._index = maxNumOfItems - 1;
                    var parentObj = this;
                    var featureSelector = ".feature";

                    //Hide control? Hides if not needed on page 
                    if ($(featureSelector).size() <= maxNumOfItems) {
                        $(this._id).remove();
                        return false;
                    }

                    var getTotalPages = function(parentObj) {
                        var remainingItems = $(featureSelector).size() % maxNumOfItems;
                        var totalBlankFeatures = maxNumOfItems - remainingItems;
                        var blankFeature = "<div class='article feature blankFeature' style='border: none; height: 227px;'>&nbsp;</div>";
                        var blankFeatureHTML = "";

                        if (remainingItems > 0) {
                            for (var i = 1; i <= totalBlankFeatures; i++) {
                                //add blank features to collection
                                blankFeatureHTML = blankFeatureHTML + blankFeature;
                            }
                            $(".contentOverflow").append($(blankFeatureHTML));
                        }

                        var totalPages = $(featureSelector).size() / maxNumOfItems;
                        $("#paginatorPagesTotal", currPager).html(totalPages);
                    }

                    //Fill page with blank elements (empty placeholders)
                    getTotalPages(this);

                    //Grab all features and store in array object
                    $(featureSelector)
						.each(function() {
						    parentObj._collection.push(this);
						});

                    this._maxCount = this._collection.length;

                    /*//Is there more content?
                    if (parentObj._index+1 == parentObj._maxCount)
                    {
                    $(".prev, .next", parentObj._id).addClass("disabled");
                    }*/

                    //Free memory and delete hidden content
                    $(".contentOverflow").remove();


                    //Assign click events
                    var $paginator = $(currPager);

                    var getNextFeature = function(event) {
                        //Cycle through features
                        if (parentObj._index < parentObj._maxCount - 1) {

                            $(".prev", parentObj._id).removeClass("disabled");

                            //Remove the first feature element
                            $(featureSelector).eq(0).remove();

                            //Move the first right column feature element to bottom of left column
                            var $leftColumn = $(".column", ".columnContainer").eq(0);
                            var $rightColumn = $(".column", ".columnContainer").eq(1);

                            var $feature = $rightColumn.find(featureSelector).eq(0);

                            $leftColumn.append($feature);
                            $feature = null;

                            //Add new feature to bottom of right column above the paginator
                            var feature = parentObj._collection[++parentObj._index];
                            $paginator.before(feature);

                            feature = null;

                            //Are we at the end?
                            if (parentObj._index >= parentObj._maxCount - 1) {
                                //disable next button
                                $(".next", currPager).addClass("disabled");
                            }

                            delete $feature;
                            delete feature;
                        } //end if

                        event.preventDefault();
                        event.stopPropagation();
                    }

                    var getPrevFeature = function(event) {
                        //Cycle through features
                        if (parentObj._index > maxNumOfItems - 1) {
                            $(".next", currPager).removeClass("disabled");

                            var $leftColumn = $(".column", ".columnContainer").eq(0);
                            var $rightColumn = $(".column", ".columnContainer").eq(1);

                            //Remove the last feature element
                            $rightColumn
									.find(featureSelector)
									.eq(2)
									.remove();

                            //Move the last left column feature element to the top of the right column
                            var $feature = $leftColumn.find(featureSelector).eq(2);
                            $rightColumn
									.find(featureSelector)
									.eq(0)
									.before($feature);

                            $feature = null;

                            //Add new feature to top of the left column
                            var feature = parentObj._collection[parentObj._index - maxNumOfItems];
                            parentObj._index--;

                            $leftColumn
									.find(featureSelector)
									.eq(0)
									.before(feature);

                            feature = null;

                            //Are we at the end?
                            if (parentObj._index < 1) {
                                //disable next button
                                $(".prev", currPager).addClass("disabled");
                            }

                            delete $feature;
                            delete feature;
                        } //end if

                        event.preventDefault();
                        event.stopPropagation();
                    }

                    var updateCurrentPageNumber = function() {
                        var currentPage = Math.round(chfGlobal.chfPaginator._index / maxNumOfItems);
                        var nPages = chfGlobal.chfPaginator._maxCount / maxNumOfItems;
                        var $leftColumn = $(".column", ".columnContainer").eq(0);
                        var $rightColumn = $(".column", ".columnContainer").eq(1);
                        var $paginator = $(currPager);

                        var emptyRightColumn = (function() {
                            var blankFeatures = $(".blankFeature").size();
                            if (blankFeatures > 2) {
                                return true;
                            }
                            else {
                                return false;
                            }
                        })();

                        $("#paginatorPageNo", currPager).html(currentPage);

                        //Disable Previous link?
                        if (currentPage == 1) {
                            $(".prev", currPager).addClass("disabled");
                        }

                        //Shift paginator over?
                        if (currentPage == nPages && emptyRightColumn) {
                            $leftColumn.append($paginator);
                        }
                        else {
                            //is paginator on left side?
                            leftSidePaginator = $(currPager, ".columnContainer > .column:eq(0)").size();
                            if (leftSidePaginator) {
                                $rightColumn.append($paginator);
                            }
                        }
                    }

                    //Add Mouse event handlers
                    $paginator
                    //find "next" link and assign click event
							.find(".next")
							.click(
								function(event) {
								    for (var i = 0; i < maxNumOfItems; i++) {
								        getNextFeature(event);
								    }
								    updateCurrentPageNumber();
								}
							)

                    //Transverse the DOM back to paginator element
							.end()

                    //find "previous" link and assign click event
							.find(".prev")
							.click(
								function(event) {
								    for (var i = 0; i < maxNumOfItems; i++) {
								        getPrevFeature(event);
								    }
								    updateCurrentPageNumber();
								}
							);

                },

                profileMode: function(currPager) {
                    var introPresent = /\w/.test($(".listIntro p").text());

                    if (introPresent)
                        $(".ducSidebar .list").prepend("<li>" + $(".listIntro").html() + "</li>");
                    else
                        $(".paginator .title em").hide();

                    var $ducSidebar = $(".ducSidebar");
                    var $profiles = $ducSidebar.find(".list li");

                    //Get total profiles
                    var totalProfiles = $profiles.size();
                    $("#paginatorPagesTotal", currPager).html(totalProfiles);

                    //Hide pager
                    if (totalProfiles == 1) {
                        $profiles.addClass("selected")
							.find("a")
							.clone()
							.insertBefore(".ducProfileLink")
							.addClass("ducProfileLink")
							.addClass("topDots")
							.next("a")
							.remove();

                        $(".ducSidebar .body").addClass("oneListItem");
                        $(currPager).remove();
                        return false;
                    }

                    //Show first profile
                    $profiles
						.eq(0)
						.addClass("selected")
						.find("a")
						.clone()
						.insertBefore(".ducProfileLink")
						.addClass("ducProfileLink")
						.next("a")
						.remove();

                    //Assign functionality to prev & next buttons
                    $(".next", currPager)
						.click(
							function(event) {
							    var currPage = $("#paginatorPageNo", currPager).html();
							    var nextPage = parseInt(currPage) + 1;

							    if (nextPage <= totalProfiles) {
							        $("#paginatorPageNo", currPager).html(nextPage);
							        $profiles
										.filter(".selected")
										.removeClass("selected")
										.next("li")
										.addClass("selected")
										.find("a")
										.clone()
										.insertBefore(".ducProfileLink")
										.addClass("ducProfileLink")
										.next("a")
										.remove();

							        if (currPage == 1 && introPresent)
							            $(".paginator .title em").hide();

							        if (nextPage == totalProfiles)
							            $(this).addClass("disabled");

							        $(".prev", currPager).removeClass("disabled");
							    }
							    event.preventDefault();
							}
						);


                    $(".prev", currPager)
							.click(
								function(event) {
								    var currPage = $("#paginatorPageNo", currPager).html();

								    if (currPage > 1) {
								        var nextPage = parseInt(currPage) - 1;

								        $("#paginatorPageNo", currPager).html(nextPage);
								        $profiles
											.filter(".selected")
											.removeClass("selected")
											.prev("li")
											.addClass("selected")
											.find("a")
											.clone()
											.insertBefore(".ducProfileLink")
											.addClass("ducProfileLink")
											.next("a")
											.remove();

								        if (nextPage == 1)
								            $(this).addClass("disabled");

								        if (currPage == 2 && introPresent) {
								            $(".ducProfileLink").hide();
								            $(".paginator .title em").show();
								        }

								        $(".next", currPager).removeClass("disabled");
								    }

								    event.preventDefault();
								}
							);

                    var currPage = $("#paginatorPageNo").html();
                },

                followLinksMode: function(currPager) {
                    $(".disabled", currPager).click(function(event) {
                        event.preventDefault();
                    });
                },

                listMode: function(currPager) {

                    var $ducSidebar = $(".paginationList");
                    var $listSections = $ducSidebar.find(".list > li");

                    //Get total listSections
                    var totallistSections = $listSections.size();
                    $("#paginatorPagesTotal", currPager).html(totallistSections);

                    //Hide pager
                    if (totallistSections == 1) {
                        $listSections.addClass("selected");

                        $(".ducProfileLink")
							.attr("href", $listSections.attr("url"));

                        $(currPager).remove();
                        return false;
                    }
                    else {
                        //Remove the profile link from DOM					
                        $(".ducProfileLink").remove();
                    }

                    //Show first profile
                    $listSections
						.eq(0)
						.addClass("selected");


                    //Assign functionality to prev & next buttons
                    $(".next", currPager)
						.click(
							function(event) {
							    var currPage = $("#paginatorPageNo", currPager).html();
							    var nextPage = parseInt(currPage) + 1;

							    if (nextPage <= totallistSections) {
							        $("#paginatorPageNo", currPager).html(nextPage);
							        $listSections
										.filter(".selected")
										.removeClass("selected")
										.next("li")
										.addClass("selected");

							        if (nextPage == totallistSections) {
							            $(this).addClass("disabled");
							        }
							        $(".prev", currPager).removeClass("disabled");
							    }
							    event.preventDefault();
							}
						);


                    $(".prev", currPager)
							.click(
								function(event) {
								    var currPage = $("#paginatorPageNo", currPager).html();

								    if (currPage > 1) {
								        var nextPage = parseInt(currPage) - 1;

								        $("#paginatorPageNo", currPager).html(nextPage);
								        $listSections
											.filter(".selected")
											.removeClass("selected")
											.prev("li")
											.addClass("selected");

								        if (nextPage == 1) {
								            $(this).addClass("disabled");
								        }
								        $(".next", currPager).removeClass("disabled");
								    }
								    event.preventDefault();
								}
							);

                    var currPage = $("#paginatorPageNo").html();
                }
            },

            chfDonate: {
                _id: ".contributionLevels",
                _levelSelectors: ".contributionLevels .benefits, .contributionLevels .header a",
                _inputSelector: ".contribution .amount",

                init: function() {
                    if ($(this._id).size() < 1) {
                        return false;
                    }

                    this.assignClickEvnt();

                    this.checkInputAmt();
                },

                assignClickEvnt: function() {

                    var parentObj = this;
                    var $levels = $(this._levelSelectors);

                    $levels
						.click(
							function(event) {
							    var $parentLI = $(this).parents("li:eq(0)");

							    if (!$parentLI.hasClass("selected")) {
							        $(".selected", parentObj._id)
										.find(".selected")
										.removeClass("selected");

							        $parentLI.addClass("selected");
							    }
							    else {
							        $parentLI.removeClass("selected");
							    }

							    $parentLI.siblings().removeClass("selected");

							    event.preventDefault();
							}
					);
                }, //end assignClickEvnt

                checkInputAmt: function() {
                    var parentObj = this;

                    $(this._inputSelector)
						.keyup(
							function() {
							    var $ranges = $("[range]", this._id);
							    var amt = String(this.value).replace(",", "");
							    amt = parseInt(amt);

							    //Reset selection							
							    $(".selected", parentObj._id)
									.removeClass("selected");

							    //Match amount to level range								
							    $ranges
									.each(
										function() {
										    var rangeAmt = $(this).attr("range");

										    var lbound = rangeAmt.split("-")[0];
										    var ubound = rangeAmt.split("-")[1];

										    if ((amt >= lbound) && (amt <= ubound)) {
										        $(this).prev(".header").find("a").click();
										        return false;
										    }
										}
								);
							}
						);
                }

            }, //end chfDonate

            chfPressRoom: function() {

                //Assign mouse events only for Press Room
                if ($(".showAllPressReleases").size() < 1) {
                    return false;
                }

                //Assign button functionality
                $(".showAllPressReleases .showAll")
					.click(
						function(event) {
						    $(this)
								.addClass("hidden")

								.siblings(".hideAll")
								.removeClass("hidden")

								.siblings("ul:eq(0)")
								.removeClass("hidden");

						    event.preventDefault();
						}
					);

                $(".showAllPressReleases .hideAll")
					.click(
						function(event) {
						    $(this)
								.addClass("hidden")

								.siblings(".showAll")
								.removeClass("hidden")

								.siblings("ul:eq(0)")
								.addClass("hidden");

						    event.preventDefault();
						}
					);
            },

            chfBoardOfDirectors: function() {
                var $classSelector = $(".chfStaffBoard .longTitle");
                var maxCharCount = 89;

                if ($classSelector.size() < 1) {
                    return false;
                }

                //Truncate if more than predetermined # of chars.
                $classSelector
					.each(
						function(index) {
						    var $longTitle = $(this);
						    var text = $longTitle.text().replace(/^\s*|\s*$/g, '');
						    var charCount = text.length;

						    if (charCount > maxCharCount) {
						        var abbrText = document.createElement("div");
						        var txtNode = document.createTextNode(text.substr(0, 89) + "...");
						        $(abbrText).addClass("abbr");
						        abbrText.appendChild(txtNode);

						        //Show rest of text when visitor clicks 'more' link
						        var $clickForMore = $("<a class='more' href='#'>More</a>");
						        $clickForMore
									.click(
										function(event) {
										    $(".longTitle .orig").addClass("hidden");
										    $(".longTitle .abbr").removeClass("hidden");

										    $(this)
												.parent(".abbr")
												.addClass("hidden")
												.parents(".longTitle")
												.find(".orig")
												.removeClass("hidden");

										    event.preventDefault();
										}
									);

						        $(abbrText).append($clickForMore);
						        $longTitle.wrapInner("<div class='orig hidden'><div>'");
						        $longTitle.append(abbrText);
						    }
						}
					);
            },

            chfAccordion: {
                _selector: '.accordion',

                init: function() {
                    $(this._selector)
						.each(
							function() {
							    $item = $(this);

							    $item
									.find(".body")
									.hide()

									.end()

									.find(".item")
									.addClass("showAll")

									.find(".title a")
									.click(
										function(event) {

										    var showDescription = $(this).parents("li:eq(0)").hasClass("showAll");

										    if (showDescription) {
										        //Close any open descriptions
										        $(".hideAll")
													.removeClass("hideAll")
													.addClass("showAll")
													.children(".body")
													.slideUp("slow");

										        //Open the current description
										        $(this)
													.parents(".item")
													.removeClass("showAll")
													.addClass("hideAll")
													.find(".body")
													.slideDown("slow");
										    }
										    else {
										        //Close the current description
										        $(this)
												.parents(".item")
												.removeClass("hideAll")
												.addClass("showAll")
												.find(".body")
												.slideUp("slow");
										    }

										    event.preventDefault();
										}
									);
							}
						)
                }
            },


            /**
            * Leave as last function in json object. Add funcs above not below.
            * Contains list of functions that can be called outside of closure in global space.
            */
            chfPublic: {
                isLoggedIn: false,

                summonPrintFriendly: function() {
                    var mUrl = location.href.replace(/(.*)#$/, "$1");
                    var mPrintParam = location.href.indexOf("?") == -1 ? "?p=1" : "&p=1";

                    window.open(mUrl + mPrintParam, "mWindow", "height = 747, width = 780, location = 0, status = 1, toolbar = 0, scrollbars = 1, menubar = 1");
                },

                mCharSizes: {
                    init: function() {
                        var mSample = $(".source p:first");

                        if (mSample.innerHeight()) {
                            this.mDefault = mSample.html().length / mSample.innerHeight();
                            mSample.addClass("sixteenPx");
                            this.mSixteen = mSample.html().length / mSample.innerHeight();
                            mSample.removeClass("sixteenPx").addClass("eighteenPx");
                            this.mEighteen = mSample.html().length / mSample.innerHeight();
                            mSample.removeClass("eighteenPx");
                        }
                    },

                    mGetPixels: function() {
                        if ($(".output").hasClass("sixteenPx"))
                            return this.mSixteen;
                        else if ($(".output").hasClass("eighteenPx"))
                            return this.mEighteen;

                        return this.mDefault;
                    },

                    mDefault: "2.9046",
                    mSixteen: "2.4734",
                    mEighteen: "1.8512"
                },

                mLoadProfileMode: function(yCurrPager) {
                    var currPager = $(yCurrPager);
                    var introPresent = /\w/.test($(".listIntro p").text());

                    if (introPresent)
                        $(".ducSidebar .list").prepend("<li>" + $(".listIntro").html() + "</li>");
                    else
                        $(".paginator .title em").hide();

                    var $ducSidebar = $(".ducSidebar");
                    var $profiles = $ducSidebar.find(".list li");

                    //Get total profiles
                    var totalProfiles = $profiles.size();
                    $("#paginatorPagesTotal", currPager).html(totalProfiles);

                    //Hide pager
                    if (totalProfiles == 1) {
                        $profiles.addClass("selected")
							.find("a")
							.clone()
							.insertBefore(".ducProfileLink")
							.addClass("ducProfileLink")
							.addClass("topDots")
							.next("a")
							.remove();

                        $(".ducSidebar .body").addClass("oneListItem");
                        $(currPager).remove();
                        return false;
                    }

                    //Show first profile
                    $profiles
						.eq(0)
						.addClass("selected")
						.find("a")
						.clone()
						.insertBefore(".ducProfileLink")
						.addClass("ducProfileLink")
						.next("a")
						.remove();

                    //Assign functionality to prev & next buttons
                    $(".next", currPager)
						.click(
							function(event) {
							    var currPage = $("#paginatorPageNo", currPager).html();
							    var nextPage = parseInt(currPage) + 1;

							    if (nextPage <= totalProfiles) {
							        $("#paginatorPageNo", currPager).html(nextPage);
							        $profiles
										.filter(".selected")
										.removeClass("selected")
										.next("li")
										.addClass("selected")
										.find("a")
										.clone()
										.insertBefore(".ducProfileLink")
										.addClass("ducProfileLink")
										.next("a")
										.remove();

							        if (currPage == 1 && introPresent)
							            $(".paginator .title em").hide();

							        if (nextPage == totalProfiles)
							            $(this).addClass("disabled");

							        $(".prev", currPager).removeClass("disabled");
							    }
							    event.preventDefault();
							}
						);


                    $(".prev", currPager)
							.click(
								function(event) {
								    var currPage = $("#paginatorPageNo", currPager).html();

								    if (currPage > 1) {
								        var nextPage = parseInt(currPage) - 1;

								        $("#paginatorPageNo", currPager).html(nextPage);
								        $profiles
											.filter(".selected")
											.removeClass("selected")
											.prev("li")
											.addClass("selected")
											.find("a")
											.clone()
											.insertBefore(".ducProfileLink")
											.addClass("ducProfileLink")
											.next("a")
											.remove();

								        if (nextPage == 1)
								            $(this).addClass("disabled");

								        if (currPage == 2 && introPresent) {
								            $(".ducProfileLink").hide();
								            $(".paginator .title em").show();
								        }

								        $(".next", currPager).removeClass("disabled");
								    }

								    event.preventDefault();
								}
							);

                    var currPage = $("#paginatorPageNo").html();
                },

                mLoadPaginator: function(mReload) {
                    if (!mReload)
                        this.mCharSizes.init();

                    var source = ".longSecondaryArticle .source";
                    mPaginator = this;
                    var mMax = 680; //$(".output").outerHeight();
                    var mThisPageSize = 0;
                    var mCharsPerPixel = this.mCharSizes.mGetPixels(); //$(".source p:first").html().length / $(".source p:first").innerHeight();

                    $(".longSecondaryArticle .output").html("");
                    $(".output").append("<div class='page visible first' style='overflow: auto'></div>");

                    $(source).children().each(function() {
                        var mThisBlockSize = $(this).outerHeight();

                        if (mThisPageSize + mThisBlockSize < mMax) {
                            mThisPageSize += mThisBlockSize;
                            $(this).clone().appendTo(".output .page:last");
                        } else {
                            if (this.nodeName == "P") {
                                $(".output .page:last").append("<p class='outputLast'></p>");
                                var mParagraph = $(".outputLast:last");
                                var mSpaceLeft = mMax - mThisPageSize;
                                var mCharsAvailable = Math.floor(mSpaceLeft * mCharsPerPixel) - 30;

                                $(this).contents().each(function() {
                                    var mImageE;
                                    var mTag;
                                    var mSetImageDimensions = function(mImageElement) {
                                        mTag = "<img src='" + mImageElement.src + "'/>";

                                        if ($(mImageElement).outerHeight() >= mSpaceLeft) {
                                            $(".output").append("<div class='page' style='overflow: auto'><p></p></div>");
                                            mParagraph = $(".output .page p:last");
                                        } else {
                                            mImageSpacePercentage = 1 - (($(mImageElement).outerWidth() * $(mImageElement).outerHeight()) / (351 * mSpaceLeft));
                                            mCharsAvailable = Math.floor(mCharsAvailable * mImageSpacePercentage);
                                        }
                                    }

                                    if (this.nodeName == "#text")
                                        mTag = "<span>" + this.data + "</span>";
                                    else if (this.nodeName == "IMG") {
                                        mSetImageDimensions(this);
                                    } else
                                        mTag = "<" + this.nodeName + ">" + $(this).html() + "</" + this.nodeName + ">";

                                    var mLength = $(mTag).text().length;

                                    if (mLength > mCharsAvailable && mParagraph.hasClass("outputLast")) {
                                        if (this.nodeName == "#text") {
                                            var mText = $(mTag).text();
                                            var mCharsLast = mText.charAt(mCharsAvailable);

                                            for (mI = mCharsAvailable; mI > 0; mI--) {
                                                if (/\s/.test(mText.charAt(mI)))
                                                    break;
                                                else
                                                    mCharsAvailable--;
                                            }

                                            mParagraph.append("<span>" + mText.substr(0, mCharsAvailable) + "</span>");

                                            var mRemainingText = mText.substr(mCharsAvailable, mLength);
                                            var mMaxTextLength = Math.floor(680 * mCharsPerPixel);

                                            while (mRemainingText.length > mMaxTextLength) {
                                                for (mI = mMaxTextLength; mI > 0; mI--) {
                                                    if (/\s/.test(mRemainingText.charAt(mI)))
                                                        break;
                                                    else
                                                        mMaxTextLength--;
                                                }

                                                $(".output").append("<div class='page' style='overflow: auto'><p>" + mRemainingText.substr(0, mMaxTextLength) + "</p></div>");
                                                mRemainingText = mRemainingText.substr(mMaxTextLength, mRemainingText.length - 1);
                                            }

                                            mTag = "<span>" + mRemainingText + "</span>";
                                        }

                                        $(".output").append("<div class='page' style='overflow: auto'><p></p></div>");
                                        mParagraph = $(".output .page p:last");
                                    }

                                    mParagraph.append(mTag);
                                    mCharsAvailable -= mLength;
                                });
                            } else {
                                $(".output").append("<div class='page' style='overflow: auto'></div>");
                                $(".output .page:last").append($(this));
                            }

                            mThisPageSize = $(".output .page:last *:first").outerHeight();
                        }
                    });

                    this.mAddPager();
                },

                mAddPager: function() {
                    var container = ".output";
                    var currPager = $(".longSecondaryArticle .paginator");
                    var totalPages = $('.output .page').length;
                    //alert(totalPages);

                    var updatePageNumber = function(action) {
                        var currPage = $("#paginatorPageNo", currPager).html();
                        var value = 1;

                        switch (action) {
                            case "increase":
                                value = ++currPage;
                                break;
                            case "decrease":
                                value = --currPage;
                                break;
                        }

                        $("#paginatorPageNo", currPager).html(value);
                    }

                    $(container).children(":first-child").addClass("visible").addClass("first");
                    $(container).children(":last-child").addClass("last");
                    $(container).children(":gt(0)").addClass("hidden");

                    $("#paginatorPagesTotal", currPager).html($(container).children().size());

                    $(".next", currPager).click(function(event) {
                        var $currPage = $(container).find(".visible");

                        if (!$currPage.hasClass("last")) {
                            $currPage.removeClass("visible").addClass("hidden").next().addClass("visible").removeClass("hidden");

                            updatePageNumber("increase");

                            $currPage = $(container).find(".visible");

                            if ($currPage.hasClass("last"))
                                $(this).addClass("disabled");

                            $(".prev", currPager).removeClass("disabled");
                        }

                        //                        event.preventDefault();
                    });

                    $(".prev", currPager).click(function(event) {
                        var $currPage = $(this._container).find(".visible");

                        if (!$currPage.hasClass("first")) {
                            $currPage.removeClass("visible").addClass("hidden").prev().addClass("visible").removeClass("hidden");

                            updatePageNumber("decrease");

                            $currPage = $(this._container).find(".visible");

                            if ($currPage.hasClass("first"))
                                $(this).addClass("disabled");

                            $(".next", currPager).removeClass("disabled");
                        }

                        //                        event.preventDefault();
                    });

                    //					$(".page").css("overflow", "auto");

                    var totalPages = parseInt($("#paginatorPagesTotal", currPager).html());

                    if (totalPages == 1) {
                        $(".longSecondaryArticle .body").addClass("borderStyleDouble");
                        $(currPager).hide();
                    } else
                        $(".longSecondaryArticle .body").removeClass("borderStyleDouble");
                },

                showFlashOverlay: function() {
                    $("#mediaPlayer")
						.show();
                },

                hideFlashOverlay: function() {
                    $(".ducOverlay")
						.addClass("hidden");
                },

                popClose: function(el) {
                    $('#' + el).hide();
                },

                hiManny: function() {
                    var mannysRegExp = new RegExp("^\\w+([-+.']\\w+)*@\\w+([-.]\w+)*\\.\\w+([-.]\\w+)*$");
                    var yevvysRegExp = new RegExp("^\\w+([-+.']\\w+)*@\\w+([-.]\w+)*\\.\\w+([-.]\\w+)*(, {0,1}\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*)*$");
                    var mannysEmail = "exweerdo@gmail.com, yevvy@mummymail.com";
                },

                forgotPassword: {
                    returnToSignIn: function() {
                        $("#signinForgotPwd .closeBtn").click();
                        $("a:eq(0)", "#signinContainer").click();
                        $(".forgotForm").show();
                    },
                    success: function(mMessage) {
                        $(document).ready(function() {
                            $("#signinForgotPwd .body").html(mMessage);
                            $("#signinForgotPwd .body").append("<a href='javascript: chfGlobalPublic.forgotPassword.returnToSignIn();'>Go Sign In</a>");
                            $(".forgotForm").hide();
                            $("a:eq(0)", "#signinContainer").click();
                            $(".forgotPassword").click();
                        });
                    },
                    failure: function(mMessage) {
                        $(document).ready(function() {
                            $("#signinForgotPwd .body").append("<div class='red redPositioner'>" + mMessage + "</div>");
                            $("a:eq(0)", "#signinContainer").click();
                            $(".forgotPassword").click();
                        });
                    }
                },

                showSignInError: function(mMessage) {
                    $(document).ready(function() {
                        $("#signinPopup .chfError").html(mMessage);
                        $("a:eq(0)", "#signinContainer").click();
                    });
                },

                srcPop: function(rootURL, assetsPath) {
                    //alert($(".ducOverlay").html());
                    var oldContent = $(".ducOverlay").html();

                    var sEmbed =
                        '<object height="340" width="461">\n' +
                        '\t<param name="movie" value="http://' + rootURL + '/Assets/swf/videoDUC.swf' + assetsPath + '">\n' +
                        '\t<param name="wmode" value="transparent"/>\n' +
                        '\t<param name="allowscriptaccess" value="always"/>\n' +
                        '\t<embed src="http://' + rootURL + '/Assets/swf/videoDUC.swf' + assetsPath + '" width="428" height="338">\n' +
                        '</object>\n';


                    //Create node with src string sent from Flash
                    var popup =
                        $('<div id="srcPop">' +
                        '<div class="closeSrcPop"><img src="/Assets/img/embed_video_close.gif" alt="Close this layer" /></div>' +
                        '<div class="title">Embed This Video</div>' +
                        '<p>Use this HTML code to embed the video on your blog or site:</p>' +
                        '<div class="inner"><textarea id="EmbedText" readonly rows="20"></textarea></div>' +
                        '</div>');

                    $(".ducOverlay").css({ "background": "#000", "height": "339px", "width": "461px" });
                    $(".ducOverlay").html(popup);
                    $("#EmbedText").text(sEmbed);

                    //Removes Popup and Overlay from body onHide
                    var remove = function() { $('#srcPop').remove(); }

                    //Make the 'closeSrcPop' div in the popup the close button
                    $('.closeSrcPop').click(function() {
                        $(".ducOverlay").html(oldContent);
                    });

                },



                GM: {
                    geo: null,
                    map: null,
                    smMap: null,
                    marker: null,
                    bounds: null,
                    address: new Array(),
                    //latLng: new Array(),
                    aLatLng: new Array(),
                    // Call this function when the page has been loaded
                    // no argument loads normal map
                    // an arg loads a map pair (used on Duc pages)
                    initialize: function(type) {
                        //if a ticket has been purchased
                        $('.confirmed').each(function(i, e) {
                            $(this).find('.locate').addClass('hiLite');
                        });
                        var _this = this;

                        //New Geo Locator
                        _this.geo = new GClientGeocoder();

                        //Set the first geo-location then create a map option
                        if (type) {
                            _this.setLatLngArray();
                            _this.smMap();
                        } else {
                            _this.setLatLngArray();
                            _this.setMap();
                        }
                    },
                    lgMap: function() {
                        var _this = this;
                        _this.map = new google.maps.Map2(document.getElementById("lgMap"));
                        //Larger Map Controls (small map has no controls)
                        _this.map.addControl(new GMapTypeControl());
                        _this.map.addControl(new GSmallMapControl());
                        _this.map.enableContinuousZoom();
                        _this.map.enableScrollWheelZoom();
                        _this.geo.getLatLng(_this.address[0], function(point) {
                            if ($('.latLng').text() != 'null') {
                                var coor = $('.latLng').text().split(',');
                                var nPoint = new GLatLng(coor[0], coor[1]);
                                //New Map Bounds instance stored in GM.bounds
                                var box = new GLatLngBounds(nPoint);
                                _this.map.setCenter(nPoint, _this.map.getBoundsZoomLevel(box) - 5);
                                //Add Marker to both maps
                                var mark2 = new GMarker(nPoint);
                                _this.map.addOverlay(mark2);
                            } else {
                                //New Map Bounds instance stored in GM.bounds
                                var box = new GLatLngBounds(point);
                                _this.map.setCenter(point, _this.map.getBoundsZoomLevel(box) - 5);
                                //Add Marker to both maps
                                var mark2 = new GMarker(point);
                                _this.map.addOverlay(mark2);
                            }
                        });
                    },
                    smMap: function() {
                        var _this = this;
                        //New Map Instance
                        _this.smMap = new google.maps.Map2(document.getElementById("smMap"));
                        _this.smMap.disableDragging();

                        _this.geo.getLatLng(_this.address[0], function(point) {
                            //Add Marker to map
                            if ($('.latLng').text() != 'null') {
                                var coor = $('.latLng').text().split(',');
                                var nPoint = new GLatLng(coor[0], coor[1]);
                                _this.smMap.setCenter(nPoint, 15);
                                var mark1 = new GMarker(nPoint);
                            } else {
                                _this.smMap.setCenter(point, 15);
                                var mark1 = new GMarker(point);
                            }

                            _this.smMap.addOverlay(mark1);
                            //Set click event for Larger View link
                            $('.largeMap').click(function() { chfGlobalPublic.GM.lgMap(); return false; });
                        });
                    },
                    setMap: function() {
                        var _this = this;

                        //New Map Instance
                        _this.map = new google.maps.Map2(document.getElementById("map"));
                        //Initialize Custom Markers
                        _this.baseIcon();

                        // Basic Map Controls
                        _this.map.addControl(new GMapTypeControl());
                        _this.map.addControl(new GSmallMapControl());

                        _this.setBounds(_this.address[0]);


                        $.each($('.locate'), function(i, e) {
                            var id = parseInt(i + 1, 10);
                            var addr = _this.address[i];
                            var hi = $(this).hasClass('hiLite');
                            //if($(this).parent('.confirmed')) hi=true;
                            //alert(hi);

                            _this.geo.getLatLng(addr, function(point) {
                                //alert(_this.aLatLng[i]);
                                _this.multiPoint(_this.aLatLng[i], id, hi);
                            });
                        });

                    },
                    setBounds: function(addr) {
                        _this = this;
                        //New Map Bounds instance stored in GM.bounds
                        //This is only used for maps with multiple points
                        _this.geo.getLatLng(_this.address[0], function(point) {
                            _this.bounds = new GLatLngBounds(point);
                        });
                    },
                    setLatLngArray: function() {
                        var _this = this;

                        //Will only register a value for an index if the
                        //corresponding latLng HTML tag contains 'null' string
                        $.each($('.locate'), function(i, e) {
                            _this.address[i] = $(this).text();
                            _this.geo.getLatLng($(this).text(), function(point) {
                                //alert($('#latLng' + i).text());
                                if ($('#latLng' + i).text() == 'null') {
                                    //alert(point);
                                    _this.aLatLng[i] = point;
                                }
                            });
                        });

                        //Now the aLatLng array is populated with values from the latLng HTML tags
                        $.each($('.latLng'), function(i, e) {
                            if ($(this).text() != 'null') {
                                var coor = $(this).text().split(',');
                                _this.aLatLng[i] = new GLatLng(coor[0], coor[1]);
                                //_this.latLng[i] = new GLatLng(coor[0], coor[1]);
                            }
                            $(this).attr('id', 'latLng' + i);
                        });
                        //alert(_this.aLatLng);
                    },
                    baseIcon: function() {
                        _this = this;
                        //Create a base Icon for numbered markers
                        _this.baseIcon = new GIcon(G_DEFAULT_ICON);
                        _this.baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
                        _this.baseIcon.iconSize = new GSize(26, 39);
                        _this.baseIcon.shadowSize = new GSize(37, 42);
                        _this.baseIcon.iconAnchor = new GPoint(9, 34);
                        _this.baseIcon.infoWindowAnchor = new GPoint(9, 2);
                    },
                    starIcon: function() {
                        _this = this;
                        //Create a base Icon for starred markers
                        _this.starIcon = new GIcon(G_DEFAULT_ICON);
                        _this.starIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
                        _this.starIcon.iconSize = new GSize(26, 39);
                        _this.starIcon.shadowSize = new GSize(37, 42);
                        _this.starIcon.iconAnchor = new GPoint(9, 34);
                        _this.starIcon.infoWindowAnchor = new GPoint(9, 2);
                    },
                    //for map w/ multiple, resizes/zooms map window to view all points
                    multiPoint: function(point, id, hi) {
                        //alert(point);
                        _this = this;
                        var box = _this.bounds;

                        //Extend the box
                        box.extend(point);

                        //Zoom the map to show all the markers
                        _this.map.setCenter(box.getCenter(), _this.map.getBoundsZoomLevel(box) - 1);

                        //Add the Numbered/Colored markers
                        _this.map.addOverlay(_this.makeNumberedMarker(point, id, hi));
                    },

                    //Make the Numbered markers on the Itinerary Pages
                    makeNumberedMarker: function(point, index, hiLite) {
                        var _this = this;
                        // Create a numbered icon for this point using our icon class
                        var letteredIcon = new GIcon(_this.baseIcon);

                        if (hiLite) {
                            letteredIcon.image = "../Assets/img/markers/orange/marker" + index + ".png";
                            letteredIcon.printImage = "../Assets/img/markers/orange/marker" + index + ".png";
                            letteredIcon.mozPrintImage = "../Assets/img/markers/orange/marker" + index + ".png";
                        }
                        else {
                            letteredIcon.image = "../Assets/img/markers/green/marker" + index + ".png";
                            letteredIcon.printImage = "../Assets/img/markers/green/marker" + index + ".png";
                            letteredIcon.mozPrintImage = "../Assets/img/markers/green/marker" + index + ".png";
                        }

                        // Set up our GMarkerOptions object
                        markerOptions = { icon: letteredIcon };
                        var marker = new GMarker(point, markerOptions);
                        //alert(point+' '+marker);

                        return marker;
                    }


                }, //end of GM(Google Maps)

                showEmailMessage: function() {
                    chfGlobal.chfClickabilityMenu.init();
                    chfGlobal.chfClickabilityMenu.populateEmailFields();

                    $("#emailMessagePopup").show();
                }
            }

        };

        return chfGlobal.chfPublic;
    }
)(jQuery)

    jQuery.noConflict();
