// JavaScript Document
function mkSlideShow(ob){
		var nrs=ob.getElements('.nr');
		if(nrs.length>1){
			nrs.setStyle('display','none');
			var ims=new Asset.images(['/gfx/pause_r.gif','/gfx/play.gif','/gfx/play_r.gif'], {
			onComplete: function(){
				var im=ob.getElement('#pp');
				im.act=true;
				im.addClass('l');
				im.addEvent('mouseover',function(){this.getElement('img').src=((this.act)? '/gfx/pause_r.gif' : '/gfx/play_r.gif') });
				im.addEvent('mouseout',function(){this.getElement('img').src=((this.act)? '/gfx/pause.gif' : '/gfx/play.gif') });
				im.addEvent('click',function(e){
					new Event(e).stop();							 
					var pr=	this.getParent().getParent();							
					if(this.act){
						this.getElement('img').src='/gfx/play.gif';
						$clear(pr.show);
						pr.getElements('.nr').setStyle('display','inline');
						if(pr.getElement('#s'+pr.act).getStyle('opacity')<1){
							pr.getElement('#s'+pr.act).fd.cancel();
							pr.getElement('#s'+pr.act).ld=false;
							pr.swap();
						}else{
							pr.getElement('#s'+((pr.act)? 0 : 1)).ld=false;
							pr.getElement('#s'+((pr.act)? 0 : 1)+' img').dispose();
						}
					}else{
						this.getElement('img').src='/gfx/pause.gif';
						pr.n=pr.getElement('.nrs .nr_act a').nr;
						pr.n=((pr.n<(pr.slides.length-1))? pr.n+1 : 0);
						pr.ld(((pr.act)? 0 : 1),true);
						pr.show=pr.nxt.delay(3000,pr);
						pr.getElements('.nr').setStyle('display','none');
					}
					this.act=((this.act)? false : true);
				});
			}});
			ob.slides=new Array();
			ob.n=0;
			ob.act=0;
			ob.wait=false;
			ob.show;
			nrs.each(function(item,index){						
				var vars=item.getElement('input').value.split(':');//data
				if(!index)item.addClass('nr_act');
				ob.slides.push({'src':vars[0],'w':vars[1],'h':vars[2],'typ':vars[3],'cl':vars[4], 'pid':vars[5], 'ptit':vars[6], 'ploc':vars[7]});
				var a=item.getElement('a')
				a.addEvent('click',function(e){
					new Event(e).stop();
					var pr=this.getParent().getParent().getParent();
					pr.n=this.nr;
					$('ld').setStyle('display','block');
					pr.ld(pr.act,false);								   	
								   
				});
				a.nr=index;
			})
			ob.getElements('.slide').each(function(item){
				item.fd=new Fx.Tween(item,{duration: 2000, wait: false});
				item.fd.addEvent('onComplete',function(item){
					item.getParent().swap();
					clock.resume.delay(500,clock);
				});
			});
			
			ob.n=((ob.n<ob.slides.length-1)? ob.n+1 : 0);
			ob.ld=function (m,run){
				if(this.slides[this.n].typ=='img'){
					var once=false;
					im= new Asset.image(this.slides[this.n].src, { 'class':((this.slides[this.n].cl=='px')? '' :'sc' ),
						onload: function(){
							if(once){
								return;
							}else{
								once = true;
								$('s'+m).ld=true;
								var pr=$('s'+m).getParent();
								if(run){
									$('s'+m).adopt(this);
									pr.getElements('.nr')[pr.n].removeClass('nr_act');
									pr.n=((pr.n<(pr.slides.length-1))? pr.n+1 : 0);
									if(pr.wait){
										pr.wait=false;
										pr.nxt();
									}
								}else{
									this.replaces(pr.getElement('#s'+m+' img'));
									if ($('p_t'))$('p_t').set('html', '<a href="/?section=Projects&id='+pr.slides[this.n].pid+'">'+pr.slides[this.n].ptit+'</a><div class="page_sub_title">'+pr.slides[pr.n].ploc+'</div>');
									$('ld').setStyle('display','none');
									var nrs=pr.getElements('.nr');
									nrs.removeClass('nr_act');
									nrs[pr.n].addClass('nr_act');
								}
							}
						}
					});
				}
			}
			ob.nxt=function(){
				var nxt=((this.act)? '#s'+0 : '#s'+1);
				if(this.getElement(nxt).ld){
					this.getElement('#s'+this.act).fd.set('opacity',1);
					this.getElement('#s'+this.act).fd.start('opacity',1,0);
					clock.pause();
				}else{
					this.wait=true;
				}
			}
			
			ob.swap=function(){
				var nrs=this.getElements('.nr');
				nrs.removeClass('nr_act');
				
				if ($('p_t'))$('p_t').set('html', '<a href="/?section=Projects&id='+this.slides[this.n].pid+'">'+this.slides[this.n].ptit+'</a><div class="page_sub_title">'+this.slides[this.n].ploc+'</div>');
				nrs[((this.n)? this.n-1 : this.slides.length-1)].addClass('nr_act');
				this.getElement('#s'+this.act+' img').dispose();
				var slide=this.getElement('#s'+this.act);
				slide.fd.set('opacity',1);
				slide.setStyle('z-index',900);
				slide.ld=false;
				this.act=((this.act)? 0 : 1);
				this.getElement('#s'+this.act).setStyle('z-index',1000);
				if( this.getElement('.nr').getStyle('display')=='none'){
					this.ld(((this.act)? 0 : 1),true);
					this.show=this.nxt.delay(3000,this);
				}
			}
		}else{
			//$('s0').adopt(ob.getElement('img'));
		}
	}
	function mkFullScreen(ob){
		var ims=new Asset.images(['/gfx/full_screen.gif','/gfx/un_full_screen.gif','/gfx/un_full_screen_r.gif'], {
		onComplete: function(){
			var im=ob.getElement('#fs');
			im.act=false;
			im.addClass('l');
			im.addEvent('mouseover',function(){this.getElement('img').src=((this.act)? '/gfx/un_full_screen_r.gif' : '/gfx/full_screen_r.gif') });
			im.addEvent('mouseout',function(){this.getElement('img').src=((this.act)? '/gfx/un_full_screen.gif' : '/gfx/full_screen.gif') });
			im.addEvent('click',function(e){
			new Event(e).stop();					 
				var pr=	this.getParent().getParent();							
				if(this.act){
					if(Browser.Engine.trident4){
						window.location=location.href;
					}else{
					this.getElement('img').src='/gfx/full_screen.gif';
					$(pr).removeClass('full');
					$(pr).inject($('content').getElement('.col4 .col4'),'after');
					$('full').setStyle('display',null);
					$(document.html).setStyle('overflow',this.scr);
					$(pr).setStyle('height',Math.floor((parseInt($('content').getElement('.col4').getStyle('width'))*0.666)/7)*7+'px');
					}
				}else{
					this.scr=$(document.html).getStyle('overflow');
					this.getElement('img').src='/gfx/un_full_screen.gif';
					$('full').grab(pr);
					$(pr).addClass('full');
					$(document.html).setStyle('overflow','hidden');
					$('full').setStyle('display','block');
					snap();
				}
				this.act=((this.act)? false : true);
			});
		}});
	}
		