g_HomePageLink = "lower-deschutes.php"; //default
g_RtColHover = 0; //Override anywhere in html since the code below doesn't execute until doc ready

s7_DAY = 1;
s30_DAY = 2;
sYEAR = 3;

$(document).ready(function() {

    if (g_RtColHover)
    {
        $("#Right-Col").fadeTo("0",0.3);
        $("#Right-Col").show("0");
    }
    else
    {
        if (chkObject(false,"Right-Col"))
            document.getElementById("Right-Col").style.display="block";
    }    


    //$.preloadCssImages();
    flychartInit();

    /* Note: Home will need to in the form http://fishthedeschutes.com/XXXXXXX therefore this function will have to take that into account */
    /*       The plan is for SEO reasons to have a home page per body of water. the default home page will be the lower deschutes and will */
    /*       be a 301 re-direct to http://fishthedeschutes.com/lower-deschutes-river.  Also, don't forget to set 301s for all exist pages  */
    /*       from the old site
    /* Update: Since everything is going to live on the main site now flyandfiled.com this no longer necessary.  Home means home now                                                                                                             */
    
    $("#HomeMask").click(function(event) {
        window.location.href = g_HomePageLink;
    });
    

    $("#Right-Col").hover(
    function () {
    if (g_RtColHover)
      {$(this).fadeTo("fast",1);}
    }, 
    function () {
    if (g_RtColHover)
      {$(this).fadeTo("fast",0.3);}
    }
    );

    /* ************** COMMENTS ***************** */
    $("#CommentBlockCtl").click(function(event) {
        event.preventDefault();
        $("#CommentBlock").show();
    });

    /* ************** Read More / Less Controls ****** */
    $("#ReadMoreLowerDeschutesCtl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreLowerDeschutes").hide();
        $("#ReadMoreLowerDeschutesMore").show("3000");        
        $("#ReadLessLowerDeschutes").show();        
    });    

    $("#ReadLessLowerDeschutesCtl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreLowerDeschutes").show();
        $("#ReadMoreLowerDeschutesMore").hide("3000");        
        $("#ReadLessLowerDeschutes").hide();        
    });    
    
    
    $("#ReadMoreUpperDeschutesCtl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreUpperDeschutes").hide();
        $("#ReadMoreUpperDeschutesMore").show("3000");        
        $("#ReadLessUpperDeschutes").show();        
    });    

    $("#ReadLessUpperDeschutesCtl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreUpperDeschutes").show();
        $("#ReadMoreUpperDeschutesMore").hide("3000");        
        $("#ReadLessUpperDeschutes").hide();        
    });    
                 
    $("#ReadMoreFallRiverCtl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreFallRiver").hide();
        $("#ReadMoreFallRiverMore").show("3000");        
        $("#ReadLessFallRiver").show();        
    });    

    $("#ReadLessFallRiverCtl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreFallRiver").show();
        $("#ReadMoreFallRiverMore").hide("3000");        
        $("#ReadLessFallRiver").hide();        
    });    

    $("#ReadMoreCrookedRiverCtl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreCrookedRiver").hide();
        $("#ReadMoreCrookedRiverMore").show("3000");        
        $("#ReadLessCrookedRiver").show();        
    });    

    $("#ReadLessCrookedRiverCtl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreCrookedRiver").show();
        $("#ReadMoreCrookedRiverMore").hide("3000");        
        $("#ReadLessCrookedRiver").hide();        
    });    

    $("#ReadMoreMetoliusRiverCtl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreMetoliusRiver").hide();
        $("#ReadMoreMetoliusRiverMore").show("3000");        
        $("#ReadLessMetoliusRiver").show();        
    });    

    $("#ReadLessMetoliusRiverCtl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreMetoliusRiver").show();
        $("#ReadMoreMetoliusRiverMore").hide("3000");        
        $("#ReadLessMetoliusRiver").hide();        
    });    

    $("#ReadMoreEastLakeCtl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreEastLake").hide();
        $("#ReadMoreEastLakeMore").show("3000");        
        $("#ReadLessEastLake").show();        
    });    

    $("#ReadLessEastLakeCtl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreEastLake").show();
        $("#ReadMoreEastLakeMore").hide("3000");        
        $("#ReadLessEastLake").hide();        
    });    

    
    $("#ReadMoreLavaLakesCtl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreLavaLakes").hide();
        $("#ReadMoreLavaLakesMore").show("3000");        
        $("#ReadLessLavaLakes").show();        
    });    

    $("#ReadLessLavaLakesCtl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreLavaLakes").show();
        $("#ReadMoreLavaLakesMore").hide("3000");        
        $("#ReadLessLavaLakes").hide();        
    });    

      
    $("#ReadMoreHosmerCtl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreHosmer").hide();
        $("#ReadMoreHosmerMore").show("3000");        
        $("#ReadLessHosmer").show();        
    });    

    $("#ReadLessHosmerCtl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreHosmer").show();
        $("#ReadMoreHosmerMore").hide("3000");        
        $("#ReadLessHosmer").hide();        
    });    

    $("#ReadMoreCraneCtl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreCrane").hide();
        $("#ReadMoreCraneMore").show("3000");        
        $("#ReadLessCrane").show();        
    });    

    $("#ReadLessCraneCtl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreCrane").show();
        $("#ReadMoreCraneMore").hide("3000");        
        $("#ReadLessCrane").hide();        
    });    
      
    $("#ReadMoreHomePg1Ctl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreHomePg1").hide();
        $("#ReadMoreHomePg1More").show("3000");        
        $("#ReadLessHomePg1").show();        
    });    

    $("#ReadLessHomePg1Ctl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreHomePg1").show();
        $("#ReadMoreHomePg1More").hide("3000");        
        $("#ReadLessHomePg1").hide();        
    });    

    $("#ReadMoreHomePg2Ctl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreHomePg2").hide();
        $("#ReadMoreHomePg2More").show("3000");        
        $("#ReadLessHomePg2").show();        
    });    

    $("#ReadLessHomePg2Ctl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreHomePg2").show();
        $("#ReadMoreHomePg2More").hide("3000");        
        $("#ReadLessHomePg2").hide();        
    });    

    $("#ReadMoreHomePg3Ctl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreHomePg3").hide();
        $("#ReadMoreHomePg3More").show("3000");        
        $("#ReadLessHomePg3").show();        
    });    
      
    $("#ReadLessHomePg3Ctl").click(function(event) {
        event.preventDefault();        
        $("#ReadMoreHomePg3").show();
        $("#ReadMoreHomePg3More").hide("3000");        
        $("#ReadLessHomePg3").hide();        
    });    

      
    /* ************** CHART POPUPS ***************** */

    /**************** Open Charts ***************** */
    
    /* Madras */
    $("#SevenDayMadras").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupMadras7Day").show("3000");
        //GraphChart("Madras7DayChartHolder-Flow", "madras7day-flow.xml", s7_DAY);
        //GraphChart("Madras7DayChartHolder-Stage", "madras7day-stage.xml", s7_DAY);
    });

    $("#ThirtyDayMadras").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupMadras30Day").show("3000");
        //GraphChart("Madras30DayChartHolder-Flow", "madras30day-flow.xml", s30_DAY);
        //GraphChart("Madras30DayChartHolder-Stage", "madras30day-stage.xml", s30_DAY);
    });

    $("#YearMadras").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupMadrasYear").show("3000");
        //GraphChart("MadrasYearChartHolder-Flow", "madras-year-flow.xml", sYEAR);
        //GraphChart("MadrasYearChartHolder-Stage", "madras-year-stage.xml", sYEAR);
    });

    /* Moody */
        $("#SevenDayMoody").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupMoody7Day").show("3000");
        //GraphChart("Moody7DayChartHolder-Flow", "moody7day-flow.xml", s7_DAY);
        //GraphChart("Moody7DayChartHolder-Stage", "moody7day-stage.xml", s7_DAY);
    });

    $("#ThirtyDayMoody").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupMoody30Day").show("3000");
        //GraphChart("Moody30DayChartHolder-Flow", "moody30day-flow.xml", s30_DAY);
        //GraphChart("Moody30DayChartHolder-Stage", "moody30day-stage.xml", s30_DAY);
    });

    $("#YearMoody").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupMoodyYear").show("3000");
        //GraphChart("MoodyYearChartHolder-Flow", "moody-year-flow.xml", sYEAR);
        //GraphChart("MoodyYearChartHolder-Stage", "moody-year-stage.xml", sYEAR);
    });

    /* Shitike */     
        $("#SevenDayShitike").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupShitike7Day").show("3000");
        //GraphChart("Shitike7DayChartHolder-Flow", "shitike7day-flow.xml", s7_DAY);
        //GraphChart("Shitike7DayChartHolder-Stage", "shitike7day-stage.xml", s7_DAY);
    });

    $("#ThirtyDayShitike").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupShitike30Day").show("3000");
        //GraphChart("Shitike30DayChartHolder-Flow", "shitike30day-flow.xml", s30_DAY);
        //GraphChart("Shitike30DayChartHolder-Stage", "shitike30day-stage.xml", s30_DAY);
    });

    $("#YearShitike").click(function(event) {
        event.preventDefault();        
        ClosePopUps();
        $("#ChartPopupShitikeYear").show("3000");
        //GraphChart("ShitikeYearChartHolder-Flow", "shitike-year-flow.xml", sYEAR);
        //GraphChart("ShitikeYearChartHolder-Stage", "shitike-year-stage.xml", sYEAR);
    });

    /* Kahneeta */     
        $("#SevenDayKahneeta").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupKahneeta7Day").show("3000");
        //GraphChart("Kahneeta7DayChartHolder-Flow", "kahneeta7day-flow.xml", s7_DAY);
        //GraphChart("Kahneeta7DayChartHolder-Stage", "kahneeta7day-stage.xml", s7_DAY);
    });

    $("#ThirtyDayKahneeta").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupKahneeta30Day").show("3000");
        //GraphChart("Kahneeta30DayChartHolder-Flow", "kahneeta30day-flow.xml", s30_DAY);
        //GraphChart("Kahneeta30DayChartHolder-Stage", "kahneeta30day-stage.xml", s30_DAY);
    });

    $("#YearKahneeta").click(function(event) {
        event.preventDefault();        
        ClosePopUps();
        $("#ChartPopupKahneetaYear").show("3000");
        //GraphChart("KahneetaYearChartHolder-Flow", "kahneeta-year-flow.xml", sYEAR);
        //GraphChart("KahneetaYearChartHolder-Stage", "kahneeta-year-stage.xml", sYEAR);
    });

    /* Metolius River Grandview */
    $("#SevenDayGrandview").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupGrandview7Day").show("3000");
        //GraphChart("Grandview7DayChartHolder-Flow", "grandview7day-flow.xml", s7_DAY);
        //GraphChart("Grandview7DayChartHolder-Stage", "grandview7day-stage.xml", s7_DAY);
    });

    $("#ThirtyDayGrandview").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupGrandview30Day").show("3000");
        //GraphChart("Grandview30DayChartHolder-Flow", "grandview30day-flow.xml", s30_DAY);
        //GraphChart("Grandview30DayChartHolder-Stage", "grandview30day-stage.xml", s30_DAY);
    });

    $("#YearGrandview").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupGrandviewYear").show("3000");
        //GraphChart("GrandviewYearChartHolder-Flow", "grandview-year-flow.xml", sYEAR);
        //GraphChart("GrandviewYearChartHolder-Stage", "grandview-year-stage.xml", sYEAR);
    });

    /* Upper Deschutes Benham Falls */
    $("#SevenDayBenham").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupBenham7Day").show("3000");
    });

    $("#ThirtyDayBenham").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupBenham30Day").show("3000");
    });

    $("#YearBenham").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupBenhamYear").show("3000");
    });


    /* Crooked River Below Prineville Resv. */
    $("#SevenDayPrineville").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupPrineville7Day").show("3000");
    });

    $("#ThirtyDayPrineville").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupPrineville30Day").show("3000");
    });

    $("#YearPrineville").click(function(event) {
        event.preventDefault();
        ClosePopUps();
        $("#ChartPopupPrinevilleYear").show("3000");
    });

    
    /* ************************** Close Charts ******************************** */
    
    /* Madras */
    $("#CloseChartPopupMadras7Day").click(function(event) {
        event.preventDefault();
        $("#ChartPopupMadras7Day").hide("0");
    });

    $("#CloseChartPopupMadras30Day").click(function(event) {
        event.preventDefault();
        $("#ChartPopupMadras30Day").hide("0");
    });

    $("#CloseChartPopupMadrasYear").click(function(event) {
        event.preventDefault();
        $("#ChartPopupMadrasYear").hide("0");
    });

    /* Moody */
    $("#CloseChartPopupMoody7Day").click(function(event) {
        event.preventDefault();
        $("#ChartPopupMoody7Day").hide("0");
    });

    $("#CloseChartPopupMoody30Day").click(function(event) {
        event.preventDefault();
        $("#ChartPopupMoody30Day").hide("0");
    });

    $("#CloseChartPopupMoodyYear").click(function(event) {
        event.preventDefault();
        $("#ChartPopupMoodyYear").hide("0");
    });
    
    /* Shitike */
    $("#CloseChartPopupShitike7Day").click(function(event) {
        event.preventDefault();
        $("#ChartPopupShitike7Day").hide("0");
    });

    $("#CloseChartPopupShitike30Day").click(function(event) {
        event.preventDefault();
        $("#ChartPopupShitike30Day").hide("0");
    });

    $("#CloseChartPopupShitikeYear").click(function(event) {
        event.preventDefault();
        $("#ChartPopupShitikeYear").hide("0");
    });

    /* Kahneeta */
    $("#CloseChartPopupKahneeta7Day").click(function(event) {
        event.preventDefault();
        $("#ChartPopupKahneeta7Day").hide("0");
    });

    $("#CloseChartPopupKahneeta30Day").click(function(event) {
        event.preventDefault();
        $("#ChartPopupKahneeta30Day").hide("0");
    });

    $("#CloseChartPopupKahneetaYear").click(function(event) {
        event.preventDefault();
        $("#ChartPopupKahneetaYear").hide("0");
    });

    /* Metolius River Grandview */
    $("#CloseChartPopupGrandview7Day").click(function(event) {
        event.preventDefault();
        $("#ChartPopupGrandview7Day").hide("0");
    });

    $("#CloseChartPopupGrandview30Day").click(function(event) {
        event.preventDefault();
        $("#ChartPopupGrandview30Day").hide("0");
    });

    $("#CloseChartPopupGrandviewYear").click(function(event) {
        event.preventDefault();
        $("#ChartPopupGrandviewYear").hide("0");
    });

    /* Upper Deschutes Benham Falls */
    $("#CloseChartPopupBenham7Day").click(function(event) {
        event.preventDefault();
        $("#ChartPopupBenham7Day").hide("0");
    });

    $("#CloseChartPopupBenham30Day").click(function(event) {
        event.preventDefault();
        $("#ChartPopupBenham30Day").hide("0");
    });

    $("#CloseChartPopupBenhamYear").click(function(event) {
        event.preventDefault();
        $("#ChartPopupBenhamYear").hide("0");
    });

    /* Crooked River Below Prineville Resv. */
    $("#CloseChartPopupPrineville7Day").click(function(event) {
        event.preventDefault();
        $("#ChartPopupPrineville7Day").hide("0");
    });

    $("#CloseChartPopupPrineville30Day").click(function(event) {
        event.preventDefault();
        $("#ChartPopupPrineville30Day").hide("0");
    });

    $("#CloseChartPopupPrinevilleYear").click(function(event) {
        event.preventDefault();
        $("#ChartPopupPrinevilleYear").hide("0");
    });

    
    /* ************** FORECAST ***************** */
    $("#MenuForecast").click(function(event) {
        event.preventDefault();
        $("#ForecastDetail").show("3000");

        $("#GuidesTopPicksDetail").hide("fast");
        $("#RiverLevelsDetail").hide("fast");
        $("#FlyChartDetail").hide("fast");
        $("#ForecastOpenDiv").hide();
        $("#ForecastCloseDiv").show();

        $("#GTPOpenDiv").show();
        $("#GTPCloseDiv").hide();
        
        $("#RLCOpenDiv").show();
        $("#RLCCloseDiv").hide();
        $("#FlyChartOpenDiv").show();
        $("#FlyChartCloseDiv").hide();
        ClosePopUps();
    });

    $("#ForecastOpenDiv").click(function(event) {
        event.preventDefault();
        $(this).hide();
        $("#ForecastCloseDiv").show();
        $("#ForecastDetail").show("3000");

        $("#GuidesTopPicksDetail").hide("fast");
                
        $("#FlyChartDetail").hide("fast");
        $("#RiverLevelsDetail").hide("fast");
        
        $("#GTPOpenDiv").show();
        $("#GTPCloseDiv").hide();


        $("#RLCOpenDiv").show();
        $("#RLCCloseDiv").hide();
        $("#FlyChartOpenDiv").show();
        $("#FlyChartCloseDiv").hide();
        ClosePopUps();
    });

    $("#ForecastCloseDiv").click(function(event) {
        event.preventDefault();
        $(this).hide();
        $("#ForecastOpenDiv").show();
        $("#ForecastDetail").hide("3000");
    });

    $("#CloseForecastDetail").click(function(event) {
        event.preventDefault();
        $("#ForecastCloseDiv").hide();
        $("#ForecastOpenDiv").show();
        $("#ForecastDetail").hide("3000");
    });

    /* ************ FLY CHART ******************* */
    $("#MenuFlyChart").click(function(event) {
        event.preventDefault();
        $("#FlyChartDetail").show("3000");

        $("#GuidesTopPicksDetail").hide("fast");

        $("#RiverLevelsDetail").hide("fast");
        $("#ForecastDetail").hide("fast");
        
        $("#FlyChartOpenDiv").hide();
        $("#FlyChartCloseDiv").show();

        $("#ForecastOpenDiv").show();
        $("#ForecastCloseDiv").hide();

        $("#GTPOpenDiv").show();
        $("#GTPCloseDiv").hide();
                
        $("#RLCOpenDiv").show();
        $("#RLCCloseDiv").hide();

        ClosePopUps();
    });

    $("#FlyChartOpenDiv").click(function(event) {
        event.preventDefault();
        $(this).hide();
        $("#FlyChartCloseDiv").show();
        $("#FlyChartDetail").show("3000");

        $("#GuidesTopPicksDetail").hide("fast");

        $("#ForecastDetail").hide("fast");
        $("#RiverLevelsDetail").hide("fast");

        $("#GTPOpenDiv").show();
        $("#GTPCloseDiv").hide();

        
        $("#RLCOpenDiv").show();
        $("#RLCCloseDiv").hide();
        $("#ForecastCloseDiv").hide();
        $("#ForecastOpenDiv").show();
        ClosePopUps();
    });

    $("#FlyChartCloseDiv").click(function(event) {
        event.preventDefault();
        $(this).hide();
        $("#FlyChartOpenDiv").show();
        $("#FlyChartDetail").hide("3000");
    });


    $("#CloseFlyChartDetail").click(function(event) {
        event.preventDefault();
        $("#FlyChartDetail").hide("3000");
        $("#FlyChartOpenDiv").show();
        $("#FlyChartCloseDiv").hide();
    });

    /* ************* RIVER LEVELES ************** */
    $("#MenuRiverLevels").click(function(event) {
        event.preventDefault();
        $("#RiverLevelsDetail").show("3000");

        $("#GuideTopPicksDetail").hide("fast");

        $("#FlyChartDetail").hide("fast");
        $("#ForecastDetail").hide("fast");
        
        $("#RLCOpenDiv").hide();
        $("#RLCCloseDiv").show();
        $("#ForecastOpenDiv").show();
        $("#ForecastCloseDiv").hide();
        $("#FlyChartOpenDiv").show();
        $("#FlyChartCloseDiv").hide();

        $("#GTPOpenDiv").show();
        $("#GTPCloseDiv").hide();
    });

    $("#RLCOpenDiv").click(function(event) {
        event.preventDefault();
        $(this).hide();
        $("#RLCCloseDiv").show();
        $("#RiverLevelsDetail").show("3000");
        $("#FlyChartDetail").hide("fast");
        $("#ForecastDetail").hide("fast");

        $("#GuidesTopPicksDetail").hide("fast");
        
        $("#ForecastOpenDiv").show();
        $("#ForecastCloseDiv").hide();
        $("#FlyChartOpenDiv").show();
        $("#FlyChartCloseDiv").hide();

        $("#GTPOpenDiv").show();
        $("#GTPCloseDiv").hide();
    });

    $("#RLCCloseDiv").click(function(event) {
        event.preventDefault();
        $(this).hide();
        $("#RLCOpenDiv").show();
        $("#RiverLevelsDetail").hide("3000");
        ClosePopUps();
    });


    $("#CloseRiverLevelDetail").click(function(event) {
        event.preventDefault();
        $("#RLCCloseDiv").hide();
        $("#RLCOpenDiv").show();
        $("#RiverLevelsDetail").hide("3000");
        ClosePopUps();
    });

    /* ************* Guides' Top Picks ************** */

    $("#GTPOpenDiv").click(function(event) {
        event.preventDefault();
        $(this).hide();
        $("#GTPCloseDiv").show();
        $("#GuidesTopPicksDetail").show("3000");

        $("#RiverLevelsDetail").hide("fast");        
        $("#FlyChartDetail").hide("fast");
        $("#FlyChartDetail").hide("fast");
        $("#ForecastDetail").hide("fast");
        $("#ForecastOpenDiv").show();
        $("#ForecastCloseDiv").hide();
        $("#FlyChartOpenDiv").show();
        $("#FlyChartCloseDiv").hide();
    });

    $("#GTPCloseDiv").click(function(event) {
        event.preventDefault();
        $(this).hide();
        $("#GTPOpenDiv").show();
        $("#GuidesTopPicksDetail").hide("3000");
        ClosePopUps();
    });

    $("#CloseGuidesTopPicksDetail").click(function(event) {
        event.preventDefault();
        $("#GTPCloseDiv").hide();
        $("#GTPOpenDiv").show();
        $("#GuidesTopPicksDetail").hide("3000");
        ClosePopUps();
    });
    

    /* ************* BODY OF WATER ************** */

    $('#BodyOfWaterSelection').click(function(event) {
        event.preventDefault();
        $('#BodyOfWaterSelection').hide();
        $('#BodyOfWaterSelectionDropDown').slideDown('fast', function() {
            // Animation complete.
        });
    });

    $('#BodyOfWaterSelectionDropDown').hover(
      function() {
          $(this).show();
      },
      function() {
          $(this).slideUp('fast', function() {
              //Animation complete
          });
          $('#BodyOfWaterSelection').show();
      });

    /* ****** Check For FlyChartInsect Click ********* */
    $("div").click(function() {
        if ($(this).attr("className") == "FlyChartInsect") {            
            var tempStr = $(this).attr("id");
            for (i = 0; i < tempStr.length; i++) {
                if (tempStr.charAt(i) == '-')
                    break;
            }
            tempStr2 = tempStr.substr(i + 1, tempStr.length - i - 1);
            if (document.getElementById("InsectTbl" + tempStr2).style.display == "table") {
                return; // Already Open, do nothing
            }
            else {
                ShowFlyChartInsectTable(tempStr2);
            }
        }
    });

    
    /* ****** Check For FlyChartInsect Hover ********* */    
    $("div").mouseover(function() {
        if ($(this).attr("className") == "FlyChartInsect") {
         
        $(this).css("color", "#c6502f");
        $(this).css("text-decoration","none");
        }
    });

    /* ****** Check For FlyChartInsect Mouse Out ********* */    
    $("div").mouseout(function() {
        if ($(this).attr("className") == "FlyChartInsect") {
         
        $(this).css("color", "#dfdbbc");
        $(this).css("text-decoration","underline");
        }        
    });

    
    $("#TopOPage").click(function(event) {
        event.preventDefault();
        $('html, body').animate({ scrollTop: 0 }, 'slow');
    });

    /* ************* STUB OUTS ************** */

   /*
    $("form").submit(function() {
        alert('TBD: Not functional');
        return false;
    });
   */
});
/* End Of Events */


