﻿slides_lg = {};
slides_lg.init = function(){
	try{
		var slideshowName = location.search.substring( "?slideshow=".length );
		
		slideshow.create( slideshowName, false, "img", "title", "" );
		
		slideshow.show.makeLarge();
		
		readHash(location.hash, false, slideshow.show);
		document.images.img.style.display = "inline";
	}
	catch(e){
		document.getElementById("title").innerHTML = "No slides requested";
	}
}
/*
	for each slide, switch the image, so 
		/images/.../foo_sm.jpg --> /images/.../foo_lg.jpg
	and
		replace slide.text with slide.title
*/
slideshow.prototype.makeLarge = function(){
	for( var i=0; i<this.slides.length; i++ ){
		this.slides[i].makeLarge();
	}
}

slide.prototype.makeLarge = function(){
	this.text = this.title;
	this.image.src = this.src = this.src.replace("_sm", "_lg");
}

slideshow.prototype.post_update_hook = function(){
	
	var prevLink = document.getElementById("slidePrev");
	var nextLink = document.getElementById("slideNext");
	if( this.current == 0 ){
		prevLink.className = "disabled";
		prevLink.href = "#" + (this.current)
	}
	else{
		prevLink.className = "";
		prevLink.href = "#" + (this.current-1)
	}
	if( this.current == this.slides.length-1 ){
		nextLink.href = "#" + (this.current)
		nextLink.className = "disabled";
	}
	else{
		nextLink.className = "";
		nextLink.href = "#" + (this.current+1)
	}
	location.hash = "#" + this.current;
}
