// JavaScript Document
function validate_form() 
{
 validity = true;
 if (document.form.userID.value == "") {
  alert("Please enter a username.");
  validity = false;
 } else {
  if (document.form.password.value == "") {
  alert("Please enter a password")
  validity = false; } 
  }
 return validity;
}



function findRollovers() 
{
	var imgs = document.getElementsByTagName("img");
	
	for(var i=0;i<imgs.length;i++)
	{
		// add the class of rollover onto the image tag, not an anchor tag.
		if ((imgs[i].getAttribute("class")) && (imgs[i].getAttribute("class").indexOf("rollover") !== -1))
		{
			imgs[i].onmouseover=function(){this.src=this.src.replace(extension(this),"_over"+extension(this));};
			imgs[i].onmouseout=function(){this.src=this.src.replace("_over"+extension(this),extension(this));};			
			
			//preload - loads the over images. The over states must have _over before the extension. e.g. logo.jpg and logo_over.jpg//
			var overImage = new Image();
			var overImageSrc = imgs[i].src.replace(extension(imgs[i]),"_over"+extension(imgs[i]));
			overImage.src=overImageSrc;	
		}
	}
}
// finds the extention of any tag passed to this function.
function extension(tag)
{
	var extension=tag.src.split(".");
	extension="."+extension[extension.length-1];
	return extension;
}


// addLoadEvent()
// Adds event to window.onload without overwriting currently assigned onload functions.
// Function found at Simon Willison's weblog - http://simon.incutio.com/
function addLoadEvent(func)
{	
	var oldonload = window.onload;
	if (typeof window.onload !== 'function')
	{
    	window.onload = func;
	} 
	else 
	{
		window.onload = function(){oldonload();func();};
	}
}
addLoadEvent(findRollovers);


/***********************************************
* Animated Collapsible DIV v2.4- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/
animatedcollapse.addDiv('members', 'fade=0,speed=400,group=choices,hide=1')
animatedcollapse.addDiv('learn_about_eco_dev', 'fade=0,speed=400,group=choices,hide=1')
animatedcollapse.addDiv('wbc', 'fade=0,speed=400,group=choices,hide=1')

animatedcollapse.ontoggle=function($, divobj, state){ //fires each time a DIV is expanded/contracted
	//$: Access to jQuery
	//divobj: DOM reference to DIV being expanded/ collapsed. Use "divobj.id" to get its ID
	//state: "block" or "none", depending on state
}

animatedcollapse.init()

$(document).ready(function() {
	$('a.lightbox').lightBox({				 
		imageLoading: 'lightbox/images/loading.gif',
		imageBtnClose: 'lightbox/images/close.gif',
		imageBtnPrev: 'lightbox/images/prev.gif',
		imageBtnNext: 'lightbox/images/next.gif'										 
	});
	
	$('.thumbnails a').lightBox({				 
		imageLoading: 'lightbox/images/loading.gif',
		imageBtnClose: 'lightbox/images/close.gif',
		imageBtnPrev: 'lightbox/images/prev.gif',
		imageBtnNext: 'lightbox/images/next.gif'										 
	}); 
	$('a[rel*=lightbox]').lightBox({				 
		imageLoading: 'lightbox/images/loading.gif',
		imageBtnClose: 'lightbox/images/close.gif',
		imageBtnPrev: 'lightbox/images/prev.gif',
		imageBtnNext: 'lightbox/images/next.gif'									 
	}); 


});

