<!--
function hideDDL(){
    var i = 0;
    
    if (document.forms.length == 0){
        return;
    }

    for (i = 0; i < document.forms[0].elements.length; i++){
        if (document.forms[0].elements[i].type == "select-one"){
            document.forms[0].elements[i].style.visibility = "hidden";
        }
    }
}

function showDDL(){
    var i = 0;
    
    if (document.forms.length == 0){
        return;
    }

    for (i = 0; i < document.forms[0].elements.length; i++){
        if (document.forms[0].elements[i].type == "select-one"){
            document.forms[0].elements[i].style.visibility = "";
        }
    }
}
function openReport(url){
	// open at 90% of screen size
    if (document.all) 
        var xMax = screen.width, yMax = screen.height; 
    else 
        if (document.layers) 
            var xMax = window.outerWidth, yMax = window.outerHeight; 
        else 
            var xMax = 640, yMax=480; 

	var iWidth = xMax * .9;
	var iHeight = yMax * .8;
	
    var xOffset = (xMax - iWidth)/2;
    var yOffset = (yMax - iHeight)/2; 

    var sFeat = "";
        
    if (sFeat.indexOf("toolbar") > -1){
		yOffset = yOffset - 30;
	}
    if (sFeat.indexOf("location") > -1){
		yOffset = yOffset - 30;
	}
    if (sFeat.indexOf("menubar") > -1){
		yOffset = yOffset - 30;
	}
    if (sFeat.indexOf("status") > -1){
		yOffset = yOffset - 30;
	}
	
	if (yOffset < 0){
		yOffset = 0;
	}
    
    if (iWidth != -1){ 
		sFeat = sFeat + ',width=' + iWidth + ',height=' + iHeight 
		sFeat = sFeat + ',screenX=' + xOffset + ',screenY=0,top=0,left=' + xOffset 
    } 
    sFeat += ',menubar,resizable';
        	
	window.open(url, "_blank", sFeat);
}

function __validateTextArea(o, iMaxLength){
	if (o.value.length > iMaxLength){
		alert("Please provide a value no longer than " + iMaxLength + " characters.  You have entered " + o.value.length + " characters.");
		o.focus();
		return false;
	}
	return true;
}

function ValidateTime(o){ 
        sVal = o.value; 
        
        var iHour; 
        var iMinute; 
        var sAMPM; 
        
        iHour = 0; 
        iMinute = 0; 
        
        if (sVal.length == 0){ 
                return; 
        } 
        
        var regExp; 
        var sTemp; 
        
        sTemp = sVal.toLowerCase(); 
        
        regExp = /:/g 
        sTemp = sTemp.replace(regExp, ""); 
        
        regExp = /am/g 
        sTemp = sTemp.replace(regExp, ""); 
        
        regExp = /pm/g 
        sTemp = sTemp.replace(regExp, ""); 

        regExp = / /g 
        sTemp = sTemp.replace(regExp, ""); 

        for(i=0; i < sTemp.length; i++){ 
                if (sTemp.charAt(i) < "0" || sTemp.charAt(i) > "9"){ 
                        alert("Time must be entered in the format hh:mm am/pm.  For example: 1:00 pm"); 
                        o.focus(); 
                        return; 
                } 
        } 
        
        if (sVal.indexOf(" ") == -1){ 
                alert("Time must be entered in the format hh:mm am/pm.  For example: 1:00 pm"); 
                o.focus(); 
                return false; 
        } 
        else{ 
                sAMPM = sVal.substr(sVal.indexOf(" ") + 1, sVal.length - sVal.indexOf(" ")) 
        } 
        
        if (sVal.indexOf(":") == -1){ 
                iMinute = 0; 
        } 
        else{ 
                iMinute = sVal.substr(sVal.indexOf(":") + 1, sVal.indexOf(" ") - sVal.indexOf(":")) 
        } 
        
        if (sVal.indexOf(":") == -1){ 
                iHour = sVal.substr(0, sVal.indexOf(" ")); 
        } 
        else{ 
                iHour = sVal.substr(0, sVal.indexOf(":")); 
        } 
        
        if (iHour < 0 || iHour > 12){ 
                alert("Time must be entered in the format hh:mm am/pm.  For example: 1:00 pm"); 
                o.focus(); 
                return; 
        } 
        
        if (iMinute < 0 || iMinute > 60){ 
                alert("Time must be entered in the format hh:mm am/pm.  For example: 1:00 pm"); 
                o.focus(); 
                return; 
        } 
        
        if (iMinute < 10){ 
                sMinute = "0" + parseInt(iMinute) 
        } 
        else{ 
                sMinute = parseInt(iMinute) 
        } 
        
        o.value = parseInt(iHour) + ":" + sMinute + " " + sAMPM.toUpperCase(); 
} 

