<!--
// Copyright 2004-2006 Crystal Moments Creative Services, LLC
// Unauthorized Duplication Prohibited. All Rights Reserved.
// 
// 

function setIndexByValue(selectBox, optionValue) {
	var i;
	if (optionValue) {
		for(i=0;i<selectBox.options.length;i++) {
			if (selectBox.options[i].value==optionValue) {
				selectBox.selectedIndex=i;
				return true;
			}
		}
	}
}
function setIndexByText(selectBox, optionText) {
	var i;
	if (optionText) {
		for(i=0;i<selectBox.options.length;i++) {
			if (selectBox.options[i].text==optionText) {
				selectBox.selectedIndex=i;
				return true;
			}
		}
	}
}
function clearSelectOptions(selectBox) {
	var i;
	for(i=selectBox.options.length-1;i>=0;i--) {
		selectBox.remove(i);
	}
}
function showHideDiv(divid, mode) {
	//mode=0 -> off
	//mode=1 -> on
	//mode other -> toggle
  if (document.getElementById(divid)) {
    switch (mode) {
      case 0:
        document.getElementById(divid).style.display="none";
        break;
      case 1:
        document.getElementById(divid).style.display="block";
        break;
      default:
        document.getElementById(divid).style.display=(document.getElementById(divid).style.display!="block")? "block" : "none";
    }
  }
}

function change(id, newClass) {

	identity=document.getElementById(id);
	
	if (identity) {
		identity.className=newClass;
	} else {
		alert (id + ' is invalid.');
	}
}

function getElementsByClassName(strClassName, strTagName, oElm){
    var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];      
        if(oRegExp.test(oElement.className)){
            arrReturnElements.push(oElement);
        }   
    }
    return (arrReturnElements)
}

function toggleToolbarImage() {
	var arrows = document.getElementById('toolbartoggle');
  if (arrows.src == "http://unitedfaith.org/admin/images/icons/tools-show.png") {
    arrows.src = "http://unitedfaith.org/admin/images/icons/tools-hide.png";
  } else {
    arrows.src = "http://unitedfaith.org/admin/images/icons/tools-show.png";
  }
}

function toggleBinImage(id,forceview) {
	var menu, titles, arrows;
	menu = getElementsByClassName("pcBins", "div", document)[0];
	titles = getElementsByClassName("topItem", "div", menu);
	arrows = getElementsByClassName("arrow", "img", menu);
	for(i=0; i<titles.length; i++){
		if (titles[i].id == id)
			if (!forceview) {
				if (arrows[i].src == "http://unitedfaith.org/admin/images/icons/show.png") {
					arrows[i].src = "http://unitedfaith.org/admin/images/icons/hide.png";
				} else {
					arrows[i].src = "http://unitedfaith.org/admin/images/icons/show.png";
				}
			} else {
				if (forceview == 'hide') {
					arrows[i].src = "http://unitedfaith.org/admin/images/icons/hide.png";
				} else {
					arrows[i].src = "http://unitedfaith.org/admin/images/icons/show.png";
				}
			}
	}
}
function loadSiteCss(site,page) {	
	var objHead = document.getElementsByTagName('head');
	if (objHead[0])
	{
		if (document.getElementById('localstylesheet')) {
			objHead[0].removeChild(document.getElementById('localstylesheet'));
		}
		var objCSS = objHead[0].appendChild(document.createElement('link'));
		objCSS.id = 'localstylesheet';
		objCSS.rel = 'stylesheet';
		objCSS.href = 'http://unitedfaith.org/css.php?c='+site+'&p='+page+'&admincss=1';
		objCSS.type = 'text/css';
//	alert(objCSS.href);
	}
}
function loadFormCss(theme) {
	var objHead = document.getElementsByTagName('head');
	if (objHead[0])
	{
		var objCSS = objHead[0].appendChild(document.createElement('link'));
		objCSS.id = 'formstylesheet';
		objCSS.rel = 'stylesheet';
		objCSS.href = 'http://unitedfaith.org/styles/forms.css.php?theme='+theme;
		objCSS.type = 'text/css';
//	alert(objCSS.href);
	}
}
function loadLocalCss(filename) {
	var objHead = document.getElementsByTagName('head');
	if (objHead[0])
	{
		var objCSS = objHead[0].appendChild(document.createElement('link'));
		objCSS.id = 'suppstylesheet';
		objCSS.rel = 'stylesheet';
		objCSS.href = 'http://unitedfaith.org/css.php?g='+filename;
		objCSS.type = 'text/css';
//	alert(objCSS.href);
	}
}
function unloadLocalCss() {
	var objHead = document.getElementsByTagName('head');
	if (objHead[0])
	{
		if (document.getElementById('suppstylesheet')) {
			objHead[0].removeChild(document.getElementById('suppstylesheet'));
		}
	}
}
/*
 * This script is written by Geert Van Aken
 * Please read the official documentation for more information
 * about the functions of this file.
 *
 * http://altum.be/products/emailobfuscator
 *
 * Please do not remove this information from the file and
 * report improvements that you make to this sourcecode
 *
 * Version 1.1.0
 * Date    2006/04/11
 */

