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


/********************************************************************
NAVIGATION
********************************************************************/

Fancymenu = new MorphList('fancymenu', {
					transition: Fx.Transitions.backOut,
	 				duration: 700
				});
				
//Actions for ajax calls
//for every action class
    $$('.ajax').each(function(el) {
        //add an event..
        el.addEvent('click', function(e) {
            e = new Event(e).stop();
           	//make ajax request
            var req = new Request.HTML({
                url: el.get('href'),
				data: { 'do' : '1' },
           		onSuccess: function(html) {
					//Clear the text currently inside the results div.
					$('content-wrapper').set('text', '');
					//Inject the new DOM elements into the results div.
					$('content-wrapper').adopt(html);
					launchMe(el.get('id'));
				},
				//Our request will most likely succeed, but just in case, we'll add an
				//onFailure method which will let the user know what happened.
				onFailure: function() {
					$('content-wrapper').set('text', 'The request failed.');
				}
			}).send();
			
        });
    });

launchMe = function(page){
	switch(page)
	{
	case 'basic':
		$$('.fc-tbx').each(function(el){el.dispose()});
		myShowHP = new Slideshow('HomeSlideShow', dataHP, {random: true, captions: false, controller: true, delay:5000, duration:1000, height: 250, hu: 'img/content/', thumbnails: false, width: 705, loader:{'animate': ['js/slideshow/loader-#.png', 12]} });
		sIFR1.initialize('div.content h2');
		sIFR2.initialize('div.content h3');
	  break;    
	case 'company':
		$$('.fc-tbx').each(function(el){el.dispose()});
		myShowHP = new Slideshow('HomeSlideShow', dataHP, {random: true, captions: false, controller: true, delay:5000, duration:1000, height: 250, hu: 'img/content/', thumbnails: false, width: 705, loader:{'animate': ['js/slideshow/loader-#.png', 12]} });
		sIFR1.initialize('div.content h2');
		sIFR2.initialize('div.content h3');
	  break;
	case 'services':
		$$('.fc-tbx').each(function(el){el.dispose()});
		myShowHP = new Slideshow('HomeSlideShow', dataHP, {random: true, captions: false, controller: true, delay:5000, duration:1000, height: 250, hu: 'img/content/', thumbnails: false, width: 705, loader:{'animate': ['js/slideshow/loader-#.png', 12]} });
		sIFR1.initialize('div.content h2');
		sIFR2.initialize('div.content h3');
		break;
	case 'contact':
		var formChk = new FormCheck('formular', {
				display : {
					errorsLocation : 1,
					indicateErrors : 2
				},
				submitByAjax:true,
				ajaxResponseDiv: $(document.body).getElement('div.rightcol')
		});
		GoogleMapsApi.init();
		sIFR1.initialize('div.content h2');
		sIFR2.initialize('div.content h3');
	  break;
	}
}
	
	
/********************************************************************
SLIDESHOW BACKGROUND
********************************************************************/
	var data = {
  		'bg01.jpg': { caption: '' }, 
  		'bg02.jpg': { caption: '' }, 
  		'bg03.jpg': { caption: '' }, 
		'bg04.jpg': { caption: '' }, 
		'bg05.jpg': { caption: '' }, 
		'bg06.jpg': { caption: '' }
	};
	sswidth = $('bgSlideshow').getSize().x
	ssheight = $('bgSlideshow').getSize().y
	
	var myShowBG = new Slideshow.Push('bgSlideshow', data, {controller: false, delay:40000, duration:1000, height: ssheight, hu: 'img/content/', thumbnails: false, width: sswidth, loader:{'animate': ['js/slideshow/loader-#.png', 12]} });

/********************************************************************
SLIDESHOW HOME
********************************************************************/
	var dataHP = {
  		'slideshow__0000.jpg': { caption: '' }, 
  		'slideshow__0001.jpg': { caption: '' }, 
  		'slideshow__0002.jpg': { caption: '' }, 
		'slideshow__0003.jpg': { caption: '' }, 
		'slideshow__0004.jpg': { caption: '' }, 
  		'slideshow__0005.jpg': { caption: '' }, 
  		'slideshow__0006.jpg': { caption: '' }, 
  		'slideshow__0007.jpg': { caption: '' }, 
		'slideshow__0008.jpg': { caption: '' }, 
		'slideshow__0009.jpg': { caption: '' }, 
  		'slideshow__0010.jpg': { caption: '' }, 
  		'slideshow__0011.jpg': { caption: '' }, 
  		'slideshow__0012.jpg': { caption: '' }, 
		'slideshow__0013.jpg': { caption: '' }, 
		'slideshow__0014.jpg': { caption: '' }, 
		'slideshow__0015.jpg': { caption: '' }

  	};

	var myShowHP = new Slideshow('HomeSlideShow', dataHP, {random: true, captions: false, controller: true, delay:5000, duration:1000, height: 250, hu: 'img/content/', thumbnails: false, width: 705, loader:{'animate': ['js/slideshow/loader-#.png', 12]} });
	
/********************************************************************
SIFR
********************************************************************/
	var sIFR1 = new sIFR("div.content h2", {swfPath: "js/", font:"museo"});
	var sIFR2 = new sIFR("div.content h3", {swfPath: "js/", font:"museo"});

//End Window.Event Onload
});


