
		

(function($){
 $.fn.extend({
 
 	customStyle : function(options) {
	  if(!$.browser.msie || ($.browser.msie&&$.browser.version>6)){
	  return this.each(function() {
			var currentSelected = $(this).find(':selected');
			$(this).after('<span class="customStyleSelectBox"><span class="customStyleSelectBoxInner">'+currentSelected.text()+'</span></span>').css({position:'absolute', opacity:0,fontSize:$(this).next().css('font-size')});
			var selectBoxSpan = $(this).next();
			var selectBoxWidth = parseInt($(this).width()) - parseInt(selectBoxSpan.css('padding-left')) -parseInt(selectBoxSpan.css('padding-right'));			
			var selectBoxSpanInner = selectBoxSpan.find(':first-child');
			selectBoxSpan.css({display:'inline-block'});
			selectBoxSpanInner.css({width:selectBoxWidth, display:'inline-block'});
			var selectBoxHeight = parseInt(selectBoxSpan.height()) + parseInt(selectBoxSpan.css('padding-top')) + parseInt(selectBoxSpan.css('padding-bottom'));
			$(this).height(selectBoxHeight).change(function(){
				// selectBoxSpanInner.text($(this).val()).parent().addClass('changed');   This was not ideal
			selectBoxSpanInner.text($(this).find(':selected').text()).parent().addClass('changed');
				// Thanks to Juarez Filho & PaddyMurphy
			});
			
	  });
	  }
	}
 });
})(jQuery);

Cufon.replace('.replace', { fontFamily:'dznmedium',fontWeight:'bold'} );
Cufon.replace('.medium', {fontFamily:'dznlight' } );
Cufon.replace('#mainnav a', { fontFamily:'dznmedium', hover:true} );
Cufon.replace('.post a', { hover:true } );
Cufon.replace('.page-navigation > li > a', { fontWeight:'bold', hover:true} );
Cufon.replace('.content h2', { fontWeight:'bold'} );
Cufon.replace('.ghalf', { fontFamily:'dznlight' } );
Cufon.replace('.impressum h4')('.impressum h3');
// Cufon.replace('.page-navigation li ul li a',{ fontWeight:'normal'} );
jQuery(document).ready( function($) {
		var ad = $('#snowad');
	$('li.snowball').hover(function() {
		
		var pos = $(this).position();
		offsetX = $(ad).height();
		offsetY = $(ad).width();
		var cssObj = {
			'left' : pos.left,
			'top'  : pos.top + 50	
		}
		
		$(ad).css(cssObj);
		$(ad).fadeIn(800);
		
		}, function() {
			console.log('l');
			$(ad).fadeOut(800);
			})
	
	
	if ($('body').hasClass('archive') ) {
	
	$('.page-navigation li ul').hide();
	$('.page-navigation li a').mouseover( function() {
		
	
	$(this).next().slideDown(300);
	$(this).next().addClass('opennav');
		})}
		
	$('.chosen').chosen().change( function(e, i) {
			window.location = this.value;
		});
	
	
	$('#menu-referenzen').change( function() {
		window.location = $(this).val();
		
		
		})
	$(document).ready(function(){
		$('#menu-referenzen').customStyle();
		});
	
	});
	
	jQuery(window).resize(function($) {
		
		redesign();
		});

	function redesign() {
		width = jQuery(window).width()
		

		Cufon.refresh();
			

		
	}

(function($){
    $.fn.preloadImages = function(options){

        var defaults = {
            showSpeed: 500,
            easing: 'easeOutQuad'
        };

        var options = $.extend(defaults, options);

        return this.each(function(){
            var container = $(this);
			
			$(container).find('img.lupe').css({'visibility' : 'hidden'});
            var image = container.find('img:not(img.lupe)');

            $(image).css({ "visibility": "hidden", "opacity": "0" });
            $(image).bind('load error', function(){
                $(this).css({ "visibility": "visible" }).animate({ opacity:"1" }, {duration:options.showSpeed, easing:options.easing}).parent(container).removeClass('preload');
			

            }).each(function(){
                if(this.complete || ($.browser.msie && parseInt($.browser.version) == 6)) { 
				$(this).trigger('load'); }
				
            });
			
        });
		
    }
})(jQuery);

