SlideShow.current_image=0;
SlideShow.signatur;

function SlideShow(){
	this.current_image=0;
}

/*SlideShow.prototype.move=function(step,img_array,signatur){
	if(this.current_image==null || (signatur!=null && signatur!=signatur)){
		this.signatur=signatur;
		this.current_image=0;
	}
	
	this.current_image+=step;

	last_index=img_array.length-1;
	//Has next?
	if(this.current_image>=last_index){
		this.curren_image=last_index;
		$('#link_next_enabled').hide();
		$('#link_next_disabled').show()
	}else{
		$('#link_next_enabled').show();
		$('#link_next_disabled').hide();
	}
	
	if(this.current_image<=0){
		this.current_image=0;
		$('#link_prev_enabled').hide();
		$('#link_prev_disabled').show();
	}else{
		$('#link_prev_enabled').show();
		$('#link_prev_disabled').hide();
	}
	obj=img_array[this.current_image];
	$('#property_image_tag').attr('src',obj[0]);
	$('#property_image_tag').attr('width',obj[1]);
	$('#property_image_tag').attr('height',obj[2]);
	$('#property_image_tag').attr('alt',obj[3]);
	return false;
}*/

SlideShow.slides;
SlideShow.no_image_text;

SlideShow.prototype.clearImages=function(){
	$('#property_image').empty();
	$('#link_next_enabled').hide();
	$('#link_next_disabled').show();
	$('#link_prev_enabled').hide();
	$('#link_prev_disabled').show();
}

SlideShow.prototype.setNoImageText=function(text){
	this.no_image_text=text;
}


SlideShow.prototype.setImages=function(new_images){
	this.current_image=0;
	this.clearImages();
	if(new_images==null){
		$('#property_image').append('<table border="0" cellpadding="0" cellspacing="0"><tr style="height: 216px;vertical-align: middle;"><td style="width: 288px;text-align:center;">'+this.no_image_text+'</td></tr></table>');
		return;
	}
	for(x=0;x<new_images.length;x++){
	var obj=new_images[x];
		$('#property_image').append('<img style="padding:0px;border:0px" alt="'+obj[3]+'" src="'+obj[0]+'" width="'+obj[1]+'" height="'+obj[2]+'" />');
	}
	this.slides=$('#property_image > img');
	this.last_index=this.slides.length-1;
	for(x=0;x<this.slides.length;x++){
		if(x>0)
		$(this.slides[x]).hide();	
	}
	this.change(0);
}

SlideShow.prototype.change=function(step){
	if(this.current_image==(this.current_image+step)){
		this.updateNavigationState();
		return false;	
	}else{
		$(this.slides[this.current_image]).hide();
	}
	this.current_image+=step;

	
	
	//Has next?
	if(this.current_image>=this.last_index){
		this.curren_image=this.last_index;
	}
	if(this.current_image<=0){
		this.current_image=0;
	}
	$(this.slides[this.current_image]).show();
	this.updateNavigationState();
	return false;
}

SlideShow.prototype.updateNavigationState=function(){
	if(this.current_image>=this.last_index){
		//Disable Next
		$('#link_next_enabled').hide();
		$('#link_next_disabled').show()
	}else{
		//Enable Next
		$('#link_next_enabled').show();
		$('#link_next_disabled').hide();
	}
	
	if(this.current_image<=0){
		//Disable Previous
		$('#link_prev_enabled').hide();
		$('#link_prev_disabled').show();
	}else{
		//Enable Previous
		$('#link_prev_enabled').show();
		$('#link_prev_disabled').hide();
	}
}
