var imageloop=
{
 stil:
 [
   [
    'bounce',
    'http://st.imageloop.com/_img/_sl/newloop/effects/bounce.gif',
    {'playerConfig' : {'transitionType' : 'BounceEffect'}}
   ],
   [
    'slider',
    'http://st.imageloop.com/_img/_sl/newloop/effects/slider.gif',
    {'playerConfig' : {'transitionType' : 'SliderEffect'}}
   ],
   [
    'collage',
    'http://st.imageloop.com/_img/_sl/newloop/effects/collage.gif',
    {'playerConfig' : {'transitionType' : 'CollageEffect'}}
   ],
   [
    'cube',
    'http://st.imageloop.com/_img/_sl/newloop/effects/cube.gif',
    {'playerConfig' : {'transitionType' : 'CubeEffect'}}
   ],
   [
    'spin',
    'http://st.imageloop.com/_img/_sl/newloop/effects/spin.gif',
    {'playerConfig' : {'transitionType' : 'SpinEffect'}}
   ],
   [
    'flip',
    'http://st.imageloop.com/_img/_sl/newloop/effects/flip.gif',
    {'playerConfig' : {'transitionType' : 'FlipEffect'}}
   ],
   [
    'oldfilm',
    'http://st.imageloop.com/_img/_sl/newloop/effects/film.gif',
    {'playerConfig' : {'transitionType' : 'FilmEffect'}}
   ],
   [
    'checker',
    'http://st.imageloop.com/_img/_sl/newloop/effects/check.gif',
    {'playerConfig' : {'transitionType' : 'CheckerEffect'}}
   ],
   [
    'gate',
    'http://st.imageloop.com/_img/_sl/newloop/effects/gate.gif',
    {'playerConfig' : {'transitionType' : 'GateEffect'}}
   ],
   [
    'superstar',
    'http://st.imageloop.com/_img/_sl/newloop/effects/superstar.gif',
    {'playerConfig' : {'transitionType' : 'SuperstarsEffect'}}
   ],
   [
    'show',
    'http://st.imageloop.com/_img/_sl/newloop/effects/show.gif',
    {'playerConfig' : {'transitionType' : 'ShowEffect'}}
   ],
   [
    'album',
    'http://st.imageloop.com/_img/_sl/newloop/effects/book.gif',
    {'playerConfig' : {'transitionType' : 'AlbumEffect'}}
   ],
   [
    'flyout',
    'http://st.imageloop.com/_img/_sl/newloop/effects/flyout.gif',
    {'playerConfig' : {'transitionType' : 'FlyOutEffect'}}
   ],
   [
    'zoomin',
    'http://st.imageloop.com/_img/_sl/newloop/effects/zoomIn.gif',
    {'playerConfig' : {'transitionType' : 'ZoomInEffect'}}
   ],
   [
    'flick',
    'http://st.imageloop.com/_img/_sl/newloop/effects/flick.gif',
    {'playerConfig' : {'transitionType' : 'FlickEffect'}}
   ],
   [
    'hearts',
    'http://st.imageloop.com/_img/_sl/newloop/effects/hearts.gif',
    {'playerConfig' : {'transitionType' : 'HeartEffect'}}
   ]
 ],
 skin:
 [
   [
    'barock',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_259.gif',
    {'playerConfig' : {'skinType' : '259,34,39,34,41'}}
   ],
   [
    'superstar',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_260.gif',
    {'playerConfig' : {'skinType' : '260,34,23,34,23'}}
   ],
   [
    'iPhone',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_23.gif',
    {'playerConfig' : {'skinType' : '23,64,16,66,17'}}
   ],
   [
    'oldframe',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_257.gif',
    {'playerConfig' : {'skinType' : '257,34,34,34,35'}}
   ],
   [
    'edhardy',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_245.gif',
    {'playerConfig' : {'skinType' : '245,5,5,5,5'}}
   ],
   [
    'diamonds',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_258.gif',
    {'playerConfig' : {'skinType' : '258,20,29,20,29'}}
   ],
   [
    'desperate',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_263.gif',
    {'playerConfig' : {'skinType' : '263,25,23,25,27'}}
   ],
   [
    'culchacandela',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_250.gif',
    {'playerConfig' : {'skinType' : '250,5,5,5,5'}}
   ],
   [
    'imac',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_226.gif',
    {'playerConfig' : {'skinType' : '226,10,9,10,77'}}
   ],
   [
    'oldpolaroid',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_233.gif',
    {'playerConfig' : {'skinType' : '233,20,29,20,29'}}
   ],
   [
    'knuddels',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_247.gif',
    {'playerConfig' : {'skinType' : '247,40,40,40,40'}}
   ],
   [
    'modernhearts',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_253.gif',
    {'playerConfig' : {'skinType' : '253,25,23,25,27'}}
   ],
   [
    'black',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_236.gif',
    {'playerConfig' : {'skinType' : '236,30,20,30,20'}}
   ],
   [
    'silver',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_234.gif',
    {'playerConfig' : {'skinType' : '234,30,20,30,20'}}
   ],
   [
    'blue',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_237.gif',
    {'playerConfig' : {'skinType' : '237,30,20,30,20'}}
   ],
   [
    'pink',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_241.gif',
    {'playerConfig' : {'skinType' : '241,30,20,30,20'}}
   ],
   [
    'lightblue',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_239.gif',
    {'playerConfig' : {'skinType' : '239,30,20,30,20'}}
   ],
   [
    'orange',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_240.gif',
    {'playerConfig' : {'skinType' : '240,30,20,30,20'}}
   ],
   [
    'red',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_243.gif',
    {'playerConfig' : {'skinType' : '243,30,20,30,20'}}
   ],
   [
    'violet',
    'http://st.imageloop.com/_img/_sl/skinico/ic_sl_stz_242.gif',
    {'playerConfig' : {'skinType' : '242,30,20,30,20'}}
   ]
 ],
 effekte:
 [
   [
    'autumn',
    'http://st.imageloop.com/_img/_sl/newloop/themes/autumn_small.png',
    {'playerConfig' : {'themeType' : 'AutumnTheme'}}
   ],
   [
    'balloons',
    'http://st.imageloop.com/_img/_sl/newloop/themes/balloons_small.png',
    {'playerConfig' : {'themeType' : 'BallonsTheme'}}
   ],
   [
    'bees',
    'http://st.imageloop.com/_img/_sl/newloop/themes/bees_small.png',
    {'playerConfig' : {'themeType' : 'BeesTheme'}}
   ],
   [
    'bubbles',
    'http://st.imageloop.com/_img/_sl/newloop/themes/bubbles_small.png',
    {'playerConfig' : {'themeType' : 'BubblesTheme'}}
   ],
   [
    'teardrop',
    'http://st.imageloop.com/_img/_sl/newloop/themes/teardrop_small.png',
    {'playerConfig' : {'themeType' : 'DropBubblesTheme'}}
   ],
   [
    'stars2',
    'http://st.imageloop.com/_img/_sl/newloop/themes/stars2_small.png',
    {'playerConfig' : {'themeType' : 'StarsTheme2'}}
   ],
   [
    'fallstars',
    'http://st.imageloop.com/_img/_sl/newloop/themes/fallstars_small.png',
    {'playerConfig' : {'themeType' : 'FallStarsTheme'}}
   ],
   [
    'firefly',
    'http://st.imageloop.com/_img/_sl/newloop/themes/firefly_small.png',
    {'playerConfig' : {'themeType' : 'FireflyTheme'}}
   ],
   [
    'firework',
    'http://st.imageloop.com/_img/_sl/newloop/themes/firework_small.png',
    {'playerConfig' : {'themeType' : 'FireworksTheme'}}
   ],
   [
    'rain',
    'http://st.imageloop.com/_img/_sl/newloop/themes/rain_small.png',
    {'playerConfig' : {'themeType' : 'RainsTheme'}}
   ],
   [
    'hearts',
    'http://st.imageloop.com/_img/_sl/newloop/themes/hearts_small.png',
    {'playerConfig' : {'themeType' : 'HeartsTheme'}}
   ]
 ]
};