function requiredField(oField, sMsg){ 
        if (oField.value.length == 0){ 
                alert(sMsg); 
                oField.focus(); 
                return false; 
        } 
        
        return true; 
} 

function openWindow(sUrl, sName, iWidth, iHeight, sFeatures) { 
	if (arguments.length < 5){
		alert('openWindow requires 5 arguments');
		return false;
	}
		
    if (document.all) 
        var xMax = screen.width, yMax = screen.height; 
    else 
        if (document.layers) 
            var xMax = window.outerWidth, yMax = window.outerHeight; 
        else 
            var xMax = 640, yMax=480; 

    var xOffset = (xMax - iWidth)/2;
    var yOffset = (yMax - iHeight)/2; 

        sFeat = sFeatures.toLowerCase();
        
        if (sFeat.indexOf("toolbar") > -1){
			yOffset = yOffset - 30;
		}
        if (sFeat.indexOf("location") > -1){
			yOffset = yOffset - 30;
		}
        if (sFeat.indexOf("menubar") > -1){
			yOffset = yOffset - 30;
		}
        if (sFeat.indexOf("status") > -1){
			yOffset = yOffset - 30;
		}
		
		if (yOffset < 0){
			yOffset = 0;
		}
        
        if (iWidth != -1){ 
                sFeat = sFeat + ',width=' + iWidth + ',height=' + iHeight 
                sFeat = sFeat + ',screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset 
        } 
        
    window.open(sUrl,sName,sFeat); 
} 

function FormatNum(sNum, iDec, sType){ 
        // sType = $, %, "" 
        if (typeof sNum == "number"){ 
                sNum = sNum.toString(); 
        } 
        
        var sTemp = ""; 
        var sNumWhole = ""; 
        var sNumFrac = ""; 
        var iDecLoc = 0; 
        var counter = 0; 
        var bNegative = false; 
        var regExp = ""; 
        
        // remove commas 
        regExp = /,/g 
        sNum = sNum.replace(regExp, ""); 
        
        // remove $ 
        regExp = /\$/g 
        sNum = sNum.replace(regExp, ""); 
        
        // remove % 
        regExp = /%/g 
        sNum = sNum.replace(regExp, ""); 
        
        // remove - 
        if (sNum.indexOf("-") != -1) 
                bNegative = true; 
        
        regExp = /-/g 
        sNum = sNum.replace(regExp, ""); 
                
        iDecLoc = sNum.indexOf("."); 
        
        if (iDecLoc == -1){ 
                sNumFrac = ""; 
                sNumWhole = sNum; 
        } 
        else{ 
                sNumWhole = sNum.substr(0, iDecLoc); 
                sNumFrac = sNum.slice(iDecLoc + 1); 
        } 

        while (sNumWhole.length > 0 && sNumWhole.charAt(0) == "0"){ 
                sNumWhole = sNumWhole.substr(1, sNumWhole.length - 1); 
        } 
                        
        if (sNumWhole.length == 0) 
                sNumWhole = "0"; 

        for (i=sNumWhole.length-1; i > -1; i--){ 
                if (counter > 0 && counter % 3 == 0) 
                        sTemp = "," + sTemp 
                        
                sTemp = sNumWhole.charAt(i) + sTemp 
                counter++; 
        } 
        
        while (sNumFrac.length < iDec){ 
                sNumFrac = sNumFrac + "0" 
        } 
                
        // chop off additional decimals
        
        
        // end      
        
        if (sType == "$") 
                sTemp = "$" + sTemp; 
        
        if (bNegative) 
                sTemp = "-" + sTemp; 
        
        // remove - 
        if (iDec != 0) 
                sTemp = sTemp + "." + sNumFrac; 
                
        if (sType == "%") 
                sTemp = sTemp + "%"; 
                
        //alert(sTemp);
        //if (parseInt(sNumWhole) == 0 && parseInt(sNumFrac) == 0){ 
        //      sTemp = ""; 
        //} 
        
        return sTemp; 
} 

