﻿function clearCals(y, mID) {
    var z = 0;
    while (y >= z) {
        z++
        var m = mID + z;
        hideEventDiv(m)
    }
}

function toggle(x, y, m, Cook) {
    clearCals(y, m);
    showEventDiv(x);
    if (Cook != 'no') setCookie(m, x, 1);
}

function showEventDiv(x) {
    document.getElementById(x).style.display = 'block'
}

function hideEventDiv(x) {
    if (document.getElementById(x) != null)
        document.getElementById(x).style.display = 'none'
}

function setCookie(c_name, value, expiredays) {
    var exdate = new Date()
    exdate.setDate(exdate.getDate() + expiredays)
    document.cookie = c_name + "=" + escape(value) +
	((expiredays == null) ? "" : ";expires=" + exdate) +
	";path=/"
}

function getCookie(c_month) {
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_month + "=")
        if (c_start != -1) {
            c_start = c_start + c_month.length + 1
            c_end = document.cookie.indexOf(";", c_start)
            if (c_end == -1) c_end = document.cookie.length
            return unescape(document.cookie.substring(c_start, c_end))
        }
    }
    return null
}


/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/

function makeTheDiv() {
    document.write('<div id="traildiv"></div>');
}

function showTrail(copy) {
    document.getElementById('traildiv').innerHTML = copy;
    document.getElementById('traildiv').style.visibility = "visible";
    document.onmousemove = followmouse

}

function gettrailobj() {
    return document.getElementById("traildiv").style
}

function truebody() {
    return (!window.opera && document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body
}

function hidetrail() {
    gettrailobj().visibility = "hidden"
    document.onmousemove = ""

}

function followmouse(e) {

    var xcoord = offsetfrommouse[0]
    var ycoord = offsetfrommouse[1]
    if (typeof e != "undefined") {
        xcoord += e.pageX
        ycoord += e.pageY
    }
    else if (typeof window.event != "undefined") {
        xcoord += truebody().scrollLeft + event.clientX
        ycoord += truebody().scrollTop + event.clientY
    }
    var docwidth = document.all ? truebody().scrollLeft + truebody().clientWidth : pageXOffset + window.innerWidth - 15
    var docheight = document.all ? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)
    gettrailobj().display = ""
    gettrailobj().left = xcoord + "px"
    gettrailobj().top = ycoord + "px"
}
/* END TRAIL SCRIPT */



document.write('<div id="traildiv"></div>');

/**
* syncHeight - jQuery plugin to automagically Snyc the heights of columns
* Made to seemlessly work with the CCS-Framework YAML (yaml.de)
* @requires jQuery v1.0.3
*
* http://blog.ginader.de/dev/syncheight/
*
* Copyright (c) 2007 
* Dirk Ginader (ginader.de)
* Dirk Jesse (yaml.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Version: 1.0
*
* Usage:
$(document).ready(function(){
$('p').syncHeight();
$(window).resize(function(){ //if you want to update the columns after a Browser resize (optional)
$('p').syncHeight();
});
});
*/

(function($) {
    $.fn.syncHeight = function(settings) {
        var max = 0;
        var browser_id = 0;
        var property = [
		   ['min-height', '0px'],
			['height', '1%']
		];

        // check for IE6 ...
        if ($.browser.msie && $.browser.version < 7) {
            browser_id = 1;
        }

        // get maximum element height ...
        $(this).each(function() {
            // fallback to auto height before height check ...
            $(this).css(property[browser_id][0], property[browser_id][1]);
            var val = $(this).height();
            val = val - 88;
            if (val > max) {
                max = val;
            }
        });

        // set synchronized element height ...
        $(this).each(function() {
            $(this).css(property[browser_id][0], max + 'px');
        });
        return this;
    };
})(jQuery);

$(document).ready(function() {
    $('.monkForm div.required label').append('*');
    $('.monkForm legend:first').remove();
});

/*
// Author : Joe Mallory
// Created : 10/9/2009
// Description : Custom hide/show of outdated calendar event text listings not yet manually removed
*/

var months = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var currentDate          = new Date();
var currentDateDay       = currentDate.getDate();
var currentDateMonth     = months[currentDate.getMonth()];
var currentDateMonthNum  = currentDate.getMonth();
var currentDateYear      = currentDate.getFullYear();

$("document").ready(function() {
    $("p.date").each(function() {
        // Get current event date
        var myEvent            = ($(this).text()).split(" ");
        var myEventMonth       = myEvent[0];
        var myEventMonthNum    = -1;
        var myEventDay         = myEvent[1];
        var myEventYear        = myEvent[2];
        
        // Get the correct month listed (Match truncated)
        for (var i=0; i<months.length; i++) {
            if (months[i].indexOf(myEventMonth) > -1) {
                myEventMonth    = months[i];
                myEventMonthNum = i;
            }
        }
        
        // Hide the event if Month and/or Month & Day have passed
        if (myEventMonthNum <= currentDateMonthNum && myEventYear <= currentDateYear) {
            if ((myEventMonth == currentDateMonth && myEventDay < currentDateDay) || myEventMonthNum < currentDateMonthNum) {
                $(this).parent().css("display", "none");
            }
        }
    });
});