// JavaScript Document
function confirmLogout() { //v3.0
	if (confirm("Are you sure you want to logout?","")) {
		top.location.href = "logout.php";
	}
}
function callApplication(application) {
	top.location.href = application
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function openNewWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function doAlert(myString) { //v3.0
	alert(myString);
}
function confirmDelete(description, issue_no) { //v3.0
	if (confirm("Are you sure you want to Delete Newsletter issue " +issue_no+ "?","")) {
		parent.mainframe.document.location.href = "delete_newsletter.php?issue_no="+issue_no+"&descript="+description
	}
}
function confirmEvalDelete(confirmMsg, theHref) { //v3.0
	if (confirm(confirmMsg,"")) {
		parent.mainframe.document.location.href = theHref
	}
}
function confirmTheDelete(confirmMsg, confirmMsg2, theHref) { //v3.0
	if (confirm(confirmMsg+"\n \n"+confirmMsg2+" ?","")) {
		parent.mainframe.document.location.href = theHref
	}
}
function confirmTheDelete2(confirmMsg, confirmMsg2, theHref, whichFrame) { //v3.0
	if (confirm(confirmMsg+"\n \n"+confirmMsg2+" ?","")) {
		parent.definition_left.document.location.href = theHref
	}
}
function confirmCopy(description, issue_no, section_no, do_copy) { //v3.0
	if (confirm("Do you really want to copy Newsletter issue " +issue_no+ "?","")) {
		parent.mainframe.document.location.href = "copy_newsletter.php?issue_no="+issue_no+"&issue_description="+description+"&num_of_sections="+section_no+"&do_copy="+do_copy
	}
}
function confirmTheCopy(confirmMsg, theHref) { //v3.0
	if (confirm(confirmMsg,"")) {
		parent.mainframe.document.location.href = theHref
	}
}
function confirmEmail(description, issue_no, viewable, editable, called_by) { //v3.0
	if (confirm("Once you have distributed the newsletter with this email function \n you will NOT be able to edit this newsletter again!!! \n \n Do you wish to email Newsletter Issue "+issue_no+"?","")) {
		parent.mainframe.document.location.href = "e_newsletter.php?issue_no="+issue_no+"&issue_description="+description+"&is_viewable="+viewable+"&editable="+editable+"&called_by="+called_by
	}
}
function callModule(module) { //v3.0
	parent.mainframe.document.location.href = module
}
function callModuleIframe(module,iframeName) { //v3.0
	parent.fileList.document.location.href = module
}
function calltodoCatEc(mod) { //v3.0
	parent.todoCatEc.document.location.href = mod
}
function viewImage(theImage, theHeight, theWidth, theName, theOptions) {
	imageWindow = window.open
}
function promptNewFileName(thefile, thePath, theURL, oldName) {
//	imageWindow = window.open
	newFileName = prompt("Please enter the a filename for \n"+thefile,oldName);
	if (newFileName) {
		parent.fileList.document.location.href = theURL+newFileName
	}
}
function setFrames(left, mainf) { //v3.0
	parent.leftframe.document.location.href = left
	parent.mainframe.document.location.href = mainf
}
function setMenuApp(menuf, mainf) { //v3.0
//alert('function setMenuApp('+menuf+', '+mainf+')');
	parent.menu.document.location.href = menuf
	parent.mainframe.document.location.href = mainf
}
function callApps(mainf) { //v3.0
	parent.mainframe.document.location.href = mainf
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function promptRename(theMsg, theOldName, theURL) {
//	imageWindow = window.open
	newName = prompt(theMsg+"\n"+theOldName,"");
	if (newName) {
		parent.mainframe.document.location.href = theURL+newName
	}
}
function validateLogin(loginForm) {
	loginProblem = false;
	loginMsg = "";
	if (loginForm.username.value == "" && loginForm.password.value == "") {
 		loginProblem = true
		loginMsg = "Please enter a valid Login ID and Password to gain access"
	} else if (loginForm.username.value == "") {
 		loginProblem = true
		loginMsg = "Please enter a valid Login ID to gain access" 
	} else if (loginForm.password.value == "") {
 		loginProblem = true
		loginMsg = "Please enter a  valid Password to gain access" 
	}
	if (loginProblem) {
		document.getElementById("logMsg").width = 400
 		document.getElementById("logMsg").height = 30
		logMsg.document.write("<html><head></head><body><div align=\"center\"><font color=\"#FF0000\" size=\"2\">")
		logMsg.document.write(loginMsg)
		logMsg.document.write("</font></div></body></html>")
		logMsg.document.close()
		return false
	 } else {
		document.getElementById("logMsg").width = 0
 		document.getElementById("logMsg").height = 0
		return true
	 }
}
function loginError(errMsg) {
	document.getElementById("logMsg").width = 400
	document.getElementById("logMsg").height = 30
	logMsg.document.write("<html><head></head><body><div align=\"center\"> <font color=\"#FF0000\" size=\"2\">")
	logMsg.document.write(errMsg)
	logMsg.document.write("</font></div></body></html>")
	logMsg.document.close()
}
function validateECAG(thisForm) {
	err = false;
	eMsg = "Please correct the following:\n";
    if (thisForm.stratCat.value == "") {
 		err = true
		eMsg = eMsg+"\n -- Please Select a Strategic Category!!" 
	} 
	if (thisForm.description.value == "") {
 		err = true
		eMsg = eMsg+"\n -- Please enter a Description" 
	} 
	if (thisForm.theMeasure.options[thisForm.theMeasure.selectedIndex].value == "") {
 		err = true
		eMsg = eMsg+"\n -- Please Select how you will measure!!" 
	}
	if (err) {
		alert(eMsg);
		return false;
	} else {
		return true
	 }
}
function set_major_Minor_cat(is_smc) {
	document.getElementById("ec_sm").smc.disabled = !(document.getElementById("ec_sm").smc.disabled);
	document.getElementById("ec_sm").measurement_cat.disabled = !(document.getElementById("ec_sm").measurement_cat.disabled);
	if (!is_smc) {
		document.getElementById("ec_sm").smc.value = ""
	}
}
function expandCollapse(whichElement) {
	var element = document.getElementById(whichElement);
	element.style.display = (element.style.display == "none") ? "block" : "none";
}
function expandCollapseMouseOver(whichElement) {
	var element = document.getElementById(whichElement);
	if (element.style.display == "none") {
		window.status="Show the Goals/Objevtives for " + whichElement
	} else {
		window.status="Hide the Goals/Objectives for " + whichElement
	}
}
function openCloseFrame(){
var ocCheckThis=parent.frames["hidden"].document.forms[0].elements["o_c_status"].value
	if (ocCheckThis=="close"){
		document.getElementById("o_c_Frame").src="/images/ePro_close_btn.gif"
		parent.minMaxFrame("left",144)
		parent.frames["hidden"].document.forms[0].elements["o_c_status"].value="open"
		document.getElementById("showOrHide").style.display=""
	} else if (ocCheckThis=="open"){
		document.getElementById("o_c_Frame").src="/images/ePRO_open_btn.gif";
		parent.minMaxFrame("left",13)
		parent.frames["hidden"].document.forms[0].elements["o_c_status"].value="close";
		document.getElementById("showOrHide").style.display="none"
	}
}
function openCloseFrame_innerTop(){
var ocCheckThis=parent.frames["hidden"].document.forms[0].elements["o_c_status"].value
	if (ocCheckThis=="open"){
		parent.frames["leftframe"].document.getElementById("o_c_Frame").src="/images/ePRO_open_btn.gif";
		parent.minMaxFrame("left",13)
		parent.frames["hidden"].document.forms[0].elements["o_c_status"].value="close";
		parent.frames["leftframe"].document.getElementById("showOrHide").style.display="none"
	} else if (ocCheckThis=="close"){
		parent.frames["leftframe"].document.getElementById("o_c_Frame").src="/images/ePRO_close_btn.gif";
		parent.minMaxFrame("left",144)
		parent.frames["hidden"].document.forms[0].elements["o_c_status"].value="open";
		parent.frames["leftframe"].document.getElementById("showOrHide").style.display=""
	}	
}
function openCloseFrameMouseOver(){
var ocCheckThis=parent.frames["hidden"].document.forms[0].elements["o_c_status"].value
	if (ocCheckThis=="close"){
		window.status="Open the Left Frame";
	} else if (ocCheckThis=="open"){
		window.status="Close the Left Frame";
	}
}
function showMenu(whichFrame,whichElement) {
//var myMenu=parent.frames["menu"].document.getElementById(whichElement);
var myMenu=parent.frames[whichFrame].document.getElementById(whichElement);
	myMenu.style.display = "block";
}
function hideMenu(whichFrame,whichElement) {
//var myMenu=parent.frames["menu"].document.getElementById(whichElement);
var myMenu=parent.frames[whichFrame].document.getElementById(whichElement);
	myMenu.style.display = "none";
}
var whitespace = " \t\n\r";
function isEmpty(s) {
	var i;
	if (s == null || s.length == 0) 
		return true;
	for (i = 0; i < s.length; i++) {
		var c = s.charAt(i);
		if (whitespace.indexOf(c) == -1)
			return false;
	}
	return true;
}
function isEmail(s) {
	validEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
	if (validEmail.test(s)) {
		return true;
	} 
	return false;
}
function isValidPhone(s) {
	validPhone = /^\(?(\d{3})\)?[\-\/]?(\d{3})[\-\/]?(\d{4})$/
	if (validPhone.test(s)) {
		return true;
	} 
	return false;
}
function isNum(s) {
	var i;
	if (isEmpty(s)) {
		return false;
	} 
	for (i = 0; i < s.length; i++) {
		if (s.charAt(i) != "," && s.charAt(i) != ".") {
			if (s.charAt(i) < "0") {
				return false
			}
			if (s.charAt(i) > "9") {
				return false
			}
		}
	}
	return true;
}
function isNumNotEmpty(s) {
	var i;
	for (i = 0; i < s.length; i++) {
		if (s.charAt(i) != "," && s.charAt(i) != ".") {
			if (s.charAt(i) < "0") {
				return false
			}
			if (s.charAt(i) > "9") {
				return false
			}
		}
	}
	return true;
}
function validatempc_ec(thisForm) {
	var inputProblem = false;
	var errMsg = "Please correct the following error(s)\n\n";
    if (isEmpty(thisForm.master_course_code.value)) {
		inputProblem = true
		errMsg = errMsg + "* Please enter a Master Program Code\n"
	}
    if (!isNum(thisForm.bcCount.value) || thisForm.bcCount.value < "1") {
 		inputProblem = true
		errMsg = errMsg + "* Please Select at least one Business Category\n"
	}
	if (thisForm.program_category.value == "blank") {
 		inputProblem = true;
		errMsg = errMsg + "* Please select a Program Category\n"
	}
	if (!isEmpty(thisForm.min_capacity.value)) {
	    if (!isNumNotEmpty(thisForm.min_capacity.value)) {
 			inputProblem = true
			errMsg = errMsg + "* Minimum Capacity must be a valid Number\n"
		}
	}
    if (!isNum(thisForm.master_price.value)) {
 		inputProblem = true
		errMsg = errMsg + "* Price is NOT a valid dollar amount\n"
	}
    if (isEmpty(thisForm.name.value)) {
		inputProblem = true
		errMsg = errMsg + "* Please enter a Program Name\n"
	}
    if (isEmpty(thisForm.description.value)) {
		inputProblem = true
		errMsg = errMsg + "* Please enter a Program Description\n"
	}
	if (inputProblem) {
		alert(errMsg);
		return false;
	} else {
		return true;
	}
}
function updateBCfield(thisCheckBox) {
	var bcCount = document.getElementById("bcCount").value;
	if (thisCheckBox.checked) {
		switch (bcCount)  {
			case "0":
				bcCount = "1"
				break
			case "1":
				bcCount = "2"
				break
			case "2":
				bcCount = "3"
				break
			default:
				bcCount = "4"
		}
	} else {
		switch (bcCount)  {
			case "4":
				bcCount = "3"
				break
			case "3":
				bcCount = "2"
				break
			case "2":
				bcCount = "1"
				break
			default:
				bcCount = "0"
		}
	}
	document.getElementById("bcCount").value=bcCount;
	document.getElementById("bcChanged").value="1";
}
function mpc_ecCancel(alert_msg) {
	do_alert = true;
	call_module = "mpc.php?do_alert="+do_alert+"&alert_msg="+alert_msg;
	callModule(call_module);
}
function prgrms_ecCancel(alert_msg,stat,sort_field,sort_order) {
	do_alert = true;
	call_module = "prgrms.php?do_alert="+do_alert+"&alert_msg="+alert_msg+"&stat="+stat+"&sort_field="+sort_field+"&sort_order"+sort_order;
	callModule(call_module);
}
function prgrms_onLineCancel(alert_msg) {
	do_alert = true;
	call_module = "prgrms_online.php?do_alert="+do_alert+"&alert_msg="+alert_msg;
	callModule(call_module);
}
function hilite(obj) {
	var element = document.getElementById(obj);
	element.style.backgroundColor = "silver";
}
function delite(obj) {
  document.getElementById(obj).style.backgroundColor = "white";
}
function getWorkshopReinforcementInfo() {
	workshop_id=document.getElementById("workshop_id").value;
	reinforcement_id=document.getElementById("reinforcement_id").value;
	course_code=document.getElementById("course_code").value;
	company=document.getElementById("company").value;
	region=document.getElementById("region").value;
	workshop_start_date=document.getElementById("workshop_start_date").value;
	w_startDate=document.getElementById("w_startDate").value;
	workshop_end_date=document.getElementById("workshop_end_date").value;
	w_endDate=document.getElementById("w_endDate").value;
	reinforcement_start_date=document.getElementById("reinforcement_start_date").value;
	r_startDate=document.getElementById("r_startDate").value;
	reinforcement_end_date=document.getElementById("reinforcement_end_date").value;
	r_endDate=document.getElementById("r_endDate").value;
	wcity=document.getElementById("wcity").value;
	wstate=document.getElementById("wstate").value;
	wfacilitator=document.getElementById("wfacilitator").value;
	sfacilitator=document.getElementById("sfacilitator").value;
	company=document.getElementById("company").value;
	hours=document.getElementById("hours").value;
	minutes=document.getElementById("minutes").value;
	am_pm=document.getElementById("am_pm").value;
	coordinator=document.getElementById("coordinator").value;
	coordinator_other_info=document.getElementById("coordinator_other_info").value;
	workshop_time_note=document.getElementById("workshop_time_note").value;
	ufreq_typeLength = document.prgrms_ec.ufreq_type.length;
	isChecked = false;
	for (i=0; i < ufreq_typeLength; i++) {
		if (document.prgrms_ec.ufreq_type[i].checked) {
			isChecked = true
			ufreq_type = document.prgrms_ec.ufreq_type[i].value
		}
	}
	if (!isChecked) {
		ufreq_type = null
	}

	uweek_whichDayLength = document.prgrms_ec.uweek_whichDay.length;
	isChecked = false;
	for (i=0; i < uweek_whichDayLength; i++) {
		if (document.prgrms_ec.uweek_whichDay[i].checked) {
			isChecked = true
			uweek_whichDay = document.prgrms_ec.uweek_whichDay[i].value
		}
	}
	if (!isChecked) {
		uweek_whichDay = null
	}	
	
	urec_month = document.getElementById("urec_month").value;
	uwhat_sequence=document.getElementById("uwhat_sequence").value;
	uwhatDay=document.getElementById("uwhatDay").value;
	direct_billLength = document.prgrms_ec.direct_bill.length;
	isChecked = false;
	for (i=0; i < direct_billLength; i++) {
		if (document.prgrms_ec.direct_bill[i].checked) {
			isChecked = true
			direct_bill = document.prgrms_ec.direct_bill[i].value
		}
	}
	if (!isChecked) {
		direct_bill = null
	}
	isWorkshop=document.getElementById("isWorkshop").value;
	calling="prgrms_ec.php?mode=a&workshop_id="+workshop_id+"&reinforcement_id="+reinforcement_id+"&course_code="+course_code+"&company="+company+"&region="+region+"&workshop_start_date="+workshop_start_date+"&w_startDate="+w_startDate+"&workshop_end_date="+workshop_end_date+"&w_endDate="+w_endDate+"&reinforcement_start_date="+reinforcement_start_date+"&r_startDate="+r_startDate+"&reinforcement_end_date="+reinforcement_end_date+"&r_endDate="+r_endDate+"&wcity="+wcity+"&wstate="+wstate+"&wfacilitator="+wfacilitator+"&company="+company+"&sfacilitator="+sfacilitator+"&hours="+hours+"&minutes="+minutes+"&am_pm="+am_pm+"&ufreq_type="+ufreq_type+"&uweek_whichDay="+uweek_whichDay+"&urec_month="+urec_month+"&uwhat_sequence="+uwhat_sequence+"&uwhatDay="+uwhatDay+"&direct_bill="+direct_bill+"&coordinator="+coordinator+"&coordinator_other_info="+coordinator_other_info+"&workshop_time_note="+workshop_time_note+"&isWorkshop="+isWorkshop;
	callModule(calling);
}
function getOnLineInfo() {
	masterID=document.getElementById("masterID").value;
	course_code=document.getElementById("course_code").value;
	start_date=document.getElementById("start_date").value;
	startDate=document.getElementById("startDate").value;
	end_date=document.getElementById("end_date").value;
	endDate=document.getElementById("endDate").value;
	company=document.getElementById("company").value;
	coordinator=document.getElementById("coordinator").value;
	coordinator_other_info=document.getElementById("coordinator_other_info").value;
	corporate_licLength = document.prgrms_online_ec.corporate_lic.length;
	isChecked = false;
	for (i=0; i < corporate_licLength; i++) {
		if (document.prgrms_online_ec.corporate_lic[i].checked) {
			isChecked = true
			corporate_lic = document.prgrms_online_ec.corporate_lic[i].value
		}
	}
	if (!isChecked) {
		direct_bill = null
	}
	calling="prgrms_online_ec.php?mode=a&masterID="+masterID+"&course_code="+course_code+"&company="+company+"&start_date="+start_date+"&startDate="+startDate+"&end_date="+end_date+"&endDate="+endDate+"&company="+company+"&corporate_lic="+corporate_lic+"&coordinator="+coordinator+"&coordinator_other_info="+coordinator_other_info;
	callModule(calling);
}
function validate_program(thisForm) {
	var inputProblem = false;
	var errMsg = "Please correct the following error(s)\n\n";
    if (isEmpty(thisForm.program_code.value)) {
		inputProblem = true;
		errMsg = errMsg + " --- Please enter a Program Code\n";
	}
    if (isEmpty(thisForm.name.value)) {
		inputProblem = true;
		errMsg = errMsg + " --- Please enter a Program Name\n";
	}
    if (!isNum(thisForm.price.value)) {
 		inputProblem = true;
		errMsg = errMsg + " --- Price is NOT a valid dollar amount\n";
	}
	direct_billLength = thisForm.direct_bill.length;
	isChecked = false;
	for (i=0; i < direct_billLength; i++) {
		if (document.prgrms_ec.direct_bill[i].checked) {
			isChecked = true;
		}
	}
	if (!isEmpty(thisForm.min_capacity.value)) {
	    if (!isNumNotEmpty(thisForm.min_capacity.value)) {
 			inputProblem = true;
			errMsg = errMsg + " --- Minimum Capacity must be a valid Number\n";
		}
	}
	if (!isEmpty(thisForm.max_capacity.value)) {
	    if (!isNumNotEmpty(thisForm.max_capacity.value)) {
 			inputProblem = true;
			errMsg = errMsg + " --- Maximum Capacity must be a valid Number\n";
		}
	}
	if (!isEmpty(thisForm.start_date.value) && !isEmpty(thisForm.end_date.value)) {	
		if (thisForm.start_date.value > thisForm.end_date.value) {
			inputProblem = true;
			errMsg = errMsg + " --- Start Date be greater than the end date\n";
		}
	}
	if (!isEmpty(thisForm.reinforcement_start_date.value) && !isEmpty(thisForm.reinforcement_end_date.value)) {	
		if (thisForm.reinforcement_start_date.value > thisForm.reinforcement_end_date.value) {
			inputProblem = true
			errMsg = errMsg + "* RReinforcement START DATE must be an earlier date than the END DATE\n"		
		}
	}
	if (inputProblem) {
		alert(errMsg);
		return false;
	} else {
		return true;
	}
}
function validate_onLineProgram(thisForm) {
	var inputProblem = false;
	var errMsg = "Please correct the following error(s)\n\n";
    if (isEmpty(thisForm.course_code.value)) {
		inputProblem = true
		errMsg = errMsg + "* Please enter a Program Code\n"
	}
    if (isEmpty(thisForm.c_name.value)) {
		inputProblem = true
		errMsg = errMsg + "* Please enter a Program Name\n"
	}
    if (!isNum(thisForm.price.value)) {
 		inputProblem = true
		errMsg = errMsg + "* Price is NOT a valid dollar amount\n"
	}
	direct_billLength = document.prgrms_ec.direct_bill.length;
	isChecked = false
	for (i=0; i < direct_billLength; i++) {
		if (document.prgrms_ec.direct_bill[i].checked) {
			isChecked = true
		}
	}
	if (!isChecked) {
 		inputProblem = true
		errMsg = errMsg + "* Corporate Licensing Option must be Selected\n"
	}
	if (!isEmpty(thisForm.min_capacity.value)) {
	    if (!isNumNotEmpty(thisForm.min_capacity.value)) {
 			inputProblem = true
			errMsg = errMsg + "* Minimum Capacity must be a valid Number\n"
		}
	}
	if (!isEmpty(thisForm.max_capacity.value)) {
	    if (!isNumNotEmpty(thisForm.max_capacity.value)) {
 			inputProblem = true
			errMsg = errMsg + "* Maximum Capacity must be a valid Number\n"
		}
	}
	if (inputProblem) {
		alert(errMsg);
		return false;
	} else {
		return true;
	}
}
function changeHrsMins(what,whichOne) {
	if (whichOne == '2') {
		var hour =  document.getElementById("hours2").value;
		var minutes =  document.getElementById("minutes2").value;
		var am_pm = document.getElementById("am_pm2").value;
	} else {
		var hour =  document.getElementById("hours").value;
		var minutes =  document.getElementById("minutes").value;
		var am_pm = document.getElementById("am_pm").value;
	}
	if (what == "hrs") {
		hour++
		if (hour == 13) {
			hour = 1
		}
		if (whichOne == '2') {
			document.getElementById("hours2").value = hour
			if (document.getElementById("hours2").value < 10) {
				document.getElementById("hours2").value = "0"+document.getElementById("hours2").value
			}
		} else {
			document.getElementById("hours").value = hour
			if (document.getElementById("hours").value < 10) {
				document.getElementById("hours").value = "0"+document.getElementById("hours").value
			}		
		}
	} else if (what == "min") {
		minutes++
		if (minutes == 60) {
			minutes = 0
		}
		if (whichOne == '2') {
			document.getElementById("minutes2").value = minutes
			if (document.getElementById("minutes2").value < 10) {
				document.getElementById("minutes2").value = "0"+document.getElementById("minutes2").value
			}
		} else {
			document.getElementById("minutes").value = minutes
			if (document.getElementById("minutes").value < 10) {
				document.getElementById("minutes").value = "0"+document.getElementById("minutes").value
			}
		}
	} else if (what == "am_pm") {
		if (whichOne == '2') {
			if (am_pm == "am") {
				document.getElementById("am_pm2").value = "pm"
			} else {
				document.getElementById("am_pm2").value = "am"
			}
		} else {
			if (am_pm == "am") {
				document.getElementById("am_pm").value = "pm"
			} else {
				document.getElementById("am_pm").value = "am"
			}
		}
	}
}
function validate_regGrpPaymentNames(thisForm) {
	var inputProblem = false;
	var errMsg = "Please correct the following error(s)\n\n";
	if (thisForm.program_list.value == "blank") {
 		inputProblem = true;
		errMsg = errMsg + "* Please select a Program\n"
	}
    if (!isNum(thisForm.num_collected.value) || thisForm.num_collected.value < "1") {
 		inputProblem = true
		errMsg = errMsg + "* Total Collected must be a valid Number\n"
	}
	if (inputProblem) {
		alert(errMsg);
		return false;
	} else {
		return true;
	}
}
function validate_regGrpPaymentNamesEmails(thisField) {
	var element = document.getElementById(thisField);
	if (!isEmpty(element.value)) {
		if (!isEmail(element.value)) {
			element.style.backgroundColor = "red";
			alert("Please Correct Invalid EMAIL Address entered for \n"+element.value);
			return;
		}
	}
	element.style.backgroundColor = "white";
}
function scrollHeader () {
//alert('scrolling');
	var scrollTop=parseInt(document.body.scrollTop);
	var PBTop=parseInt(document.all['topHeader'].style.top);
	if(scrollTop!=PBTop){
		document.all['topHeader'].style.top=scrollTop;
	}
}
function previewEmail() {
	var subject =  document.getElementById("subject").value;
	var title =  document.getElementById("title").value;
	var myBody =  document.getElementById("body").value;
	var course_code =  document.getElementById("course_code").value;
	var program_name =  document.getElementById("program_name").value;
	var start_end_dates =  document.getElementById("start_end_dates").value;
	var cmpny_code =  document.getElementById("cmpny_code").value;
	var calling="email_preview.php?course_code="+course_code+"&start_end_dates="+start_end_dates+"&title="+title+"&body="+myBody;
	alert(calling);
	MM_openBrWindow(calling, 'emailPreview', 'scrollbars=yes,resizable=yes,width=800,height=600')
}
function selectEndorsement(obj,inc_or_pri) {
	var element = document.getElementById(obj);
	module = "endorsement_select_update.php?id_key="+element.value+"&inc_or_pri="+inc_or_pri+"&endorse=1&on_off=";
	if (element.checked) {
		module = module + "on";
	} else {
		module = module + "off";
	}
	window.open(module,"upEnd","scrollbars=no,resizable=no,width=0,height=0");
}
function selectLikeMost(obj,inc_or_pri) {
	var element = document.getElementById(obj);
	module = "endorsement_select_update.php?id_key="+element.value+"&inc_or_pri="+inc_or_pri+"&endorse=0&on_off=";
	if (element.checked) {
		module = module + "on";
	} else {
		module = module + "off";
	}
	window.open(module,"upEnd","scrollbars=no,resizable=no,width=0,height=0");
}
function selectStory(obj) {
	var element = document.getElementById(obj);
	module = "success_select_update.php?id_key="+element.value+"&on_off=";
	if (element.checked) {
		module = module + "on";
	} else {
		module = module + "off";
	}
	window.open(module,"upEnd","scrollbars=no,resizable=no,width=0,height=0");
}
function validateSuccess(thisForm) {
	inputProblem = false;
	if (isEmpty(thisForm.success.value)) {
 		inputProblem = true
		problemMsg = "Cannot 'save' a empty Success Story."
	}
	if (!inputProblem) {
		return true
	} else {
		alert(problemMsg)
		return false
	}
}
function validateProcessEntry(thisForm) {
	inputProblem = false;
	if (isEmpty(thisForm.name.value)) {
 		inputProblem = true
		problemMsg = "Please enter the WBS  Name."
	}
	if (!inputProblem) {
		return true
	} else {
		alert(problemMsg)
		return false
	}
}
function validate_NL_Request(thisForm) {
	var inputProblem = false;
	$alert_msg = 'Please correct the following\n\n';
    if (isEmpty(thisForm.last_name.value)) {
		inputProblem = true
		$alert_msg = $alert_msg+'   - Please enter your LAST NAME\n';
	}
    if (isEmpty(thisForm.first_name.value)) {
		inputProblem = true
		$alert_msg = $alert_msg+'   - Please enter your FIRST NAME\n';
	}
    if (isEmpty(thisForm.email.value) || !isEmail(thisForm.email.value)) {
		$alert_msg = $alert_msg+'   - Please enter a valid email address\n';
 		inputProblem = true;
	}
	if (inputProblem) {
		alert($alert_msg);
		return false;
	} else {
		return true;
	}
}
function validateLeadRequest(thisForm) {
	var inputProblem = false;
	$alert_msg = 'Please correct the following\n\n';
    if (isEmpty(thisForm.last_name.value)) {
		inputProblem = true
		$alert_msg = $alert_msg+'   - Please enter your LAST NAME\n';
	}
    if (isEmpty(thisForm.first_name.value)) {
		inputProblem = true
		$alert_msg = $alert_msg+'   - Please enter your FIRST NAME\n';
	}
    if (isEmpty(thisForm.email.value) || !isEmail(thisForm.email.value)) {
		$alert_msg = $alert_msg+'   - Please enter a valid email address\n';
 		inputProblem = true;
	}
	if (isEmpty(thisForm.telephone.value) || !isValidPhone(thisForm.telephone.value)) {
		$alert_msg = $alert_msg+'   - Please enter a valid phone number\n';
 		inputProblem = true;
	}  
	var howManyChecked = 0;
	if (thisForm.interest1.checked) {
		howManyChecked++;
	}
	if (thisForm.interest2.checked) {
		howManyChecked++;
	}
	if (thisForm.interest3.checked) {
		howManyChecked++;
	}
	if (thisForm.newsletter_opt.checked) {
		howManyChecked++;
	}
	if (howManyChecked == 0) {
		$alert_msg = $alert_msg+'   - Please check your interest\n';
 		inputProblem = true;
	}
	if (isEmpty(thisForm.validateRefCode.value)) {
		$alert_msg = $alert_msg+'   - Please enter Reference Code\n';
 		inputProblem = true;
	}  else	if (thisForm.validateRefCode.value != thisForm.refCode.value) {
		$alert_msg = $alert_msg+'   - Reference Code is not valid. Please re-enter.\n';
 		inputProblem = true;
	} 
	if (inputProblem) {
		alert($alert_msg);
		return false;
	} else {		
		return true;
	}
}
function validateFreeOffer(thisForm) {
	var inputProblem = false;
	$alert_msg = 'Please correct the following\n\n';
    if (isEmpty(thisForm.last_name.value)) {
		inputProblem = true
		$alert_msg = $alert_msg+'   - Please enter your LAST NAME\n';
	}
    if (isEmpty(thisForm.first_name.value)) {
		inputProblem = true
		$alert_msg = $alert_msg+'   - Please enter your FIRST NAME\n';
	}
    if (isEmpty(thisForm.email.value) || !isEmail(thisForm.email.value)) {
		$alert_msg = $alert_msg+'   - Please enter a valid email address\n';
 		inputProblem = true;
	}
	if (inputProblem) {
		alert($alert_msg);
		return false;
	} else {		
		return true;
	}
}
function whatModule(){
var whatModInFrame=parent.parent.frames["hidden"].document.forms[1].elements["what_module_in_left_frame"].value
	if (whatModInFrame=="file_list"){
		parent.parent.frames["hidden"].document.forms[1].elements["what_module_in_left_frame"].value="mod_list"
		parent.definition_left.document.location.href = 'module_definition_left.php';
	}
}
function openNewWindow(openWhat) {
	window.open(openWhat);
}
function callFromLogout(mod) {
	top.location.href = mod;
}
function showSamples(evt) {
	evt = (evt) ? evt : event;
	err = false;
	if (evt) {
//		if (pwCustom.user_category.value =='blank') {
//			err = true;
//			alert('Prospect type must be selected to view samples!');
//		}
		if (!err) {
			sample1.document.location.href = 'pw_sample.php?category=&reference='+pwCustom.reference.value ;
			if (document.getElementById('sampleDiv').style.visibility != 'visible') {
				document.getElementById('sampleDiv').style.visibility = 'visible';
				document.getElementById('sampleDiv').style.width= '480';
				document.getElementById('sampleDiv').style.height= '550';
			} else {
				document.getElementById('sampleDiv').style.visibility = 'hidden';
				document.getElementById('sampleDiv').style.width= '1';
				document.getElementById('sampleDiv').style.height= '1';
			}
		}
	}
}
function validate_email (thisForm) {
    if (isEmpty(thisForm.email_address.value) || !isEmail(thisForm.email_address.value)) {
		eMsg = "Please enter a VALID email Address." 		
		document.getElementById("errMsg").width = 250
 		document.getElementById("errMsg").height = 25
		errMsg.document.write("<html><head></head><body bgcolor=\"#e0dfe3\"><font color=\"#FF0000\" size=\"3\">")
		errMsg.document.write(eMsg)
		errMsg.document.write("</font></body></html>")
		errMsg.document.close()
		document.getElementById("email_address").focus();
		return false;
	} else {
		return true
	 }
}
function openMemberSite() {
	window.open("http://www.collaborativexchange.com/i_apps/website_manager/preview.php?c_c=pmrd&idKey=317","memberSite","height=768,width=1024,resizable=yes,menubar=no,status=no,scrollbars=yes"); 
}
function openWidget(widget) {
	window.open(widget,"ePRO_widgets","height=768,width=1024,resizable=yes,menubar=no,status=no,scrollbars=yes"); 
}
function closeMenu() {
var ocCheckThis=parent.frames["hidden"].document.forms[0].elements["o_c_status"].value
	if (ocCheckThis=="open"){
		parent.frames["leftframe"].document.getElementById("o_c_Frame").src="/images/ePRO_open_btn.gif";
		parent.minMaxFrame("left",13)
		parent.frames["hidden"].document.forms[0].elements["o_c_status"].value="close";
		parent.frames["leftframe"].document.getElementById("showOrHide").style.display="none"
	}
}
function popup_emailList (url,popup_name) {
	if (!popup_name) {
		popup_name = "EmailList";
	}
	window.open(url,popup_name,'height=450,width=650,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,titlebar=no');
}
function setup_button() {
	if (document.getElementById('back_button') != undefined) {
		if (document.getElementById('view_by').value == 'expl') {
				document.getElementById('back_button').innerHTML = '<input class="btnBlueText" type="button" name="Button" value="Grid List" onClick="close_leftPanel();callingViewBy();">';
		} else {
			document.getElementById('back_button').innerHTML = '<input class="btnBlueText" type="button" name="Button" value="&laquo;&nbsp;Explorer Style" onClick="open_leftPanel();callingViewBy();">';
		}
	}
}
function showFieldPopups(evt,whichOne) {
	evt = (evt) ? evt : event;
	err = false;
	if (evt) {
		var elem = (evt.target) ? evt.target : evt.srcElement;
		var position = getFieldPosition(elem.id);
		var s = document.getElementById(whichOne).style;
		s.left = (position.left + (elem.offsetWidth * -0)) + "px";
		s.top = (position.top - 0) + "px";
		document.getElementById(whichOne).style.display = ''
	}
}
function getFieldPosition(elemID) {
    var offsetTrail = document.getElementById(elemID);
    var offsetLeft = 25;
    var offsetTop = -10;
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTop += offsetTrail.offsetTop;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && 
        typeof document.body.leftMargin != "undefined") {
        offsetLeft += document.body.leftMargin;
        offsetTop += document.body.topMargin;
    }
    return {left:offsetLeft, top:offsetTop};
}
function hideFieldDescription(whichOne) {
	if (document.getElementById(whichOne) != undefined) {
		document.getElementById(whichOne).style.display = 'none'
	}
}
function uploads(imageType) {
	if (document.getElementById('popupUploader').style.display == "none") {
		document.getElementById('uploader').src = '../common_apps/uploadImage.php?org_level='+document.getElementById('org_level').value+'&imageType='+imageType+'&iframe='+document.getElementById('iframe').value+'&idKey='+document.getElementById('idKey').value;
		document.getElementById('popupUploader').style.display = "";
	} else {
		document.getElementById('popupUploader').style.display = "none";
	}
}
function check_all_checkboxes() {
	var checkboxes = new Array();
	checkboxes = document.getElementsByTagName('input');
	for (var i = 0; i < checkboxes.length; i++) {
		if (checkboxes[i].type == 'checkbox') {
			checkboxes[i].checked = true;
		}
	}
}
function uncheck_all_checkboxes() {
	var checkboxes = new Array();
	checkboxes = document.getElementsByTagName('input');
	for (var i = 0; i < checkboxes.length; i++) {
		if (checkboxes[i].type == 'checkbox') {
			checkboxes[i].checked = false;
		}
	}
}
function expandCollapseFolder(whichElement,whichImageElement,whichHiddenElement) {
	var imageElement = document.getElementById(whichImageElement);
//alert(whichElement);
	if (document.getElementById(whichElement).style.display == "none") {
		document.getElementById(whichElement).style.display = "";
		imageElement.src = "/images/fe1_p.gif";
	} else {
		document.getElementById(whichElement).style.display = "none";
		imageElement.src = "/images/fc1_p.gif";
	}
}
function expandCollapseFolder2(whichElement,whichImageElement,whichHiddenElement) {
	var imageElement = document.getElementById(whichImageElement);
	if (document.getElementById(whichElement).style.display == "none") {
		document.getElementById(whichElement).style.display = "";
		imageElement.src = "/images/minus.gif";
	} else {
		document.getElementById(whichElement).style.display = "none";
		imageElement.src = "/images/plus.gif";
	}
}
function expandCollapseFolders(whichElement,whichImageElement,img_expand,img_collapse) {
	var imageElement = document.getElementById(whichImageElement);
	if (document.getElementById(whichElement).style.display == "none") {
		document.getElementById(whichElement).style.display = "";
		imageElement.src = img_collapse;
	} else {
		document.getElementById(whichElement).style.display = "none";
		imageElement.src = img_expand;
	}
}
/*****************************************************/
/*****************       TABS        *****************/
/*****************************************************/
function mouse_over(p) {
	p.className="mouseover_tab";
	document.getElementById(p.id+"Anchor").className = "anchorOver";
}
function mouse_out(p) {
//alert('p.id = '+p.id);
	if (p.id == whichOne) {
		document.getElementById(p.id+"Anchor").className = "anchorSelected";
		p.className="selectedTab";
	} else {
		document.getElementById(p.id+"Anchor").className = "anchorNotSelected";
		p.className="notSelectedTab";
	}
}
function tabClick(whichOne,path) {
	document.location.href = whichOne;
	//document.location.href = path+whichOne+".php?first_time=1&idKey="+document.getElementById("idKey").value+"&iStatus="+document.getElementById("iStatus").value+"&mode="+document.getElementById("mode").value+"&whichOne="+whichOne+"&initiative_type="+document.getElementById("initiative_type").value+"&org_level="+document.getElementById("org_level").value+"&fromPers="+document.getElementById("fromPers").value;
}

/*****************************************************/
/*****************     LIGHTBOX      *****************/
/*****************************************************/
var light_box;
function showLightBox(evt, p) {
//alert(p.div);
//alert('div_popUp visibility = '+document.getElementById('lightBox_container').style.visibility);
	evt = (evt) ? evt : event;
	err = false;
	if (evt) {
//alert ("is evt");
		if (document.getElementById('lightBox_container').style.visibility != 'visible') {
			if (p) {
				if (p.title) {
					document.getElementById('lb_title').innerHTML = p.title;
				} else {
					document.getElementById('lb_title').innerHTML = '&nbsp;';
				}
				lightBox.table = p.table;
				var elem     = document.getElementById(p.div);
				
				var s = document.getElementById('lightBox_container').style;
				light_box = document.getElementById('lightBox_container');
				if (p.center) {
					var h = elem.offsetHeight;
					var w = elem.offsetWidth;
					showCenter(window.center({width:w,height:h}))
				} else {
					var position = getElementPosition(p.div);
					s.left = (position.left) + "px";
					s.top = (position.top+50) + "px";
				}
				document.getElementById('lightBox_container').style.visibility = 'visible';
				document.getElementById('lightBox_container').style.display = 'block';
			}
		} else {
			document.getElementById('lightBox_container').style.visibility = 'hidden';
			document.getElementById('lightBox_container').style.display = 'none';
		}
	}
}
function hideFloater(whichFloater) {
//	document.getElementById('getURL_title').innerHTML = '&nbsp;';
	document.getElementById(whichFloater).value = '';
	document.getElementById(whichFloater).style.display = 'none';
	hide(whichFloater);
}
function getElementPosition(elemID) {
    var offsetTrail = document.getElementById(elemID);
    var offsetLeft = -0;
    var offsetTop = 20;
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTop += offsetTrail.offsetTop;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && 
        typeof document.body.leftMargin != "undefined") {
        offsetLeft += document.body.leftMargin;
        offsetTop += document.body.topMargin;
    }
    return {left:offsetLeft, top:offsetTop};
}
function showFloater(whichFloater) {
//	document.getElementById('getURL_title').innerHTML = '&nbsp;';
	document.getElementById(whichFloater).style.visibility = 'visible';
	document.getElementById(whichFloater).style.display = 'block';
}

