 (function($) {
    $.fn.wait = function(option, options) {
        milli = 1000; 
        if (option && (typeof option == 'function' || isNaN(option)) ) { 
            options = option;
        } else if (option) { 
            milli = option;
        }
        // set defaults
        var defaults = {
            msec: milli,
            onEnd: options
        },
        settings = $.extend({},defaults, options);

        if(typeof settings.onEnd == 'function') {
            this.each(function() {
                setTimeout(settings.onEnd, settings.msec);
            });
            return this;
        } else {
            return this.queue('fx',
            function() {
                var self = this;
                setTimeout(function() { $.dequeue(self); },settings.msec);
            });
        }
    }
})(jQuery);

$(function() {
	/*$('.uitem').hover(
		function() { $(this).addClass('uhover'); }, 
		function() { $(this).removeClass('uhover'); }
	);*/
	$('#pacontent .prodpic').bind('mouseenter', function() { 
			$('#zoomicon').fadeIn('slow', function() { });
		}).bind('mouseleave', function() {
			$('#zoomicon').fadeOut('slow', function() { });
	});/*

	$('a.chgeim').live('click', function (event) {
		event.preventDefault();
		$('#thumbgallery .highlight').removeClass('highlight');
		$(this).parent().addClass('highlight');
		var himage = $('#thumbgallery .highlight').html();
		$('.prodpic').html(himage);
		$('.prodpic img').removeAttr('width');
		$('.prodpic img').removeAttr('height');
		$('.prodpic img').attr('src', $('a.chgeim').attr('href'));
		$('.prodpic a').removeAttr('class');
		$('.prodpic a').attr('rel', 'prettyPhoto');
		$('#zoomicon a').attr('href', $('a.chgeim').attr('rel'));
		$('.prodpic a').attr('href', $('a.chgeim').attr('rel'));
		$("a[rel^='prettyPhoto']").prettyPhoto();
		return false;
	});*/
});

$.extend({URLEncode:function(str){
str = (str+'').toString();
return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+');
}});

function __tellafriend(lang) {
if(!lang) lang = 'de';
$.prettyPhoto.open('/fileadmin/scripts/php/tellafriend_'+lang+'.php?url='+$.URLEncode(window.location.href)+'&title='+$.URLEncode($(document).attr('title'))+'&iframe=true&width=400&height=365', '', 'Seite Weiterempfehlen');
}

$(document).ready(function(){
//loadThumb($('#thumbgallery .thumb:first-child'));
// $('.prodpic a').attr('rel', 'prettyPhoto');
$('#zoomicon a').attr('href', $('.prodpic a').attr('rel'));
$("a[rel^='prettyPhoto']").prettyPhoto();


$('.catswitchLink').click(function() {				
	if($('#catSwitch').height() < '49') {
		$('#catSwitch').animate({
			height: $('#catSwitch ul').height()			
		  }, "slow","swing" );
	} else {
		$('#catSwitch').animate({
			height: '48px'
		  }, "slow","swing" ); 					
		}			
	return false;	
});

/*fix firefox 3.6 bug on windows*/
if($.browser.firefox() && $.browser.version.string().substr(0,3) == "3.6" && $.browser.win())
{$('#rainWrapper').css('left','-78px');}

/*
	var himage = $('#thumbgallery .highlight').html();
	$('.prodpic').html(himage);
	$('.prodpic img').removeAttr('width');
	$('.prodpic img').removeAttr('height');
	$('.prodpic img').attr('src', $('.prodpic a').attr('href'));
	$('.prodpic a').removeAttr('class');
	$('.prodpic a').attr('rel', 'prettyPhoto');
	$('#zoomicon a').attr('href', $('.prodpic a').attr('rel'));
	$("a[rel^='prettyPhoto']").prettyPhoto();
	*/
}); // end document ready function

