var CarmelBibleCollege = {

  init : function() {
    if (!document.getElementById) { return; }
    CarmelBibleCollege.home();
    var x = document.getElementById("faculty");
    if (!x) { return; }
    x = document.getElementById("aside");
    x = x.getElementsByTagName("img");
    for (i in x) {
      x[i].onmouseover = CarmelBibleCollege.mouseoverHandler;
      x[i].onmouseout = CarmelBibleCollege.mouseoutHandler;
    }
  },

  mouseoverHandler : function(e) {
    document.getElementById("main_image").src = e.target.src;
    document.getElementById("second_image").src = e.target.src.replace(".jpg", "-info.png");
  },

  mouseoutHandler : function(e) {
    document.getElementById("main_image").src = "/images/faculty-gerri.jpg";
    document.getElementById("second_image").src = "/images/faculty-gerri-info.png";
  },

  home : function() {

	id = function(id) { return document.getElementById(id); };

	if (!id("home")) { return; }

	id("why").className = "hide";
	id("disomma").className = "hide";
	id("leask").className = "hide";

	var swf = new SWFObject("/scripts/mediaplayer.swf","mediaplayer","320","240","8");
	swf.addParam("allowfullscreen","true");
        swf.addVariable('shownavigation','false');
        swf.addVariable('autostart','true');
	swf.addVariable("width","320");
	swf.addVariable("height","240");
	swf.addVariable("file","/images/promo.flv");
	swf.write("video");
	id("video").className = "hide";

	new Image().src = "/images/home-disomma.jpg";
	new Image().src = "/images/home-leask.jpg";

	id("text-why").onclick = function() {
		id("text-steps").className = "hide";
		id("disomma").className = "";
		id("leask").className = "";
		id("video").className = "hide";
	};

	id("text-video").onclick = function() {
		id("text-steps").className = "";
		id("disomma").className = "hide";
		id("leask").className = "hide";
		id("video").className = "";
		id("why").className = "hide";
	};

	id("disomma").onclick = function() {
		id("why").className = "";
		id("disommaText").className = "";
		id("leaskText").className = "hide";
	};

	id("leask").onclick = function() {
		id("why").className = "";
		id("disommaText").className = "hide";
		id("leaskText").className = "";
	};

  }

}

CarmelBibleCollege.init();
