function updateDate() {
	var current_date = new Date ( );
	var month_names = new Array ( );
	month_names[month_names.length] = "Jan";
	month_names[month_names.length] = "Feb";
	month_names[month_names.length] = "Mar";
	month_names[month_names.length] = "Apr";
	month_names[month_names.length] = "May";
	month_names[month_names.length] = "Jun";
	month_names[month_names.length] = "Jul";
	month_names[month_names.length] = "Aug";
	month_names[month_names.length] = "Sep";
	month_names[month_names.length] = "Oct";
	month_names[month_names.length] = "Nov";
	month_names[month_names.length] = "Dec";
	
	var day_names = new Array ( );
	day_names[day_names.length] = "Sun";
	day_names[day_names.length] = "Mon";
	day_names[day_names.length] = "Tue";
	day_names[day_names.length] = "Wed";
	day_names[day_names.length] = "Thu";
	day_names[day_names.length] = "Fri";
	day_names[day_names.length] = "Sat";
	
	var currentDateString = day_names[current_date.getDay()]+", "+ current_date.getDate()+" "+month_names[current_date.getMonth()]+" "+ current_date.getFullYear();
  // Update the date display
  document.getElementById("currentDateString").innerHTML = currentDateString;
}

// used to minimize/restore portal
// imgObj = this  #the image object
function resizeMe(imgObj,openClose) { // openClose added by JFK
	var imgObj2 = new Object();
	imgObj2.elNode = imgObj;
		
	// boolean to determine if we have to create the div to hold the elements
	var contExists = false;

	// search for div above image
	while(imgObj2.elNode.parentNode.tagName != "DIV" && imgObj2.elNode.parentNode.tagName != "BODY") {
		imgObj2.elNode = imgObj2.elNode.parentNode;
	}
	
	// get the image's parent node (the DIV)
	var obj= imgObj2.elNode.parentNode;

	var resObj;
	
	// check to see if the container exists
	for(i=0; i<obj.childNodes.length; i++) {
		if(obj.childNodes[i].tagName == "DIV" && obj.childNodes[i].id.substring(0,20) == "sectionDivContainer_") {
			contExists = true;
			resObj = obj.childNodes[i];
		}
	}
	
	
	
	// check if the table is in the resize div
	// if parent of image and parent of table are not the same
	if(contExists == false) {
		resObj = document.getElementById(putElementsInDiv(obj));
	}
	
	// do resize
	if((openClose=="open") || ((openClose != "close") && (resObj.style.display)) == "none") {
		resObj.style.display = "block";
		imgObj.src="images/iconMin.gif";
	} else {
		resObj.style.display = "none";
		imgObj.src="images/iconMax.gif";		
	}	
}

// put the table in a div... used with resizeMe()
function putElementsInDiv(obj) {
	// create div container
	var parDiv = document.createElement("div");
	// set the id
var idsuffix=obj.id // JFK 20060606
if (!idsuffix) { closeablePortletDivSeq++;idsuffix=closeablePortletDivSeq} // JFK 20060606
	parDiv.id = "sectionDivContainer_" + idsuffix; // JFK 20060606 (idsuffix was obj.id)
	// start adding after finding the span with the buttons
	var spanFound = false;
	// go through all the child nodes
	for(i=0; i<obj.childNodes.length; i++) {
		//alert(obj.id + "\\" + obj.childNodes[i].tagName + "//" + obj.childNodes[i].id);		
		// if we've found the first span (the one containing the buttons), continue
		if(spanFound == false && obj.childNodes[i].tagName == "SPAN") {
			// go through all remaining objects from the bottom up
			for(j=obj.childNodes.length-1; j>i; j--) {
				//alert(obj.id + "//" + obj.childNodes[j].tagName + "//" + obj.childNodes[j].id);		
				// add the first node
				if(parDiv.childNodes.length == 0) {
					parDiv.appendChild(obj.childNodes[j]);	
				} else {
					// insert remaining nodes before the first one
					parDiv.insertBefore(obj.childNodes[j],parDiv.childNodes[0]);	
				}
			}
			// done
			break;
		}		
	}	
	// add this div
	obj.appendChild(parDiv);	
	
	return parDiv.id;
}

/**
 * function to stripe tables
 */

function stripe(sTable) {
	/* recolor here */
	if (typeof sTable == "string") {
		sTable = document.getElementById(sTable);
	}
	
	// check if the table is defined before continuing
	if(sTable != undefined) {
		var row = null;
		
		// counter for visible rows
		var vr = 0;
		
		// go through each row in the table
		for(var i=0; i<sTable.getElementsByTagName("TBODY")[0].rows.length; i++) {
			row = sTable.getElementsByTagName("TBODY")[0].rows[i];
			if(i == 0) {
				prevRow = row;
			} else {
				prevRow =	sTable.getElementsByTagName("TBODY")[0].rows[i-1];
			}

			spanningRow = false;
			groupedRow = false;
			
			// compare row IDs
			if(row.id.length > 0 && prevRow.id.length > 0) {
				hLocR = row.id.indexOf("-");
				hLocP = prevRow.id.indexOf("-");
				if(row.id.substring(0,hLocR) == prevRow.id.substring(0,hLocP)) {
					groupedRow = true;
					if(vr == 0) vr=1;
					//alert(row.id.substring(0,hLocR) + "\n" + prevRow.id.substring(0,hLocP) + "\n#" + groupedRow);
				}
			}
		
			//	alert(row.childNodes[1].attributes.getNamedItem("colspan").value + "//" + row.childNodes[1].innerHTML);

			//	if(row.childNodes[0].hasAttribute && row.childNodes[0].hasAttribute("colspan")) {
			if(row.childNodes[0].nodeName != "#text") {
				if(row.childNodes[0].attributes.getNamedItem("colspan").value > 1 ) { //&& prevRow.childNodes[0].attributes.getNamedItem("colspan").value == 1
					spanningRow = true;
				} else {
					spanningRow = false;
				}
			} else if(row.childNodes[1].hasAttribute("colspan")) { // && !prevRow.childNodes[1].hasAttribute("colspan")
					spanningRow = true;
				} else {
					spanningRow = false;
			}


			// check if the row is visible... don't want to stripe invisible rows
			if(row.style.display != "none" && !spanningRow && !groupedRow) {
				vr++;
				// if the row index is even, set the row class to the even
				if(vr % 2 == 0) {
					row.className = "even";
				}
				else
				{
					row.className = "odd";
				}		
			}	else if(spanningRow || groupedRow) {
					row.className = prevRow.className;
			}
			
		} // end for loop
	}
}

function addClassName(el, sClassName) {
	var s = el.className;
	var p = s.split(" ");
	var l = p.length;
	for (var i = 0; i < l; i++) {
		if (p[i] == sClassName)
			return;
	}
	p[p.length] = sClassName;
	el.className = p.join(" ").replace( /(^\s+)|(\s+$)/g, "" );
}

function removeClassName(el, sClassName) {
	var s = el.className;
	var p = s.split(" ");
	var np = [];
	var l = p.length;
	var j = 0;
	for (var i = 0; i < l; i++) {
		if (p[i] != sClassName)
			np[j++] = p[i];
	}
	el.className = np.join(" ").replace( /(^\s+)|(\s+$)/g, "" );
}

function hasClassName(el, sClassName) {
	var hasClass = false;
	var s = el.className;
	var p = s.split(" ");
	var np = [];
	var l = p.length;
	var j = 0;
	for (var i = 0; i < l; i++) {
		if (p[i] == sClassName)
			hasClass = true;
	}
	
	return hasClass;
}