var slideshows=new Array();

function slideshow(sid)
{
  this.id=slideshows.length;
  slideshows[this.id]=this;
  this.sid=sid;
  this.parent=modules[sid];
  this.vPos=0;
  this.draw=function()
  {
  	this.parent.data.html=this.parent.data.SOption.html?this.parent.data.SOption.html:'';
  	if(typeof this.parent.data.SOption.pics=='object')
  		this.parent.data.SOption.pics=convertToArray(this.parent.data.SOption.pics);
  		
  }
  this.openOption=function()
  {

    this.parent.data['tpl']['option']=tpl.loadTpl('modules/'+moduleTyps[this.parent.typ]+'/edit/option',function(){ editModule.moduleClass.openOption(); });

    tpl.loadTpls();    
    if(!this.parent.data['tpl']['option'])
      return;    
    this.parent.data['tpl']['option']=this.parent.data['tpl']['option'].process(imageloop);
  	this.parent.setTpl('option');      
  }
  this.setData=function(data)
  {
  	if(!this.parent.playerConfig)
  		this.parent.playerConfig=new Array();
  	
    for(var item in data[2]['playerConfig'])	
  	 this.parent.playerConfig[item]=data[2]['playerConfig'][item];
  	 if(this.parent.data.SOption.iID)
  	 {
 			editModule.loading();
		  	engine.ajax.addRequest('/ajax.php?f=spoon/loop&l=changeProp',function(data){editModule.moduleClass.loaded(data)},'id='+this.parent.data.SOption.iID+'&data='+JSON.stringify(this.parent.playerConfig));
     }
      else
        this.reload();
  }
	this.reload=function()
	{
		if(this.parent.data.SOption.pics)
		{
			editModule.loading();
		  	engine.ajax.addRequest('/ajax.php?f=spoon/loop&l=all',function(data){editModule.moduleClass.loaded(data)},'id='+this.parent.data.SOption.iID+'&data='+JSON.stringify(this.parent.playerConfig)+'&images='+JSON.stringify(this.parent.data.SOption.pics));
		}  		
	}
	this.setEdit=function()
	{
		engine.ajax.addRequest('/ajax.php?f=album/getAlbum',function(get){editModule.moduleClass.setAlbums(get)})
	}
	this.setAlbums=function(get)
	{
	
			var albums=JSON.parse(get);
			$('selectAlbum').innerHTML='';
			var op=document.createElement('option');
			op.innerHTML='Bitte wählen';
			op.value	='';
			$('selectAlbum').appendChild(op);			
			
		for(id in albums)
		{
			var op=document.createElement('option');
			op.innerHTML=albums[id].ATitle;
			op.value	=albums[id].AID;
			$('selectAlbum').appendChild(op); 
		}
		
    	this.parent.data.albums=new Array();
		this.parent.data.albums=albums;
	}
	this.setAlbum=function(get)
	{
	
			var images=JSON.parse(get);

		for(id in images)
		{
		  	var id=this.parent.data.SOption.pics.length;
		  	 this.parent.data.SOption.pics[id]=images[id];		
		}
		this.parent.reloadEdit();
		this.reload(); 
	}	
  this.setMenu=function(typ)
  {
  	$('showSkin').style.display='none';
  	$('showStil').style.display='none';  	
  	$('showEffekte').style.display='none';  	
   	$('show'+typ).style.display='block';   
   	
   	$('menuSkin').className='';
  	$('menuStil').className='';  	
  	$('menuEffekte').className='';  	
   	$('menu'+typ).className='active';     	
   		
  }
  this.slideUp=function()
  {
  	if(this.vPos>0)
  	{
  		this.vPos--;
  		$('vSlider').style.top=55*this.vPos+'px';
  	}
  }
  this.slideDown=function()
  {
  	if(this.vPos*5<Math.ceil(this.parent.data.SOption.pics.length/5))
  	{
  		this.vPos++;
  		$('vSlider').style.top=55*this.vPos+'px';
  	}  	
  }
  this.deleteAllPics=function()
  {
  	 this.parent.data.SOption.pics=new Array();
  	 this.parent.reloadEdit();  
  	 	this.reload();	  	
  }
  this.deletePic=function(id)
  {
      var name=this.parent.data.SOption.pics[id].substr(1+this.parent.data.SOption.pics[id].lastIndexOf('/'));
      alert(name);
  	this.parent.data.SOption.pics.splice(id,1);
  	 this.parent.reloadEdit();  
   	 if(this.parent.data.SOption.iID)
  	 {
 			editModule.loading();
		  	engine.ajax.addRequest('/ajax.php?f=spoon/loop&l=deletePic&n='+name,function(data){editModule.moduleClass.loaded(data)},'id='+this.parent.data.SOption.iID);
     }
      else 	 
  	 	this.reload();	
  }
  this.loadAlbum=function(id)
  {
  	if(id>0)
  	{
		engine.ajax.addRequest('/ajax.php?f=album/getPic&id='+id,function(get){editModule.moduleClass.setAlbum(get)});
		$('selectAlbum').value='';
  	}
  }
  this.loaded=function(data)
  {
		  	    if(data.length)
		  	    {
		  	        var con=eval('('+data+')');
		  	        editModule.data.SOption.iID=con.id;
	
		  	       editModule.setEditPropertyData('html',con.html);
                }
  }
  this.setImage=function(image)
  {
  	var img=image.split('|');
  	var id=this.parent.data.SOption.pics.length;
  	 this.parent.data.SOption.pics[id]='http://'+rotate(img[0])+'.'+config['config']['imgdomain']+'/'+img[1];  	
  	 this.parent.reloadEdit();
  	 
  	 if(this.parent.data.SOption.iID)
  	 {
 			editModule.loading();
		  	engine.ajax.addRequest('/ajax.php?f=spoon/loop&l=addPic',function(data){editModule.moduleClass.loaded(data)},'id='+this.parent.data.SOption.iID+'&images='+JSON.stringify(new Array(this.parent.data.SOption.pics[id])));
     }
      else
        this.reload();
  }
}
