/*
	
	Website: 
	BOB Design http://www.bob-design.de/
	Imagion AG http://www.imagion.de/
	Javascript Datei
	20.04.2007 Daan Meskers
	$last_change: 20.04.2007 Daan Meskers
*/

window.addEvent('domready', function() {
	T2.init()
});
window.addEvent('resize', function() {
	T2.sizeElements()
});

var T2 = {
	setUpMenu: function() {
		$$('a.menuLink').each(function(el){
			el.onclick=openPage
		});
		$$('UL.menu LI').each(function(el){
			var tabPull = new Fx.Style(el, 'left',{
				duration:200,
				wait:false,
				transition:Fx.Transitions.Back.easeOut
			});
			el.addEvent('mouseover', function(){
				if ( !window.ie ) tabPull.start(-4);
				else this.setStyles({'left': -5 });
				var img = this.getElement( "IMG" )
				img.src = img.src.replace(/\.png/i, "_on.png")
			});
			el.addEvent('mouseout', function(){
				if ( !window.ie )  tabPull.start( 0 );
				else this.setStyles({'left': 0 });
				var img = this.getElement( "IMG" )
				img.src = img.src.replace(/_on\.png/i, ".png")
			});		
		});
		
	},
	sizeElements: function() {
		var newH = $('Content').getSize()["size"]["y"] - 360
		$('home').setStyles({'height': newH });
	},
	init: function(){
		this.setUpMenu();
		this.sizeElements();
		
	}
}
var myStop, so
function openPage(event) {
	var event = new Event(event);
	event.preventDefault();	// stop default behaviour
	this.blur();	// remove click border
	var myhref = this.href.substring( this.href.lastIndexOf("/")+4) // get href
		myhref = myhref.substring( 0, myhref.length-5)	
	var collapsible = new Fx.Styles( $('home'), { 
			transition: Fx.Transitions.linear,
			dration: 500,
			wait: false,
			onComplete: function(request){ 
				if ( $('home').getSize()["size"]["y"] < 21 ) {
					$('Main').className = ""
					$('home').innerHTML =  $( myhref ).innerHTML
					collapsible.start({'height': [0, $('Content').getSize()["size"]["y"] ]});
				} else  {
					$('home').setStyles({'overflow': 'auto'});
					T2.sizeElements();
					Lightbox.init()
					if( myhref == "trailer" ) {
						// insert Player
						new Element('div', {'id': 'player'}).injectInside( $('home') );
						if ( !window.ie || window.ie ) {
							so = new SWFObject('swf/mediaplayer.swf','mpl','700','290','8');
							so.addParam('allowscriptaccess','always');
							so.addParam('allowfullscreen','true');
							so.addParam("wmode","opaque");
							so.addParam("bgcolor","#222222");
							so.addVariable('height','290');
							so.addVariable('width','700');
							so.addVariable('linkfromdisplay','true');
							so.addVariable('callback','urchin');
							so.addVariable('displaywidth','480');
							so.addVariable('lightcolor','0x0099CC');
							so.addVariable('file','flv/trailers.rss');
							so.addVariable('image','../img/Logos/imagion.png');
							if (!window.ie) {
								so.write('player');
							} else {
								$('player').innerHTML = so.getSWFHTML();
							}
						}
						$('Main').className = "Trailer"
					} 					
				}
			} 
		});
	$('home').setStyles({'overflow': 'hidden'});
	collapsible.start({'height': [$('Content').getSize()["size"]["y"] , 0]});
	return false;
}


var CSS_Styles = "DIV#Content { overflow: hidden; }"
document.write('<style type="text/css" media="screen,projektion">'+CSS_Styles+'</style>');