var gallery1Count=0;var gallery1Layers=0;var gallery1_iconX=-1;var gallery1_iconY=0;var gallery1_iconFile="../_img/gallery/next.gif";var cantpress = 0;gallery1 = {	render:function(fs) {    //this.files =gallery1_elems;		this.files = fs.split("|||");		if (!this.timer) this.timer = 7000;		if (!this.destDiv) this.destDiv = "gallerydiv";        $(this.destDiv).innerHTML="<div id='gallery1_frame' style='position:absolute; left:0px; '><div id='gallery1_div1' style='position:absolute; top:0; left:0; '></div><div id='gallery1_div2' style='position:absolute; top:0; left:0;'></div></div>";        //flag for swapping on off        if (this.files.length <= 1) {            this.justone = 1;        } else {            this.justone = 0;        }        		//preload        for (f=0; f<this.files.length; f++) {			a = new Image();			a.src=this.files[f];		}				if ($(this.destDiv)) {			gallery1.display();			gallery1.arrange();		}	},	arrange:function() {		this.setInt = setInterval("gallery1.nextFile()",gallery1.timer);		if ($("gallery1_buttonicon")) {            $("gallery1_buttonicon").src=gallery1_iconFile;        }	},	nextFile:function() {        if (this.justone == 0) {            gallery1Count++;            if (gallery1Count>=this.files.length) {                gallery1Count=0;            }            gallery1.display();        }	},	display:function() {		var addBtn = "";		var addcss = "";		if (gallery1_iconX == -1) {			addpos = "right:32px; bottom:32px;";		} else {			addpos = "left:"+gallery1_iconX+"px; top:"+gallery1_iconY+"px";		}		dest_div = ( gallery1Layers == 0) ? "gallery1_div1" : "gallery1_div2";		new Effect.Fade(dest_div,{duration:.5, from:1.0, to:0.0, beforeStart:function() {cantpress=1} });		gallery1Layers = 1 - gallery1Layers;		dest_div = ( gallery1Layers == 0 ) ? "gallery1_div1" : "gallery1_div2";		new Effect.Appear(dest_div,{duration:.5, from:0.0, to:1.0, afterFinish:function() {cantpress=0} });		addcss = "<style>#gallery1_btnpos_a{ display:block; filter:Alpha(opacity=60); opacity:.60;  } #gallery1_btnpos_a:hover  { filter:Alpha(opacity=30);  opacity:.30; }</style>";		        if (this.justone == 0) {            addBtn = "<div id='gallery1_btnpos' style='position:absolute; "+addpos+" z-index:1000' onmouseover='gallery1.stop()' onmouseout='gallery1.arrange()'><a  id='gallery1_btnpos_a'  href='javascript:gallery1.next()' ><div><img id='gallery1_buttonicon' src='"+gallery1_iconFile+"' border=0></div></a></div>";        }        		$(dest_div).innerHTML=addcss+"<div style=''><img src='"+gallery1.files[gallery1Count]+"'>"+addBtn+"</div>";	},	next:function() {		if (cantpress==0) {	        clearInterval(gallery1.setInt);    	    gallery1.nextFile();		//gallery1.arrange();        } else {			$("debug").innerHTML="";		}	},	stop:function() {		clearInterval(this.setInt);					}}