function FormatDate(sDate){ 
        if (sDate.length == 0) 
                return ""; 
                
        var inputStr = sDate 
        
        // convert hyphen delimiters to slashes 
        while (inputStr.indexOf("-") != -1) { 
                inputStr = replaceString(inputStr,"-","/") 
        } 

        var delim1 = inputStr.indexOf("/") 
        var delim2 = inputStr.lastIndexOf("/") 

        if (delim1 != -1) { 
                // there are delimiters; extract component values 
                var mm = parseInt(inputStr.substring(0,delim1),10) 
                var dd = parseInt(inputStr.substring(delim1 + 1,delim2),10) 
                var yyyy = parseInt(inputStr.substring(delim2 + 1, inputStr.length),10) 
        } else { 
                // there are no delimiters; extract component values 
                var mm = parseInt(inputStr.substring(0,2),10) 
                var dd = parseInt(inputStr.substring(2,4),10) 
                var yyyy = parseInt(inputStr.substring(4,inputStr.length),10) 
        } 
        if (isNaN(mm) || isNaN(dd) || isNaN(yyyy)) { 
                // there is a non-numeric character in one of the component values 
                return "" 
        } 
        if (mm < 1 || mm > 12) { 
                // month value is not 1 thru 12 
                return "" 
        } 
        if (dd < 1 || dd > 31) { 
                // date value is not 1 thru 31 
                return "" 
        } 

        // validate year, allowing for checks between year ranges 
        // passed as parameters from other validation functions 
        if (yyyy < 100) { 
                // entered value is two digits, which we allow for 1930-2029 
                if (yyyy >= 30) { 
                        yyyy += 1900 
                } else { 
                        yyyy += 2000 
                } 
        } 

        var today = new Date() 
        // default year range (now set to (this year - 100) and (this year + 25) 
        var thisYear = today.getYear() 
        if (thisYear < 100) { 
                thisYear += 1900 
        } 

        if (!checkMonthLength(mm,dd)) { 
                return "" 
        } 
        if (mm == 2) { 
                if (!checkLeapMonth(mm,dd,yyyy)) { 
                        return "" 
                } 
        } 
        
        return mm + "/" + dd + "/" + yyyy 
} 
function FormatMonthYear(sDate){ 
        if (sDate.length == 0) 
                return "present"; 
                
        if (sDate.toLowerCase() == "present"){
			return "present";
		}
		
        var inputStr = sDate 
        
        // convert hyphen delimiters to slashes 
        while (inputStr.indexOf("-") != -1) { 
                inputStr = replaceString(inputStr,"-","/") 
        } 

        var delim1 = inputStr.indexOf("/") 

        if (delim1 != -1) { 
                // there are delimiters; extract component values 
                var mm = parseInt(inputStr.substring(0,delim1),10) 
                var yyyy = parseInt(inputStr.substring(delim1 + 1, inputStr.length),10) 
        } else { 
                // there are no delimiters; extract component values 
                var mm = parseInt(inputStr.substring(0,2),10) 
                var yyyy = parseInt(inputStr.substring(2,inputStr.length),10) 
        } 
        if (isNaN(mm) || isNaN(yyyy)) { 
                // there is a non-numeric character in one of the component values 
                return "" 
        } 
        if (mm < 1 || mm > 12) { 
                // month value is not 1 thru 12 
                return "" 
        } 

        // validate year, allowing for checks between year ranges 
        // passed as parameters from other validation functions 
        if (yyyy < 100) { 
                // entered value is two digits, which we allow for 1930-2029 
                if (yyyy >= 30) { 
                        yyyy += 1900 
                } else { 
                        yyyy += 2000 
                } 
        } 

        var today = new Date() 
        // default year range (now set to (this year - 100) and (this year + 25) 
        var thisYear = today.getYear() 
        if (thisYear < 100) { 
                thisYear += 1900 
        } 

//        if (!checkMonthLength(mm,dd)) { 
//                return "" 
//        } 
//        if (mm == 2) { 
//                if (!checkLeapMonth(mm,dd,yyyy)) { 
//                        return "" 
//                } 
//        } 
        
        return mm + "/" + yyyy 
} 

