function getCheckedValue(radioObj) {

	if(!radioObj)
		return "";
	var radioLength = radioObj.length;

	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

/*load the javascript for the module into the document head... if we don't do this we can't pickup the script
with the module thats loaded through AJAX*/

/*1 = public
0 = admin*/
/*readyFunctions is a list of functions that need to run once a script is loaded, the function is in the same location in it's list, as  the script
in scriptPath that its running for...*/
function insertScriptandStyle(scriptPath,stylePath,pubAdmin,readyFunctions){

	moduleStyle = buildHtml.createLink(stylePath,null,null,"moduleStyle" + moduleStyleCnt);
	moduleStyleCnt++;
	
	/*we have to get the head this way... getElementById won't work on a head cause it can't have an id*/
	docHead = document.getElementsByTagName("head")[0];
	
	/*we can have multiple scripts, so loop through the list and add them all*/
	scriptArray = scriptPath.split(",");
	if ( typeof(readyFunctions) != "undefined" && readyFunctions != null ) {
		readyFuncArray = readyFunctions.split(",");
	}
	else{
		readyFuncArray = new Array();
	}
	
	for(i=0;i<scriptArray.length;i++){
		moduleScript = buildHtml.createScript('text/javascript',scriptArray[i],readyFuncArray[i],"moduleScript" + moduleScriptCnt);
		
		/*the index.php for the public and admin side have a script for our ajax object.... we insert right after that. this is mostly done so that 
		all the default js on the admin side can get the afterModuleDel functions that we are appending...*/
		if(document.getElementById("ajaxScript") == null || pubAdmin == 1){
			docHead.appendChild(moduleScript);
	  	}
	  	else{
			insertAfter(document.getElementById("ajaxScript"),moduleScript);
	  	}
		
		moduleScriptCnt++;
		
	}
	/*make sure to load styles first, or some of the javascript stuff buggers up*/
	
	/*the index.php for the public and admin side have a script for our ajax object.... we insert right after that. this is mostly done so that 
	all the default js on the admin side can get the afterModuleDel functions that we are appending...*/
	if(document.getElementById("ajaxScript") == null || pubAdmin == 1){
		docHead.appendChild(moduleStyle);
	}
	else{
		insertAfter(document.getElementById("ajaxScript"),moduleStyle);
	}

}

// This function inserts newNode after referenceNode
function insertAfter( referenceNode, newNode ){
    referenceNode.parentNode.insertBefore( newNode, referenceNode.nextSibling );
}

/*converts a 12 hour time string to a 24 hour time string that is mysql compatible*/
function timeConvertMysql(timeVal){
	
	var timeAry = timeVal.split(":");
	var timeHrs = timeAry[0];
	
	if(timeVal.match(/am/i) != null){
		var timeStr = timeHrs + ":" + timeAry[1].slice(0,timeAry[1].indexOf(" ",0)) + ":00";
		return timeStr;
	}
	else if(timeVal.match(/pm/i) != null){
		timeHrs = parseInt(timeHrs) + 12;
		var timeStr = timeHrs + ":" + timeAry[1].slice(0,timeAry[1].indexOf(" ",0)) + ":00";
		return timeStr;
	}
	else{
		alert("Invalid Time Entered");
		return false;
	}
}

function epochToMySQL(eDate){
	var newDate = eDate.split("/");
	var myDate = newDate[2] + "-" + newDate[0] + "-" + newDate[1];
	return myDate;
}

function toggleFAQChild(faqID){

	var faqAns = document.getElementById("faqAnswer" + faqID);
	
	/*note... we can't use getElementsByName here cause it won't work on IE DOM created elements*/
	var allAns = document.getElementsByClassName("faqAns");

	/*loop through and close previously opened answers*/
	for(i=0;i<allAns.length;i++){
		/*if it isn't the one we want open, and its currently open, close it*/
		if(allAns[i].id != "faqAnswer" + faqID && document.getElementById(allAns[i].id).style.display != "none"){
			Effect.BlindUp(allAns[i].id,{ duration: 0.5});
		}
	}
	
	/*toggle if its opened or closed*/
	if(faqAns.style.display == "none"){
		Effect.BlindDown("faqAnswer" + faqID,{ duration: 0.5});
	}
	else{
		Effect.BlindUp("faqAnswer" + faqID,{ duration: 0.5});
	}

}

function toggleServices(faqID){

	var faqAns = document.getElementById("servicesAns" + faqID);
	
	/*note... we can't use getElementsByName here cause it won't work on IE DOM created elements*/
	var allAns = document.getElementsByClassName("servicesAns");

	/*loop through and close previously opened answers*/
	for(i=0;i<allAns.length;i++){
		/*if it isn't the one we want open, and its currently open, close it*/
		if(allAns[i].id != "servicesAns" + faqID && document.getElementById(allAns[i].id).style.display != "none"){
			Effect.BlindUp(allAns[i].id,{ duration: 0.5});
		}
	}
	
	/*toggle if its opened or closed*/
	if(faqAns.style.display == "none"){
		Effect.BlindDown("servicesAns" + faqID,{ duration: 0.5});
	}
	else{
		Effect.BlindUp("servicesAns" + faqID,{ duration: 0.5});
	}

}
