window.addEvent('domready', function() {

//var data = ['01.jpg','02.jpg','03.jpg','04.jpg','05.jpg'];

  if($('gallist')){

	   list = $('gallist').value;

	   alist = list.split(",");

	   var data = alist;

	   //alert(data.length);

	   if($('gallistgo') && $('gallistgo').value < data.length){

		  listgo = $('gallistgo').value;

	   }else{

		  listgo = 0;

	  }

	   

	   var myShow = new Slideshow('bild', data, {controller: false, height: 283, hu: 'files', thumbnails: false, width: 850,delay:4000});

		/*$('galback').addEvents({

			  click: function(){

				  myShow.prev();

			  }

		});

		$('galnext').addEvents({

			click: function(){

				myShow.next();

			}

		});

		$('galbacklink').addEvents({

			click: function(){

				history.back();

			}

		});*/

		myShow.go(listgo);  

  }


/*
 if($('flashimage')){

	var flashimg = $('flashimage').value;

    //var flashimg = 'flash/start/trio_base.swf';
	
	var obj = new Swiff(flashimg, {

    id: 'flashimg_01',

	container: 'bild',

    width: 850,

    height: 283

	}); 

 }
 */
 
  if($('flashimage')){

	var flashimg = $('flashimage').value;
	var flashimgpath = $('flashimagepath').value;

    //var flashimg = 'flash/start/trio_base.swf';
	
	var obj = new Swiff(flashimg, {

    id: 'flashimg_01',

	container: 'bild',
	
	params: {
        base: flashimgpath
    },

    width: 850,

    height: 283

	}); 

 }
 
 
 
 
 if($('flashimagetest')){

	var flashimg = $('flashimagetest').value;

    //var flashimg = 'flash/start/trio_base.swf';
	
	var obj = new Swiff(flashimg, {

    id: 'flashimg_01',

	container: 'bild',

    width: 850,

    height: 283,
	
	params: {
     allowScriptAccess:'always'
	},
	
	events: {
        onLoad: function() {
            Swiff.remote(obj, 'echoText', 'Hello Flash, meet Swiff.');
        }
    }	
	}); 
	
	 $$('h1').addEvent('click',function(){ 
		//var flashfile = $('flashimagetest').value;
		alert(obj);
		obj.echoText("Hello, Flash.  We skipped a call to Swiff.remote!");
	  });
	

 }

 

 if($('basic_news')){

	var obj = new Swiff('trio_callout_266x266_hauptkatalog2012.swf', {

    id: 'flashnews_01',

	container: 'basic_news',

    width: 266,

    height: 266

	}); 

 }

 

  if($('style_news')){

	var obj = new Swiff('trio_callout_266x266_lifestylekatalog2012.swf', {

    id: 'flashnews_02',

	container: 'style_news',

    width: 266,

    height: 266

	}); 

 }

 

 if($('welcome_news')){

	//var obj = new Swiff('welcome_news.swf', {
	var obj = new Swiff('trio_callout_266x266_light_building.swf', {

    id: 'flashnews_03',

	container: 'welcome_news',

    width: 266,

    height: 266

	}); 

 }




	if($('accordion')){
		  $$('h3').addEvent('mouseover',function(){
			 $$('h3').setStyle('cursor','pointer'); 
		  });
		  
		   //$$('h3').addEvent('click',function(){
		   //	 $$('h3').setStyle('border-top-width','0px'),
		   //	 this.setStyle('border-top-width','1px');
		  //});
		  
		  var myAccordion = new Accordion($$('h3'), $$('.news_text'), { display: 0, alwaysHide: true });
	  }






/*******************************************************************************
* google map functions
*******************************************************************************/

	if($('googleAPI')) {
    	googleMapsLoad();
    	setFilialeOnGM();
  	}



	function googleMapsLoad() {
	  if(GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("googleMap"));
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
	  } else alert("Dieser Browser ist leider nicht kompatibel zur Google Maps API");
	}
	
	function createMarker(point, html, shopmarker) {
	  var icon              = new GIcon();
	  icon.image            = shopmarker;
	  icon.iconSize         = new GSize(32, 38);
	  icon.iconAnchor       = new GPoint(15, 38);
	  icon.infoWindowAnchor = new GPoint(15, 1);
	  var marker            = new GMarker(point, icon);
	  if(html != "") GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html);});  
	  return marker;
	}
	
	function setFilialeOnGM() {
	  if($('gm_lat') && $('gm_lon')) {
		var gmLat        = $('gm_lat').value;
		var gmLon        = $('gm_lon').value;
		var gmHtml       = '';
		var gmShopmarker = 'content/images/gmaps/' + $('gm_shoptyp').value + '.png';
		var center       = new GLatLng(gmLat, gmLon);
		map.setCenter(center, 14);
		point  = new GLatLng(gmLat, gmLon);
		marker = new GMarker(point);
		//marker = createMarker(point, gmHtml, gmShopmarker);
		map.addOverlay(marker);
	  }
	}



});


window.addEvent('unload', function() {

  if($('googleAPI')) GUnload();

});



