// JavaScript Document

var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
var DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');

function FormatTime(thisObj){
	var AMPM="";
	var tValue = thisObj.value;
	if(tValue=="")return;
//--------- Clean up the Input
	tValue = tValue.toUpperCase();
	tValue = tValue.replace(".","")
	tValue = tValue.replace(":","")
	tValue = tValue.replace(" ","")
	if(tValue.search("A")>0){AMPM="AM"}
	else if(tValue.search("P")>0){AMPM="PM"}
	//else{ if(tHR<9) AMPM="PM" }
	tValue = tValue.replace("A","")
	tValue = tValue.replace("P","")
	tValue = tValue.replace("M","")
//---------- Parse Time	
	var tMIN = tValue.substring(tValue.length - 2)
	var tHR = parseInt(tValue/100)
	if(AMPM==""){
		AMPM="AM"
		if(tHR<8) AMPM="PM"
		if(tHR>12){
			tHR = tHR-12
			AMPM="PM"
		}
	}
	thisObj.value=tHR+":"+tMIN+" "+AMPM
}
function makeAJAXRequest(url,returnFunction) {
        var http_request = false;

        if (window.XMLHttpRequest) { // Mozilla, Safari, ...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        http_request.onreadystatechange = function() { eval(returnFunction)(http_request); };
        http_request.open('GET', url, true);
        http_request.send(null);

}

// ------ NEW COMMON JS FUNCTIONS FOR 2012 ---------------
function addComments(fID,iID){
	//alert('/webadmin/acs/common/dialogs/comments.asp?fid='+fID+'&iid='+iID);
	loadwindow('/webadmin/acs/common/dialogs/comments.asp?fid='+fID+'&iid='+iID,500,250,'Shepherding Comments')
}


// ------ END COMMON FUNCTIONS FOR 2012 ---------------