function ValidateMonthYear(o){
	if(!isMonthYear(o.value)){
		o.focus();
		return;
	}
	
	o.value = FormatMonthYear(o.value);
}

function ValidateDate(o){ 
	if (o.value == "t" || o.value == "T"){
		var d = new Date();
		o.value = (d.getMonth() + 1) + "/" + d.getDate() + "/" + d.getFullYear();
	}
	if (!isDate(o.value)){ 
		o.focus(); 
		return; 
	} 

	o.value = FormatDate(o.value); 
} 

function ValidatePercent(o, iDecimals){ 
        if (!isPercent(o.value, iDecimals)){ 
                o.focus(); 
                alert("Please provide a valid percent with no more than " + iDecimals + " places after the decimal."); 
                return; 
        } 
        o.value = FormatNum(o.value, iDecimals, "%"); 
} 

function ValidateCurrency(o, iDecimals){ 
        if (!isCurrency(o.value, iDecimals)){ 
                o.focus(); 
                alert("Please provide a valid dollar amount with no more than " + iDecimals + " places after the decimal.");

                return; 
        } 
        o.value = FormatNum(o.value, iDecimals, "$"); 
} 

function ValidateNumber(o, iDecimals, bSupressFormatting, sPermittedSign){ 
        if (!isNumber(o.value, iDecimals)){ 
                o.focus(); 
                alert("Please provide a valid number with no more than " + iDecimals + " places after the decimal."); 
                return; 
        } 
        
        var inputStr = o.value;
        var regExp = /\$/g 
        inputStr = inputStr.replace(regExp, ""); 
        var regExp = /,/g 
        inputStr = inputStr.replace(regExp, ""); 

		if (parseInt(inputStr) > 2147483647){
			o.focus(); 
			alert("Please provide a valid number that is less than 2,147,483,647."); 
			return; 
		}

		if (parseInt(inputStr) > 0 && sPermittedSign == "N"){
			o.focus();
			alert("Please provide a number less than zero.");
			return;
		}
		
		if (parseInt(inputStr) < 0 && sPermittedSign == "P"){
			o.focus();
			alert("Please provide a number greater than zero.");
			return;
		}
		
		if (bSupressFormatting){
			return;
		}
			
        o.value = FormatNum(o.value, iDecimals, ""); 
} 

function BuildMissingString(strItem1,strItem2){ 
        if (strItem1 != ""){ 
                strItem1 = strItem1 + ", " 
                } 
        if (strItem2 != "") { 
                strItem1 = strItem1 + strItem2; 
        } 
        return strItem1; 
} 

function IsBlank(s){ 
var len=s.length 
var i 
if(s == "") return true; 
for(i=0;i<len;++i){ 
        if(s.charAt(i)!=" ") return false; 
} 
return true; 
} 

function isCurrency(inputVal, iDecimals) { 
        var regExp = /\$/g 
        inputVal = inputVal.replace(regExp, ""); 
        var regExp = /-/g 
        inputVal = inputVal.replace(regExp, ""); 
        
        return isNumber(inputVal, iDecimals); 
} 

