goTop = function(){
	$.scrollTo(0, {queue:true, duration:300});
	return false;
}

$(document).ready(function(){

	window.defaultStatus="Design + Programming by FEINHEIT kreativ studio · www.feinheit.ch";
	
	$('#menu a, div#pfad a').not('a.nomood,a#vega-film,a#vega-distribution').click(function() {
		var nexthref = this.href;
		$("#moodboard").animate({height:312,opacity:'show' },'slow',function(){location.href = nexthref});
		return false;
	});
	$('a.nomood').click(function() {
		var nexthref = this.href;
		$("#headermediaplayer").hide();
		$("#moodboard").animate({height:'hide' ,opacity:'hide' },'slow',function(){location.href = nexthref});
		return false;
	});

	$('a#fest-prize,a#pressvision').click(function() {
		$("#"+this.id+"-text").animate({height:'toggle'},'fast');
		return false;
	 });	
	 
	$('a.news_detail').click(function() {
		$("#"+this.id+" + div").animate({height:'toggle'},'fast');
		return false;
	 });


	$('a.mood-trailer').click(function() {
		goTop();
		loadxml(this.rel);
		return false;
	 });	

	$('.filmliste .sp2 a').mouseover(function () {
		mc = $('#'+this.rel)
		mc.css("display","block");
//		mc.animate({ height: 'show', opacity: "show" }, 'fast');
	});

	$('.filmliste .sp2 a').mouseout(function () {
		mc = $('#'+this.rel)
		mc.css("display","none");
//		mc.animate({ height: 'hide', opacity: "hide" }, 'fast');
	});

	$('.filmliste .sp2 a.not-more').click(function () {
		return false;
	});
});
 
 
function resizemoodboard(h){
	if ($.browser.mozilla) {
	   $("#moodboard").height(h);
		if (h > 400){
		     $("#menu").hide();
		     $("#pfad").hide();
		     $("#lang").hide();
		} else {
		     $("#menu").show();
		     $("#pfad").show();
		     $("#lang").show();
		}
	}else{
		$("#moodboard").animate({height: h },'slow');
		if (h > 400){
		     $("#menu").animate({ height: 'hide', opacity: "hide" }, 'slow');
		     $("#pfad").animate({ opacity: "hide" }, 'slow');
		     $("#lang").animate({ opacity: "hide" }, 'slow');
		} else {
		     $("#menu").animate({ height: 'show', opacity: "show" }, 'slow');
		     $("#pfad").animate({ opacity: "show" }, 'slow');
		     $("#lang").animate({ opacity: "show" }, 'slow');
		}
	}
}

function openmoodboard(){
	resizemoodboard(502);
}

function closemoodboard(){	
	resizemoodboard(312);
}

function togglemoodboard(){
	if($("#moodboard").height()>312){
		closemoodboard();
	}else{
		openmoodboard();
	}
}	

function loadxml(xml){
	closemoodboard();
	swfPath("headermediaplayerid").loadnewxml(xml);
}
function gotoitem(id){
	closemoodboard();
	swfPath("headermediaplayerid").gotoitem(id);
}
function stopslideshow(){
	swfPath("headermediaplayerid").stopslideshow();
}
function playslideshow(){
	swfPath("headermediaplayerid").playslideshow();
}

function swfPath(swfid) {
	if(navigator.appName.indexOf("Microsoft") != -1){
		return window[swfid]
	}else{
		return document[swfid]
	}
}

