// Page select function
function pageSelect(dis){
	window.location = (dis.value);
}

$(document).ready(	
	function() {
		if ( is_ie5 || is_ie5_5 ) {
			document.getElementById("middle").align="center";
			document.getElementById("bannerTop").align="center";
			document.getElementById("bannerBottom").align="center";
		}
		if ( is_ie6 || ( is_ie5 && !is_mac ) || ( is_ie5_5 && !is_mac ) ) {
			navRoot = document.getElementById("nav");
			for (i=0; i<navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.className+=" over";
					}
					node.onmouseout=function() {
						this.className=this.className.replace(" over", "");
					}
				}
			}
		}
		renCount = galleryPics.length;
		if ( renCount > 1 ) {
			renInt=setInterval("autoRen()",5000);
		}
	}
);

function isDigit(num) {
	if (num.length>1){return false;}
	var string="1234567890";
	if (string.indexOf(num)!=-1){return true;}
	return false;
}

function isBlank(val){
	if(val==null){return true;}
	for(var i=0;i<val.length;i++) {
		if ((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")){return false;}
		}
	return true;
}

function isInteger(val){
	if (isBlank(val)){return false;}
	for(var i=0;i<val.length;i++){
		if(!isDigit(val.charAt(i))){return false;}
		}
	return true;
}

var loadImage = new Image;
var loadImage2 = new Image;
var renInt;
var renCount;
var renIndex=0;
var galleryPics=[];

function autoRen (){
	if ( renIndex == renCount -1 ) loadRen(0);
	else loadRen(renIndex+1);
}
function loadRen (ind){
	oldImage = galleryPics[renIndex];
	newImage = galleryPics[ind];
	loadImage.onload=function(){
		$("#renOld").attr("src",oldImage[0]);
		$("#renOld").show();
		loadImage2.onload=function(){
			$("#ren").hide();
			$("#ren").attr({"src":newImage[0], "title":newImage[1]});
			$("#renOld").fadeOut(2000,function(){
				$("#renOld").attr("src","/_/clear.gif");
			});
			$("#ren").fadeIn(2000)
		}
		loadImage2.src =newImage[0];
	}
	loadImage.src = oldImage[0];
	renIndex = ind;
}