// JavaScript Document

window.addEvent("domready", function() {
	sl.setimgLinks();
});

// sl = set links
sl={
	setimgLinks:function(){
		sl.imgList = document.getElementById("imageList");
		sl.imgLinks = sl.imgList.getElementsByTagName("a");
		for(var i=0;i<sl.imgLinks.length;i++){
			if( DOMhelp.cssjs("check",sl.imgLinks[i],"img")){
				sl.imgHref = sl.imgLinks[i].getAttribute("href");
				if(sl.imgHref.lastIndexOf("/")){
				sl.imgIndex = sl.imgHref.lastIndexOf("/");
				sl.imgHref = sl.imgHref.substring(sl.imgIndex+1);
				}
				sl.suffixIndex = sl.imgHref.indexOf(".jpg");
				sl.imgRel = sl.imgLinks[i].getAttribute("rel");
				sl.relHeightIndex = sl.imgRel.indexOf("height:");
				sl.heightValue = Number(sl.imgRel.substring(17)) - 22;
				//alert(sl.heightValue);
				
				sl.imgURL = "scrollWin.html?img=" + sl.imgHref.substring(0,sl.suffixIndex) + "&height=" + sl.heightValue;
				sl.imgLinks[i].setAttribute("href", sl.imgURL);
				
			}
			
		}
		sl.setMultiBox();
		sl.setMoreInfo();
	},
	setMoreInfo:function(){
		sl.mySlide = new Fx.Slide('moreInfoContent').hide();
		DOMhelp.cssjs("remove",$('moreInfoContent'),"hideMe");
		$('infoA').onclick = function(){
			return false;	
		}
		DOMhelp.addEvent($('moreInfoBT'),'click',sl.toggleButton,false);
	},
	toggleButton:function(){
		sl.mySlide.toggle();
	},
	setMultiBox:function(){
		if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
			var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
		}
		if (ieversion>=8){
			sl.versionNum = "okay";
			//document.write("You're using IE8 or above")
		}else if (ieversion>=7){
			//document.write("You're using IE7.x")
			sl.versionNum = "okay";
		}else if (ieversion>=6){
			//document.write("You're using IE6.x")
			sl.versionNum = "tooLow";
		}else if (ieversion>=5){
			//document.write("You're using IE5.x")
			sl.versionNum = "tooLow";
		}else{
			sl.versionNum = "okay";
			//document.write("n/a")
		}
		//alert(sl.versionNum);
		if(sl.versionNum != "tooLow"){
			var box = {};
			box = new MultiBox('img', {descClassName: 'photoDesc', useOverlay: true, showControls:true, openFromLink:false});
		}
	}

}