function chkObject(inParent,theVal) {
    if(inParent){
        if (window.opener.document.getElementById(theVal) != null) {
            return true;
        } 
        else {
            return false;
        }
    }
    else {
        if (document.getElementById(theVal) != null) {
            return true;
        } 
        else {
            return false;
        }
    }
}




function RtColHover(Control) {
    if (Control > 0)
        g_RtColHover = 1;
    else
        g_RtColHover = 0;        
}


function ClosePopUps() {
    $("#ChartPopupMadras7Day").hide();
    $("#ChartPopupMadras30Day").hide();
    $("#ChartPopupMadrasYear").hide();    

    $("#ChartPopupMoody7Day").hide();
    $("#ChartPopupMoody30Day").hide();
    $("#ChartPopupMoodyYear").hide();    

    $("#ChartPopupShitike7Day").hide();
    $("#ChartPopupShitike30Day").hide();
    $("#ChartPopupShitikeYear").hide();    

    $("#ChartPopupKahneeta7Day").hide();
    $("#ChartPopupKahneeta30Day").hide();
    $("#ChartPopupKahneetaYear").hide();        

    $("#ChartPopupGrandview7Day").hide();
    $("#ChartPopupGrandview30Day").hide();
    $("#ChartPopupGrandviewYear").hide();        
    
    $("#ChartPopupBenham7Day").hide();
    $("#ChartPopupBenham30Day").hide();
    $("#ChartPopupBenhamYear").hide();        

    $("#ChartPopupPrineville7Day").hide();
    $("#ChartPopupPrineville30Day").hide();
    $("#ChartPopupPrinevilleYear").hide();        
    
}


