/******************************
*
* Javascript for www.scrippsjschool.org
*
* @date: 2007-0606
*
* some code may be borrowed or heavily inspired by Jeremy Keith's DOM Scripting (2005) from Friends of Ed.
*
*********************************/


/* functions related to incorporating flash video */
function getFlashContent(name) {
        if (navigator.appName.indexOf("Microsoft") != -1) {
            return window[name];
        } else {
            return document[name];
        }
    }


function initFlashVideo(swfName, filename){
	getFlashContent(swfName).sendToAS(filename);
}


function showMe(myTarget){
	if(!document.getElementById){
		return false;
	}
	if(document.getElementById(myTarget)){
		document.getElementById(myTarget).className = "showMe";
		return false; // keep my link from doing anything
	}
	return false;
}

function hideMe(myTarget){
	if(!document.getElementById){
		return false;
	}
	if(document.getElementById(myTarget)){
		document.getElementById(myTarget).className = "hideMe";
		return false; // keep my link from doing anything
	}
	return false;
}

/* function to show the additional comment/account fields in the blog comment area */
function prep_createAccountCheckbox(){
	if(!document.getElementsByTagName || !document.getElementById){
		return false;
	}
	if(document.getElementById("createAccount")){
		var clicker = document.getElementById("createAccount");
		clicker.onclick = function(){
			var target = document.getElementById("comment_optional");
			var box = document.getElementById("shell");
			target.style.display = "block";
			//box.style.minHeight = (box.scrollHeight + 200) + "px";
			prep_contentHeight();
		}
	}
}
addLoadEvent(prep_createAccountCheckbox);


/* open in new window code */
/* generic popup window function to act as an interface to window.open() 
* DOM Scripting (88) */
function popUp(winURL, title, w, h){
	d = "width=" + w + ",height=" + h;
	window.open(winURL, title, d);
}



/* global resources */

/* function to simply multiple functions in window.onload
* DOM Scripting (103) :: Simon Willison (http://simon.incution.com) */
function addLoadEvent(func) {
	var oldonload = window.onload;
	if(typeof window.onload != 'function'){
		window.onload = func;
	}
	else {
		window.onload = function(){
			oldonload();
			func();
		}
	}
}

