	/* Gallary */

	count = 0;
	imglength = 18;
	var imageLength;

	prImg= new Array();
		for (i=0; i<imageLength; i++){
			prImg[i] = new Image();
			prImg[i].src = "/gallery/images/" + (i+1) + ".jpg";
		}
		
	function isSafari() {
		var userAgent = navigator.userAgent;
		return (userAgent.indexOf("Safari")!=-1);
	}
	
	/*	
function next(){
	new Effect.Fade("slidePhoto", { 
		from:0.9,to:0.0,duration: 1.0,fps:60,
		 afterFinishInternal: function(effect) { 
		 	new Effect.Fade("slidePhoto", { from:0.0,to:1.0,duration: 2.5,fps:60,
		 		beforeStartInternal: function(effect) {
		 			count ++;
					imageLength = count;
					if(count == imglength) count = 0;
					document.getElementById('slidePhoto').src = "/gallery/images/" + (count+1) + ".jpg";
		 		}
		 	});
		}
	});
}

function previous(){
	new Effect.Fade("slidePhoto", { 
		from:0.9,to:0.0,duration:  1.0,fps:60,
				  afterFinishInternal: function(effect) {
		 	new Effect.Fade("slidePhoto", { from:0.0,to:1.0,duration: 2.5,fps:60,
		 		beforeStartInternal: function(effect) {
		 			count --;
		 			if(count <= -1) count = imglength-1;
		 			document.getElementById('slidePhoto').src = "/gallery/images/" + (count+1)  + ".jpg";
		 		}
		 	});
		}
	});
}

//   setInterval("beforeStartInternal()", 1000);
*/


 function next(){
	count ++;
	imageLength = count;
	if(count == imglength) count = 0;
	document.getElementById('slidePhoto').src = "/gallery/images/" + (count+1) + ".jpg";
	
	// safari bug fix
	if (isSafari()) {
		document.getElementById("slidePhoto").width = prImg[count].width;
		document.getElementById("slidePhoto").height = prImg[count].height;
	}
}
	
function previous(){
		count --;
		if(count <= -1) count = imglength-1;
		document.getElementById('slidePhoto').src = "/gallery/images/" + (count+1)  + ".jpg";
		
		// safari bug fix
		if (isSafari()) {
			document.getElementById("slidePhoto").width = prImg[count].width;
			document.getElementById("slidePhoto").height = prImg[count].height;
		}
}

