function closemenu() {
	Menu1.className = "menuOut"
	Menu2.className = "menuOut"
	Menu3.className = "menuOut"
	Menu4.className = "menuOut"
	Menu5.className = "menuOut"
	Menu6.className = "menuOut"
	Menu7.className = "menuOut"
	SubMenu1.style.display='none'
	SubMenu2.style.display='none'
	SubMenu3.style.display='none'
	SubMenu4.style.display='none'
	SubMenu5.style.display='none'
	SubMenu6.style.display='none'
	SubMenu7.style.display='none'	
}
function subMenuOpen(e) {
	e.className = "menuOver"
	eval("Sub" + e.id + ".style.display='inline'")
}

function subMenuOpenE(e) {
	e.className = "menuOverE"
	eval("Sub" + e.id + ".style.display='inline'")
}
function subMenuClose(e) {
	e.className = "menuOut"
	eval("Sub" + e.id + ".style.display='none'")
}
function subMenuCloseE(e) {
	e.className = "menuOutE"
	eval("Sub" + e.id + ".style.display='none'")
}
function subMenuOver(e) {
	//alert(e.parentElement.tagName);
	e.className = "subMenuOver"
}

function subMenuOut(e) {
	e.className = "subMenuOut"
}

//-----------TABLE SORT
function setDataType(cValue)
{
 	// This function converts dates and numbers for proper array sorting when in the sort function
    	var isDate = new Date(cValue);
    	if (isDate == "NaN") {
        	if (isNaN(cValue)) {
			// The value is a string, make all characters in string upper case to assure proper a-z sort
  		    	cValue = cValue.toUpperCase();
            	return cValue;
          }
        	else {
        		// Value is a number, to prevent string sorting of a number, add an additional digit that is the + to the 
        		// length of the number when it is a string
			var myNum;
            	myNum = String.fromCharCode(48 + cValue.length) + cValue;
            	return myNum;
          }
	}
  	else {
  		// Value to sort is a date, remove all of the punctuation and return the string number
		// bug - strng and not numerical sort... (1 - 10 - 11...)
		var myDate = new String();
        	myDate = isDate.getFullYear() + " " ;
        	myDate = myDate + isDate.getMonth() + " ";
        	myDate = myDate + isDate.getDate(); + " ";
        	myDate = myDate + isDate.getHours(); + " ";
        	myDate = myDate + isDate.getMinutes(); + " ";
        	myDate = myDate + isDate.getSeconds();
        	//myDate = String.fromCharCode(48 + myDate.length) + myDate;
        	return myDate ;
 	}
}
function sortTable(col, tableToSort)
{
window.status ='Sorting.....'
    	var iCurCell = col + tableToSort.cols;
    	var totalRows = tableToSort.rows.length;
    	var bSort = 0;
    	var colArray = new Array();
   	var oldIndex = new Array();
    	var indexArray = new Array();
    	var bArray = new Array();
    	var newRow;
    	var newCell;
    	var i;
    	var c;
    	var j;

    	// ** Populate the array colArray with contents of the column selected
    	for (i=1; i < tableToSort.rows.length; i++) {
     	colArray[i - 1] = setDataType(tableToSort.cells(iCurCell).innerText);
        	iCurCell = iCurCell + tableToSort.cols;
    	}
    	// ** Copy array for comparison after sort
    	for (i=0; i < colArray.length; i++) {
      	bArray[i] = colArray[i];
      }
    	// ** Sort the column items
    	colArray.sort();
    	for (i=0; i < colArray.length; i++) { 		// Loop through the new sorted array
		indexArray[i] = (i+1);
        	for(j=0; j < bArray.length; j++) { 		// Loop through the old array
	        	// When the item in the old and new match, place the current row number in the proper
	        	// position in the new order array so rows can be moved... make sure current row number is
	        	// not already in the new order array
			if (colArray[i] == bArray[j]) {  		
            		for (c=0; c<i; c++) {
                    	if ( oldIndex[c] == (j+1) ) {
                      		bSort = 1;
                    	}
           		}
        			if (bSort == 0) {
					oldIndex[i] = (j+1);
                  	}
                 	bSort = 0;
             	}
          }
    	}
  	// ** Sorting complete, add new rows to base of table....
	for (i=0; i<oldIndex.length; i++) {
	newRow = tableToSort.insertRow();
	newRow.className="viewtd"
      	for (c=0; c<tableToSort.cols; c++) {
          	newCell = newRow.insertCell();
          	newCell.innerHTML = tableToSort.rows(oldIndex[i]).cells(c).innerHTML;
        	}
  	}
  	//Move new rows to top of table....
	for (i=1; i<totalRows; i++) {
      	tableToSort.moveRow((tableToSort.rows.length -1),1);
    	}
  	//Delete the older rows from the bottom of the table....
  	for (i=1; i<totalRows; i++) {
      	tableToSort.deleteRow();
   	}
window.status ='Finished sorting.'
}