$(document).ready(function(){

	$(".pikto").mouseover(function(){
		this.src = this.src.replace("_pos","_neg");
		$(this).stop().animate({backgroundColor:'#333'},300);
	})
	.mouseout(function(){
		this.src = this.src.replace("_neg","_pos");
		$(this).stop().animate({backgroundColor:'#f0f0f0'},100);
	})
	
	//Label inside of inputfields
	function insidelabel(selector, name) {
		$(selector).val(name);
		$(selector).css({'color':'#999'});
		
		$(selector).focus(function () {
			//Input Value
			if ($(this).val() == name) { $(this).val(''); }
			$(this).css({'color':'#000'})
		});
				
		$(selector).blur(function () {
			if ($(this).val() == '') { $(this).val(name); }
			if ($(this).val() == name) {
				$(this).css({'color':'#999'});
			}
		});
	}
	
	insidelabel(".sf", "Wonach suchst du?");
		
	$('.post_content img').hide();
	
	$(window).load(function() {
	
		$('.post_content img').each(function() {
			if ($(this).width() > '565') {
				$(this).removeAttr('height');
				$(this).width('565');
			}
			$(this).fadeIn('fast');
		});
	});
	
	$('ul.syndicate_email li div.sociable').remove();
	
});

$(window).load(function () {

	/*add Fancybox link attributes*/	
	$('.gallery .attachment-thumbnail').each(function() {
		$(this).parent().addClass('imggroup');
		$(this).parent().attr('rel', 'imggroup');
	});
	
	$('.post_content a img').each(function() {
		$(this).parent().addClass('imggroup');
		//$(this).parent().attr('rel', 'imggroup');
	});
	
	$('.post_content a[href^="http://www.youtube.com"]').each(function() {
		$(this).addClass('youtube');
	});
	
	/* This is basic - uses default settings */
	//$("a.group").fancybox();

	/* Apply fancybox to multiple items */
	$("a.imggroup").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	300, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'overlayOpacity':	0.9,
		'overlayColor'	:	'#000',
		'titleShow'		:	false
	});
	
	/*Fancybox for youtubevids*/
	$(".youtube").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic',
			'speedIn'		: 300, 
			'speedOut'		: 200, 
			'overlayOpacity': 0.9,
			'overlayColor'	: '#000',
			'title'			: this.title,
			'width'			: 680,
			'height'		: 495,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});
		return false;
	});

});
