    // CALENDAR.JS STARTS HERE
    locProtocol  = window.location.protocol;

    var CALENDAR_MonthNames      = "";
    var CALENDAR_MonthShortNames = "";
    var CALENDAR_DayShortNames   = "";
    var dayShortNametext         = "";
    var dayShortNamearea         = "";
    var dateArea                 = "";
    var disabledDate             = "";
    var enabledDate              = "";
    var currentDateBoxArea       = "";
    var monthNameText            = "";
    var minmumLeadDays           = 0;
    var dayCellHeight            = "";
    var userSelectedDate         = "";

	// This will set the current date as the date on the user's clock.  Change to server date here if necessary.
	// Remember: Month is 0-indexed in javascript.
	//var DAYS_OUT = 3;
	var temp = new Date();
	var CALENDAR_CurrentDate = new Date(temp.getFullYear(), temp.getMonth(), temp.getDate());

	// Main constructor function.  Takes the object variable name as a parameter (for self-refferential behavior with links)
	function Calendar(selfName, monthNames, monthShortNames, dayShortNames, dayShNameText, dayShNamearea, datArea, disabDate, enabDate, currDateBoxArea, monthNamText, dayCellHgt, selectedArrDate, leadDays) {
        CALENDAR_MonthNames      = monthNames;
        CALENDAR_MonthShortNames = monthShortNames;
        CALENDAR_DayShortNames   = dayShortNames;

		this.name = selfName;	// Self-referential property. 

        if(selectedArrDate != "CURR_DATE"){
            CALENDAR_CurrentDate = selectedArrDate; 
        }

        this.selectedDate = addDays(CALENDAR_CurrentDate, parseInt(leadDays));
		this.currentMonth = this.selectedDate.getMonth();
		this.currentYear = this.selectedDate.getFullYear();

		this.layer = false;		// Layer to regenerate into

		// Application-specific behaviors
		this.autoRender = true;		// Should we regenerate if the user selects something?
		this.onDateSelect = false;	// If not false, must contain a valid js command to execute when date is selected
		this.onMonthSelect = false;	// If not false, must contain a valid js command to execute when month is selected
		this.backgroundcolor = false;
		this.weekdayHeaderBackgroundColor = false;
		this.dayBackgroundColor = false;
		this.currentDayBackgroundColor = false;
		this.font_size = false;

		this.lowerLimit = false;	// If not false, must contain a valid date (lower bound)
		this.upperLimit = false;	// If not false, must contain a valid date (upper bound)

		this.outOfBounds = CalendarOutOfBounds;
		this.getMonthName = CalendarGetMonthName;
		this.getMonthShortName = CalendarGetMonthShortName;
		this.getSelectedDate = CalendarGetSelectedDate;
		this.getDaysInMonth = CalendarGetDaysInMonth;

		this.select = CalendarSelect;
		this.selectMonth = CalendarSelectMonth;

		this.renderDays = CalendarRenderDays;
		this.renderDaySelectLink = CalendarRenderDaySelect;
		this.renderPrevMonthLink = CalendarRenderPrevMonth;
		this.renderNextMonthLink = CalendarRenderNextMonth;
		this.renderHeader = CalendarRenderHeader;
		this.render = CalendarRender;
		this.renderToLayer = CalendarRenderToLayer;
		this.refresh = CalendarRefresh;

        dayShortNametext         = dayShNameText;
        dayShortNamearea         = dayShNamearea;
        dateArea                 = datArea;
        disabledDate             = disabDate;
        enabledDate              = enabDate;
        currentDateBoxArea       = currDateBoxArea;
        monthNameText            = monthNamText
        dayCellHeight            = dayCellHgt;

        userSelectedDate         = selectedArrDate;
        if(userSelectedDate == "CURR_DATE"){
            currentDateBoxArea   = datArea;
        }
        this.selectdate = userSelectedDate;
	}

