
var JS_GALLERY_LOADED=true;var JS_GALLERY_FILE='gallery.js';var JS_GALLERY_VERSION='0.5';var JS_GALLERY_BUILD_DATE='2006/02/28';var JS_GALLERY_DISPLAYTYPE_NONE=1;var JS_GALLERY_DISPLAYTYPE_BLOCK=2;var JS_GALLERY_DISPLAYTYPE_TABLE=8;var JS_GALLERY_DISPLAYTYPE_VISIBLE=16;var JS_GALLERY_DISPLAYTYPE_INLINE=32;function Gallery(opts)
{this.init(opts);}
Gallery.prototype={init:function(opts)
{this.history=new Array();this.position=1;this.count=0;this.options={slide_id_ref:'slide-',on_position_change:new Function("p","return true"),quantity:0,carosel:new Boolean(),display_type:JS_GALLERY_DISPLAYTYPE_BLOCK};if(opts)
{this.set_options(opts);};},back:function()
{this.cycle(this.position,this._position_decrement());},clear_history:function()
{this.history=new Array();},go_to:function(item)
{this.cycle(this.position,item);return true;},go_to_first:function()
{this.cycle(this.position,1);return true;},go_to_last:function()
{this.cycle(this.position,this.options.quantity);return true;},go_to_internal_anchor:function(uri)
{var uri=(uri)?uri:self.location;var re=/\#([0-9]+)/;if((slide=re.exec(uri))&&slide[1]<=this.options.quantity)
this.go_to(slide[1]);else
this.go_to_first();return true;},go_to_random:function()
{var randNum=Math.ceil(Math.random()*this.options.quantity);var matched;var match=new RegExp("^"+randNum+"$");for(var i=0;i<this.history.length;i++)
{if(this.history[i]==randNum)
{matched=true;}
else
{matched=false;}}
if(!matched){this.go_to(randNum)};},hide:function(item)
{this._go(item,false);this._position_decrement();},hide_all:function(item)
{for(var i=this.options.quantity;i>0;i--)
{this.go_to(i,false);}},next:function()
{this.cycle(this.position,this._position_increment());},set_options:function(opts)
{for(var key in opts)
{this.options[key]=opts[key];}},set_carosel_off:function()
{this.options.carosel=false;},set_carosel_on:function()
{this.options.carosel=true;},set_display_type:function(type)
{this.options.display_type=type;},set_slide_ref:function(ref)
{this.options.slide_ref=ref;},show:function(item)
{this._go(item,true);},show_all:function(item)
{for(var i=this.options.quantity;i>0;i--)
{this._go(i,true);}},show_range:function(start,length)
{for(var i=this.options.quantity;i>0;i--)
{if(i>=start_index&&(i<start_index+length))
this._go(i,true);else
this._go(i,false);}},show_selective:function()
{for(var i=arguments.length;i>=0;i--)
{this._go(arguments[i],true);}},skip_back:function(items)
{var old_position=this.position;var new_position;for(var i=1;i<=items;i++)
{new_position=this._position_decrement();}
this.cycle(old_position,new_position);},skip_forward:function(items)
{var old_position=this.position;var new_position;for(var i=1;i<=items;i++)
{new_position=this._position_increment();}
this.cycle(old_position,new_position);},cycle:function(old_item,new_item)
{this._go(old_item,false);this._go(new_item,true);this.history[this.history.length]=new_item;this.count++;this._set_position(new_item);this.options.on_position_change(this.position);return true;},_go:function(item,state)
{if(isNaN(Math.ceil(item))){warn('gallery.go : item "'+item+'" is not a number');return false;}
var slide_ref=document.getElementById(this.options.slide_id_ref+item);if(state)
{switch(this.options.display_type)
{case JS_GALLERY_DISPLAYTYPE_NONE:slide_ref.style.display='';break;case JS_GALLERY_DISPLAYTYPE_BLOCK:slide_ref.style.display='block';break;case JS_GALLERY_DISPLAYTYPE_TABLE:slide_ref.style.display='table';break;case JS_GALLERY_DISPLAYTYPE_INLINE:slide_ref.style.display='inline';break;case JS_GALLERY_DISPLAYTYPE_VISIBLE:slide_ref.style.visibility='visible';break;default:break;}}
else
{switch(this.options.display_type)
{case JS_GALLERY_DISPLAYTYPE_VISIBLE:slide_ref.style.visibility='hidden';break;default:slide_ref.style.display='none';break;}}
return true;},_set_position:function(item)
{this.position=item;return true;},_position_increment:function()
{if(this.position<this.options.quantity)
this.position++;else if((this.position==this.options.quantity)&&(this.options.carosel))
this.position=1;else
return false;return this.position;},_position_decrement:function()
{if(this.position>1)
this.position--;else if((this.position==1)&&(this.options.carosel))
this.position=this.options.quantity;else
return false;return this.position;}}