/* *************** GRAPHS ***************** */
function GraphChart(TargetDivID, ChartDataFileName, ChartType) {
    if (ChartType == s7_DAY)
        SWF = "FCF_Area2D.swf";
    else
        SWF = "FCF_MSArea2D.swf";

    var chart = new FusionCharts("Charts/" + SWF, "ChartId", "500", "350");
    chart.setDataURL("ChartData/"+ChartDataFileName);
    chart.render(TargetDivID);
}

/* ************* SUPPORT FOR FLY CHARTS ********** */

var g_FlyPatternTableCount = 0;

/* Count all the FlyPatternTables and display the first table named InsectTbl1 by convention */
function flychartInit() {
    var allTables = document.getElementsByTagName("table");

    for (var i = 0; i < allTables.length; i++) {
        if (allTables.item(i).className == "FlyPatternsTable") {
            g_FlyPatternTableCount = g_FlyPatternTableCount + 1;
        }
    }
     
    $('#InsectTbl1').show();
    myElement = document.getElementById('Insect-1');
    myElement.style.background = 'url(images/insect-pattern-expanded-img.gif)';
    myElement.style.backgroundRepeat = 'no-repeat';
}

function ShowFlyChartInsectTable(TblToOpen) {
    
    for (j = 1; j <= g_FlyPatternTableCount; j++) {
        if (document.getElementById("InsectTbl" + j).style.display == "block")  {
            $("#InsectTbl" + j).slideUp('fast', function() {
                // Animation complete.
                document.getElementById("Insect-" + j).style.background = 'url(images/insect-pattern-expand-img.gif)';
                document.getElementById("Insect-" + j).style.backgroundRepeat = 'no-repeat';
                document.getElementById("Insect-" + TblToOpen).style.background = 'url(images/insect-pattern-expanded-img.gif)';
                document.getElementById("Insect-" + TblToOpen).style.backgroundRepeat = 'no-repeat';

                $('#InsectTbl' + TblToOpen).slideDown('fast', function() {
                    // Animation complete.
                });
            });
            break;
        }
    }
}


