var daysOfEachMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
var monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var globalCalendar;

var theDate = new Date();
var month = theDate.getMonth() + 1;
var day = theDate.getDate() + 1;
var year = theDate.getFullYear();
var displayType = "month";
	
function refreshCalendar(calendarObject, obj) {
	if ((displayType == "week") && (month == theDate.getMonth() + 1) && (day == 1)) day = theDate.getDate();
	if (day > daysOfEachMonth[month - 1]) {
		day = day - daysOfEachMonth[month - 1];
		month += 1;
	}
	if (day < 1) {
		month -= 1;
	}	
	if (month > 12) {
		month = 1;
		year += 1;
	}
	if ((month < (theDate.getMonth() + 1)) && (year == theDate.getFullYear())) {
		month = theDate.getMonth() + 1;
	}
	if (month < 1) {
		month = 12;
		year -= 1;
	}
	if (day < 1) {
		if (month == (theDate.getMonth())) { 
			day = 1;
		} else {
			day = daysOfEachMonth[month - 1];
		}
	}
	if (displayType == "month") day = 1;
	if (document.getElementById(calendarObject.id)) clearElements(document.getElementById(calendarObject.id));
	
	if (displayType == "all") {
		document.getElementById("avtd").style.visibility = "visible";
		return;
	} else {
		document.getElementById("avtd").style.visibility = "hidden";
	}
	
	calendarObject = new calendar(calendarObject.id, month, day, year, calendarObject.x, calendarObject.y, calendarObject.weekX, calendarObject.weekY, calendarObject.width, calendarObject.height, calendarObject.weekWidth, calendarObject.weekHeight, calendarObject.spacing, info, displayType, calendarObject.where);
	calendarObject.create();
	
	if (displayType == "month") {
		document.getElementById("weeknavarrowl").style.visibility = "hidden";
		document.getElementById("weeknavarrowr").style.visibility = "hidden";
		if ((month == (theDate.getMonth() + 1)) && (year == splitDate(lastDate)[2])) {
			document.getElementById("monthnavarrowl").style.visibility = "hidden";
		} else {
			document.getElementById("monthnavarrowl").style.visibility = "visible";
		}
		if ((month == splitDate(lastDate)[0]) && (year == splitDate(lastDate)[2])) {
			document.getElementById("monthnavarrowr").style.visibility = "hidden";
		} else {
			document.getElementById("monthnavarrowr").style.visibility = "visible";
		}
		obj.innerHTML = monthNames[month - 1] + ' ' + year;
	} else if (displayType == "week") {
		document.getElementById("monthnavarrowl").style.visibility = "hidden";
		document.getElementById("monthnavarrowr").style.visibility = "hidden";
		if (day - (new Date(year, month - 1, day).getDay()) < 1) {
			newMonth = month - 1;
			if (newMonth < 1) newMonth = 12;
			newDay = daysOfEachMonth[newMonth - 1] + (day - (new Date(year, month - 1, day).getDay()));
		} else {
			newMonth = month;
			newDay = day - (new Date(year, month - 1, day).getDay());
		}
		if ((month <= theDate.getMonth() + 1) && (day <= theDate.getDate()) && (year == splitDate(lastDate)[2])) {
			document.getElementById("weeknavarrowl").style.visibility = "hidden";
		} else {
			document.getElementById("weeknavarrowl").style.visibility = "visible";
		}
		if ((month == splitDate(lastDate)[0]) && (day >= splitDate(lastDate)[1]) && (year == splitDate(lastDate)[2])) {
			document.getElementById("weeknavarrowr").style.visibility = "hidden";
		} else {
			document.getElementById("weeknavarrowr").style.visibility = "visible";
		}
		obj.innerHTML = 'Week Of ' + newMonth + '/' + newDay;
	}
}

//------------------------------------------------------------------
// calendar constructor


function calendar(id, month, day, year, x, y, weekX, weekY, width, height, weekWidth, weekHeight, spacing, information, displayType, where) {
	this.id = id;
	this.month = month;
	this.day = day;
	this.year = year;
	this.x = x;
	this.y = y;
	this.weekX = weekX;
	this.weekY = weekY;
	this.width = width;
	this.height = height;
	this.weekWidth = weekWidth;
	this.weekHeight = weekHeight;
	this.spacing = spacing;
	this.information = information;
	this.displayType = displayType;
	this.where = where;
	
	// Methods
	
	this.create = create;
	this.createN4 = createN4;
	this.createDOM = createDOM;
	this.clearElements = clearElements;
	this.populateDOM = populateDOM;
	this.getEventType = getEventType;
	this.getEventName = getEventName;
	this.getEventLocation = getEventLocation;
	this.getEventTimes = getEventTimes;
	this.getEventID = getEventID;
	this.splitDataSet = splitDataSet;
	this.removeDate = removeDate;
	this.extractDate = extractDate;
	this.paruseInfo = paruseInfo;
	
}

