	function refreshRollovers()
	{
		$('*[rollover]').each(function(){
			if(!$(this).hasClass('roActive'))
				$(this).attr('src', $(this).attr('origimg'));
		});
	}
	
function playmovie(movie)
{
//	alert('play ' + movie);
}

$(document).ready(function() {
	
	//before cufon, rebuild the download list
	$('DIV.filelinks').each(function() {
		//remove te title
		$(this).find('SPAN.filecount').remove();
		$(this).find('DIV').each(function() {
			//get the needed data and rewrite the content
			var link=$(this).find('A').attr('href');
			var size=$(this).find('SPAN')[0].innerHTML;
			size=size.replace(/^.*\(/, '').replace(')', '').replace(/[^a-zA-Z]*$/, '');
			//var doctype=$(this).find('A')[0].innerHTML;
			//console.info(doctype);
			// var doctype=link.toUpperCase().replace(/^.*\./, '');
			var mytext=$(this).find('SPAN')[1].innerHTML;
			var mydata=mytext.split(',',3);
			var mydate=mydata[0];
			var mytitle=mydata[1];
			var mydescription=mydata[2];
			
			var newtext="<div class='downloaditem' tolink='"+link+"'>";
			newtext += "<div class='downloaditemdate corporatesdemi'>"+mydate+"</div>";
			newtext += "<div class='downloaditemtitle corporatesdemi'>"+mytitle+"</div>";
			newtext += "<div class='downloaditemdescription corporatesdemi'>"+mydescription+" (PDF "+size+")</div>";
			newtext += "</div>";
			$(this).html(newtext);
//			console.dir(mydata);
			//alert(newtext);
		});
	});
	
	$('.downloaditem').live('mouseenter', function() {
		$(this).css('color', '#AC9F9F');
		Cufon.refresh();
	});
	
	$('.downloaditem').live('mouseleave', function() {
		$(this).css('color', '#585859');
		Cufon.refresh();
	});
	
	$('.downloaditem').live('click', function() {
		var mylink = $("base").attr("href") + $(this).attr('tolink');
		//alert(mylink);
		//var neww=window.open(mylink,"_blank");
		document.location=mylink;
	});
	
	$('DIV.filelinks').addClass('downloadlinks').removeClass('filelinks');
	
	//enable cufon for CorporateS font
	Cufon.replace('.corporates, H1', { fontFamily: 'corporates', hover: true });
	Cufon.replace('.corporatesdemi, #menu1, #menu2, .faqs H3, H2', { fontFamily: 'corporatesdemi', hover: true });
	
	var sub2 = $('#menu2 LI').length;
	if(sub2 > 0)
		$('#menu1').addClass('menu1underine');
	
	//handle the image rollovers
	
	$('*[rollover]').each(function() {
		$(this).attr('origimg', $(this).attr('src'));
	});
	
	$('*[rollover]').mouseenter(function() {
		$(this).attr('src', $(this).attr('rollover'));
	});

	$('*[rollover]').mouseleave(function() {
		if($(this).hasClass('roActive')) return;
		$(this).attr('src', $(this).attr('origimg'));
	});
	
	//intercept the links; if ending with .flv return false and run our function
	$('A').click(function() {
		var link=$(this).attr('href');
		var isflv = false;
		if(link.indexOf('.flv') == (link.length - 4) && link.length > 5) isflv=true;
		//console.info(isflv);
		if(isflv)
		{
			var havedivs=$('#moviedivoverlay').length;
			if(!havedivs)
			{
				$('#pagecontent').append('<div id="moviedivoverlay"></div><div id="moviediv"></div>');
				havedivs=$('#moviedivoverlay').length;
			}
			$('#moviedivoverlay').show();
			$('#moviediv').show();
			var html='<center><div id="moviedivclose"></div><object width="750" height="421" id="flvPlayer">';
			html+='<param name="movie" value="fileadmin/sys/videoplayer-.swf?movie='+$("base").attr("href") + link+'&btncolor=0x333333&accentcolor=0x31b8e9&txtcolor=0xdddddd&volume=30&autoload=on&autoplay=on&controls=false">';
			html+="<param name='controls' value='false'>";
			html+="<embed src='fileadmin/sys/videoplayer-.swf?movie="+$("base").attr("href") + link+"&btncolor=0x333333&accentcolor=0x31b8e9&txtcolor=0xdddddd&volume=30&autoload=on&autoplay=on&controls=false' width='750' height='421' allowFullScreen='false' type='application/x-shockwave-flash'>";
			html+='</object></center>';
			$('#moviediv').html(html);
			//console.info(havedivs);
		}
		return !isflv;
	});
	
	$('#moviedivclose').live('click', function() {
		//console.info('closing');
		$('#moviediv').remove();
		$('#moviedivoverlay').remove();
	});
	
	var balltimeout=10000;
	var balltimer;
	
	$('.hheaderball1').click(function() {
		clearTimeout(balltimer);
		$('.homeheader').animate({'margin-left': '-3027px'}, 600);
		var localtimer=setTimeout("$('.homeheader').css('margin-left', '0px')", 1000);
		balltimer=setTimeout("$('.hheaderball2').click()", balltimeout);
	});
	$('.hheaderball2').click(function() {
		clearTimeout(balltimer);
		$('.homeheader').animate({'margin-left': '-1009px'}, 600);
		balltimer=setTimeout("$('.hheaderball3').click()", balltimeout);
	});
	
	$('.hheaderball3').click(function() {
		clearTimeout(balltimer);
		$('.homeheader').animate({'margin-left': '-2018px'}, 600);
		balltimer=setTimeout("$('.hheaderball1').click()", balltimeout);
	});
	
	$('.hheaderball1, .hheaderball2, .hheaderball3').click(function() {
		$('.hheaderball1, .hheaderball2, .hheaderball3').removeClass('active');
		$(this).addClass('active');
	});
	
	$('.contactbox .contactboxup').mouseenter(function() {
		$(this).find('A').addClass('mover');
		Cufon.refresh();
	});
	
	$('.contactbox .contactboxup').mouseleave(function() {
		$(this).find('A').removeClass('mover');
		Cufon.refresh();
	});
	
	//have an arrow after each link
	$('#maincontent A').each(function() {
		var nrimages=$(this).find('IMG').length;
		if(nrimages == 0)
		{
			$(this).append(' <img class="linkarrow" src="fileadmin/sys/arrow_info_ia.png" origsrc="fileadmin/sys/arrow_info_ia.png" rollover="fileadmin/sys/arrow_info_a.png" border="0">');
		}
	});
	
	$('#maincontent A').live('mouseenter', function() {
		var rarr=$(this).find('IMG[class="linkarrow"]');
		if(rarr)
		{
			$(rarr).attr('src', $(rarr).attr('rollover'));
		}
	});
	
	$('#maincontent A').live('mouseleave', function() {
		var rarr=$(this).find('IMG[class="linkarrow"]');
		if(rarr)
		{
			$(rarr).attr('src', $(rarr).attr('origsrc'));
		}
	});
	
	balltimer=setTimeout("$('.hheaderball2').click()", balltimeout);
	
	$('.csc-default').removeAttr('boralineunder');
	$('DIV[boralineunder]').each(function() {
		var dheight=$(this).height();
		$(this).height(dheight-1);
	});
	
	$('#fde2').click(function(){
		window.open('http://www.land-der-ideen.de/365-orte/preistraeger/bora-dunstabzug-nach-unten');
	});

	$('#fde1').click(function(){
		window.open('http://www.deutscher-gruenderpreis.de/owx_1_3417_1_5_0_00000000000000.html?backlink=%2Funternehmenimfilm%3Ftabellenid%3D43%26amp%3Blim_start%3D8%26amp%3B');
	});
	
	$('.faqs H3').click(function() {
		$('.faqs P').hide();
		$(this).next().show();
		$('.faqs H3').removeClass('active');
		$(this).addClass('active');
		Cufon.refresh();
	});
	
	$('.acctitle').click(function() {
		$('.acctitle').removeClass('active');
		$('.acctext').hide();
		$(this).addClass('active');
		$(this).next().show();
		Cufon.refresh();
	});
	
	$('.accordionproduct').mouseenter(function() {
		var prodid=$(this).attr('prodid');
		$('IMG[produid="'+prodid+'"]').mouseenter();
		//need to find a way to center
		var left=$('IMG[produid="'+prodid+'"]').offset().left;
		var sleft=$('#prodroller').offset().left;
		if(left - sleft > 830)
		{
			jspApiObject.scrollBy(parseInt(left)-800,0, true);
			left=$('IMG[produid="'+prodid+'"]').offset().left;
		}
		if(left < sleft)
		{
			jspApiObject.scrollBy(parseInt(left)-parseInt(sleft),0, true);
			left=$('IMG[produid="'+prodid+'"]').offset().left;
		}
	});
	
	$('.accordionproduct').mouseleave(function() {
		var prodid=$(this).attr('prodid');
		$('IMG[produid="'+prodid+'"]').mouseleave();
	});
	
	$('.accordionproduct').click(function() {
		var prodid=$(this).attr('prodid');
		$('IMG[produid="'+prodid+'"]').click();
	});
	
	$('.accordion').each(function() {
	    var aaa=$('.acctitle').length;
	    //console.info(aaa);
	    $(this).find('.acctitle').eq(aaa-1).css('border-bottom', 0);
	});
	
	$('#mainlogo').click(function() {
		document.location='/';
	});
	
	$('#faktuelles').mouseenter(function() {
		$('#fstatus').html(langaktuelles);
		Cufon.refresh();
	});
	
	$('#faktuelles').mouseleave(function() {
		$('#fstatus').html('');
	});
	
	$('#faktuelles').click(function() {
		document.location='/index.php?id=39';
	});
	
	$('#ffilme').mouseenter(function() {
		$('#fstatus').html(langfilme);
		Cufon.refresh();
	});
	
	$('#ffilme').mouseleave(function() {
		$('#fstatus').html('');
	});
	
	$('#ffilme').click(function() {
		document.location='/index.php?id=54';
	});
	
	$('#fdownloads').mouseenter(function() {
		$('#fstatus').html(langdownloads);
		Cufon.refresh();
	});
	
	$('#fdownloads').mouseleave(function() {
		$('#fstatus').html('');
	});
	
	$('#fdownloads').click(function() {
		document.location='/index.php?id=55';
	});
	
	if(window.location.pathname == '/')
	{
		$('A[href="home/"]').parent().addClass('active');
	}
	
	$('.csc-default > DIV').each(function() {
		var topmargin = parseInt($(this).parent().css('margin-top'));
		if(topmargin > 0)
		{
			$(this).css('margin-top', topmargin+'px');
			$(this).parent().css('margin-top', '');
		}
	});
	
	repositionfooter=function() {
		$('#mainfooter').css('position', '').css('width', '').css('bottom', '');
		var wheight=$(window).height();
		var dheight=$(document).height();
		
		if(wheight >= dheight)
		{
			$('#mainfooter').css('position', 'absolute').css('width', '1009px').css('bottom', 0);
		}
		
		//console.info(wheight + ', ' + dheight);
	}
	setTimeout('repositionfooter()', 1000);
	
	$(window).resize(function() { repositionfooter(); });
	
	$('.pressemappebox').eq($('.pressemappebox').length-1).css('border-bottom', '0');

	$('SELECT').sSelect();
})