//----------------------------- Methods

	function CalendarOutOfBounds(d) {
		var out = false;
		var dv = d.valueOf();

		if (this.lowerLimit) {
			out = (this.lowerLimit.valueOf() > d);
		}
		if (this.upperLimit && !out) {
			out = (this.upperLimit.valueOf() < d);
		}
		return out;
	}

	function CalendarGetMonthName() {
		return CALENDAR_MonthNames[this.currentMonth];
	}

	function CalendarGetMonthShortName() {
		return CALENDAR_MonthShortNames[this.currentMonth];
	}

	function CalendarGetSelectedDate() {
		return this.selectedDate;
	}

	function CalendarGetDaysInMonth(year, month) {
		var a = new Date(year, month, 1);
		if (month == 11) {
			var b = new Date(year+1, 0, 1);
		} else {
			var b = new Date(year, month+1, 1);
		}

		var millsDiff = b-a;
		return Math.round(millsDiff / 86400000); 			// 86,400,000 milliseconds in a day
	}

//------------- Actions
	function CalendarSelect(y, m, d) {
		this.selectedDate = new Date(y, m, d);
		this.refresh();

		if (this.onDateSelect) {
			eval(this.onDateSelect);
		}
	}

	function CalendarSelectMonth(y, m) {
		this.currentMonth = m;
		this.currentYear = y;
		this.refresh();

		if (this.onMonthSelect) {
			eval(this.onMonthSelect);
		}
	}

//------------- HTML Rendering routines
	function CalendarRenderDays() {
		var output = "";

		// Figure out how many days are being shown
		var totalDays = this.getDaysInMonth(this.currentYear, this.currentMonth);

		// Identify what day-of-week to start on
		var startDay = (new Date(this.currentYear, this.currentMonth, 1)).getDay();

		// Add day-name header row
		output += "<table width='100%' bgcolor='" + this.backgroundcolor + "' border=0 cellpadding=0 cellspacing=3><tr><td><table width='100%' cellpadding=0 cellspacing=1 border=0><tr>";
		for (var i in CALENDAR_DayShortNames) {
            output += "<td width='14.3%' style='color:"+dayShortNametext+"; font-family:Arial; font-weight:bold; background-color:"+dayShortNamearea+"; text-align:center;'><font style='color:"+dayShortNametext+"; font-family:Arial; font-weight:bold; font-size:" + this.font_size + "; background-color:"+dayShortNamearea+"; text-align:center;'>" + CALENDAR_DayShortNames[i] + "</font></td>";
			//R output += "<td width='14.3%' style='color:#b04e0d; font-family:Arial; font-weight:bold; background-color:" + this.weekdayHeaderBackgroundColor + "; text-align:center;'><font style='color:#ffffff; font-family:Arial; font-weight:bold; font-size:" + this.font_size + "; background-color:" + this.weekdayHeaderBackgroundColor + "; text-align:center;'>" + CALENDAR_DayShortNames[i] + "</font></td>";
		}
		output += "</tr>";

		var showDays = false;
		var currentDay = 1;
		for (var w = 0; w < 6; w++) {
			output += "<tr>";
			for (var d = 0; d < 7; d++) {
				showDays = (showDays || (!showDays && d == startDay));

				if (!showDays || currentDay > totalDays) {
					// Show disabled box
                    output += "<td width='14.3%' style='background-color:"+dateArea+"; text-align:center; height: "+dayCellHeight+"; color:#b04e0d; font-family:Arial; font-size:9px;'><font style='text-align:center; color:#b04e0d; font-family:Arial; font-size:9px;'>&nbsp;</font></td>";
				} else {
					var currentDate    = new Date(this.currentYear, this.currentMonth, currentDay);

					if (this.outOfBounds(currentDate)) {
						// Show disabled box
                        output += "<td width='14.3%' style='background-color:"+dateArea+"; text-align:center; height: "+dayCellHeight+"; color:#f9e9b6; font-family:Arial; font-size:" + this.font_size + ";'><font style='text-align:center; color:"+disabledDate+"; font-family:Arial; font-size:" + this.font_size + ";'>"+currentDay+"</font></td>";

                    } else if (currentDate.valueOf() == this.selectdate.valueOf() || userSelectedDate == "CURR_DATE" || currentDate.valueOf() == userSelectedDate.valueOf()) {

                    //} else if (this.selectedDate && currentDate.valueOf() == this.selectedDate.valueOf()) {
						// Show current date box
                        output += "<td width='14.3%' style='background-color:"+currentDateBoxArea+"; text-align:center; height: "+dayCellHeight+"; color:#003063; font-family:Arial; font-size:" + this.font_size + ";'>";
						output += this.renderDaySelectLink(currentDate);
						output += "</td>";
                        userSelectedDate = "";
					} else {
						// Show selectable date box
                        output += "<td width='14.3%' style='background-color:"+dateArea+"; text-align:center; height: "+dayCellHeight+";  color:#b04e0d; font-family:Arial; font-size:" + this.font_size + ";'>";
						output += this.renderDaySelectLink(currentDate);
						output += "</td>";
					}
					currentDay++;
				}
			}
			output += "</tr>\n";
		}
		output += "</table></td></tr></table>";

		return output;
	}

	function CalendarRenderDaySelect(date) {
		var output = "<a href='' onClick='";
		output += this.name+".select("+date.getFullYear()+","+date.getMonth()+","+date.getDate()+"); return false;";

		if (date.valueOf() == CALENDAR_CurrentDate.valueOf()) {
            output += "' style='text-decoration:none;'><font style='font-family:Arial; font-size:" + this.font_size + "; text-align:center; text-decoration:none; color:"+enabledDate+"; font-family:Arial;'>"+date.getDate()+"</font></a>";
		} else {
            output += "' style='text-decoration:none;'><font style='font-family:Arial; font-size:" + this.font_size + "; text-align:center; text-decoration:none; color:"+enabledDate+"; font-family:Arial;'>"+date.getDate()+"</font></a>";
		}
		return output;
	}

	function CalendarRenderHeader() {
		var output = "";
		output += "<table width=100% height=15 border=0 cellpadding=0 cellspacing=0>";
		output += "<tr>";
		output += "<td valign=bottom width=15 style='text-align:right; text-decoration:none; background-color:" + this.backgroundcolor + "; color:#961AE2; font-family:Arial; font-size:" + this.font_size + ";'>";
		output += this.renderPrevMonthLink();
		output += "</td>";
        output += "<td valign=bottom style='text-align:center; text-decoration:none; background-color:" + this.backgroundcolor + "; color:"+monthNameText+"; font-family:Arial;'><font style='text-align:center; text-decoration:none; color:"+monthNameText+"; font-family:Arial; font-size:"+ this.font_size + ";'>";
		output += this.getMonthName(this.currentMonth) + " " + this.currentYear;
		output += "</font></td>";
		output += "<td valign=bottom width=15 style='text-align:left; text-decoration:none; background-color:" + this.backgroundcolor + "; color:#961AE2; font-family:Arial; font-size:" + this.font_size + ";'>";
		output += this.renderNextMonthLink();
		output += "</td></tr></table>";

		return output;
	}

	function CalendarRenderPrevMonth() {
		var output = "";
		if (this.currentMonth == 0) {
			var m = 11;
			var y = this.currentYear - 1;
		} else {
			var m = this.currentMonth - 1;
			var y = this.currentYear;
		}

		if (!this.outOfBounds(new Date(y, m, this.getDaysInMonth(y,m)))) {
			output += "<a href='' onClick='";
			output += this.name+".selectMonth("+y+","+m+"); return false;";
            output += "' style='text-align:right; text-decoration:none; background-color:" + this.backgroundcolor + "; color:"+monthNameText+"; font-family:Arial; font-size:" + this.font_size + ";'>&lt;</a>";
		}else{
			output += "<img src='" + locProtocol + "//images.tickets.com/images/wdpro/spacer.gif' width=7 height=2>";
		}
		return output;
	}