function isNumber(inputVal, iDecimals) { 
        oneDecimal = false 
        var charsAfterDecimal = 0; 
        inputStr = inputVal.toString() 
        for (var i = 0; i < inputStr.length; i++) { 
                var oneChar = inputStr.charAt(i) 
                if (i == 0 && oneChar == "-") { 
                        continue 
                } 
                
                if (oneDecimal) 
                        charsAfterDecimal++; 

                if (oneChar == "." && !oneDecimal) { 
                        oneDecimal = true; 
                        continue; 
                } 
                
                if (oneDecimal && charsAfterDecimal > iDecimals){ 
                        return false 
                } 
                
                if (oneChar == ","){ 
                        continue 
                } 
                
                if (oneChar < "0" || oneChar > "9") { 
                        return false 
                } 
        } 
        
		
        return true 
} 
function isPercent(inputVal, iDecimals) { 
        oneDecimal = false 
        var charsAfterDecimal = 0; 
        inputStr = inputVal.toString() 
        for (var i = 0; i < inputStr.length; i++) { 
                var oneChar = inputStr.charAt(i) 
                if (i == 0 && oneChar == "-") { 
                        continue 
                } 
                
                if (oneChar == "%"){ 
                        continue 
                } 
                
                if (oneChar == "." && !oneDecimal) { 
                        oneDecimal = true 
                        continue 
                } 
                
                if (oneDecimal) 
                        charsAfterDecimal++; 
                
                if (charsAfterDecimal > iDecimals){ 
                        return false 
                } 
                
                if (oneChar == ","){ 
                        continue 
                } 
                
                if (oneChar < "0" || oneChar > "9") { 
                        return false 
                } 
        } 
        return true 
} 

function isDate(sVal) { 
        if (sVal.length == 0) 
                return true; 
                
        var inputStr = sVal 
        
        // convert hyphen delimiters to slashes 
        while (inputStr.indexOf("-") != -1) { 
                inputStr = replaceString(inputStr,"-","/") 
        } 
        var delim1 = inputStr.indexOf("/") 
        var delim2 = inputStr.lastIndexOf("/") 
        if (delim1 != -1 && delim1 == delim2) { 
                // there is only one delimiter in the string 
                alert("The date entry is not in an acceptable format.\n\nYou can enter dates in the following formats: mmddyyyy, mm/dd/yyyy, or mm-dd-yyyy.  (If the month or date data is not available, enter \'01\' in the appropriate location.)")

                return false 
        } 
        if (delim1 != -1) { 
                // there are delimiters; extract component values 
                var mm = parseInt(inputStr.substring(0,delim1),10) 
                var dd = parseInt(inputStr.substring(delim1 + 1,delim2),10) 
                var yyyy = parseInt(inputStr.substring(delim2 + 1, inputStr.length),10) 
        } else { 
                // there are no delimiters; extract component values 
                var mm = parseInt(inputStr.substring(0,2),10) 
                var dd = parseInt(inputStr.substring(2,4),10) 
                var yyyy = parseInt(inputStr.substring(4,inputStr.length),10) 
        } 
        if (isNaN(mm) || isNaN(dd) || isNaN(yyyy)) { 
                // there is a non-numeric character in one of the component values 
                alert("The date entry is not in an acceptable format.\n\nYou can enter dates in the following formats: mmddyyyy, mm/dd/yyyy, or mm-dd-yyyy.")

                return false 
        } 
        if (mm < 1 || mm > 12) { 
                // month value is not 1 thru 12 
                alert("Months must be entered between the range of 01 (January) and 12 (December).") 
                return false 
        } 
        if (dd < 1 || dd > 31) { 
                // date value is not 1 thru 31 
                alert("Days must be entered between the range of 01 and a maximum of 31 (depending on the month and year).")

                return false 
        } 

        // validate year, allowing for checks between year ranges 
        // passed as parameters from other validation functions 
        if (yyyy < 100) { 
                // entered value is two digits, which we allow for 1930-2029 
                if (yyyy >= 30) { 
                        yyyy += 1900 
                } else { 
                        yyyy += 2000 
                } 
        } 

        var today = new Date() 
        // default year range (now set to (this year - 100) and (this year + 25) 
        var thisYear = today.getYear() 
        if (thisYear < 100) { 
                thisYear += 1900 
        } 

        if (!checkMonthLength(mm,dd)) { 
                return false 
        } 
        if (mm == 2) { 
                if (!checkLeapMonth(mm,dd,yyyy)) { 
                        return false 
                } 
        } 
        // put the Informix-friendly format back into the field 
        return true 
} 