//------------------------------------------------------------------
//	calendar.create: PUBLIC METHOD
//	a front end function which detects different browsers and executes the proper calendar
//  creation function (i.e. all DOM Level 1 compliant browsers get calendar.createDOM, whereas
//  Netscape 4 gets calendar.createN4, etc...)

function create() {
	globalCalendar = null;
	if (this.year % 4 == 0) {
		daysOfEachMonth[1] = 29;					// the year Mod 4 == Leap Year, therefore Feb has 29 days
	} else {
		daysOfEachMonth[1] = 28;					// if not, it's a standard year, so Feb has 28 days
	}

	if (document.layers) {
		this.createN4();
	}
	if (document.getElementById) {
		this.createDOM();
	}
}

//------------------------------------------------------------------
// calendar.createDOM: PRIVATE METHOD
// this is called for browsers which are DOM Level 1 compliant
// it has been tested lightly on both IE6 and Netscape 6, and seems to be working properly

function createDOM() {
	var theDate = new Date(this.year, this.month - 1, this.day);// gets the 1st day of the month and year specified
	var currentDay = this.day - 1;

	var calendar = document.createElement("div");				// creates the calendar div element
	this.calendar = calendar;
	this.calendar.id = this.id;											// sets that div's ID to the ID specified in the function arguments
	this.calendar.style.position = "absolute";						// the Calendars CSS attributes are set here
	
	if (this.displayType == "month") {
		this.calendar.style.top = this.y;
		this.calendar.style.left = this.x;
		for (var i = 0; i < 37; i++) {								// goes through a 5 week & 2 day timeline (37 days)
			var week = Math.floor(i / 7) + 1;						// The current week
			var day = (i % 7) + 1;									// the current current day of the week
			var dayDIV = document.createElement("div");				// creates a temporary DIV to store some information
			dayDIV.id = "week" + week + "day" + day;				// sets that DIV's ID to an ID which states the current week and the current day of the week (to make it unique)
			dayDIV.style.position = "absolute";						// sets the CSS Attributes
			dayDIV.style.top = ((week - 1) * (this.height + this.spacing));	// The top and left are equal to the width and height of each div (set in the arguments) + the spacing between
			dayDIV.style.left = ((day - 1) * (this.width + this.spacing));
			dayDIV.style.width = this.width - 2;
			dayDIV.style.height = this.height - 2;
			dayDIV.style.zIndex = 0;
			if ((i >= theDate.getDay()) && (currentDay < daysOfEachMonth[this.month - 1])) {		// if the current day of the 5 week calendar is >= the day that the first day of this month fall on, and the current day of the month is < the # of days of the month
				dayDIV.style.background = "#ffffff";										// display the month in a different color
				if ((month == ((new Date().getMonth()) + 1)) && (new Date().getDate() == currentDay + 1)) {
					dayDIV.style.background = "#283E66";
				}
				this.populateDOM(dayDIV,new Array(this.month,currentDay + 1,this.year));
				
				dateTime = document.createElement("div");
				dateTime.style.position = "absolute";
				dateTime.style.top = this.height - 15;
				dateTime.style.left = this.width - 15;
				dateTime.style.width = 12;
				dateTime.style.textAlign = "right";
				dateTime.appendChild(document.createTextNode(currentDay + 1));					// display the current day of the month
				dateTime.onmouseover = function() { this.parentNode.style.border = "solid 1px #4DAC26"; }
				dateTime.onmouseout = function() { this.parentNode.style.border = "solid 1px white"; }
				dayDIV.appendChild(dateTime);
				
				currentDay++;
				dayDIV.style.border = "solid 1px white";
			} else if ((currentDay == 0) || (i < 35)) {
				dayDIV.style.width = this.width;
				dayDIV.style.height = this.height;
				dayDIV.style.background = "#04132A";										// show that the month is a different month
			}
			this.calendar.appendChild(dayDIV);													// append the temporary DIV to the calendar DIV
		}
		var instructions = document.createElement("#");
		instructions.style.position = "absolute";
		instructions.style.left = 5;
		instructions.style.top = 252;
		instructions.src = "#";
		
		this.calendar.appendChild(instructions);
	}
	
	if (this.displayType == "week") {
		this.calendar.style.top = this.weekY;
		this.calendar.style.left = this.weekX;
		
		var currentLeft = 0;
		
		var newYear = this.year;
		var newMonth = this.month;
		var newDay = this.day;
		
		if ((new Date(newYear, newMonth - 1, newDay).getDay()) != 0) {
			newDay = newDay - (new Date(newYear, newMonth - 1, newDay).getDay());
			if (newDay < 1) {
				newMonth -= 1;
				if (newMonth < 1) {
					newYear -= 1;
					newMonth = 12;
				}
				newDay = daysOfEachMonth[newMonth - 1];
			}
		}
		
		for (var day = 0; day < 7; day++) {
			var dayDIV = document.createElement("div");
			if ((newDay + day) > daysOfEachMonth[newMonth - 1]) {
				newMonth += 1;
				if (newMonth > 12) {
					newMonth = 1;
					newYear += 1;
				}
				newDay = -day + 1;
			}
			
			// alert(newMonth + "/" + (newDay + day) + "/" + newYear + " - " + new Date(newYear, newMonth - 1, (newDay + day)).getDay());
			dayDIV.id = "day" + (newDay + day);
			dayDIV.style.position = "absolute";						
			dayDIV.style.width = ((this.weekWidth / 2) - (this.spacing / 2));
			dayDIV.style.background = "#FFFFFF";
			
			switch(new Date(newYear, newMonth - 1, (newDay + day)).getDay()) {
				case 0:
					dayName = "SUN";
					identColor = "#B3C649";
					break;
				case 1:
					dayName = "MON";
					identColor = "#92B6DA";
					break;
				case 2:
					dayName = "TUE";
					identColor = "#92B6DA";
					break;
				case 3:
					dayName = "WED";
					identColor = "#92B6DA";
					break;
				case 4:
					dayName = "THU";
					identColor = "#92B6DA";
					break;
				case 5:
					dayName = "FRI";
					identColor = "#92B6DA";
					break;
				case 6:
					dayName = "SAT";
					identColor = "#B3C649";
					break;
			}
						
			dateString = document.createElement("div");
			dateString.style.position = "absolute";
			dateString.style.left = 2;
			
			dName = document.createElement("span");
			dName.style.color = "#657E92";
			dName.appendChild(document.createTextNode(dayName));
			
			dateString.appendChild(dName);
			dateString.appendChild(document.createElement("br"));
			dateString.appendChild(document.createTextNode(newMonth + "/" + (newDay + day)));
			if ((newMonth == new Date().getMonth() + 1) && (newDay + day == new Date().getDate())) dayDIV.style.background = "#283E66";

			dayDIV.appendChild(dateString);
			
			var infoSpot = paruseInfo(this.information,new Array(newMonth, newDay + day, newYear));
			if (infoSpot != -1) {
				var dataSet = this.splitDataSet(removeDate(this.information[infoSpot]));
			} else {
				var dataSet = new Array();
			}
			if (dataSet.length <= 1) {
				dayDIV.style.height = 60;
			} else {
				dayDIV.style.height = 15 + (28 * dataSet.length);
			}
			
			if (calendar.childNodes.length > 0) {
				dayDIV.style.top = parseInt(calendar.childNodes[calendar.childNodes.length - 1].style.top) + parseInt(calendar.childNodes[calendar.childNodes.length - 1].style.height) + this.spacing;
				if ((parseInt(dayDIV.style.top) + parseInt(dayDIV.style.height)) > this.weekHeight) {
					currentLeft = ((this.width * 4) + (this.width / 2)) + this.spacing;
					dayDIV.style.top = 0;
				}
			} else {
				dayDIV.style.top = 0;
			}
			
			dayDIV.style.left = currentLeft;
			
			color = document.createElement("div");
			color.style.background = identColor;
			color.style.position = "absolute";
			color.style.top = 0;
			color.style.left = 170;
			color.style.width = 10;
			color.style.height = dayDIV.style.height;
			dayDIV.appendChild(color);
			this.populateDOM(dayDIV, new Array(newMonth,newDay + day,newYear));
			this.calendar.appendChild(dayDIV);										// append the temporary DIV to the calendar DIV
		}
	}
	
	if (this.displayType == "all") {
		this.calendar.style.top = this.weekY;
		this.calendar.style.left = this.weekX;
		this.calendar.style.clip = "rect(0px " + this.weekWidth + " " + this.weekHeight + " 0px)";
		this.calendar.style.overflow = "hidden";
		
		var calendarContent = document.createElement("div");
		calendarContent.style.position = "absolute";
		calendarContent.id = "listcontent";
		calendarContent.style.top = 0;
		calendarContent.style.left = 0;
		calendarContent.style.width = this.weekWidth;
		
		var calendarTable = document.createElement("table");
		alert(this.information.length);
		for (var i = 0; i < this.information.length; i++) {
			var calendarTR = document.createElement("tr");
			this.populateDOM(calendarTR, this.extractDate(this.information[i]));
			calendarTable.appendChild(calendarTR);
			alert(i);
			calendarTR = null;
		}
		calendarContent.appendChild(calendarTable);
		this.calendar.appendChild(calendarContent);
	}
	
	this.where.appendChild(calendar);												// append the calendar DIV to the BODY tag
	dayDIV = null;
	dateString = null;
	dName = null;
	calendar = null;
	globalCalendar = this;
}

