function setHeader(typeName) {
	if($("img."+typeName).size()>0) {
		$("img."+typeName).show();
	} else {
		$("img.meta").show();
	}
}

function setFlash(typeName) {
	if($("p."+typeName).size()>0) {
		$("p."+typeName).show();
		getId = $("p."+typeName).attr('id');
	}
	switch (typeName) {
		case "EN_EfkonWorldwide": typeFlash = "worldof.swf"; break;
		case "EN_JobsCareer": typeFlash = "careers.swf"; break;
		case "EN_NewsMedia": typeFlash = "newsflow.swf"; break;
		case "EN_newsEintrag": typeFlash = "newsflow.swf"; break;
		case "EN_ProductsSolutions": typeFlash = "innovativesolutions.swf"; break;
		case "EN_Company": typeFlash = "freetoflow.swf"; break;
		case "EN_References": typeFlash = "freetoflow.swf"; break;
		case "EN_Technologies": typeFlash = "technologie.swf"; break;
	}
	typeFlashDir = "/_images/header/"+typeFlash;
	var flashvars = {};
	var params = {};
	var attributes = {wmode:'transparent'};
	swfobject.embedSWF(typeFlashDir, getId, "320", "208", "8.0.0", flashvars, params, attributes);
}


function bodyCSS() {
	if($(window).width()<1000) {
		$('body').css('overflow','auto').css('overflow-x','auto').css('-ms-overflow-x','auto');
	} else {
		$('body').css('overflow','auto').css('overflow-x','hidden').css('-ms-overflow-x','hidden');
	}
}

$(document).ready( function() {
	// PNG FIX für IE6
	$(document).pngFix();
	
	// window size and resize
	bodyCSS();
	$(window).resize(function() {bodyCSS();});
	
	// IMG ohne alt Text füllen
	$("img[alt='']").attr('alt','Efkon');
	
	// Fancybox
	$("a[href$='jpg'][class!='imgdownload'], a[href$='jpeg'][class!='imgdownload'], a[href$='png'][class!='imgdownload'], a[href$='gif'][class!='imgdownload']").fancybox();
	
	// seitenhoehenkorrektur
	var leftheight = $("#subnav").height() + $("#subboxleft").height();
	if(leftheight>800) {
		$("#textSub").css('padding-bottom','110px');
	}

	
	// focus/unfocus funktionen bei such formular
	$("#searchTerm").each(function() {
		var original = $(this).val();
		$(this).focus(function() {
			if(original==$(this).val()) {
				$(this).val('');
			}
		});
		$(this).blur(function() {
			if($(this).val()=='') {
				$(this).val(original);
			}
		});
	});
	$('img.zoomImage').each( function() {
		wSmall = $(this).width();
		wBig = wSmall*1.2;
		hSmall = $(this).height();
		hBig = hSmall*1.2;
		$(this).attr('wSmall',wSmall).attr('wBig',wBig).attr('hSmall',hSmall).attr('hBig',hBig);
	});
	
	$('img.zoomImage').bind('mouseover', function() {
		if($(this).attr('rel')=='0') {
			iHeight = $(this).attr('hBig');
			iWidth = $(this).attr('wBig');
			$(this).animate({height:iHeight, width:iWidth}, 350, function() {$(this).attr('rel','1');}); 
		} 
	}).bind('mouseleave', function() {
		if($(this).attr('rel')=='1') {
			iHeight = $(this).attr('hSmall');
			iWidth = $(this).attr('wSmall');
			$(this).animate({height:iHeight, width:iWidth}, 400, function() {$(this).attr('rel','0');}); 
		}
	});
	
	// mouseover pulldown headernavigation
	$('.mainNavFolder').bind('mouseenter', function () {
		if($(this).attr('rel')==0) {
			$(this).find("a > div:eq(0)").removeClass('naviLeft').addClass('naviLeftOn');
			$(this).find("a > div:eq(1)").removeClass('naviBody').addClass('naviBodyOn');
			$(this).find("a > div:eq(2)").removeClass('naviRight').addClass('naviRightOn');
		}
		width = $(this).width();
		$(this).find('div.mainNavPulldown').width(180).fadeIn(750);
	}).bind('mouseleave', function () {
		if($(this).attr('rel')==0) {
			$(this).find("a > div:eq(0)").removeClass('naviLeftOn').addClass('naviLeft');
			$(this).find("a > div:eq(1)").removeClass('naviBodyOn').addClass('naviBody');
			$(this).find("a > div:eq(2)").removeClass('naviRightOn').addClass('naviRight');
		}
		$(this).find('div.mainNavPulldown').fadeOut(50);
	});
	
	// mouseover index Box
	$(".iBoxOben").bind('mouseenter', function () {
		if($(this).attr('rel')=='0') {
			$(this).attr('rel','1');
			$(this).find('.iBoxObenSub').animate({height:"105px", marginTop:"-105px"}, 300);
		}
	}).bind('mouseleave', function() {
		$(this).find('.iBoxObenSub').animate({height:"32px", marginTop:"-32px"}, 300, function () {
			$(this).parent('.iBoxOben').attr('rel','0');
		});
	});

	// alt text fuer textbilder
	$("a[rel='textbilder']").each( function() {
    	$(this).attr('title',$(this).next().next().text());
	});
	
	// alt text fuer textbilder
	$("a[rel='textbilder_r']").each( function() {
    	$(this).attr('title',$(this).next().text());
	});

});
