// WebCT Javascript Feb 2005
// Complile by Katrina Espanol
// For LTRC WebCT at McMaster University
// webcthelp@mcmaster.ca

var draw_automatic_breadcrumb = true;
var set_breadcrumb_label = true;
var MMcookiesection = "WebCT Login";
var breadcrumbURL = "breadcrumbURLValue";
if (breadcrumbURL == "breadcrumbURLValue") {
	breadcrumbURL = location.href;
}

function searchMacSubmit() {
		document.forms[1].q.value = document.forms[0].q.value;
		document.forms[1].submit();
		return false;
}

function toggleClamShellMenu(objectID) {
	var object = document.getElementById(objectID);
	if (object.style.display =='block')  object.style.display='none';
	else object.style.display='block';
	return;
}

function popup(mylink, windowname){
/* This code functions withput having to turn Javascipt on. If Javascript is not turned on, the page will open in the same browser window as the parent page */
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=700,height=500,scrollbars=yes');
return false;
}

function popupHelpModule(mylink, windowname){
/* This code functions withput having to turn Javascipt on. If Javascript is not turned on, the page will open in the same browser window as the parent page */
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=700,height=600,scrollbars=no');
return false;
}

function popupTidbits(mylink, windowname){
/* This code functions withput having to turn Javascipt on. If Javascript is not turned on, the page will open in the same browser window as the parent page */
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=350,height=400,scrollbars=yes');
return false;
}


function popupLoginTroubles(mylink, windowname){
/* This code functions withput having to turn Javascipt on. If Javascript is not turned on, the page will open in the same browser window as the parent page */
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=375,height=400,scrollbars=yes');
return false;
}
/*
 * Javascript fix for Safari's inability to link to named anchors (or ids of elements) inside 
 * elements with overflow: auto set
 *
 * see http://blog.deconcept.com/code/overflowsafari/overflowsafari.html
 * for more information
 *
 * by Geoff Stearns ( geoff @ deconcept.com )
 *
 */


// the id of the element with overflow: auto set, in this case the div
var targBox = "box";

function init() {
	if (document.getElementById) {
		var atags = document.getElementsByTagName("A");
		for (var i=0;i<atags.length;i++) {
			var ca = atags[i];
			if (ca.href.indexOf("#") > -1) {
				ca.onclick = function() {
					scrollDivToAnchor(this.href.split("#")[1]);
				}
			}
		}
	}
}

function scrollDivToAnchor(a) {

	var b = document.getElementById(targBox);
	b.scrollTop = document.getElementById(a).offsetTop - b.offsetTop;

	// alternately, if your elements are not nested within other nodes inside the box,
	// you could use document.getElementById(a).parentNode.scrollTop
	// that way you wouldn't need to specify the id of the scrollable box

}

if (navigator.userAgent.indexOf("Safari") > -1) {
	window.onload = init;
}


function OpenNewWindow(page) 
{
var newWindow = null;
newWindow = 

window.open(page,'externalWindow','height=500,scrollbars=yes,left=50,top=100,menubar=Yes,resizable=Yes,toolbar=Yes,location=yes,status=yes');
newWindow.focus();   
}

