/*
	Standards Compliant Rollover Script
	Author : Daniel Nolan
	http://www.bleedingego.co.uk/webdev.php
*/

preloadedImages = new Array();
function preloadImage(uri){
	var plength = preloadedImages.length
	preloadedImages[plength] = new Image();
	preloadedImages[plength].src = uri;
}

jQuery(function(){
	var conf = {className:"", postfix:"_o"};
	jQuery(".imgover").each(function(){
		this.oSrc = this.src;
		this.rSrc = this.oSrc.replace(/(\.gif|\.jpg|\.png)/, conf.postfix + "$1");
		this.sSrc = this.oSrc.replace(/(\.gif|\.jpg|\.png)/, "_s" + "$1");
		preloadImage(this.rSrc);
	}).hover(function(){
		this.src = this.rSrc;
	},function(){
		this.src = this.oSrc;
	});

	/* Stay GlobalNav */
	var bodyClass = "/" + jQuery("body").attr("class");
	jQuery("div#globalNavigation ul img.imgover").each(function(){
		var a = jQuery(this).parent().attr("href");
		if(a.indexOf(bodyClass) > -1){
			this.src = this.sSrc;
			jQuery(this).unbind();
		}
	});

	/* Stay LocalNav */
	var bodyId = document.body.id;
	if(bodyId){
		var key = 'lNav' + bodyId.replace(/^lStay/, '');
		jQuery("div#localNavigation li#" + key + " img.imgover").unbind().each(function(){
			this.src = this.rSrc;
		});
	}
});