function isMonthYear(sVal) { 
        if (sVal.length == 0) 
                return true; 
                
        if (sVal.toLowerCase() == "present"){
			return true;
		}
                
        var inputStr = sVal 
        
        // convert hyphen delimiters to slashes 
        while (inputStr.indexOf("-") != -1) { 
                inputStr = replaceString(inputStr,"-","/") 
        } 
        var delim1 = inputStr.indexOf("/") 
        if (delim1 != -1) { 
                // there are delimiters; extract component values 
                var mm = parseInt(inputStr.substring(0,delim1),10) 
                var yyyy = parseInt(inputStr.substring(delim1 + 1, inputStr.length),10) 
        } else { 
                // there are no delimiters; extract component values 
                var mm = parseInt(inputStr.substring(0,2),10) 
                var yyyy = parseInt(inputStr.substring(2,inputStr.length),10) 
        } 
        if (isNaN(mm) || isNaN(yyyy)) { 
                // there is a non-numeric character in one of the component values 
                alert("The date entry is not in an acceptable format.\n\nYou can enter dates in the following formats: mmyyyy, mm/yyyy, mm-yyyy, mmyy, mm/yy or mm-yy.")

                return false 
        } 
        if (mm < 1 || mm > 12) { 
                // month value is not 1 thru 12 
                alert("Months must be entered between the range of 01 (January) and 12 (December).") 
                return false 
        } 

        // validate year, allowing for checks between year ranges 
        // passed as parameters from other validation functions 
        if (yyyy < 100) { 
                // entered value is two digits, which we allow for 1930-2029 
                if (yyyy >= 30) { 
                        yyyy += 1900 
                } else { 
                        yyyy += 2000 
                } 
        } 

        var today = new Date() 
        // default year range (now set to (this year - 100) and (this year + 25) 
        var thisYear = today.getYear() 
        if (thisYear < 100) { 
                thisYear += 1900 
        } 

        // put the Informix-friendly format back into the field 
        return true 
} 

// check the entered month for too high a value 
function checkMonthLength(mm,dd) { 
        var months = new Array("","January","February","March","April","May","June","July","August","September","October","November","December")

        if ((mm == 4 || mm == 6 || mm == 9 || mm == 11) && dd > 30) { 
                alert(months[mm] + " has only 30 days.") 
                return false 
        } else if (dd > 31) { 
                alert(months[mm] + " has only 31 days.") 
                return false 
        } 
        return true 
} 

// check the entered February date for too high a value 
function checkLeapMonth(mm,dd,yyyy) { 
        if (yyyy % 4 > 0 && dd > 28) { 
                alert("February of " + yyyy + " has only 28 days.") 
                return false 
        } else if (dd > 29) { 
                alert("February of " + yyyy + " has only 29 days.") 
                return false 
        } 
        return true 
} 

// extract front part of string prior to searchString 
function getFront(mainStr,searchStr){ 
        foundOffset = mainStr.indexOf(searchStr) 
        if (foundOffset == -1) { 
                return null 
        } 
        return mainStr.substring(0,foundOffset) 
} 

// extract back end of string after searchString 
function getEnd(mainStr,searchStr) { 
        foundOffset = mainStr.indexOf(searchStr) 
        if (foundOffset == -1) { 
                return null 
        } 
        return mainStr.substring(foundOffset+searchStr.length,mainStr.length) 
} 

// insert insertString immediately before searchString 
function insertString(mainStr,searchStr,insertStr) { 
        var front = getFront(mainStr,searchStr) 
        var end = getEnd(mainStr,searchStr) 
        if (front != null && end != null) { 
                return front + insertStr + searchStr + end 
        } 
        return null 
} 

// remove deleteString 
function deleteString(mainStr,deleteStr) { 
        return replaceString(mainStr,deleteStr,"") 
} 

// replace searchString with replaceString 
function replaceString(mainStr,searchStr,replaceStr) { 
        var front = getFront(mainStr,searchStr) 
        var end = getEnd(mainStr,searchStr) 
        if (front != null && end != null) { 
                return front + replaceStr + end 
        } 
        return null 
} 

function selectedRadioValue(o){ 
        for (var i=0; i < o.length; i++){ 
                if (o[i].checked){ 
                        return o[i].value; 
                } 
        } 
        
        return "";      
} 


