﻿/**
 * @project YOULOOKFOR.us Functions
 * @site http://www.weinshop-peth.de
 * @description JavaScript and jQuery functions
 * @license Code licensed under the MIT License:
 * @see http://creativecommons.org/licenses/MIT/
 * @see http://opensource.org/licenses/mit-license.php
 * @see http://de.wikipedia.org/wiki/MIT-Lizenz
 * @author Eduard Seifert <seifert DOT eduard AT googlemail DOT com>
 * @lastmodified 20110319
 */

/*
 * jQuery UI Effects 1.8rc3
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/
 */
jQuery.effects||(function(g){g.effects={};g.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(l,k){g.fx.step[k]=function(m){if(!m.colorInit){m.start=j(m.elem,k);m.end=i(m.end);m.colorInit=true}m.elem.style[k]="rgb("+Math.max(Math.min(parseInt((m.pos*(m.end[0]-m.start[0]))+m.start[0],10),255),0)+","+Math.max(Math.min(parseInt((m.pos*(m.end[1]-m.start[1]))+m.start[1],10),255),0)+","+Math.max(Math.min(parseInt((m.pos*(m.end[2]-m.start[2]))+m.start[2],10),255),0)+")"}});function i(l){var k;if(l&&l.constructor==Array&&l.length==3){return l}if(k=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(l)){return[parseInt(k[1],10),parseInt(k[2],10),parseInt(k[3],10)]}if(k=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(l)){return[parseFloat(k[1])*2.55,parseFloat(k[2])*2.55,parseFloat(k[3])*2.55]}if(k=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(l)){return[parseInt(k[1],16),parseInt(k[2],16),parseInt(k[3],16)]}if(k=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(l)){return[parseInt(k[1]+k[1],16),parseInt(k[2]+k[2],16),parseInt(k[3]+k[3],16)]}if(k=/rgba\(0, 0, 0, 0\)/.exec(l)){return a.transparent}return a[g.trim(l).toLowerCase()]}function j(m,k){var l;do{l=g.curCSS(m,k);if(l!=""&&l!="transparent"||g.nodeName(m,"body")){break}k="backgroundColor"}while(m=m.parentNode);return i(l)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};var e=["add","remove","toggle"],c={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};function f(){var n=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,o={},l,m;if(n&&n.length&&n[0]&&n[n[0]]){var k=n.length;while(k--){l=n[k];if(typeof n[l]=="string"){m=l.replace(/\-(\w)/g,function(p,q){return q.toUpperCase()});o[m]=n[l]}}}else{for(l in n){if(typeof n[l]==="string"){o[l]=n[l]}}}return o}function b(l){var k,m;for(k in l){m=l[k];if(m==null||g.isFunction(m)||k in c||(/scrollbar/).test(k)||(!(/color/i).test(k)&&isNaN(parseFloat(m)))){delete l[k]}}return l}function h(k,m){var n={_:0},l;for(l in m){if(k[l]!=m[l]){n[l]=m[l]}}return n}g.effects.animateClass=function(k,l,n,m){if(g.isFunction(n)){m=n;n=null}return this.each(function(){var r=g(this),o=r.attr("style")||" ",s=b(f.call(this)),q,p=r.attr("className");g.each(e,function(t,u){if(k[u]){r[u+"Class"](k[u])}});q=b(f.call(this));r.attr("className",p);r.animate(h(s,q),l,n,function(){g.each(e,function(t,u){if(k[u]){r[u+"Class"](k[u])}});if(typeof r.attr("style")=="object"){r.attr("style").cssText="";r.attr("style").cssText=o}else{r.attr("style",o)}if(m){m.apply(this,arguments)}})})};g.fn.extend({_addClass:g.fn.addClass,addClass:function(l,k,n,m){return k?g.effects.animateClass.apply(this,[{add:l},k,n,m]):this._addClass(l)},_removeClass:g.fn.removeClass,removeClass:function(l,k,n,m){return k?g.effects.animateClass.apply(this,[{remove:l},k,n,m]):this._removeClass(l)},_toggleClass:g.fn.toggleClass,toggleClass:function(m,l,k,o,n){if(typeof l=="boolean"||l===undefined){if(!k){return this._toggleClass(m,l)}else{return g.effects.animateClass.apply(this,[(l?{add:m}:{remove:m}),k,o,n])}}else{return g.effects.animateClass.apply(this,[{toggle:m},l,k,o])}},switchClass:function(k,m,l,o,n){return g.effects.animateClass.apply(this,[{add:m,remove:k},l,o,n])}});g.extend(g.effects,{version:"1.8rc3",save:function(l,m){for(var k=0;k<m.length;k++){if(m[k]!==null){l.data("ec.storage."+m[k],l[0].style[m[k]])}}},restore:function(l,m){for(var k=0;k<m.length;k++){if(m[k]!==null){l.css(m[k],l.data("ec.storage."+m[k]))}}},setMode:function(k,l){if(l=="toggle"){l=k.is(":hidden")?"show":"hide"}return l},getBaseline:function(l,m){var n,k;switch(l[0]){case"top":n=0;break;case"middle":n=0.5;break;case"bottom":n=1;break;default:n=l[0]/m.height}switch(l[1]){case"left":k=0;break;case"center":k=0.5;break;case"right":k=1;break;default:k=l[1]/m.width}return{x:k,y:n}},createWrapper:function(k){if(k.parent().is(".ui-effects-wrapper")){return k.parent()}var l={width:k.outerWidth(true),height:k.outerHeight(true),"float":k.css("float")},m=g("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0});k.wrap(m);m=k.parent();if(k.css("position")=="static"){m.css({position:"relative"});k.css({position:"relative"})}else{g.extend(l,{position:k.css("position"),zIndex:k.css("z-index")});g.each(["top","left","bottom","right"],function(n,o){l[o]=k.css(o);if(isNaN(parseInt(l[o],10))){l[o]="auto"}});k.css({position:"relative",top:0,left:0})}return m.css(l).show()},removeWrapper:function(k){if(k.parent().is(".ui-effects-wrapper")){return k.parent().replaceWith(k)}return k},setTransition:function(l,n,k,m){m=m||{};g.each(n,function(p,o){unit=l.cssUnit(o);if(unit[0]>0){m[o]=unit[0]*k+unit[1]}});return m}});function d(l,k,m,n){if(typeof l=="object"){n=k;m=null;k=l;l=k.effect}if(g.isFunction(k)){n=k;m=null;k={}}if(typeof k=="number"||g.fx.speeds[k]){n=m;m=k;k={}}k=k||{};m=m||k.duration;m=g.fx.off?0:typeof m=="number"?m:g.fx.speeds[m]||g.fx.speeds._default;n=n||k.complete;return[l,k,m,n]}g.fn.extend({effect:function(n,m,p,q){var l=d.apply(this,arguments),o={options:l[1],duration:l[2],callback:l[3]},k=g.effects[n];return k&&!g.fx.off?k.call(this,o):this},_show:g.fn.show,show:function(l){if(!l||typeof l=="number"||g.fx.speeds[l]){return this._show.apply(this,arguments)}else{var k=d.apply(this,arguments);k[1].mode="show";return this.effect.apply(this,k)}},_hide:g.fn.hide,hide:function(l){if(!l||typeof l=="number"||g.fx.speeds[l]){return this._hide.apply(this,arguments)}else{var k=d.apply(this,arguments);k[1].mode="hide";return this.effect.apply(this,k)}},__toggle:g.fn.toggle,toggle:function(l){if(!l||typeof l=="number"||g.fx.speeds[l]||typeof l=="boolean"||g.isFunction(l)){return this.__toggle.apply(this,arguments)}else{var k=d.apply(this,arguments);k[1].mode="toggle";return this.effect.apply(this,k)}},cssUnit:function(k){var l=this.css(k),m=[];g.each(["em","px","%","pt"],function(n,o){if(l.indexOf(o)>0){m=[parseFloat(l),o]}});return m}});g.easing.jswing=g.easing.swing;g.extend(g.easing,{def:"easeOutQuad",swing:function(l,m,k,o,n){return g.easing[g.easing.def](l,m,k,o,n)},easeInQuad:function(l,m,k,o,n){return o*(m/=n)*m+k},easeOutQuad:function(l,m,k,o,n){return -o*(m/=n)*(m-2)+k},easeInOutQuad:function(l,m,k,o,n){if((m/=n/2)<1){return o/2*m*m+k}return -o/2*((--m)*(m-2)-1)+k},easeInCubic:function(l,m,k,o,n){return o*(m/=n)*m*m+k},easeOutCubic:function(l,m,k,o,n){return o*((m=m/n-1)*m*m+1)+k},easeInOutCubic:function(l,m,k,o,n){if((m/=n/2)<1){return o/2*m*m*m+k}return o/2*((m-=2)*m*m+2)+k},easeInQuart:function(l,m,k,o,n){return o*(m/=n)*m*m*m+k},easeOutQuart:function(l,m,k,o,n){return -o*((m=m/n-1)*m*m*m-1)+k},easeInOutQuart:function(l,m,k,o,n){if((m/=n/2)<1){return o/2*m*m*m*m+k}return -o/2*((m-=2)*m*m*m-2)+k},easeInQuint:function(l,m,k,o,n){return o*(m/=n)*m*m*m*m+k},easeOutQuint:function(l,m,k,o,n){return o*((m=m/n-1)*m*m*m*m+1)+k},easeInOutQuint:function(l,m,k,o,n){if((m/=n/2)<1){return o/2*m*m*m*m*m+k}return o/2*((m-=2)*m*m*m*m+2)+k},easeInSine:function(l,m,k,o,n){return -o*Math.cos(m/n*(Math.PI/2))+o+k},easeOutSine:function(l,m,k,o,n){return o*Math.sin(m/n*(Math.PI/2))+k},easeInOutSine:function(l,m,k,o,n){return -o/2*(Math.cos(Math.PI*m/n)-1)+k},easeInExpo:function(l,m,k,o,n){return(m==0)?k:o*Math.pow(2,10*(m/n-1))+k},easeOutExpo:function(l,m,k,o,n){return(m==n)?k+o:o*(-Math.pow(2,-10*m/n)+1)+k},easeInOutExpo:function(l,m,k,o,n){if(m==0){return k}if(m==n){return k+o}if((m/=n/2)<1){return o/2*Math.pow(2,10*(m-1))+k}return o/2*(-Math.pow(2,-10*--m)+2)+k},easeInCirc:function(l,m,k,o,n){return -o*(Math.sqrt(1-(m/=n)*m)-1)+k},easeOutCirc:function(l,m,k,o,n){return o*Math.sqrt(1-(m=m/n-1)*m)+k},easeInOutCirc:function(l,m,k,o,n){if((m/=n/2)<1){return -o/2*(Math.sqrt(1-m*m)-1)+k}return o/2*(Math.sqrt(1-(m-=2)*m)+1)+k},easeInElastic:function(l,n,k,u,r){var o=1.70158;var q=0;var m=u;if(n==0){return k}if((n/=r)==1){return k+u}if(!q){q=r*0.3}if(m<Math.abs(u)){m=u;var o=q/4}else{var o=q/(2*Math.PI)*Math.asin(u/m)}return -(m*Math.pow(2,10*(n-=1))*Math.sin((n*r-o)*(2*Math.PI)/q))+k},easeOutElastic:function(l,n,k,u,r){var o=1.70158;var q=0;var m=u;if(n==0){return k}if((n/=r)==1){return k+u}if(!q){q=r*0.3}if(m<Math.abs(u)){m=u;var o=q/4}else{var o=q/(2*Math.PI)*Math.asin(u/m)}return m*Math.pow(2,-10*n)*Math.sin((n*r-o)*(2*Math.PI)/q)+u+k},easeInOutElastic:function(l,n,k,u,r){var o=1.70158;var q=0;var m=u;if(n==0){return k}if((n/=r/2)==2){return k+u}if(!q){q=r*(0.3*1.5)}if(m<Math.abs(u)){m=u;var o=q/4}else{var o=q/(2*Math.PI)*Math.asin(u/m)}if(n<1){return -0.5*(m*Math.pow(2,10*(n-=1))*Math.sin((n*r-o)*(2*Math.PI)/q))+k}return m*Math.pow(2,-10*(n-=1))*Math.sin((n*r-o)*(2*Math.PI)/q)*0.5+u+k},easeInBack:function(l,m,k,p,o,n){if(n==undefined){n=1.70158}return p*(m/=o)*m*((n+1)*m-n)+k},easeOutBack:function(l,m,k,p,o,n){if(n==undefined){n=1.70158}return p*((m=m/o-1)*m*((n+1)*m+n)+1)+k},easeInOutBack:function(l,m,k,p,o,n){if(n==undefined){n=1.70158}if((m/=o/2)<1){return p/2*(m*m*(((n*=(1.525))+1)*m-n))+k}return p/2*((m-=2)*m*(((n*=(1.525))+1)*m+n)+2)+k},easeInBounce:function(l,m,k,o,n){return o-g.easing.easeOutBounce(l,n-m,0,o,n)+k},easeOutBounce:function(l,m,k,o,n){if((m/=n)<(1/2.75)){return o*(7.5625*m*m)+k}else{if(m<(2/2.75)){return o*(7.5625*(m-=(1.5/2.75))*m+0.75)+k}else{if(m<(2.5/2.75)){return o*(7.5625*(m-=(2.25/2.75))*m+0.9375)+k}else{return o*(7.5625*(m-=(2.625/2.75))*m+0.984375)+k}}}},easeInOutBounce:function(l,m,k,o,n){if(m<n/2){return g.easing.easeInBounce(l,m*2,0,o,n)*0.5+k}return g.easing.easeOutBounce(l,m*2-n,0,o,n)*0.5+o*0.5+k}})})(jQuery);;


/*
 * jQuery UI Effects Slide 1.8rc3
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Slide
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(a){a.effects.slide=function(b){return this.queue(function(){var e=a(this),d=["position","top","left"];var i=a.effects.setMode(e,b.options.mode||"show");var h=b.options.direction||"left";a.effects.save(e,d);e.show();a.effects.createWrapper(e).css({overflow:"hidden"});var f=(h=="up"||h=="down")?"top":"left";var c=(h=="up"||h=="left")?"pos":"neg";var j=b.options.distance||(f=="top"?e.outerHeight({margin:true}):e.outerWidth({margin:true}));if(i=="show"){e.css(f,c=="pos"?-j:j)}var g={};g[f]=(i=="show"?(c=="pos"?"+=":"-="):(c=="pos"?"-=":"+="))+j;e.animate(g,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(i=="hide"){e.hide()}a.effects.restore(e,d);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}e.dequeue()}})})}})(jQuery);;


/**
 * jQuery Plugin Toggle Fade v1.0
 * Requires jQuery 1.2.3 (Not tested with earlier versions).
 * Copyright (c) 2008 Gregorio Magini [gmagini at gmail dot com] 
 * 
 * @param: Object Array. Arguments need to be in object notation.
 * Returns: jQuery.
 * Options:
 *    speedIn: Sets the speed of the fadeIn effect. Default: "normal".
 *    speedOut: Sets the speed of the fadeOut effect. Default: same as speedIn.
 *
 * Examples: 
 *    
 *    speedIn and speedOut both "normal":
 *    $("#toggle-link").toggleFade();
 *
 *    speedIn and speedOut both "fast":
 *    $("#toggle-link").toggleFade({ speedIn : "fast");
 *
 *    different settings for speedIn and speedOut:
 *    $("#toggle-link").toggleFade({ speedIn : 800, speedOut : 150 });
 */

(function($) {
	$.fn.toggleFade = function(settings) {
		settings = jQuery.extend({
			speedIn: "normal",
			speedOut: settings.speedIn
		}, settings );
		return this.each(function() {
			var isHidden = jQuery(this).is(":hidden");
			jQuery(this)[ isHidden ? "fadeIn" : "fadeOut" ]( isHidden ? settings.speedIn : settings.speedOut);
		});
	};
})(jQuery);


/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * @copyright Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * @license Dual licensed under MIT and GPL.
 * @date 5/25/2009
 * @author Ariel Flesler
 * @version 1.4.2
 * @see http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);


/**
 * jQuery Tooltip plugin 1.3
 *
 * @see  http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
 * @see  http://docs.jquery.com/Plugins/Tooltip
 *
 * Copyright (c) 2006 - 2008 Jörn Zaefferer
 * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $
 * @note  Dual licensed under the MIT and GPL licenses:
 * @see   http://www.opensource.org/licenses/mit-license.php
 * @see   http://www.gnu.org/licenses/gpl.html
 */
;(function($){var helper={},current,title,tID,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.tooltip={blocked:false,defaults:{delay:200,fade:false,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){$.tooltip.blocked=!$.tooltip.blocked;}};$.fn.extend({tooltip:function(settings){settings=$.extend({},$.tooltip.defaults,settings);createHelper(settings);return this.each(function(){$.data(this,"tooltip",settings);this.tOpacity=helper.parent.css("opacity");this.tooltipText=this.title;$(this).removeAttr("title");this.alt="";}).mouseover(save).mouseout(hide).click(hide);},fixPNG:IE?function(){return this.each(function(){var image=$(this).css('backgroundImage');if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"}).each(function(){var position=$(this).css('position');if(position!='absolute'&&position!='relative')$(this).css('position','relative');});}});}:function(){return this;},unfixPNG:IE?function(){return this.each(function(){$(this).css({'filter':'',backgroundImage:''});});}:function(){return this;},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]();});},url:function(){return this.attr('href')||this.attr('src');}});function createHelper(settings){if(helper.parent)return;helper.parent=$('<div id="'+settings.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if($.fn.bgiframe)helper.parent.bgiframe();helper.title=$('h3',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent);}function settings(element){return $.data(element,"tooltip");}function handle(event){if(settings(this).delay)tID=setTimeout(show,settings(this).delay);else
show();track=!!settings(this).track;$(document.body).bind('mousemove',update);update(event);}function save(){if($.tooltip.blocked||this==current||(!this.tooltipText&&!settings(this).bodyHandler))return;current=this;title=this.tooltipText;if(settings(this).bodyHandler){helper.title.hide();var bodyContent=settings(this).bodyHandler.call(this);if(bodyContent.nodeType||bodyContent.jquery){helper.body.empty().append(bodyContent)}else{helper.body.html(bodyContent);}helper.body.show();}else if(settings(this).showBody){var parts=title.split(settings(this).showBody);helper.title.html(parts.shift()).show();helper.body.empty();for(var i=0,part;(part=parts[i]);i++){if(i>0)helper.body.append("<br/>");helper.body.append(part);}helper.body.hideWhenEmpty();}else{helper.title.html(title).show();helper.body.hide();}if(settings(this).showURL&&$(this).url())helper.url.html($(this).url().replace('http://','')).show();else
helper.url.hide();helper.parent.addClass(settings(this).extraClass);if(settings(this).fixPNG)helper.parent.fixPNG();handle.apply(this,arguments);}function show(){tID=null;if((!IE||!$.fn.bgiframe)&&settings(current).fade){if(helper.parent.is(":animated"))helper.parent.stop().show().fadeTo(settings(current).fade,current.tOpacity);else
helper.parent.is(':visible')?helper.parent.fadeTo(settings(current).fade,current.tOpacity):helper.parent.fadeIn(settings(current).fade);}else{helper.parent.show();}update();}function update(event){if($.tooltip.blocked)return;if(event&&event.target.tagName=="OPTION"){return;}if(!track&&helper.parent.is(":visible")){$(document.body).unbind('mousemove',update)}if(current==null){$(document.body).unbind('mousemove',update);return;}helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){left=event.pageX+settings(current).left;top=event.pageY+settings(current).top;var right='auto';if(settings(current).positionLeft){right=$(window).width()-left;left='auto';}helper.parent.css({left:left,right:right,top:top});}var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+settings(current).left;helper.parent.css({left:left+'px'}).addClass("viewport-right");}if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+settings(current).top;helper.parent.css({top:top+'px'}).addClass("viewport-bottom");}}function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()};}function hide(event){if($.tooltip.blocked)return;if(tID)clearTimeout(tID);current=null;var tsettings=settings(this);function complete(){helper.parent.removeClass(tsettings.extraClass).hide().css("opacity","");}if((!IE||!$.fn.bgiframe)&&tsettings.fade){if(helper.parent.is(':animated'))helper.parent.stop().fadeTo(tsettings.fade,0,complete);else
helper.parent.stop().fadeOut(tsettings.fade,complete);}else
complete();if(settings(this).fixPNG)helper.parent.unfixPNG();}})(jQuery);


var YLF = {
	/**
	 * Initialize
	 */
	init: function() {
		// class 'js' if JavaScript available
		jQuery('body').attr('class', 'js ');
		
		YLF.slidingThumbnailBoxes();
		YLF.slideNavigationHeader();
		YLF.slideContentDetails();
		YLF.fadeThumbnailsOnStart();
		YLF.fadeThumbnailsOnPost();
		YLF.highlightPosts();
		YLF.scrollToTop();
		YLF.initTooltip();
		YLF.initTooltipImages();
		YLF.initDetectIE67();
	}, /* END init() */
	
	
	/**
	 * Slide Navigation Header in and out
	 */
	slideNavigationHeader: function() {
		var sliderBtnOpen  = jQuery('#header-slider-btn-open');
		var sliderBtnClose = jQuery('#header-slider-btn-close');
		var sliderOpen     = jQuery('#header-slider-open');
		var sliderClose    = jQuery('#header-slider-close');
		var header         = jQuery('#header');
		var content        = jQuery('#content');
		
		jQuery(sliderBtnOpen).click(function() {
			jQuery(sliderOpen).fadeOut('slow');
			jQuery(header).slideDown('slow');
			jQuery(sliderClose).fadeIn('slow');
			//jQuery(content).css('marginTop', '13em');
			jQuery(content).animate({'marginTop' : '13em' }, 'slow');
			return false;
		});
		
		jQuery(sliderBtnClose).click(function() {
			jQuery(sliderClose).fadeOut('slow');
			jQuery(header).slideUp('normal');
			jQuery(sliderOpen).fadeIn('slow');
			//jQuery(content).css('marginTop', '5em');
			jQuery(content).animate({'marginTop' : '5em' }, 400);
			return false;
		});
	}, /* END slideNavigationHeader() */
	
	
	/**
	 * Slide Content Details in and out
	 */
	slideContentDetails: function() {
		detailsOpenBtn  = jQuery('#details-open a');
		detailsCloseBtn = jQuery('#details-close a');
		contentHeading  = jQuery('.post h2');
		contentDetails  = jQuery('.post-content .details');
		// initially hide detailsCloseBtn
		jQuery(detailsCloseBtn).hide();
		// initially show detailsCloseBtn
		// jQuery(detailsOpenBtn).hide();
		// open details
		jQuery(detailsOpenBtn).click(function() {
			jQuery(contentDetails).show('slide', { direction: 'right' }, 500);
			jQuery(contentHeading).show('slide', { direction: 'right' }, 500);
			jQuery(this).fadeOut('slow');
			jQuery(detailsCloseBtn).fadeIn('slow');
			return false;
		});
		// close details
		jQuery(detailsCloseBtn).click(function() {
			jQuery(contentDetails).hide('slide', { direction: 'right' }, 500);
			jQuery(contentHeading).hide('slide', { direction: 'right' }, 500);
			jQuery(this).fadeOut('slow');
			jQuery(detailsOpenBtn).fadeIn('slow');
			return false;
		});
	}, /* END slideContentDetails() */
	
	
	/**
	 * Fade Thumbnails on Start Page
	 * @note set to 1 because IE6 won't display thumbs
	 */
	fadeThumbnailsOnStart: function() {
		var thumbs = jQuery('#content .thumbnails img');

		// initialy darken thumbs
		// 90% visbility | css opacity works too > but with animate better for cross browsers
		jQuery(thumbs).animate({'opacity': 1 });
		/*
		jQuery(thumbs).hover(function() {
			jQuery(this).stop().animate({ 'opacity': 1 });
		}, function() {
			jQuery(this).stop().animate({ 'opacity': .9 });
		});
		*/
	}, /* END fadeThumbnailsOnStart() */
	
	
	/**
	 * Fade Thumbnails on Post Post
	 */
	fadeThumbnailsOnPost: function() {
		var thumbs = jQuery('.ngg-gallery-thumbnail img');
		jQuery(thumbs).animate({'opacity': .7 });
		jQuery(thumbs).hover(function() {
			jQuery(this).stop().animate({ 'opacity': 1 });
		}, function() {
			jQuery(this).stop().animate({ 'opacity': .7 });
		});
	}, /* END fadeThumbnailsOnPost() */
	
	
	/**
	 * Sliding Boxes for Captions
	 * @see http://buildinternet.com/2009/03/sliding-boxes-and-captions-with-jquery/
	 */
	slidingThumbnailBoxes: function() {
		// Vertical Sliding
		/*
		jQuery('.boxgrid.slidedown').hover(function() {
			jQuery('.cover', this).stop().animate({top:'-260px'},{queue:false,duration:300});
		}, function() {
			jQuery('.cover', this).stop().animate({top:'0px'},{queue:false,duration:300});
		});
		*/
		
		// Full Caption Sliding (Hidden to Visible)
		//jQuery('.cover.boxcaption').css('top', '150px');
		jQuery('.boxgrid.captionfull').hover(function() {
			jQuery('.cover', this).stop().animate({top:'0'},{queue:false,duration:300});
		}, function() {
			jQuery('.cover', this).stop().animate({top:'-150px'},{queue:false,duration:300});
		});
	}, /* END slidingThumbnailBoxes() */
	
	
	/**
	 * Highlight Posts of specified Category
	 */
	highlightPosts: function() {
		// Categories
		var cats            = jQuery('#content .post img');
		var cat_work        = jQuery('#content .post.work img');
		var cat_photography = jQuery('#content .post.photography img');
		var cat_graphic     = jQuery('#content .post.graphic img');
		var cat_print       = jQuery('#content .post.print img');
		var cat_web         = jQuery('#content .post.web img');
		var cat_motion      = jQuery('#content .post.motion img');
		var cat_corporate   = jQuery('#content .post.corporate img');
		
		// Triggers
		var trigger_work        = jQuery('#highlight-work');
		var trigger_photography = jQuery('#highlight-photography');
		var trigger_graphic     = jQuery('#highlight-graphic');
		var trigger_print       = jQuery('#highlight-print');
		var trigger_web         = jQuery('#highlight-web');
		var trigger_motion      = jQuery('#highlight-motion');
		var trigger_corporate   = jQuery('#highlight-corporate');
		
		jQuery(trigger_work).click(function() {
			jQuery(cats).animate({'opacity': .2 });
			jQuery(cat_work).animate({'opacity': 1 });
		});
		jQuery(trigger_photography).click(function() {
			jQuery(cats).animate({'opacity': .2 });
			jQuery(cat_photography).animate({'opacity': 1 });
		});
		jQuery(trigger_graphic).click(function() {
			jQuery(cats).animate({'opacity': .2 });
			jQuery(cat_graphic).animate({'opacity': 1 });
		});
		jQuery(trigger_print).click(function() {
			jQuery(cats).animate({'opacity': .2 });
			jQuery(cat_print).animate({'opacity': 1 });
		});
		jQuery(trigger_web).click(function() {
			jQuery(cats).animate({'opacity': .2 });
			jQuery(cat_web).animate({'opacity': 1 });
		});
		jQuery(trigger_motion).click(function() {
			jQuery(cats).animate({'opacity': .2 });
			jQuery(cat_motion).animate({'opacity': 1 });
		});
		jQuery(trigger_corporate).click(function() {
			jQuery(cats).animate({'opacity': .2 });
			jQuery(cat_corporate).animate({'opacity': 1 });
		});
	}, /* END highlightPosts() */
	
	
	/**
	 * Scroll to Top (Back to top)
	 */
	scrollToTop: function() {
		jQuery('#totop').click(function() {
			jQuery.scrollTo( '#top', 800 );
			return false;
		});
	}, /* END scrollToTop() */
	
	
	/**
	 * Tooltip, based on jQuery Tooltip plugin 1.3
	 * @see  http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
	 * @see  http://docs.jquery.com/Plugins/Tooltip
	 */
	initTooltip: function() {
		// Tooltip for special marked links
		//jQuery('.tooltip').tooltip({ 
		// Tooltip for all links
		jQuery('body a').tooltip({ 
			/* positionLeft: true, */
			track: true,
			//delay: 0,
			delay: 1000,
			showURL: false,
			showBody: ' - ',
			//extraClass: 'info',
			opacity: 1, //0.9,
			fixPNG: true,
			top: 15,
			left: 15,
			fade: 250
			/*
			bodyHandler: function() { 
				//return $('<p class="message-info">&nbsp;</p>');
				return $($(this).text());
			}
			*/
		});
	}, /* END initTooltip() */
	
	
	/**
	 * Tooltip, based on jQuery Tooltip plugin 1.3 for images in content
	 * @see  http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
	 * @see  http://docs.jquery.com/Plugins/Tooltip
	 */
	initTooltipImages: function() {
		/*
		jQuery('div.post-content a.x').click(function(e) {
			e.preventDefault();
			//do other stuff when a click happens
			return false;
		});
		*/
		// Tooltip for images in postings
		/*
		jQuery('img.ngg-singlepic').each( function() {
			$(this).attr( 'title', $(this).attr('alt') );
		});
		*/
		jQuery('img.ngg-singlepic').tooltip({
			track: true,
			delay: 250,
			showURL: false,
			showBody: ' - ',
			opacity: 1,
			fixPNG: true,
			top: 15,
			left: 15,
			fade: 250,
		});
	}, /* END initTooltipImages() */
	
	
	/**
	 * Fixed position for #detectIE in IE6 div
	 */
	initDetectIE67: function() {
		jQuery('#detectIE').css({
			'opacity': '0.9'
		});
		jQuery('#detectIE').hover(function() {
			jQuery(this).fadeTo('fast', 1.0);
		}, function() {
			jQuery(this).fadeTo('fast', 0.9);
		});
		jQuery(window).scroll(function() {
			jQuery('#detectIE').css('top', jQuery(window).scrollTop() + 'px');
		});
	} /* END initDetectIE67() */
}


/**
 * DOM Ready | start the scripts when DOM ready
 * @note same as window.onload = function() {}
 */
jQuery(document).ready(function() {
	YLF.init();
});
