﻿/// <reference path="jquery-1.3.2-vsdoc2.js" />

$(document).ready(function() {
    $('#client form').hide();
    $('#client a.clientBtn').click(function(event) {
        $('#client form').toggle(active);

    });
    var url = window.location.href;
    var filename = url.substring(url.lastIndexOf('/') + 1);
    $.cookie('pageId', filename);
    $.cookie('subject', 'Cutwater Inquiry');
    $.cookie('emailTo', 'info@cutwater.com');

    $("#emailLink").attr("href", "mailto:?subject=RESEARCH&body=" + window.location.href);
    $("#lMenuCutwaterSpeaks").removeClass("hide");
    $("#liResearch").addClass("active");
    $("#main_market").addClass("active");
    //add recent events here

   /* var d = new Date();

    var currentMonth = d.getMonth();

    switch (currentMonth) {

        case 0:
            var data = $("#table" + currentMonth + " tbody").html();
            $("#recentNews").html(data);

            break;
        case 1:
            var data = $("#table" + currentMonth + " tbody").html() + $("#table" + (currentMonth - 1) + " tbody").html();
            $("#recentNews").html(data);
            break;
        case 2:
            var data = $("#table" + currentMonth + " tbody").html() + $("#table" + (currentMonth - 1) + " tbody").html() + $("#table" + (currentMonth - 2) + " tbody").html();
            $("#recentNews").html(data);
            break;
        case 3:
        case 4:
        case 5:
        case 6:
        case 7:
        case 8:
        case 9:
        case 10:
        case 11: var data = $("#table" + (currentMonth - 1) + " tbody").html() + $("#table" + (currentMonth - 2) + " tbody").html() + $("#table" + (currentMonth - 3) + " tbody").html();
            $("#recentNews").html(data);
            if ($('#recentNews tr').length == 0) {
                counter = 3;
                while ($('#recentNews tr').length == 0) {

                    var month = currentMonth - counter;
                    if (month > 0) {
                        var data = $("#table" + (month) + " tbody").html();
                        $("#recentNews").html(data);
                        if ($('#recentNews tr').length > 0)
                            break;
                        else
                            counter++;
                    }
                    else {

                        $("#recentNews").html("<tr> <td colspan='3'>there are no records to display</td></tr>");
                        break;

                    }
                }
            }

            break;




        default:
            break;
    }

    //var rowCount = $('#recentNews tr').length;

    $("#recentNews tr:odd").addClass('oddRow');

    $("#recentNews tr:even").addClass('evenRow');

    */

});


var selectedmonth = "";
var lastSelected = "";
function showEventtable() {

    selectedmonth = (document.getElementById("monthSelector").options.selectedIndex - 1);
    $("#table" + selectedmonth).removeClass("hide");
    if (selectedmonth != lastSelected)
        $("#table" + lastSelected).addClass("hide");
    lastSelected = selectedmonth;
}
function openPopup() {
    window.open(alertPageLocation, '', 'width=600,height=500');

}
function printDiv() {
    self.print();
}	