//Generic image swap function, make sure to name your images -off and -on. Works with any extension. usage = swap(this, 1); to turn an image on 0 to turn it off. 
function swap(lmnt, state) { 
 currentImg = lmnt.src;
 ext = currentImg.substring(currentImg.lastIndexOf("."));
 if(state == 1){
  currentSub = currentImg.substring(0,currentImg.lastIndexOf("."));
  lmnt.src = currentSub + "-on" + ext;
 } else { 
  currentSub = currentImg.substring(0,currentImg.lastIndexOf("-"));
  lmnt.src = currentSub + ext;
 }
}

function loginFocus(lmnt, state) { 
 if(state == 1){
  lmnt.style.borderColor = '#cccc33';
 } else { 
  lmnt.style.borderColor = '#999999';
 }
}

/*Course description Open and Close functions*/
var activeID = '';
var currentInt;

function toggleDiv(int) { 
 if (int == activeID) { 
  //alert ("if 1");
  Effect.BlindUp($('libabstract'+int), {duration:.2});
  $('expander'+activeID).src='/images/common/16-square-green-add.png'; 
  setTimeout( function () { 
   $('libitem'+int).style.backgroundColor = 'transparent';
   $('libabstract'+int).style.display = 'none';
   activeID = '';
  }, 205);
 } 
 else if (activeID != '') { 
  //alert ("else if 2");
  Effect.BlindUp($('libabstract'+activeID), {duration:.2});
  $('expander'+activeID).src='/images/common/16-square-green-add.png'; 
  setTimeout( function () { 
   $('libitem'+activeID).style.backgroundColor = 'transparent';
   $('libabstract'+activeID).style.display = 'none';
   $('libitem'+int).style.backgroundColor = '#f2f2f2';
   $('expander'+int).src='/images/common/16-square-green-remove.png'; 
   Effect.BlindDown($('libabstract'+int), {duration:.2});
   activeID = int;
  }, 210);
 } else { 
  //alert ("else 3, int is "+int);
  Effect.BlindDown($('libabstract'+int), {duration:.2});
  $('expander'+int).src='/images/common/16-square-green-remove.png';
  $('libitem'+int).style.backgroundColor = '#f2f2f2';
  setTimeout( function () { 
   $('libabstract'+int).style.height = 'auto';
   activeID = int;
  }, 205);
 }
}


function foo() { }

function whatisthis(){
  Effect.Appear($('whatsthis'), {duration:.3});
  setTimeout(function(){$('whatsthis').style.width = 'auto';$('whatsthis').style.height = 'auto';}, 350)
   setTimeout(function(){Effect.Puff($('whatsthis'), {duration:.3});}, 3000)
  }

/*This opens and closes the div for the additional Corporate Members*/
var activeMember = 0;

function openMembers() { 
 if (activeMember == 0) {
  Effect.BlindDown($('addmembers'), {duration:.2});
  setTimeout(function(){$('addmembers').style.display = 'block';}, 220)
  activeMember = 1;
 }
}

function closeMembers() { 
 if (activeMember == 1) {
  Effect.BlindUp($('addmembers'), {duration:.2});
  setTimeout(function(){$('addmembers').style.display = 'none';}, 220)
  activeMember = 0;
 }
}
		// ----------------------------------
		// Z-Lightbox v. 1.0
		// Copyright 2008 by Zaneray Inc.
		// Written by: Flori Seeger
		// ----------------------------------
		
		window.onresize=function() { setprocessingheight(); }
		window.onscroll=function() { setprocessingheight(); }
		
		function setprocessingheight() {
			if ($('processingdisp')){
				var xscroll = 0;
				var yscroll = 0;
				var xtotalscroll = 0;
				var ytotalscroll = 0;
				var xwindow = 0;
				var ywindow = 0;
				var xdiv = 0;
				var ydiv = 0;
				
				// how far scrolled in x and y directions
				xscroll = window.pageXOffset ||
									document.body.scrollLeft ||
									document.documentElement.scrollLeft;
			
				yscroll = window.pageYOffset ||
									document.body.scrollTop ||
									document.documentElement.scrollTop;
			
				// browser window width and height
				xwindow = self.innerWidth ||
									document.documentElement.clientWidth ||
									document.body.clientWidth;
									
				ywindow = self.innerHeight ||
									document.documentElement.clientHeight ||
									document.body.clientHeight;
				
				// total possible scroll x and y directions
				xtotalscroll = xwindow + window.scrollMaxX ||
											 document.body.scrollWidth ||
											 document.body.offsetWidth;
				
				ytotalscroll = ywindow + window.scrollMaxY ||
											 document.body.scrollHeight ||
											 document.body.offsetHeight;
				
				// get display container width and height				
				xdiv = $('processingdisp').offsetWidth;
				ydiv = $('processingdisp').offsetHeight; 	
				
				//$('processing').style.width = xwindow + (xscroll - 20) + 'px'; //disabled and replaced with 100% width in css
				$('processing').style.height = ywindow + yscroll + 'px';
				
				if (xwindow <= xdiv){
					$('processingdisp').style.left = "0px";
				}
				else {
					$('processingdisp').style.left = ((xwindow + xscroll*2) / 2) - (xdiv / 2) + "px"; //half the width of processingdisp
				}
			
				if (ywindow <= ydiv){
					$('processingdisp').style.top = "0px";
				}
				else {
					$('processingdisp').style.top = ((ywindow + yscroll*2) / 2) - (ydiv / 2) + "px"; //half the height of processingdisp
				}
			}
		}