var monkeyCode = 4 << 4;
var oldStatusText = "";

function EOa() {
  return String.fromCharCode(monkeyCode);
}

function EOd(pText) {
  var splitted = pText.split(",");
  var result = "";

  for (i = 0 ; i < splitted.length ; i++) {
    result += String.fromCharCode(splitted[i]);
  }
  return result;
}

function EOp() {
  var prefix = EOd('109,97,105');
  prefix += EOd('108,116');
  return prefix + EOd('111,58');
}

function EOad(pName, pdomain) {
  EOad(pName, pDomain, null);
}

function EOinitStatus(pName, pDomain) {
  oldStatusText = window.status;
  window.status = Loc(pName, pDomain);
}

function EOrestoreStatus() {
  window.status = oldStatusText;
}

function EOae(pName, pDomain, pSubj, pHover, pText, pClass, pClick, divid) {

//  alert("pName = " + pName + "\npDomain = " + pDomain + "\npSubj = " + pSubj + "\npHover = " + pHover + "\npText = " + pText + "\npClass = " + pClass);

  var result = "<a href=\"JavaScript:EOad('" + pName + "','" + pDomain + "'";
  if (pSubj != null && pSubj.length > 2) {
    result += ",'" + pSubj + "'";
  }
  result += ");\"";

  if (pHover != null && pHover.length > 0) {
    result += " title=\"" + EOd(pHover) + "\"";
  }

  if (pClass != null && pClass.length > 0) {
    result += " class=\"" + pClass + "\"";
  }

  if (pClick != null && pClick.length > 0) {
    result += " onclick=\"" + pClick + "\"";
  }

  result += " onMouseOver=\"EOinitStatus('" + pName + "','" + pDomain + "');return true;\" onMouseOut=\"EOrestoreStatus();\"";

  result += ">" + EOd(pText) + "</a>";

//  alert(result);
	
	if (divid) {
			jQuery('#'+divid).append(result);
	} else {
		document.write(result);
	}
}

function EOad(pName, pDomain, pSubj) {
  var loc = Loc(pName, pDomain);
  if (pSubj != null && pSubj.length > 0) {
    loc += "?" + EOd('115,117,98,106,101,99,116') + "=" + encodeURIComponent(EOd(pSubj));
  }

  document.location = loc;
}

function Loc(pName, pDomain) {
  var first = EOd(pName);
  var second = EOd(pDomain);
  var loc = EOp() + first + EOa() + second; 
  
  return loc;
}

function getSettings(InputList, Limit) {
/*
*   Breaks up a settings list into an associative array
*   Input is in the form "setting1=value1 setting2=value2 setting3=value3 ...
*   Output is an array in the form $outarray['setting1'] = "value1" ...
*/
	var contents = new Array;
	var settings = new Array;
	var thisvar;
	
	if (InputList) {
		contents = InputList.split(' ', Limit);
		for (content in contents) {
			thisvar = contents[content].split('=');
			settings[thisvar[0]] = thisvar[1];
		}
	}
	return settings;
}
function showInstructions(text) {
	jQuery('#instruct').get(0).innerHTML = text;
  jQuery('#instruct').corner();
  jQuery('#instruct').slideDown();
}
function setHelp(helpid) {
	jQuery('#pagehelp a').attr('href','/admin/includes/show_help.php?helpid='+helpid);
  jQuery('#pagehelp').show();
}
function vNavInit() {
  jQuery(document).ready(function(){
    jQuery(".supernav")
    .superfish({
      animation : { opacity:"show",height:"show"}
    });
  });
}
function arrayAvg(arr) {
	if (arr.length>0) {
  	var totalvalue=0;
    var valuecount=0;
    for (var i=0; i<arr.length; i++) {
    	if (arr[i]>0) {
     		totalvalue+=arr[i];
        valuecount++;
      }
    }
    if (totalvalue>0 && valuecount>0) {
    	return (totalvalue / valuecount);
    }
  }
}
/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
-->