// JavaScript Document
	
	jQuery(document).ready(function ()
	{	
		
		randoms = new Array('4000', '5000', '6000', '7000', '8000');
    	
		jQuery('.work-slideshow').cycle(
		{ 
    		fx: 'scrollDown',    
    		delay: 2000,
			easing: 'easeInOutExpo',
			speed: 500,
			timeoutFn: calculateTimeout 
		});
		
		function calculateTimeout(currElement, nextElement, opts, isForward)
		{
    		randomize = randoms[Math.round(Math.random() * 4)]; 
			return randomize;
		}

		jQuery('div.work-introduction').find('div.work-slideshow').stop().css(
		{
			'opacity' : 0.50
		});
		
		jQuery('div.slide-up').css(
		{
			'opacity' : 0.25
		});
		
		jQuery('a#scroll-top').click(
		function()
		{	
			$.scrollTo.defaults.easing = 'easeInOutExpo';
			$.scrollTo.defaults.duration = 500;
			$(window).scrollTo(0,
			{
				over:
				{
					top:0.5,
					left:0.5
				}
			});
			
			return false;
		});
		
		jQuery('div.work-introduction').hover(
		function()
		{
			
			jQuery(this).find('div.work-description').stop().animate(
			{
				'backgroundColor' : '#F5F5EA'
			},
			{
				speed: 100
			});

			jQuery(this).find('div.work-slideshow').stop().animate(
			{
				'opacity' : 1
			},
			{
				speed: 100
			});

			jQuery(this).find('h1').stop().animate(
			{
				'color' : '#993'
			},
			{
				speed: 100
			});
			}, function()
		{
			jQuery(this).find('div.work-description').stop().animate(
			{
				'backgroundColor' : '#EEEEE1'
			},
			{
				speed: 100
			});

			jQuery(this).find('div.work-slideshow').stop().animate(
			{
				'opacity' : 0.65
			},
			{
				speed: 250
			});

			jQuery(this).find('h1').stop().animate(
			{
				'color' : '#663'
			},
			{
				speed: 500
			});
		});
		
		// ----------------- HOME
		
		jQuery('div#home').hover(
		function()
		{
			jQuery('div#home h3').text('Wir führen Sie.');
		}, function()
		{
			jQuery('div#home h3').text('Wir machen Marken.');
		});
		
		// ----------------- META NAVIGATION
		
		jQuery('#meta-configuration').hide();
		jQuery('#meta-trigger').toggle(
		function()
		{
				jQuery('#meta-configuration').slideDown("slow");

			}, function()
			{
				jQuery('#meta-configuration').slideUp("slow");

			
			return false;
		});
		
		/*
		jQuery('#meta-navigation .trigger').click(function()
		{
			jQuery('#meta-configuration').stop().animate(
			{
				height : show
			},
			{
				speed: 250
			});
			
			return false;
		});
		*/
		// ----------------- FONT SETTINGS
		
		jQuery('#font-settings-minus').click(function()
		{
			jQuery('body').css('font-size', '90%');
			return false;
		});
		
		jQuery('#font-settings-normal').click(function()
		{
			jQuery('body').css('font-size', '100%');
			return false;
		});
		
		jQuery('#font-settings-plus').click(function()
		{
			jQuery('body').css('font-size', '115%');
			return false;
		});
		
		// ----------------- COPYLINE CREATION
		
		/*
		
		var element = $.create('div',{'class':'copy-line'});

		$('#wrapper').append($(element));

		var i = $('#page').css('height');
		i = i.replace('px', '');
		i = Math.round(i);
		
		if (i > 1000)
			i = 1000;
		
		while(i--)
		{
			var pixel = $.create('div',{'class':'pixel'});
			$(pixel).css('left', i + 'px');
			$(pixel).css('top', (5 + i) + 'px');
			$(element).append($(pixel));
		}
		
		*/
		$.beautyOfCode.init({
			theme: 'Default',
			brushes: ['Xml', 'JScript', 'CSharp', 'Plain', 'Php', 'AS3'],
			defaults: { gutter: true, 'wrap-lines' : true, 'tab-size' : 2 },
			ready: function() {
				$.beautyOfCode.beautifyAll();
			}
		});

	});
	