function CalendarRenderNextMonth() {

            var output = "";

            if (this.currentMonth == 11) {

                  var m = 0;

                  var y = this.currentYear + 1;

            } else {

                  var m = this.currentMonth + 1;

                  var y = this.currentYear;

            }

            //... next month arrow fix ... Added by Millie 12/3/03

            if (!this.outOfBounds(new Date(y, m, this.getDaysInMonth(y,m)))) {

                  output += "<a href='' onClick='";

                  output += this.name+".selectMonth("+y+","+m+"); return false;";

            output += "' style='text-align:left; text-decoration:none; background-color:" + this.backgroundcolor + "; color:"+monthNameText+"; font-family:Arial; font-size:" + this.font_size + ";'>&gt;</a>";

            }else{

                  output += "<img src='" + locProtocol + "//images.tickets.com/images/wdpro/spacer.gif' width=7 height=2 border=1>";

            }

            return output;

      }



	function CalendarRender() {
		var output = "";

		output += this.renderHeader();
		output += this.renderDays();

		return output;
	}

	function CalendarRenderToLayer(layerName, outerLayer) {

	outerLayerName = new String(outerLayer);
	if(outerLayerName == 'undefined')
	{
		outerLayerName = '';
	}
		this.layer = new Layer(layerName, outerLayerName);
		this.layer.setHtml(this.render());
	}

	function CalendarRefresh() {
		if (this.autoRender && this.layer) {
			this.layer.setHtml(this.render());
		}
	}