//------------------------------------------------------------------
// calendar.createN4: PRIVATE METHOD
// this is called when Netscape 4 is detected

// it will eventually create the calendar in Netscape 4


function createN4() {	
	var theDate = new Date(this.year, this.month - 1, this.day);	// gets the 1st day of the month and year specified
	var currentDay = this.day - 1;
	alert("Showing Calendar");
	with(document.layers[this.id].document) {
		open();
		for (var i = 0; i < this.information.length; i++) {
			alert("Writing Information: " + getEventName(this.information[i]));
			write(getEventName(this.information[i]) + "<br />");
		}
		close();
	}
}

//------------------------------------------------------------------

function populateDOM(node,infoSpot) {

	var populate = document.createElement("div");
	
	populate.id = "content" + node.id;
	populate.style.position = "absolute";
	if (this.displayType == "month") {
		populate.style.top = 5;
		populate.style.left = 5;
	}
	
	if (this.displayType == "week") {
		populate.style.top = 1;
		populate.style.left = 32;
		populate.style.fontSize = "9px";
	}
	var info = this.paruseInfo(this.information, infoSpot);

	bgimage = document.createElement("img");
	bgimage.name = infoSpot;
	bgimage.setAttribute("border","0");
	bgimage.setAttribute("src","images/spacer.gif");
	bgimage.setAttribute("width",this.width - 2);
	bgimage.setAttribute("height",this.height - 2);
	
	if (this.displayType != "week") {	
		bgimage.onmouseover = function() { this.parentNode.style.border = "solid 1px #4DAC26"; }
		bgimage.onmouseout = function() { this.parentNode.style.border = "solid 1px white"; }
	}
	
	if (info != -1) {
		if (this.displayType == "month") {
			var image = document.createElement("img");
			switch(getEventType(removeDate(this.information[info]))) {
				case "1":
					image.setAttribute("src","images/home.gif");
					break;
				case "2":
					image.setAttribute("src","images/away.gif");
					break;
				case "3":
					image.setAttribute("src","images/hwkevent.gif");
					break;
				case "4":
					image.setAttribute("src","images/meeting.gif");
					break;
			}
			if (removeDate(this.information[info]).indexOf("^") != -1) {
				image.setAttribute("src","images/meeting.gif");
			}
			
			image.setAttribute("border","0");
			image.setAttribute("id",info);
			image.onmouseover = function(evt) {
								this.style.cursor = "hand";
								var events = "<span class='featuretxt'>";
								if (globalCalendar.information[this.id].indexOf("^") != -1) {
									var splitEvents = globalCalendar.splitDataSet(removeDate(globalCalendar.information[this.id]));
									for (var x = 0; x < splitEvents.length; x++) {
										var evName = globalCalendar.getEventName(splitEvents[x]);
										if (evName.length > 45) evName = evName.substr(0,42) + "...";
										events = events + "&raquo; " + evName + "<br />";
										events = events + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='font-weight: lighter'>" + globalCalendar.getEventLocation(splitEvents[x]) + " | " + globalCalendar.getEventTimes(splitEvents[x]) + "</span><br />";
									}
								} else {
									var evName = globalCalendar.getEventName(removeDate(globalCalendar.information[this.id]));
									if (evName.length > 45) evName = evName.substr(0,42) + "...";
									events = events + "&raquo; " + evName + "<br />";
									events = events + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style='font-weight: lighter'>" + globalCalendar.getEventLocation(globalCalendar.information[this.id]) + " | " + globalCalendar.getEventTimes(globalCalendar.information[this.id]) + "</span><br />";
								}
								document.getElementById("calendarDetails").innerHTML = events + "</span>";
								document.getElementById("calendarDetailsTooltip").style.visibility = "visible";
								if (navigator.appName.toLowerCase() == "netscape") {
									document.getElementById("calendarDetailsTooltip").style.top = evt.clientY + 10;
									document.getElementById("calendarDetailsTooltip").style.left = evt.clientX - parseInt(document.getElementById("calendarDetailsTooltip").style.width);
								} else {
									document.getElementById("calendarDetailsTooltip").style.top = window.event.clientY + 10;
									document.getElementById("calendarDetailsTooltip").style.left = window.event.clientX - parseInt(document.getElementById("calendarDetailsTooltip").style.width);
								}
								document.getElementById("calendarDetailsTooltip").style.zIndex = 100;
								this.parentNode.parentNode.style.border = "solid 1px #4DAC26";
							}
			image.onmouseout =  function() {
								document.getElementById("calendarDetails").innerHTML = "Move your mouse over a calendar icon for event overview. Click for details.<BR />"
								document.getElementById("calendarDetailsTooltip").style.visibility = "hidden";
								document.getElementById("calendarDetailsTooltip").style.zIndex = 0;
								this.parentNode.parentNode.style.border = "solid 1px white";
							}
							
			image.onclick = function() {
								loc = "calendar.htm#"
								if (globalCalendar.information[this.id].indexOf("^") != -1) {
									var splitEvents = globalCalendar.splitDataSet(removeDate(globalCalendar.information[this.id]));
									for (var x = 0; x < splitEvents.length; x++) {
										 if (x > 0) loc = loc + "&eventid" + (x + 1) + "=";
										 loc = loc + globalCalendar.getEventID(splitEvents[x]);
									}
								} else {
									loc = loc + globalCalendar.getEventID(globalCalendar.removeDate(globalCalendar.information[this.id]));
								}
								loc = loc + "&month=" + month;
								window.location = loc;
							}
		
			bgimage.onmouseover = function() {
									this.parentNode.style.border = "solid 1px #4DAC26";
								}
			bgimage.onmouseout =  function() {
									this.parentNode.style.border = "solid 1px white";
								}
										
			node.appendChild(bgimage);
			
			populate.appendChild(image);
			bgimage = null;
			image = null;
		}
		
			
		if (this.displayType == "all") {
			var date = document.createElement("td");
			date.valign = "top";
			var infoC = document.createElement("td");
			var infoTable = document.createElement("table");
			date.appendChild(document.createTextNode(infoSpot[0] + "/" + infoSpot[1]));
			if (removeDate(this.information[info]).indexOf("^") != -1) {
				var data = removeDate(this.splitDataSet(this.information[info]));
				for (var x = 0; x < data.length; x++) {
					infoTR = document.createElement("tr");
					infoTD = document.createElement("td");
					var image = document.createElement("img");
					switch(getEventType(data[x])) {
						case "1":
							image.setAttribute("src","images/home.gif");
							break;
						case "2":
							image.setAttribute("src","images/away.gif");
							break;
						case "3":
							image.setAttribute("src","images/hwkevent.gif");
							break;
						case "4":
							image.setAttribute("src","images/meeting.gif");
							break;
					}			
					image.setAttribute("border","0");
					image.setAttribute("id",info);
					infoTD.appendChild(image);
					infoTD.appendChild(document.createElement("br"));
					image = null;
					infoTR.appendChild(infoTD);
					
					infoTD = document.createElement("td");
					infoTD.appendChild(document.createTextNode(getEventName(data[x])));
					infoTD.appendChild(document.createElement("br"));
					infoTD.appendChild(document.createTextNode(getEventTimes(data[x])));
					infoTR.appendChild(infoTD);
					
					infoTD = document.createElement("td");
					infoTD.valign = "top";
					infoTD.appendChild(document.createTextNode(getEventLocation(data[x])));
					infoTR.appendChild(infoTD);
					infoTD = null;
					
					infoTable.appendChild(infoTR);
					infoTR = null;
				}
			} else {
				var data = removeDate(this.information[info]);
				var infoTR = document.createElement("tr");
				var infoTD = document.createElement("td");
				var image = document.createElement("img");
				switch(getEventType(data)) {
					case "1":
						image.setAttribute("src","images/home.gif");
						break;
					case "2":
						image.setAttribute("src","images/away.gif");
						break;
					case "3":
						image.setAttribute("src","images/hwkevent.gif");
						break;
					case "4":
						image.setAttribute("src","images/meeting.gif");
						break;
				}			
				image.setAttribute("border","0");
				image.setAttribute("id",info);
				infoTD.appendChild(image);
				infoTD.appendChild(document.createElement("br"));
				image = null;
				infoTR.appendChild(infoTD);
			
				infoTD = document.createElement("td");
				infoTD.appendChild(document.createTextNode(getEventName(data)));
				infoTD.appendChild(document.createElement("br"));
				infoTD.appendChild(document.createTextNode(getEventTimes(data)));
				infoTR.appendChild(infoTD);
				
				infoTD = document.createElement("td");
				infoTD.valign = "top";
				infoTD.appendChild(document.createTextNode(getEventLocation(data)));
				infoTR.appendChild(infoTD);
				infoTD = null;
			
				infoTable.appendChild(infoTR);
				infoTR = null;
			}
			
			infoC.appendChild(infoTable);
			node.appendChild(date);
			node.appendChild(infoC);
			
			date = null;
			infoC = null;
			infoTable = null;
			return;
		}
	}
	
	if (bgimage != null) {
		node.appendChild(bgimage);
		bgimage = null;
	}
	
	node.appendChild(populate);
	populate = null;
}

