


/* this function is used to toggle div layers on or off 
 * this is used in the academic pages that display course informaiton */
function toggleLayer(whichLayer)
{
	if (document.getElementById)
	{
		//alert("1. in toggleLayer: whichLayer is: " + whichLayer);
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";

		//document.getElementById(whichLayer).innerHTML ="<div class='container'><div class='titlebar'><table border='0' cellpadding='0' cellspacing='0' width='100%'><tr><td class='title'>Beginning Spanish 1</td><td style='text-align: right; padding: 2px 2px 2px 0px;'><img src='../images/titlebarCloseButtonIcon.jpg' border='0' onClick=\"toggleLayer('courseinfo')\" style=' cursor: pointer;' /></td></tr></table></div><div class='descheader'>Course Description</div><div class='courseDesc'/>Introduction to basic language skills. Developement of listening, reading, speaking, and writing skills to become proficient at the appropriate level. Cultural understanding and sensitivity are important aspects of the courses. </div><div class='syllabus'>Syllabus: Not Available</div><div class='closeButtton'><input type='button' value='Close' onClick=\"toggleLayer('courseinfo')\" /></div></div>";

	
		var width = browserWidth()/2;
		var height = browserHeight()/2;


		//alert("scroll offset: " + getScrollXY());
		//alert("length: " + getScrollXY().length);
		//alert("substr: " + getScrollXY().substr(3,getScrollXY().length));
		//alert("scrollY: " + getScrollY());
		//alert("scrollx: " + getScrollX());
		width = width - 200;

		height = browserHeight() - getScrollY();
		
		document.getElementById(whichLayer).style.left=width+"px";
		document.getElementById(whichLayer).style.top=height+"px";
	}
	else if (document.all)
	{
		alert("2");
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
	else if (document.layers)
	{
		alert("3");
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
}



function browserWidth() {
  var myWidth = 0
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
   
  } else if( document.documentElement && document.documentElement.clientWidth ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
   
  } else if( document.body && document.body.clientWidth ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
 // window.alert( 'Width = ' + myWidth );
  return myWidth;
}

function browserHeight() {
  myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
   
    myHeight = window.innerHeight;
  } else if( document.documentElement && document.documentElement.clientHeight ) {
    //IE 6+ in 'standards compliant mode'
 
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && document.body.clientHeight ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
 
 // window.alert( 'Height = ' + myHeight );

  return myHeight;
}


/* find horizontal (left & right) scroll offsets */
function getScrollX() {
  var scrOfX = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
   
    scrOfX = window.pageXOffset;
  } else if( document.body && document.body.scrollLeft ) {
    //DOM compliant
   
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && document.documentElement.scrollLeft ) {
    //IE6 standards compliant mode
   
    scrOfX = document.documentElement.scrollLeft;
  }
  return scrOfX;
}

/* find vertical (up & down) scoll offsets */
function getScrollY() {
  var scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
   
  } else if( document.body && document.body.scrollTop ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
   
  } else if( document.documentElement && document.documentElement.scrollTop ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;
}