var isDHTML = 0;
var isID = 0;
var isAll = 0;
var isLayers = 0;

if (document.getElementById) {isID = 1; isDHTML = 1;}
else {
if (document.all) {isAll = 1; isDHTML = 1;}
else {
browserVersion = parseInt(navigator.appVersion);
if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {isLayers = 1; isDHTML = 1;}
}}

function findDOM(objectID1,objectID2,withStyle) {
//alert("'" + objectID1 + "'" + "  sdfgsdfd  " + objectID2)
//alert(isLayers + " islayers")
if(objectID1 == ''){objectID1 = false;}
	if (withStyle == 1) {
		if (isID) { return (document.getElementById(objectID2).style) ; }
		else {
			if (isAll) { return (document.all[objectID2].style); }
		else {
			if (isLayers) {
				if (objectID1) { return (document.layers[objectID1].layers[objectID2]); }
				else { return (document.layers[objectID2]); }
			}
		};}
	}
	else {
		if (isID) { return (document.getElementById(objectID2)) ; }
		else {
			if (isAll) { return (document.all[objectID2]); }
		else {
			if (isLayers) {
				if (objectID1) { return (document.layers[objectID1].layers[objectID2]); }
				else { return (document.layers[objectID2]); }
			}
		};}
	}
}

  //LAYER_NS.js STARTS HERE
// Figure out which browser is being used
var ie4 = false;
var ns4 = false;
var ns6 = false;
if (navigator.appVersion.charAt(0) == "4")
	if (navigator.appName.indexOf("Explorer") >= 0)
		ie4 = true;
	else
		ns4 = true;
else if (navigator.appVersion.charAt(0) > "4")
	ns6 = true;


var isDHTML = 0;
var isLayers = 0;
var isAll = 0;
var isID = 0;

if (document.getElementById) {isID = 1; isDHTML = 1;}
else {
if (document.all) {isAll = 1; isDHTML = 1;}
else {
browserVersion = parseInt(navigator.appVersion);
if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {isLayers = 1; isDHTML = 1;}
}}

//***************** DHTML Routines
// Constructor for cross-platform / cross-browser layer object
function Layer(layerName, outerLayer) {
	this.layer = "";
	this.html = "";
	this.xCoor=0;
	this.yCoor=0;
	this.children = new Array();

outerLayerName = new String(outerLayer);
if(outerLayerName == 'undefined')
{
	outerLayerName = '';
}

this.layer = findDOM('', layerName, 0);

	if (ie4 || ns6) {
		this.move = LayerMoveDOM;
		this.moveBy = LayerMoveByDOM;
		this.show = LayerShowDOM;
		this.hide = LayerHideDOM;
		this.resize = LayerResizeDOM;
		this.getHtml = LayerGetHtmlDOM;
		this.setHtml = LayerSetHtmlDOM;
		this.addChild = LayerAddChildDOM;
	} else {
		this.move = LayerMoveNS;
		this.moveBy = LayerMoveByNS;
		this.show = LayerShowNS;
		this.hide = LayerHideNS;
		this.resize = LayerResizeNS;
		this.getHtml = LayerGetHtmlNS;
		this.setHtml = LayerSetHtmlNS;
		this.addChild = LayerAddChildDOM;  // This will not work in netscape 4
	}
}

// Get the inner HTML (for netscape 4, will only work if setHtml was used first...)
function LayerGetHtmlDOM() {return this.layer.innerHTML;}
function LayerGetHtmlNS() {return this.html;}

// Replace the contents of the layer
function LayerSetHtmlDOM(data) {
	this.html=data;

	// save inner layers - fixes IE5 bug with child layers
	var innerDivs = new Array(this.children.length);		// Stick into a real array so reference is not lost

	for (var loop=0; loop < innerDivs.length; loop++) {
		innerDivs[loop]=this.children[loop].layer;
	}

	for (var loop=0; loop < innerDivs.length; loop++) {
		document.body.appendChild(innerDivs[loop]);
	}

	this.layer.innerHTML=data;

	// restore inner layers
	for (var loop=0; loop < innerDivs.length; loop++) {
		this.layer.appendChild(innerDivs[loop]);
	}
}