//---------------------------------------------------
// clearElements: deletes all the childNodes of the node specified, and then deletes that node

function clearElements(node) {
	var nodePointer = node;
	while(nodePointer.lastChild) {
		if (nodePointer.lastChild.lastChild) nodePointer = nodePointer.lastChild;
		// alert(nodePointer.lastChild.id);
		nodePointer.removeChild(nodePointer.lastChild);
		if ((!nodePointer.lastChild) && (nodePointer != node)) nodePointer = nodePointer.parentNode;
	}
	node.parentNode.removeChild(node);
}

//---------------------------------------------------
// getEventType: accepts an infoString and returns the type of the event in that infoString

function getEventType(infoString) {
	infoArray = infoString.split("*");
	return infoArray[0];
}

//---------------------------------------------------
// getEventName: accepts an infoString and returns the name of the event in that infoString

function getEventName(infoString) {
	infoArray = infoString.split("*");
	return infoArray[1];
}

//---------------------------------------------------

function getEventLocation(infoString) {
	infoArray = infoString.split("*");
	return infoArray[2];
}

//---------------------------------------------------
// getEventTimes: accepts an infoString and returns a string with the beginning and end times with a dash in between

function getEventTimes(infoString) {
	infoArray = infoString.split("*");
	return (infoArray[3] + "-" + infoArray[4]);
}

//---------------------------------------------------

function getEventID(infoString) {
	infoArray = infoString.split("*");
	return infoArray[5];
}

//---------------------------------------------------
// splitDataSet: if the data set has multiple entries (i.e. multiple events) it will return an array of those infoStrings

function splitDataSet(infoString) {
	if (parseInt(infoString) == infoString) return new Array();
	if (infoString.indexOf("^") != -1) {
		dataSet = infoString.split("^");
		return dataSet;
	} else {
		return new Array();
	}
}

//---------------------------------------------------

function removeDate(infoString) {
	infoArray = infoString.split("|");
	return infoArray[1];
}

//---------------------------------------------------

function extractDate(infoString) {
	infoArray = infoString.split("|");
	dateArray = infoArray[0].split("/");
	return dateArray;
}

//---------------------------------------------------

function splitDate(infoString) {
	dateArray = infoString.split("/");
	return dateArray;
}

//---------------------------------------------------

function paruseInfo(info, dateArray) {
	for (var i = 0; i < info.length; i++) {
		var extracted = extractDate(info[i]);
		if (extracted[0] == dateArray[0]) {
			if (extracted[1] == dateArray[1]) {
				if (extracted[2] == dateArray[2]) return i;
			}
		}
	}
	return -1;
}
