﻿// Idea from http://www.artlebedev.ru/tools/technogrette/js/filmstrip/

function Filmstrip(ePictureName, eLinksName){
	this.ePicture = document.getElementById(ePictureName);
	var eLinks = document.getElementById(eLinksName);
	this.aeLink = eLinks.getElementsByTagName('A');

	this.show_picture = function( sBackground, iWidth, iHeight ){
			this.ePicture.style.backgroundImage = "url(" + sBackground + ")";
			if( iWidth )
					this.ePicture.style.width = iWidth;
			if( iHeight )
					this.ePicture.style.height = iHeight;
			this.set_current( sBackground );
	}
	this.set_current = function( sHref ){
		for( var i = 0 ; i < this.aeLink.length ; i++ ){
			if( this.aeLink[i].href.match( new RegExp( sHref + "$" ) ) ){
				this.aeLink[i].className += " current";
				//this.ePrev.className = this.ePrev.className.replace( /\s+disabled/g, "" );
				//this.eNext.className = this.eNext.className.replace( /\s+disabled/g, "" );
				//if( i == 0 ){
						//this.ePrev.className += " disabled";
						//this.ePrev.onmouseover = function(){};
						//this.eNext.onmouseover = this.aeLink[i + 1].onclick;
				//}else if( i == this.aeLink.length - 1 ){
						//this.eNext.className += " disabled";
						//this.eNext.onmouseover = function(){};
						//this.ePrev.onmouseover = this.aeLink[i - 1].onclick;
				//}else{
						//this.eNext.onmouseover = this.aeLink[i + 1].onclick;
						//this.ePrev.onmouseover = this.aeLink[i - 1].onclick;
				//}
			}else{
					this.aeLink[i].className = this.aeLink[i].className.replace( /\s*current/g, "" );
			}
		}
	}
}
