function navOver(dObj){
	dObj.className += 'on';
}

function navOut(dObj){
	var sCurrentClass = dObj.className;
	var nPos = sCurrentClass.search(/on/);
	if(nPos != -1){
		var sNewClass = sCurrentClass.substr(0, nPos);
		dObj.className = sNewClass;
	}
}

function popupImageDisplay(e, obj, direction){
	//alert(e.type + obj.tagName + direction);
	if(obj.className == 'disabled'){
		return;
	}
	
	if(e.type == 'mouseover'){
		obj.src = 'images/pop_' + direction + '_off.gif';
	}
	else if(e.type == 'mouseout'){
		obj.src = 'images/pop_' + direction + '_on.gif';
	}
	else {
		dCurrentImage.style.display = 'none';
		if(direction == 'next'){
			nCurrent = nCurrent + 1;
		}
		else {
			nCurrent = nCurrent - 1;
		}
		dCurrentImage = document.getElementById('image' + nCurrent);
		dCurrentImage.style.display = 'block';
		
		if((nCurrent == 0) || (nCurrent == nImages)){
			obj.className = 'disabled';
			obj.src = 'images/pop_' + direction + '_on.gif';
		}
		else {
			document.getElementById('previousButton').className = '';
			document.getElementById('nextButton').className = '';
		}
		document.getElementById('popIndex').innerHTML = nCurrent + 1;
	}
}

/*
	Image Preloader Object - monitors when all images are loaded.
	You can add onerror and onabort event handlers if you need to
	FunctionArgs[0] = array of image src's (array) | required
	FunctionArgs[1] = proceeding image path (str) | optional
	FunctionArgs[2] = client locale set dynamically (str) | optional
*/
function GL_ImagePreloader(aImageSrc, sPath, sLocale){
   	this.nLoaded = 0;
   	this.nProcessed = 0;
	this.aImages = [];
  	this.nImages = aImageSrc.length;
	this.sPath = sPath;
	this.sLocale = sLocale;
	for(var i=0; i<aImageSrc.length; i++){ 
    	this.preload(aImageSrc[i]);
	}
}
GL_ImagePreloader.prototype.preload = function(image){
   	var oImage = new Image;
	this.aImages.push(oImage);
   	oImage.onload = GL_ImagePreloader.prototype.onload;
	oImage.oImagePreloader = this;
	oImage.bLoaded = false;
	//alert(this.sPath + this.sLocale + image)
	oImage.src = this.sPath + this.sLocale + image;
}
GL_ImagePreloader.prototype.onComplete = function(){
  	this.nProcessed++;
  	if(this.nProcessed == this.nImages){
  		//alert('image loading complete');
   	}
}
GL_ImagePreloader.prototype.onload = function(){
  	this.bLoaded = true;
  	this.oImagePreloader.nLoaded++;
  	this.oImagePreloader.onComplete();
}

// Preload nav Images
var aImg = ['nav_start_off.jpg', 'nav_start_on.jpg', 'nav_off.jpg', 'nav_on.jpg', 'nav_end_off.jpg', 'nav_end_on.jpg']
oNavPreloader = new GL_ImagePreloader(aImg, 'images/', '');