window.size = function()
{
	var w = 0;
	var h = 0;
	//IE
	if(!window.innerWidth)
	{
		//strict mode
		if(!(document.documentElement.clientWidth == 0))
		{
			w = document.documentElement.clientWidth;
			h = document.documentElement.clientHeight;
		} else  { //quirks mode 
			w = document.body.clientWidth;
			h = document.body.clientHeight;
		}
	} else { //w3c
		w = window.innerWidth;
		h = window.innerHeight;
	}
	return {width:w,height:h};
}

window.center = function()
{
	var hWnd = (arguments[0] != null) ? arguments[0] : {width:0,height:0};
	var _x = 0;
	var _y = 0;
	var offsetX = 0;
	var offsetY = 0;
	//IE
	if(!window.pageYOffset)
	{
		//strict mode
		if(!(document.documentElement.scrollTop == 0))
		{
			offsetY = document.documentElement.scrollTop;
			offsetX = document.documentElement.scrollLeft;
		} else { //quirks mode
			offsetY = document.body.scrollTop;
			offsetX = document.body.scrollLeft;
		}
	} else { //w3c
		offsetX = window.pageXOffset;
		offsetY = window.pageYOffset;
	}
	_x = ((this.size().width-hWnd.width)/2)+offsetX;
	_y = ((this.size().height-hWnd.height)/2)+offsetY;
	return{x:_x,y:_y};
}

function showCenter(point)
{
	light_box.style.top = point.y + "px";
	light_box.style.left = point.x + "px";
}

function chkbox_toggle_display (obj,obj2)
{
	if (obj.checked) {
		document.getElementById(obj2).style.display = '';
	} else {
		document.getElementById(obj2).style.display = 'none';
	}
}
		
function GetXmlHttpObject() 
{
	if (window.XMLHttpRequest) {
		// code for IE7+, Firefox, Chrome, Opera, Safari
		return new XMLHttpRequest();
	}
	if (window.ActiveXObject) {
		// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}

//Allow Reader Comment routines
function show_hide_notification(obj,obj2){
	if (obj.checked) {
		document.getElementById(obj2).style.display = '';
	} else {
		document.getElementById(obj2).style.display = 'none';
	}
}