function LayerSetHtmlNS(data) {
	this.layer.document.open();
	this.layer.document.write(data);
	this.layer.document.close();
	this.html=data;
}

// Move layer to new x/y coordinates
function LayerMoveDOM(xCoor, yCoor) {
	this.xCoor=xCoor;
	this.yCoor=yCoor;
	this.layer.style.left = this.xCoor;
	this.layer.style.top = this.yCoor;
}

function LayerMoveNS(xCoor, yCoor) {
	this.xCoor=xCoor;
	this.yCoor=yCoor;
	this.layer.left = this.xCoor;
	this.layer.top = this.yCoor;
}

// Move layer to new x/y coordinates
function LayerMoveByDOM(xCoor, yCoor) {
	this.xCoor += xCoor;
	this.yCoor += yCoor;
	this.move(this.xCoor,this.yCoor);
}

function LayerMoveByNS(xCoor, yCoor) {
	this.xCoor += xCoor;
	this.yCoor += yCoor;
	this.move(this.xCoor,this.yCoor);
}

// Resize layer
function LayerResizeDOM(x, y) {
	this.layer.style.height = y;
	this.layer.style.width = x;
}

function LayerResizeNS(x, y) {
	this.layer.height = y;
	this.layer.width = x;
}


// Show a DHTML layer
function LayerShowDOM(layerName) {
	this.layer.style.visibility = "visible";
	this.layer.style.display = "";
}

function LayerShowNS(layerName) {this.layer.visibility = "show";}

// Hide a DHTML layer
function LayerHideDOM(layerName) {
	this.layer.style.visibility = "hidden";
	this.layer.style.display = "none";
}

function LayerHideNS(layerName) {document.layers[layerName].visibility = "hide";}

// Add another layer as a child that appears within this one.  Requires a DOM-Capable browser (IE5+/NS6+)
function LayerAddChildDOM(childLayer) {
	this.children[this.children.length] = childLayer;
	this.layer.appendChild(childLayer.layer);
}



// Provide a single place to register commands to execute once the page is loaded completely.
// This allows DHTML routines to co-exist and have initialization code be defined internally
// rather than externally in the document's BODY tab.

// Note: Using this will override the onload command(s) defined in the HTML.
// Instead of using <body onLoad="myFunction();"> use <script>onLoad("myFunction();");</script>
// This will ensure that the command will be executed as well as other commands defined elsewhere.

// Additional note: This process is way simpler than it sounds.  Who knew that something less
// that 10 lines in length could be so useful?

var onLoadCommands = new Array();								// Internal array where commands are stored
var onLoadLastCommands = new Array();							// Internal array where commands are stored to be done last
var onLoadProcessed = false;
// Add a command to be called once the page is loaded
// Takes a string as a parameter -- an executable statement.
// Example: onLoad("alert('test!');");
function onLoad(command) {
	if (!onLoadProcessed) {
		onLoadCommands[onLoadCommands.length] = command;			// Add command to the stack
		window.onload = performOnLoad;								// Make sure the body tag will process the commands
	} else {
		eval(command);
	}
}

function onLoadLast(command) {
	if (!onLoadProcessed) {
		onLoadLastCommands[onLoadLastCommands.length] = command;	// Add command to the stack
		window.onload = performOnLoad;								// Make sure the body tag will process the commands
	} else {
		eval(command);
	}
}

// Process all defined commands, called once the page is completely loaded
// This function should probably not be called from anywhere else directly.
function performOnLoad() {
	for (var x=0; x < onLoadCommands.length; x++) {
		eval(onLoadCommands[x]);								// Brendan Eich, thank you for adding the eval command!!!
	}
	for (var x=0; x < onLoadLastCommands.length; x++) {
		eval(onLoadLastCommands[x]);
	}
	onLoadCommands = new Array(); 								// Once done, empty out the arrays.
	onLoadLastCommands = new Array();
	onLoadProcessed = true;
}

function addDays( myDate, days ) {
    return new Date(myDate.getTime() + days*24*60*60*1000);
}