//alert("included");


$(document).ready(function () {
    var bizname = $('h1.business-title').text();
    var reportURL = window.location.host + "/" + window.location.pathname;
    //$("select").selectbox();
    //$("#chart-select").selectbox();
    //$("#filter-select").selectbox();
    //BLUE!
    $("select:not('.basicddl')").selectbox();
    $('a.external').attr('target', '_blank'); /* replace the <a> target attribute for XHTML Strict compliance. */

    // Image animation and swapping

    // overview tab
    $("ul.thumb li").hover(function () {
        $(this).css({ 'z-index': '10' }); /*Add a higher z-index value so this image stays on top*/
        $(this).find('img').addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
			.animate({
			    marginTop: '-45px', /* The next 4 lines will vertically align this image */
			    marginLeft: '-0px',
			    /*	top: '50%',
			    left: '50%', */
			    width: '100px', /* Set new width */
			    height: '100px', /* Set new height */
			    padding: '0px'
			}, 200); /* this value of "200" is the speed of how fast/slow this hover animates */

    }, function () {
        $(this).css({ 'z-index': '0' }); /* Set z-index back to 0 */
        $(this).find('img').removeClass("hover").stop()  /* Remove the "hover" class , then stop animation queue buildup*/
			.animate({
			    marginTop: '0', /* Set alignment back to default */
			    marginLeft: '0',
			    top: '0',
			    left: '0',
			    width: '55px', /* Set width back to default */
			    height: '55px' /* Set height back to default */
			}, 400);
    }).click(function (evt) {
        $("ul.thumb li.selected").removeClass("selected");
        $(this).addClass("selected");
        var largeUrl = $(this).find('a').attr('rel');
        $("#largeImage").attr('src', largeUrl);
        evt.preventDefault();
    });

    // photos/videos tab
    $("#left .media-module .photo-thumbs li").hover(function () {
        $(this).css({ 'z-index': '10' }); /*Add a higher z-index value so this image stays on top*/
        $(this).find('img').stop() /* Add class of "hover", then stop animation queue buildup*/
			.animate({
			    top: '-16px', /* The next 4 lines will vertically align this image */
			    left: '-18px',
			    width: '100px', /* Set new width */
			    height: '100px', /* Set new height */
			    padding: '0px'
			}, 200); /* this value of "200" is the speed of how fast/slow this hover animates */

    }, function () {
        $(this).css({ 'z-index': '0' }); /* Set z-index back to 0 */
        $(this).find('img').stop()  /* Remove the "hover" class , then stop animation queue buildup*/
			.animate({
			    top: '0',
			    left: '0',
			    width: '63px', /* Set width back to default */
			    height: '63px' /* Set height back to default */
			}, 300);
    }).click(function (evt) {
        $("#left .media-module .photo-thumbs li.selected").removeClass("selected");
        $(this).addClass("selected");
        var relArr, largeUrl, caption, count;
        relArr = $(this).find('a').attr('rel').split('|');
        largeUrl = relArr[0];
        caption = relArr[1];
        count = relArr[2];
        $("#largeImage").attr('src', largeUrl);
        $("#large-photo-caption").text(caption);
        $("#image-count").text(count);
        evt.preventDefault();
    });


    // bind close action to the close button
    $("#industry-comparison-chart .close-win a").bind("click", function (e) {
        $("#industry-comparison-chart").removeClass("show");

        e.preventDefault();
        e.stopPropagation();
        return false;
    });

    /* **************************************************** */

    // bind close action to the alert close button
    $("#alert-pop .close-win a").bind("click", function (e) {
        $("#alert-pop").removeClass("show");
        e.preventDefault();
        e.stopPropagation();
        return false;
    });
    // bind close action to the related business close button
    $("#related-businesses-pop .close-win a").bind("click", function (e) {
        $("#related-businesses-pop").removeClass("show");
        e.preventDefault();
        e.stopPropagation();
        return false;
    });
    // bind close action to the what is review close button
    $("#what-report-pop .close-win a").bind("click", function (e) {
        $("#what-report-pop").removeClass("show");
        e.preventDefault();
        e.stopPropagation();
        return false;
    });
    // bind close action to the additional phone numbers close button
    $("#additional-phone-pop .close-win a").bind("click", function (e) {
        $("#additional-phone-pop").removeClass("show");
        e.preventDefault();
        e.stopPropagation();
        return false;
    });
    // bind close action to the additional email close button
    $("#additional-email-pop .close-win a").bind("click", function (e) {
        $("#additional-email-pop").removeClass("show");
        e.preventDefault();
        e.stopPropagation();
        return false;
    });
    // bind close action to the additional URLs close button
    $("#additional-url-pop .close-win a").bind("click", function (e) {
        $("#additional-url-pop").removeClass("show");
        e.preventDefault();
        e.stopPropagation();
        return false;
    });
    // bind close action to the professional affiliates close button
    $("#professional-affiliations .close-win a").bind("click", function (e) {
        $("#professional-affiliations").removeClass("show");
        e.preventDefault();
        e.stopPropagation();
        return false;
    });

    // bind close action to the complaint definitions close button
    $("#complaint-defs-pop .close-win a").bind("click", function (e) {
        $("#complaint-defs-pop").removeClass("show");
        e.preventDefault();
        e.stopPropagation();
        return false;
    });

    // bind close action to the closure definitions close button
    $("#closure-defs-pop .close-win a").bind("click", function (e) {
        $("#closure-defs-pop").removeClass("show");
        e.preventDefault();
        e.stopPropagation();
        return false;
    });

    // bind close action to the complaint process close button
    $("#complaint-process-pop .close-win a").bind("click", function (e) {
        $("#complaint-process-pop").removeClass("show");
        e.preventDefault();
        e.stopPropagation();
        return false;
    });

    // bind close action to the industry tips close button
    $("#industry-tips-pop .close-win a").bind("click", function (e) {
        $("#industry-tips-pop").removeClass("show");
        e.preventDefault();
        e.stopPropagation();
        return false;
    });

    // bind close action to the Discount Coupons close button
    $("#disc-coupons-pop .close-win a").bind("click", function (e) {
        $("#disc-coupons-pop").removeClass("show");
        e.preventDefault();
        e.stopPropagation();
        return false;
    });

    // bind close action to the What is Advertising Review close button
    $("#what-ad-review-pop .close-win a").bind("click", function (e) {
        $("#what-ad-review-pop").removeClass("show");
        e.preventDefault();
        e.stopPropagation();
        return false;
    });
    // bind close action to the What is Advertising Review close button
    $("#what-is-govt-pop .close-win a").bind("click", function (e) {
        $("#what-is-govt-pop").removeClass("show");
        e.preventDefault();
        e.stopPropagation();
        return false;
    });
    // bind close action to the What is Advertising Review close button
    $("#recommend-review-pop .close-win a").bind("click", function (e) {
        $("#recommend-review-pop").removeClass("show");
        e.preventDefault();
        e.stopPropagation();
        return false;
    });

    // bind print button feature
    $("a.print").bind("click", function (e) {
        //	alert("Print: "+$("body.print-report").length);
        if ($("body.print-report").length <= 0) {

            $("#print-dialog").addClass("show");
            e.preventDefault();
            e.stopPropagation();
            return false;
        }
        else return true;
    });
    $("a.print-this").bind("click", function (e) {
        $("#print-dialog").removeClass("show");
        e.preventDefault();
        e.stopPropagation();
        window.print();
        return false;
    });
    // bind close action to the print close button
    $("#print-dialog .close-win a").bind("click", function (e) {
        $("#print-dialog").removeClass("show");
        e.preventDefault();
        e.stopPropagation();
        return false;
    });
    // bind window.open action to .newWindow
    $(".newWindow").bind("click", function (e) {
        var url = $(this).attr("href");
        var windowName = "popUp"; //$(this).attr("name");
        var windowSize = "width=570,height=768,scrollbars=1";
        window.open(url, windowName, windowSize);
        e.preventDefault();
        return false;
    });
    /* **************************************************** */

    /*********** Expandable Table Views ***************************/
    if ($(".active-table-header").length > 0) { // if there is a table do:
        // create some handy objects
        $.toggleHeader = $(".active-table-header");
        $.toggleTable = $.toggleHeader.siblings("table.complaint-table");
        $.toggleLink = $(".active-table-header").children("a");

        // toggle icons and table view
        $.toggleLink.bind("click", function (e) {
            e.stop;
            if ($(this).children("span.icon").hasClass("open")) {
                $(this).children("span.icon").removeClass("open");
            }
            else {
                $(this).children("span.icon").addClass("open");
            }
            if ($(this).parent(".active-table-header").next("table.complaint-table").hasClass("open")) {
                $(this).parent(".active-table-header").next("table.complaint-table").removeClass("open");
            }
            else {
                $(this).parent(".active-table-header").next("table.complaint-table").addClass("open");
            }
            return false;
        });

        if ($("td.date a").length > 0) {
            $("td.date a").bind("click", function (e) {
                e.stop;

                if ($(this).hasClass("open")) {
                    //alert("close");			
                    $(this).removeClass("open");
                    $(this).parent("td.date").siblings("td.complaint-detail").children(".additional-notes").removeClass("open");
                }
                else {
                    $(this).addClass("open");
                    $(this).parent("td.date").siblings("td.complaint-detail").children(".additional-notes").addClass("open");
                }
                return false;
            });
        }

        // toggle more info icon and div view
        if ($("a.popMoreInfo").length > 0) {
            $("a.popMoreInfo").bind("click", function (e) {
                e.stop;

                if ($(this).parent("td.complaint-detail").siblings("td.date").children("a").hasClass("open")) {
                    //alert("close");			
                    $(this).parent("td.complaint-detail").siblings("td.date").children("a").removeClass("open");
                    $(this).parent("td.complaint-detail").children(".additional-notes").removeClass("open");
                }
                else {
                    $(this).parent("td.complaint-detail").siblings("td.date").children("a").addClass("open");
                    $(this).parent("td.complaint-detail").children(".additional-notes").addClass("open");
                }
                return false;
            });
        }

        // bind close fucntion to the more info close button
        if ($(".additional-notes .close-win").length > 0) {
            $(".additional-notes .close-win").bind("click", function (e) {
                $(this).parent(".additional-notes").removeClass("open");
                $(this).parent(".additional-notes").parent("td.complaint-detail").prev("td.date").children("a").removeClass("open");
                e.preventDefault();
                e.stopPropagation();
                return false;
            });
        }
    }

    //  display the What is a BBB Biz Review DIV wndow
    if ($("#what-report").length > 0) {
        $("#what-report").each(function () {
            $("#what-report").bind("click", function (e) {
                $.linkPOS = $("#what-report");
                $.pos = $.linkPOS.position();
                //alert($.pos.top)
                pageTracker._trackEvent('Pop-up', 'What Is Biz Review', bizname);
                if ($("#what-report-pop").hasClass("show")) {
                    $("#what-report-pop").removeClass("show");
                }
                else { // adjust the window position and display
                    $("#what-report-pop").css("top", ($.pos.top + 35)).css("left", $.pos.left);
                    $("#what-report-pop").addClass("show").bind("click", function () {
                        $("#what-report-pop").removeClass("show");
                    });
                }
                e.stop;
                return false;
            });
        });
    }

    //  display the Professional Affiliations window
    if ($("#profAffil").length > 0) {

        $("#profAffil").each(function () {
            $("#profAffil").bind("click", function (e) {
                $.linkPOS = $("#profAffil");
                $.pos = $.linkPOS.position();
                //alert($.pos.top)
                if ($("#professional-affiliations").hasClass("show")) {
                    //alert('in')
                    $("#professional-affiliations").removeClass("show");
                }
                else { // adjust the window position and display
                    //alert('not');
                    $("#professional-affiliations").css("top", ($.pos.top + 14)).css("left", $.pos.left - 716);
                    $("#professional-affiliations").addClass("show").bind("click", function () {
                        //$("#professional-affiliations").removeClass("show");
                    });
                }
                e.stop;
                return false;
            });
        });
    }

    //  display the What is BBB Advertising Review? window
    if ($("#what-ad-review").length > 0) {

        $("#what-ad-review").each(function () {
            $("#what-ad-review").bind("click", function (e) {
                $.linkPOS = $("#what-ad-review");
                $.pos = $.linkPOS.offset();
                //alert($.pos.top)
                pageTracker._trackEvent('Pop-up', 'Ad Review', bizname);
                if ($("#what-ad-review-pop").hasClass("show")) {
                    //alert('in')
                    $("#what-ad-review-pop").removeClass("show");
                }
                else { // adjust the window position and display
                    //alert('not');
                    $("#what-ad-review-pop").css("top", ($.pos.top)).css("left", $.pos.left + 75);
                    $("#what-ad-review-pop").addClass("show").bind("click", function () {
                        //$("#professional-affiliations").removeClass("show");
                    });
                }
                e.stop;
                return false;
            });
        });
    }
    //  display the What is Government Actions? window
    if ($("#what-is-govt").length > 0) {

        $("#what-is-govt").each(function () {
            $("#what-is-govt").bind("click", function (e) {
                $.linkPOS = $("#what-is-govt");
                $.pos = $.linkPOS.offset();
                //alert($.pos.top)
                pageTracker._trackEvent('Pop-up', 'Govt Actions', bizname);
                if ($("#what-is-govt-pop").hasClass("show")) {
                    //alert('in')
                    $("#what-is-govt-pop").removeClass("show");
                }
                else { // adjust the window position and display
                    //alert('not');
                    $("#what-is-govt-pop").css("top", ($.pos.top)).css("left", $.pos.left + 75);
                    $("#what-is-govt-pop").addClass("show").bind("click", function () {
                        //$("#professional-affiliations").removeClass("show");
                    });
                }
                e.stop;
                return false;
            });
        });
    }

    // display the Complaint Definitions popup
    if ($("#complaint-defs").length > 0) {

        $("#complaint-defs").each(function () {
            $("#complaint-defs").bind("click", function (e) {
                $.linkPOS = $("#complaint-defs");
                $.pos = $.linkPOS.offset();
                //alert($.pos.top)
                pageTracker._trackEvent('Pop-up', 'Complaint Definitions', bizname);
                if ($("#complaint-defs-pop").hasClass("show")) {
                    //alert('in')
                    $("#complaint-defs-pop").removeClass("show");
                }
                else { // adjust the window position and display
                    //alert('not');
                    $("#complaint-defs-pop").css("top", ($.pos.top)).css("left", $.pos.left);
                    $("#complaint-defs-pop").addClass("show").bind("click", function () {
                    });
                }
                e.stop;
                return false;
            });
        });
    }


    // display the Closure Definitions popup
    if ($("#closure-defs").length > 0) {

        $("#closure-defs").each(function () {
            $("#closure-defs").bind("click", function (e) {
                $.linkPOS = $("#closure-defs");
                $.pos = $.linkPOS.offset();
                //alert($.pos.top)
                pageTracker._trackEvent('Pop-up', 'Closure Definitions', bizname);
                if ($("#closure-defs-pop").hasClass("show")) {
                    //alert('in')
                    $("#closure-defs-pop").removeClass("show");
                }
                else { // adjust the window position and display
                    //alert('not');
                    $("#closure-defs-pop").css("top", ($.pos.top)).css("left", $.pos.left);
                    $("#closure-defs-pop").addClass("show").bind("click", function () {
                    });
                }
                e.stop;
                return false;
            });
        });
    }

    // display the Complaints Process popup
    if ($("#complaint-process").length > 0) {

        $("#complaint-process").each(function () {
            $("#complaint-process").bind("click", function (e) {
                $.linkPOS = $("#complaint-process");
                $.pos = $.linkPOS.offset();
                //alert($.pos.top)
                pageTracker._trackEvent('Pop-up', 'Complaint Process', bizname);
                if ($("#complaint-process-pop").hasClass("show")) {
                    //alert('in')
                    $("#complaint-process-pop").removeClass("show");
                }
                else { // adjust the window position and display
                    //alert('not');
                    $("#complaint-process-pop").css("top", ($.pos.top)).css("left", $.pos.left + 60);
                    $("#complaint-process-pop").addClass("show").bind("click", function () {
                    });
                }
                e.stop;
                return false;
            });
        });
    }

    // display the Industry Comparison Chart popup
    if ($("#icchart").length > 0) {

        $("#icchart").each(function () {
            $("#icchart").bind("click", function (e) {
                $.linkPOS = $("#icchart");
                $.pos = $.linkPOS.position();
                //alert($.pos.top)
                pageTracker._trackEvent('Pop-up', 'Industry Comparison', bizname);
                if ($("#industry-comparison-chart").hasClass("show")) {
                    //alert('in')
                    $("#industry-comparison-chart").removeClass("show");
                }
                else { // adjust the window position and display
                    //alert('not');
                    $("#industry-comparison-chart").css("top", ($.pos.top + 1238)).css("left", $.pos.left + 287);
                    $("#industry-comparison-chart").addClass("show").bind("click", function () {
                        //	$("#industry-comparison-chart").removeClass("show");
                    });
                }
                e.stop;
                return false;
            });
        });
    }

    // display the Industry Tips popup
    if ($("#industry-tips").length > 0) {

        $("#industry-tips").each(function () {
            $("#industry-tips").bind("click", function (e) {
                $.linkPOS = $("#industry-tips");
                $.pos = $.linkPOS.offset();
                //alert($.pos.top)
                if ($("#industry-tips-pop").hasClass("show")) {
                    //alert('in')
                    $("#industry-tips-pop").removeClass("show");
                }
                else { // adjust the window position and display
                    //alert('not');
                    $("#industry-tips-pop").css("top", ($.pos.top)).css("left", $.pos.left - 360);
                    $("#industry-tips-pop").addClass("show").bind("click", function () {
                        $("#industry-tips-pop").removeClass("show");
                    });
                }
                e.stop;
                return false;
            });
        });
    }

    // display the Discount Coupons popup
    if ($("#disc-coupons").length > 0) {

        $("#disc-coupons").each(function () {
            $("#disc-coupons").bind("click", function (e) {
                $.linkPOS = $("#disc-coupons");
                $.pos = $.linkPOS.position();
                //alert($.pos.top)
                if ($("#disc-coupons-pop").hasClass("show")) {
                    //alert('in')
                    $("#disc-coupons-pop").removeClass("show");
                }
                else { // adjust the window position and display
                    //alert('not');
                    $("#disc-coupons-pop").css("top", ($.pos.top + 16)).css("left", $.pos.left - 394);
                    $("#disc-coupons-pop").addClass("show").bind("click", function () {
                        //$("#professional-affiliations").removeClass("show");
                    });
                }
                e.stop;
                return false;
            });
        });
    }

    // display the Feedback Recommend Review popup

    if ($("#feedback-yes").length > 0) {

        $("#feedback-yes").each(function () {
            $("#feedback-yes").bind("click", function (e) {
                $.linkPOS = $("#feedback-yes");
                $.pos = $.linkPOS.position();
                $.surveyURL = $("#feedback-yes").attr("href");
                //alert($.pos.top)
                //alert($.surveyURL);
                pageTracker._trackEvent('Pop-up', 'Feedback Yes', bizname);
                if ($("#recommend-review-pop").hasClass("show")) {
                    //alert('in')
                    $("#recommend-review-pop").removeClass("show");
                }
                else { // adjust the window position and display
                    //alert('not');
                    $("#recommend-review-pop").css("top", ($.pos.top - 10)).css("left", $.pos.left - 94);
                    $("#recommend-review-pop").addClass("show").bind("click", function () {
                    });
                    //window.open($.surveyURL); open survey window to record "yes" response
                }
                $.post($.surveyURL, {});
                e.stop;
                return false;
            });
        });
    }

    // display the Feedback Recommend Review popup
    if ($("#feedback-no").length > 0) {
        $("#feedback-no").each(function () {
            $("#feedback-no").bind("click", function (e) {
                $.linkPOS = $("#feedback-no");
                $.pos = $.linkPOS.position();
                $.surveyURL = $("#feedback-no").attr("href");
                //alert($.pos.top)
                //alert($.surveyURL);
                pageTracker._trackEvent('Pop-up', 'Feedback No', bizname);
                if ($("#recommend-review-pop").hasClass("show")) {
                    //alert('in')
                    $("#recommend-review-pop").removeClass("show");
                }
                else { // adjust the window position and display
                    //alert('not');
                    $("#recommend-review-pop").css("top", ($.pos.top - 10)).css("left", $.pos.left - 146);
                    $("#recommend-review-pop").addClass("show").bind("click", function () {
                    });
                    //window.open($.surveyURL); open survey window to record "no" response
                }
                $.get($.surveyURL);
                e.stop;
                return false;
            });
        });
    }

    //  display Additional Phone Numbers DIV wndow
    if ($("#additional-phone-link").length > 0) {
        $("#additional-phone-link").each(function () {
            $("#additional-phone-link").bind("click", function (e) {
                $.linkPOS = $("#additional-phone-link");
                $.pos = $.linkPOS.offset();
                //alert($.pos.top)
                pageTracker._trackEvent('Pop-up', 'Additional Phone Numbers', bizname);
                if ($("#additional-phone-pop").hasClass("show")) {
                    $("#additional-phone-pop").removeClass("show");
                }
                else {
                    $("#additional-phone-pop").css("top", ($.pos.top)).css("left", $.pos.left);
                    $("#additional-phone-pop").addClass("show").bind("click", function () {
                        $("#additional-phone-pop").removeClass("show");
                    });
                }
                e.stop;
                return false;
            });
        });
    }
    //  display Additional Emails DIV wndow
    if ($("#additional-email-link").length > 0) {
        $("#additional-email-link").each(function () {
            $("#additional-email-link").bind("click", function (e) {
                $.linkPOS = $("#additional-email-link");
                $.pos = $.linkPOS.offset();
                //alert($.pos.top)
                pageTracker._trackEvent('Pop-up', 'Additional Emails', bizname);
                if ($("#additional-email-pop").hasClass("show")) {
                    $("#additional-email-pop").removeClass("show");
                }
                else {
                    $("#additional-email-pop").css("top", ($.pos.top)).css("left", $.pos.left);
                    $("#additional-email-pop").addClass("show").bind("click", function () {
                        $("#additional-email-pop").removeClass("show");
                    });
                }
                e.stop;
                return false;
            });
        });
    }
    //  display Additional URLs DIV wndow
    if ($("#additional-url-link").length > 0) {
        $("#additional-url-link").each(function () {
            $("#additional-url-link").bind("click", function (e) {
                $.linkPOS = $("#additional-url-link");
                $.pos = $.linkPOS.offset();
                //alert($.pos.top)
                pageTracker._trackEvent('Pop-up', 'Additional URLs', bizname);
                if ($("#additional-url-pop").hasClass("show")) {
                    $("#additional-url-pop").removeClass("show");
                }
                else {
                    $("#additional-url-pop").css("top", ($.pos.top)).css("left", $.pos.left);
                    $("#additional-url-pop").addClass("show").bind("click", function () {
                        $("#additional-url-pop").removeClass("show");
                    });
                }
                e.stop;
                return false;
            });
        });
    }

    //  display the Alert for this Business DIV wndow
    if ($("#alert-link").length > 0) {
        $("#alert-link").each(function () {
            $("#alert-link").bind("click", function (e) {
                $.linkPOS = $("#alert-link");
                $.pos = $.linkPOS.offset();
                //alert($.pos.top)
                pageTracker._trackEvent('Pop-up', 'Alert', bizname);
                if ($("#alert-pop").hasClass("show")) {
                    $("#alert-pop").removeClass("show");
                }
                else {
                    $("#alert-pop").css("top", ($.pos.top + 35)).css("left", $.pos.left);
                    $("#alert-pop").addClass("show").bind("click", function () {
                        $("#alert-pop").removeClass("show");
                    });
                }
                e.stop;
                return false;
            });
        });
    }

    //  display the Related Businesses DIV wndow
    if ($("#related-businesses").length > 0) {
        $("#related-businesses").each(function () {
            $("#related-businesses").bind("click", function (e) {
                $.linkPOS = $("#related-businesses");
                $.pos = $.linkPOS.offset();
                //alert($.pos.top)
                pageTracker._trackEvent('Pop-up', 'Related Businesses', bizname);
                if ($("#related-businesses-pop").hasClass("show")) {
                    $("#related-businesses-pop").removeClass("show");
                }
                else {
                    $("#related-businesses-pop").css("top", ($.pos.top + 35)).css("left", $.pos.left);
                    $("#related-businesses-pop").addClass("show").bind("click", function () {
                        $("#related-businesses-pop").removeClass("show");
                    });
                }
                e.stop;
                return false;
            });
        });
    }

    //  display the Reporting Language  DIV wndow
    if ($("#reporting-policy").length > 0) {
        $("#reporting-policy").each(function () {
            $("#reporting-policy").bind("click", function (e) {
                $.linkPOS = $("#reporting-policy");
                $.pos = $.linkPOS.offset();
                //alert($.pos.top)
                pageTracker._trackEvent('Pop-up', 'Reporting Policy', bizname);
                if ($("#reporting-policy-pop").hasClass("show")) {
                    $("#reporting-policy-pop").removeClass("show");
                }
                else {
                    $("#reporting-policy-pop").css("top", ($.pos.top - 240)).css("left", $.pos.left);
                    $("#reporting-policy-pop").addClass("show").bind("click", function () {
                        $("#reporting-policy-pop").removeClass("show");
                    });
                }
                e.stop;
                return false;
            });
        });
    }
    //GA Tracking
    $(".share").bind("click", function (e) {
        pageTracker._trackPageview(reportURL + '/share/');
    });
    $(".print-this").bind("click", function (e) {
        pageTracker._trackPageview(reportURL + '/print-this/');
    });
    $(".survey-link").bind("click", function (e) {
        pageTracker._trackPageview(reportURL + '/survey/');
    });
    $(".directions-button").bind("click", function (e) {
        pageTracker._trackEvent('Business Review Buttons', 'Get Directions', bizname);
    });


    /************** GOOLGE MAP FUNCTIONS *********************/
    $('#business-additional-info-map .enlarge').click(function (evt) {
        var elm, isSmall, parent, largePhoto, smallPhoto, expandable;

        elm = $(this);
        isSmall = !elm.hasClass("large");
        parent = elm.parent().parent();
        smallPhoto = parent.find('.small-map');
        largePhoto = parent.find('.large-map');
        expandable = parent.find(".inner-holder");

        if (isSmall) {
            //we need to go small	
            elm.text('Shrink').addClass("large");

            smallPhoto.fadeOut(
				200, function () {
				    expandable.animate({
				        width: 628,
				        height: 434
				    }, 350, function () {
				        largePhoto.fadeIn(200);
				    });
				})

        } else {
            elm.text('Enlarge').removeClass("large");

            largePhoto.fadeOut(
				200, function () {
				    expandable.animate({
				        width: 230,
				        height: 230
				    }, 350, function () {
				        smallPhoto.fadeIn(200);
				    });
				})

        }

        evt.preventDefault();

    });

    if ($("#gmaps-container").length > 0) {

        var map, geocoder, address;
        //BLUE!
        //map = new GMap2(document.getElementById("gmaps-container"));
        //map.setUIToDefault();

        //geocoder = new GClientGeocoder();
        if (($("#toLng")[0].value != "") && ($("#toLat")[0].value != "") && (1 == 0)) {
        } else {
            address = $("#toAddress")[0].value + ", " + $("#toCity")[0].value + ", " + $("#toState")[0].value + " " + $("#toZip")[0].value;
            $("#gmaps-container").goMap({
                address: address,
                zoom: 15,
                scaleControl: true,
                maptype: 'ROADMAP',
                markers: [{
                    address: address
                }]
            });
        }
        /*
        geocoder.getLatLng(
        address,
        function(point){
        map.setCenter(point, 14);
        var marker = new GMarker(point, {draggable: true});  
        map.addOverlay(marker); 												   
        });
        */
    }


    // Clear text fields 
    /*
    if($("input[type=text]").length > 0) {
    $("input[type=text]").each(function() {
    $(this).clearField();
    });
    }
    */

    // Reset Font Size
    $(".text-large").click(function () {

        $("body").css("font-size", "16px");

    });

    $(".text-med").click(function () {

        $("body").css("font-size", "12px");

    })

    $(".text-small").click(function () {

        $("body").css("font-size", "10px");

    })



});

