/* Nav Help */
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);  

function doSomething(x) {
   c="current";
    var y=document.getElementById('nav').className;
    if (y)    document.getElementById(y).className="nav";
    document.getElementById(x).className=c;
    document.getElementById('nav').className=x;
}  

function showBranch(branch,button,n) {
   var objBranch = document.getElementById(branch).style;
   var objButton = document.getElementById(button);
   n++;
     for (x=1;n>x;x++) {
		  var z = "link"+x;
		  document.getElementById(z).className="back";
	  }
	  objButton.className="current";
      for (x=1;n>x;x++) {
		  var z = "branch"+x;
      	  document.getElementById(z).style.display="none";
	  }
	  objBranch.display="block";
}

/* MonkCMS stuff */

function gotoSermon2() {
  var x=document.getElementById("sermonLists");
  var go=x.options[x.selectedIndex].value;

  window.location=go;
}

function gotoContent(x) {
  var go=x.options[x.selectedIndex].value;

  window.location=go;
}

function wimpyPopPlayer(theFile,id,stuff) {
  window.open(theFile,id,stuff);
}

/*
 * Wrote this wrapper to stay compatible / eT Oct 2008
 */
function waspPopup (filename, width, height){
  window.open('http://my.ekklesia360.com/Clients/waspPopup.php?theFile='+filename+'&w='+width+'&h='+height,'_mediaplayer','width='+width+',height='+height);
}

function doJSEvents() {
  if (!document.getElementsByTagName) return false;

  var links = document.getElementsByTagName("a");
  for (var i=0; i < links.length; i++) {
    if (links[i].className.match("mcmsSearch")) {
      links[i].onclick = function() {
        document.getElementById('searchForm').submit();
        return false;
      }
    }
    if (links[i].className.match("mcmsSearch2")) {
      links[i].onclick = function() {
        document.getElementById('searchForm2').submit();
        return false;
      }
    }
    if (links[i].className.match("thickbox")) {
      links[i].onmouseover = function() {
        window.status='';
		return true;
      }
    }
  }
  var inputs = document.getElementsByTagName("input");
  for (var i=0; i < inputs.length; i++) {
    if (inputs[i].className.match("clearClick")) {
      inputs[i].onfocus = function() {
        if (document.getElementById('search_term')) document.getElementById('search_term').value='';
        if (document.getElementById('search_term2')) document.getElementById('search_term2').value='';
        if (document.getElementById('newsletter_text')) document.getElementById('newsletter_text').value='';
        return false;
      }
    }
  }
}
window.onload=doJSEvents;


function changeFieldValue(fieldName,fieldValue) {
  document.getElementById(fieldName).value=fieldValue;
}
/*************************************************************************************************************************/