// Enhanced Calendar support
function selectEvent(sID, sIDEvent){
	// unselect date, if any
	var sSelectedDate = document.all[sID + "_txtSelectedDate"].value;
	if (sSelectedDate != ""){
		var oSelectedDate = document.all[sID + "_Day" + sSelectedDate.replace(/\//g, "-")];
		if (typeof oSelectedDate != "undefined"){
			unselectDay(oSelectedDate);
		}
	}
	document.all[sID + "_txtSelectedDate"].value = "";

	// get id of selected event
	document.all[sID + "_txtSelectedEvent"].value = sIDEvent;
	
	for(i=0; i < document.all.length; i++){
		if (document.all[i].id.indexOf(sID + "_Event" + sIDEvent + "_") != -1){
			document.all[i].className = "EnhancedCalendarEventSelected";
		}
		else if (document.all[i].id.indexOf(sID + "_Event") != -1){
			// found an event, but not the right event
			document.all[i].className = "EnhancedCalendarEvent";
		}
	}
	
	event.cancelBubble = true;
}
function selectDay(sID, sIDDay){
	// unselect event, if any
	// get id of selected event
	sIDEvent = document.all[sID + "_txtSelectedEvent"].value;
	
	if (sIDEvent != "-1"){
		for(i=0; i < document.all.length; i++){
			if (document.all[i].id.indexOf(sID + "_Event") != -1){
				// found an event, but not the right event
				document.all[i].className = "EnhancedCalendarEvent";
			}
		}
	}

	// get selected date
	// format of date id is EnhancedCalendar1:Day5-1-2002
	
	var sSelectedDate = document.all[sID + "_txtSelectedDate"].value;
	
	// get reference to selected date
	if (sSelectedDate != ""){
		var oSelectedDate = document.all[sID + "_Day" + sSelectedDate.replace(/\//g, "-")];
		if (typeof oSelectedDate != "undefined"){
			unselectDay(oSelectedDate);
		}
	}
	
	// select new date
	document.all[sID + "_" + sIDDay].className = "EnhancedCalendarDaySelected";
	
	// save newly selected date
	oSelectedDate = document.all[sID + "_" + sIDDay];
	document.all[sID + "_txtSelectedDate"].value = oSelectedDate.date;
	
	event.cancelBubble = true;
}
function unselectDay(oDay){
	oDay.className = "EnhancedCalendarDay";
}

// These functions are used to allow dragging and moving of objects on the screen
// Think virtual popups

// Determine browser and version.
function Browser() {

  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

// Global object to hold drag information.
var dragObj = new Object();
dragObj.zIndex = 0;

function dragStart(event, id) {

  var el;
  var x, y;

  // If an element id was given, find it. Otherwise use the element being
  // clicked on.
  if (id)
    dragObj.elNode = document.getElementById(id);
  else {
    if (browser.isIE)
      dragObj.elNode = window.event.srcElement;
    if (browser.isNS)
      dragObj.elNode = event.target;

    // If this is a text node, use its parent element.
    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
  }

  // Get cursor position with respect to the page.
  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Save starting positions of cursor and element.
  dragObj.cursorStartX = x;
  dragObj.cursorStartY = y;
  dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
  dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);

  if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
  if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;

  // Update element's z-index.
  dragObj.elNode.style.zIndex = ++dragObj.zIndex;

  // Capture mousemove and mouseup events on the page.
  if (browser.isIE) {
    document.attachEvent("onmousemove", dragGo);
    document.attachEvent("onmouseup",   dragStop);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS) {
    document.addEventListener("mousemove", dragGo,   true);
    document.addEventListener("mouseup",   dragStop, true);
    event.preventDefault();
  }
}

function dragGo(event) {

  var x, y;

  // Get cursor position with respect to the page.
  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Move drag element by the same amount the cursor has moved.
  dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";

  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
}

function dragStop(event) {
  // Stop capturing mousemove and mouseup events.
  if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",   dragStop);
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,   true);
    document.removeEventListener("mouseup",   dragStop, true);
  }
}
-->