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

	/* Tabs & Slogans */

	var tab_links 	= $$('.tab_link');
	var tab_divs 	= $$('.tab_div');
	var slogan_divs = $$('.slogan_div');
 
	tab_links.each ( function (link, idx) {
		link.addEvent ('click', function(e) {
			styleTabLink(idx);  	 // see below for function
			showTabDiv(idx); 	     // see below for function
			showSloganDiv(idx); 	 // see below for function
			e = new Event(e).stop(); // this is used to prevent the default link behaviour (the jump)
		});	
	});
 
	function showTabDiv (idx_to_show) {
		tab_divs.each ( function(tab_div, idx) {
			tab_div.setStyle('display', (idx_to_show == idx) ? 'block' : 'none');
		});
	}

	function showSloganDiv (idx_to_show) {
		slogan_divs.each ( function(slogan_div, idx) {
			slogan_div.setStyle('display', (idx_to_show == idx) ? 'block' : 'none');
		});
	}

	function styleTabLink (idx_to_show) {
		tab_links.each ( function(tab_link, idx) {
			tab_link.setStyle('color', (idx_to_show == idx) ? '#2569CE' : '#888');
		});
	}

	styleTabLink (0); // color first link
	showTabDiv (0); // display the first page div
	showSloganDiv (0); // display the first slogan div


	/* Senderliste */

	if(channel_list == 1)
	{
		$('sender-liste').setStyle('display','block');
	
		$('toggle-sender-liste').addEvent('click', function(e){
			e = new Event(e);
			channels.toggle();
			e.stop();
		});
	
		$('toggle-sender-liste2').addEvent('click', function(e){
			e = new Event(e);
			channels.toggle();
			e.stop();
		});
	
		var channels = new Fx.Slide('sender-liste');
		channels.hide()
	}


	/* Validator */

	if(validator == 1)
	{
		var exValidatorB = new fValidator("exB");
	}


	/* SWF Ajax */

	if(swf == 1)
	{
		$('swf_marketing').addEvent('click', function(e) {
			e = new Event(e).stop();
		 
			var url = "swf/marketing.html";
		 
			new Ajax(url, {
				method: 'get',
				update: $('swf')
			}).request();
		});
	
		$('swf_ecommerce').addEvent('click', function(e) {
			e = new Event(e).stop();
		 
			var url = "swf/ecommerce.html";
		 
			new Ajax(url, {
				method: 'get',
				update: $('swf')
			}).request();
		});
	
		$('swf_elearning').addEvent('click', function(e) {
			e = new Event(e).stop();
		 
			var url = "swf/elearning.html";
		 
			new Ajax(url, {
				method: 'get',
				update: $('swf')
			}).request();
		});
	
		$('swf_payperview').addEvent('click', function(e) {
			e = new Event(e).stop();
		 
			var url = "swf/payperview.html";
		 
			new Ajax(url, {
				method: 'get',
				update: $('swf')
			}).request();
		});
	
		$('swf_firmentv').addEvent('click', function(e) {
			e = new Event(e).stop();
		 
			var url = "swf/firmentv.html";
		 
			new Ajax(url, {
				method: 'get',
				update: $('swf')
			}).request();
		});
	
	
		/* Autostart */
	
		var url = "swf/marketing.html";
	 
		new Ajax(url, {
			method: 'get',
			update: $('swf')
		}).request();
	}

});