var HomeGallery = new Class({
    options: {
        hide: true,
        width: null,
        height: null
    },
	initialize: function(el,options)
	{
		this.setOptions(options);
		this.el = el;
		this.ap = 0;
		this.op = 0;
		this.ad = $(el).getElements('td.thumb');
		this.al = $(el).getElements('a');
		this.flashs = this.al.getProperty('rel');
		this.images = $(el).getElements('img');
		if(this.options.hide) $(el).setStyle('display', 'none');
		this.le = this.al.length;
		this.create();
		this.changeImage();	
	},
	changeImage : function()
	{
		$('flashAnim1').setStyle('display','none');
		$('flashAnim2').setStyle('display','none');
		$('flashAnim3').setStyle('display','none');
		$('flashAnim4').setStyle('display','none');
		
		$(this.imgsrc).setProperty('src',this.al[this.ap].getProperty('href'));
		$(this.imgsrc).setProperty('alt',this.images[this.ap].getProperty('alt'));
		$(this.flashs[this.ap]).setStyle('display','block');
		
		$(this.ad[this.op]).removeClass('active');
		$(this.ad[this.ap]).addClass('active');		
	},
	showImage: function(element)
	{			
		this.op = this.ap;
		var newp = this.al.indexOf($(element));
		
		if(this.ap != newp)
		{
			this.ap = newp;
			this.changeImage();
		}
	},
	create: function()
	{
this.imgsrc = $('fullview');
	}
});

HomeGallery.implement(new Options);
