// script.js
// 
// Copyright (C)2004-2005 Lakeshore Collegiate Insitute
//
// This file contains all the scripts that we developed ourselves
// Please use proper comments before every function. See example below:


// testFunc
//
// Function to multiply two numbers together (and show proper use of documentation)
// Accepts two numbers:
// a    => The first number to multiply
// b    => Multiplies the first number by this number
//
// Returns the product of a and b

function testFunc(a,b)
{
    return a*b;
}




// doOutline
//
// When a user clicks on an unfoldable menu header, this function is called
// to unfold the menu and change the icon
// Accepts one variable:
// srcElement   => The element that was clicked (usually through 'this')
//
// Returns VOID

function doOutline(srcElement) {

    // Set up variables
    var img1 = new Image();
    img1src = "url('images/plus.gif')";
    var img2 = new Image();
    img2src = "url('images/minus.gif')";
    var srcId, targetElement;

    // Retrieve IDs
    srcID = srcElement.id.substr(0, srcElement.id.length-1);
    targetElement = document.getElementById(srcID + "s");
    picElement = document.getElementById(srcID + "i");
    parentElement = document.getElementById(srcID + "p");

    //Open or close menus
    if (targetElement.style.display == "none") {
                 targetElement.style.display = "";
                 parentElement.style.backgroundImage = img2src;
//                  parentElement.style.backgroundColor = "#DDDDDD";
                 
        } else {
                 targetElement.style.display = "none";
                 parentElement.style.backgroundImage = img1src;
//                  parentElement.style.backgroundColor = "#FFFFFF";
     }
}


// doOnloadActions
//
// Perform the following actions when a page is loaded:
// - Folds up all unfolded menu entries except those that show the current page
//
// Does not accept any parameters.
//
// Returns VOID

function doOnloadActions() {

    // Fold up any unfolded menus
    for(i=1; document.getElementById("OUT" + i + "p") && i<100; i++)
    {
        menuHeader = document.getElementById("OUT" + i +"p");
        menuBody = document.getElementById("OUT" + i + "s");

        // Check if this menu contains the current page
        if( menuHeader.className != "cur_page_path"  && menuBody) {
            menuBody.style.display = "none";
        }
    }
}





//showExpl and displayNone
//shows grade layers on course content pages
layerShowExpl = new Array("content_layer_overview","content_layer_grade_9","content_layer_grade_10","content_layer_grade_11","content_layer_grade_12");

var currentTop = "content_layer_overview";

function showExpl(explName) 
{
		document.getElementById(currentTop).style.display = 'none';
		document.getElementById(explName).style.display = 'block';	
}


function displayNone() {

for (i=1; i<5; i++) {

	document.getElementById(layerShowExpl[i]).style.display = 'none';

	}
	
}

//Apply a background image to the #right div
function displayRightBackground(imgName) {

	document.getElementById("right").style.background = "url(styles/graphics/" + imgName + ".jpg) no-repeat top left";

}


//prospective student functions
function ps_qt()
{
windps_qt = window.open("prospective/qt.htm","windps_qt","height=216,width=270,status=yes,toolbar=no,menubar=no,location=no");
}

function ps_wmv()
{
windps_wmv = window.open("prospective/wmv.htm","windps_wmv","height=260,width=346,status=yes,toolbar=no,menubar=no,location=no");
}
