//javascript file
//Member/Certification/Type/Includes/CommonLogic_Certification_Type_JS.js
function func_JS_ShowStaff(iCertificationType){	
	//user wants to view Staff associated with this iCertificationType
	//Call GetXmlHttpObject found in 'AjaxFunctions_Common.js
	var oXmlHttp_Staff = GetXmlHttpObject();
	if (oXmlHttp_Staff == null){
		  alert ("Your browser does not support AJAX!");
		  return;
		}
	var sUrl_Temp = "/Member/Certification/Staff/ByType/";
	sUrl_Temp += "?iCertificationType=" + iCertificationType ;
	sUrl_Temp += "&iAction=1" ;
	sUrl_Temp += "&sid=" + Math.random();
	oXmlHttp_Staff.onreadystatechange = function() {
		// state ==4 indicates receiving response data from server is completed
		if(oXmlHttp_Staff.readyState == 4){
				// To make sure valid response is received from the server, 200 means response received is OK
				if(oXmlHttp_Staff.status == 200){	
					//hide  "show div_ShowRegisteredParticipants" link
					document.getElementById("div_ShowStaff_"+iCertificationType).style.display = "none";
					//show "hide Files" link
					document.getElementById("div_HideStaff_"+iCertificationType).style.display = "block";
					//show container
					document.getElementById("div_Staff_"+iCertificationType).style.display = "block";
					document.getElementById("div_Staff_"+iCertificationType).innerHTML = oXmlHttp_Staff.responseText ;
				} else {
						alert("Problem retrieving data from the server, status code: " + oXmlHttp_Staff.status);
				}
		}
	}
	oXmlHttp_Staff.open("GET", sUrl_Temp, true);
	oXmlHttp_Staff.send(null);
}
function func_JS_HideStaff(iCertificationType){	
	//user wants to hide Staff associated with this iCertificationType
	//show  "show div_ShowRegisteredParticipants" link
	document.getElementById("div_ShowStaff_"+iCertificationType).style.display = "block";
	//hide "hide Files" link
	document.getElementById("div_HideStaff_"+iCertificationType).style.display = "none";
	//hide container
	document.getElementById("div_Staff_"+iCertificationType).style.display = "none";
}
function func_JS_ConfirmSelection(obj){
	//user wants to select a staff member
//	var agree = confirm("Click 'OK' to view staff information for this person.\n\nOtherwise, click 'Cancel'.")
//	if (agree){
		var iUniqueID = obj.value
		var sURL = "/Member/Certification/Staff/ID/?iUniqueID=" + iUniqueID + "&#sContent"
		window.location = sURL
		return true;
//	} else {
		//reset field
//		document.form1.iUniqueID.value="";
//		return false;	
//	}	
}
function func_JS_ShowRequirements(iCertificationType){	
	//user wants to view requirements associated with this iCertificationType
	//Call GetXmlHttpObject found in 'AjaxFunctions_Common.js
	var oXmlHttp_Requirements = GetXmlHttpObject();
	if (oXmlHttp_Requirements == null){
		  alert ("Your browser does not support AJAX!");
		  return;
		}
	var sUrl_Temp = "/Member/Certification/Requirement/default.asp";
	sUrl_Temp += "?iCertificationType=" + iCertificationType ;
	sUrl_Temp += "&sid=" + Math.random();
	oXmlHttp_Requirements.onreadystatechange = function() {
		// state ==4 indicates receiving response data from server is completed
		if(oXmlHttp_Requirements.readyState == 4){
				// To make sure valid response is received from the server, 200 means response received is OK
				if(oXmlHttp_Requirements.status == 200){	
					//hide  "show div_ShowRegisteredParticipants" link
					document.getElementById("div_ShowRequirements_"+iCertificationType).style.display = "none";
					//show "hide Files" link
					document.getElementById("div_HideRequirements_"+iCertificationType).style.display = "block";
					//show container
					document.getElementById("div_Requirements_"+iCertificationType).style.display = "block";
					document.getElementById("div_Requirements_"+iCertificationType).innerHTML = oXmlHttp_Requirements.responseText ;
				} else {
						alert("Problem retrieving data from the server, status code: " + oXmlHttp_Requirements.status);
				}
		}
	}
	oXmlHttp_Requirements.open("GET", sUrl_Temp, true);
	oXmlHttp_Requirements.send(null);
}
function func_JS_HideRequirements(iCertificationType){	
	//user wants to hide requirements associated with this iCertificationType
	//show  "show div_ShowRegisteredParticipants" link
	document.getElementById("div_ShowRequirements_"+iCertificationType).style.display = "block";
	//hide "hide Files" link
	document.getElementById("div_HideRequirements_"+iCertificationType).style.display = "none";
	//hide container
	document.getElementById("div_Requirements_"+iCertificationType).style.display = "none";
}

function func_JS_Requirement_Type_Add(){
	//user wants to add a new requirement type to this iCertificationType
	var agree = confirm("Click 'OK' to confirm that you want to add a new certification type.\n\nOtherwise, click 'Cancel'. ")
	if (agree){
		//great!	
		alert("Reminder: After you add a certification, you must add at least one requirement before you can work with the new certification.\n\nPlease review expectations for the certification description by clicking the link for the term 'Description.'  \n\nIf you have questions, please talk to the Training Coordinator.")
	} else {
		return false;	
	}
	var sHeight = "650px"
	var iFrameName = 'iFrame_div_Certifications_Edit'
	//create iFrame
	var sFrame = '<iframe id="'+ iFrameName +'" name="'+ iFrameName +'" src="/Member/Certification/Type/Edit/Default.asp?iCertificationType=0" height="'+sHeight+'" frameborder="0"  style="width:100%;" dir="ltr" wrap="soft" class="clsShow" APPLICATION="yes" ></iframe>';
	var div_iframecontainer = 'div_Certifications_Edit'
	//make sure div is visible
	document.getElementById(div_iframecontainer).className = 'clsShow';
	//put new iFrame within container
	document.getElementById(div_iframecontainer).innerHTML = sFrame;
	return true; 
}
