
function effekt(id, wert) {
	if(wert==0 || wert=='nein' || wert=='no') $('#'+id).slideUp('slow');
	else $('#'+id).slideDown('slow');
}
function defaultText(elem, val1, val2) {
	if(elem.value.replace(/^\s+/,'').replace(/\s+$/,'')==val1) elem.value = val2;	
}



$(document).ready(function() {
	
	//$(".headlineImg").pngFix();
						  
	$(".img").fancybox({
		'titlePosition'	: 'over',
		'titleFormat'	: function(title, currentArray, currentIndex, currentOpts) {
		    return (currentArray.length>1 || title!='')?'<span id="fancybox-title-over"><span class="page">Bild '+(currentIndex + 1)+' / '+currentArray.length+'</span>'+title+'&nbsp;</span>':'';
		},
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'onComplete'	: function() {
			$("#fancybox-wrap").hover(function() {
				$("#fancybox-title").show();
			}, function() {
				$("#fancybox-title").hide();
			});
		}
	});
	$('#fader').fader({  
 	  speed: 5000, 
 	  timeout: 10000
   	});
	$("#links_bus").mouseover(function(){
	  $("#links_bus").animate({
		left: "0px"
	  }, 1500 );
	});
	$("#links_bus").mouseout(function(){
	  $("#links_bus").animate({
		left: "-140px"
	  }, 1500 );
	});

	

	$(".vid").each(function() {
		this.href = this.href.replace(new RegExp("watch\\?v=", "i"), 'v/');
	});
	$(".vid").fancybox({
		'padding'	: 0,
		'autoScale'	: false,
		'title'		: this.title,
		'titleShow'	: false,
		'width'		: 680,
		'height'	: 495,
		'type'		: 'swf',
		'swf'		: {
			'wmode'				: 'transparent',
			'allowfullscreen'	: 'true'
		}
	});
	if (window.location.hash!='') {
		var hash = window.location.hash.replace(/#vid_/, "");
		if ($("#v_"+hash).length!=0) {
			$("#v_"+hash).trigger('click');
			return false;
		}
	}
	
	
});

// forceNumeric() plug-in implementation
jQuery.fn.forceNumeric = function () {
	return this.each(function () {
		$(this).keydown(function (e) {
		var key = e.which || e.keyCode;
			if (!e.shiftKey && !e.altKey && !e.ctrlKey &&
				key >= 48 && key <= 57 ||
				key >= 96 && key <= 105 ||
				key == 190 || key == 188 || key == 109 || key == 110 ||
				key == 8 || key == 9 || key == 13 ||
				key == 35 || key == 36 ||
				key == 37 || key == 39 ||
				key == 46 || key == 45)
				return true;
			
			return false;
		});
	});
}
