/**
 * jQuery Masonry v2.0.110808
 * A dynamic layout plugin for jQuery
 * The flip-side of CSS Floats
 * http://masonry.desandro.com
 *
 * Licensed under the MIT license.
 * Copyright 2011 David DeSandro
 */
(function(a,b,c){var d=b.event,e;d.special.smartresize={setup:function(){b(this).bind("resize",d.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",d.special.smartresize.handler)},handler:function(a,b){var c=this,d=arguments;a.type="smartresize",e&&clearTimeout(e),e=setTimeout(function(){jQuery.event.handle.apply(c,d)},b==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Mason=function(a,c){this.element=b(c),this._create(a),this._init()};var f=["position","height"];b.Mason.settings={isResizable:!0,isAnimated:!1,animationOptions:{queue:!1,duration:500},gutterWidth:0,isRTL:!1,isFitWidth:!1},b.Mason.prototype={_filterFindBricks:function(a){var b=this.options.itemSelector;return b?a.filter(b).add(a.find(b)):a},_getBricks:function(a){var b=this._filterFindBricks(a).css({position:"absolute"}).addClass("masonry-brick");return b},_create:function(c){this.options=b.extend(!0,{},b.Mason.settings,c),this.styleQueue=[],this.reloadItems();var d=this.element[0].style;this.originalStyle={};for(var e=0,g=f.length;e<g;e++){var h=f[e];this.originalStyle[h]=d[h]||""}this.element.css({position:"relative"}),this.horizontalDirection=this.options.isRTL?"right":"left",this.offset={};var i=b(document.createElement("div"));this.element.prepend(i),this.offset.y=Math.round(i.position().top),this.options.isRTL?(i.css({"float":"right",display:"inline-block"}),this.offset.x=Math.round(this.element.outerWidth()-i.position().left)):this.offset.x=Math.round(i.position().left),i.remove();var j=this;setTimeout(function(){j.element.addClass("masonry")},0),this.options.isResizable&&b(a).bind("smartresize.masonry",function(){j.resize()})},_init:function(a){this._getColumns("masonry"),this._reLayout(a)},option:function(a,c){b.isPlainObject(a)&&(this.options=b.extend(!0,this.options,a))},layout:function(a,c){var d,e,f,g,h,i;for(var j=0,k=a.length;j<k;j++){d=b(a[j]),e=Math.ceil(d.outerWidth(!0)/this.columnWidth),e=Math.min(e,this.cols);if(e===1)this._placeBrick(d,this.colYs);else{f=this.cols+1-e,g=[];for(i=0;i<f;i++)h=this.colYs.slice(i,i+e),g[i]=Math.max.apply(Math,h);this._placeBrick(d,g)}}var l={};l.height=Math.max.apply(Math,this.colYs)-this.offset.y,this.options.isFitWidth&&(l.width=this.cols*this.columnWidth-this.options.gutterWidth),this.styleQueue.push({$el:this.element,style:l});var m=this.isLaidOut?this.options.isAnimated?"animate":"css":"css",n=this.options.animationOptions,o;for(j=0,k=this.styleQueue.length;j<k;j++)o=this.styleQueue[j],o.$el[m](o.style,n);this.styleQueue=[],c&&c.call(a),this.isLaidOut=!0},_getColumns:function(){var a=this.options.isFitWidth?this.element.parent():this.element,b=a.width();this.columnWidth=this.options.columnWidth||this.$bricks.outerWidth(!0)||b,this.columnWidth+=this.options.gutterWidth,this.cols=Math.floor((b+this.options.gutterWidth)/this.columnWidth),this.cols=Math.max(this.cols,1)},_placeBrick:function(a,b){var c=Math.min.apply(Math,b),d=0;for(var e=0,f=b.length;e<f;e++)if(b[e]===c){d=e;break}var g={top:c};g[this.horizontalDirection]=this.columnWidth*d+this.offset.x,this.styleQueue.push({$el:a,style:g});var h=c+a.outerHeight(!0),i=this.cols+1-f;for(e=0;e<i;e++)this.colYs[d+e]=h},resize:function(){var a=this.cols;this._getColumns("masonry"),this.cols!==a&&this._reLayout()},_reLayout:function(a){var b=this.cols;this.colYs=[];while(b--)this.colYs.push(this.offset.y);this.layout(this.$bricks,a)},reloadItems:function(){this.$bricks=this._getBricks(this.element.children())},reload:function(a){this.reloadItems(),this._init(a)},appended:function(a,b,c){if(b){this._filterFindBricks(a).css({top:this.element.height()});var d=this;setTimeout(function(){d._appended(a,c)},1)}else this._appended(a,c)},_appended:function(a,b){var c=this._getBricks(a);this.$bricks=this.$bricks.add(c),this.layout(c,b)},remove:function(a){this.$bricks=this.$bricks.not(a),a.remove()},destroy:function(){this.$bricks.removeClass("masonry-brick").each(function(){this.style.position="",this.style.top="",this.style.left=""});var c=this.element[0].style;for(var d=0,e=f.length;d<e;d++){var g=f[d];c[g]=this.originalStyle[g]}this.element.unbind(".masonry").removeClass("masonry").removeData("masonry"),b(a).unbind(".masonry")}},b.fn.imagesLoaded=function(a){var b=this.find("img"),c=[],d=this,e=b.length;if(!b.length){a.call(this);return this}b.one("load error",function(){--e===0&&(e=b.length,b.one("load error",function(){--e===0&&a.call(d)}).each(function(){this.src=c.shift()}))}).each(function(){c.push(this.src),this.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="});return this};var g=function(a){this.console&&console.error(a)};b.fn.masonry=function(a){if(typeof a=="string"){var c=Array.prototype.slice.call(arguments,1);this.each(function(){var d=b.data(this,"masonry");if(!d)g("cannot call methods on masonry prior to initialization; attempted to call method '"+a+"'");else{if(!b.isFunction(d[a])||a.charAt(0)==="_"){g("no such method '"+a+"' for masonry instance");return}d[a].apply(d,c)}})}else this.each(function(){var c=b.data(this,"masonry");c?(c.option(a||{}),c._init()):b.data(this,"masonry",new b.Mason(a,this))});return this}})(window,jQuery);
;
/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * 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 Tools v1.2.5 - The missing UI library for the Web
 * 
 * tabs/tabs.js
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/
 * 
 */
(function(a){a.tools=a.tools||{version:"v1.2.5"},a.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialIndex:0,event:"click",rotate:!1,history:!1},addEffect:function(a,c){b[a]=c}};var b={"default":function(a,b){this.getPanes().hide().eq(a).show(),b.call()},fade:function(a,b){var c=this.getConf(),d=c.fadeOutSpeed,e=this.getPanes();d?e.fadeOut(d):e.hide(),e.eq(a).fadeIn(c.fadeInSpeed,b)},slide:function(a,b){this.getPanes().slideUp(200),this.getPanes().eq(a).slideDown(400,b)},ajax:function(a,b){this.getPanes().eq(0).load(this.getTabs().eq(a).attr("href"),b)}},c;a.tools.tabs.addEffect("horizontal",function(b,d){c||(c=this.getPanes().eq(0).width()),this.getCurrentPane().animate({width:0},function(){a(this).hide()}),this.getPanes().eq(b).animate({width:c},function(){a(this).show(),d.call()})});function d(c,d,e){var f=this,g=c.add(this),h=c.find(e.tabs),i=d.jquery?d:c.children(d),j;h.length||(h=c.children()),i.length||(i=c.parent().find(d)),i.length||(i=a(d)),a.extend(this,{click:function(c,d){var i=h.eq(c);typeof c=="string"&&c.replace("#","")&&(i=h.filter("[href*="+c.replace("#","")+"]"),c=Math.max(h.index(i),0));if(e.rotate){var k=h.length-1;if(c<0)return f.click(k,d);if(c>k)return f.click(0,d)}if(!i.length){if(j>=0)return f;c=e.initialIndex,i=h.eq(c)}if(c===j)return f;d=d||a.Event(),d.type="onBeforeClick",g.trigger(d,[c]);if(!d.isDefaultPrevented()){b[e.effect].call(f,c,function(){d.type="onClick",g.trigger(d,[c])}),j=c,h.removeClass(e.current),i.addClass(e.current);return f}},getConf:function(){return e},getTabs:function(){return h},getPanes:function(){return i},getCurrentPane:function(){return i.eq(j)},getCurrentTab:function(){return h.eq(j)},getIndex:function(){return j},next:function(){return f.click(j+1)},prev:function(){return f.click(j-1)},destroy:function(){h.unbind(e.event).removeClass(e.current),i.find("a[href^=#]").unbind("click.T");return f}}),a.each("onBeforeClick,onClick".split(","),function(b,c){a.isFunction(e[c])&&a(f).bind(c,e[c]),f[c]=function(b){b&&a(f).bind(c,b);return f}}),e.history&&a.fn.history&&(a.tools.history.init(h),e.event="history"),h.each(function(b){a(this).bind(e.event,function(a){f.click(b,a);return a.preventDefault()})}),i.find("a[href^=#]").bind("click.T",function(b){f.click(a(this).attr("href"),b)}),location.hash&&e.tabs=="a"&&c.find("[href="+location.hash+"]").length?f.click(location.hash):(e.initialIndex===0||e.initialIndex>0)&&f.click(e.initialIndex)}a.fn.tabs=function(b,c){var e=this.data("tabs");e&&(e.destroy(),this.removeData("tabs")),a.isFunction(c)&&(c={onBeforeClick:c}),c=a.extend({},a.tools.tabs.conf,c),this.each(function(){e=new d(a(this),b,c),a(this).data("tabs",e)});return c.api?e:this}})(jQuery);
;
jQuery(document).ready(function(){

var $container = jQuery('#homePage');
$container.imagesLoaded(function(){
$container.masonry({
itemSelector : '.panel-pane',
columnWidth : 215,
isAnimated: true,
animationOptions: {
duration: 600,
easing: 'swing',
queue: false
}
});
});

var $refContainer = jQuery('#referenzenPage');
$refContainer.imagesLoaded(function(){
$refContainer.masonry({
itemSelector : '.refBox',
columnWidth : 215,
isAnimated: true,
animationOptions: {
duration: 600,
easing: 'swing',
queue: false
}
});
});

var $newsContainer = jQuery('#newsPage');
$newsContainer.imagesLoaded(function(){
$newsContainer.masonry({
itemSelector : '.newsBox',
columnWidth : 215,
isAnimated: true,
animationOptions: {
duration: 600,
easing: 'swing',
queue: false
}
});
});

jQuery('#homePage .panel-pane').click(function() {
boxID = this;
currentID = jQuery(this).attr('id');
boxAnimation(boxID,currentID);
});

jQuery('#referenzenPage .refBox').click(function() {
boxID = this;
refBoxAnimation(boxID);
});

jQuery('#newsPage .newsBox').click(function() {
boxID = this;
newsBoxAnimation(boxID);
});

jQuery('#newsBox').click(function() {
window.location = '/news';
});

var mapFrame = '<iframe style="width:100%; height:615px; border:0; scrolling:no; marginheight:0; marginwidth:0;" src="http://maps.google.de/maps?hl=de&amp;client=firefox-a&amp;q=tricontes+m%C3%BCnchen+arnulfstra%C3%9Fe&amp;ie=UTF8&amp;hq=tricontes&amp;hnear=Arnulfstra%C3%9Fe,+M%C3%BCnchen,+Bayern&amp;cid=9105405801105379692&amp;ll=48.146446,11.554613&amp;spn=0.030925,0.047979&amp;z=14&amp;iwloc=A&amp;output=embed"></iframe>';
jQuery('#anfahrtBox').click(function() {
if (!jQuery('#anfahrtBox').hasClass('mapOpen')) {
jQuery('#anfahrtBox').addClass('mapOpen');
jQuery('#mapFrame').html(mapFrame);
}
});

var fbFrame = '<iframe style="scrolling:no; border:0; border:none; overflow:hidden; width:100%; height:440px; allowTransparency:true;"  src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FTricontes%2F170510499631450%3Fref%3Dts&amp;width=350&amp;colorscheme=light&amp;show_faces=false&amp;border_color&amp;stream=true&amp;header=true&amp;height=427"></iframe>';
jQuery('#insideBox').click(function() {
if (!jQuery('#insideBox').hasClass('fbOpen')) {
jQuery('#insideBox').addClass('fbOpen');
jQuery('#fbFrame').html(fbFrame);
}
});

jQuery('#referenzenBox').click(function() {
window.location = '/referenzen';
});

function boxAnimation(boxID,currentID) {
if (!jQuery(boxID).hasClass('activeBox') && currentID != 'newsBox' && currentID != 'referenzenBox') {
jQuery('#homePage .panel-pane').removeClass('activeBox');
jQuery(boxID).addClass('activeBox');
jQuery('#mapFrame').html('&nbsp;');
jQuery('#anfahrtBox').removeClass('mapOpen');
jQuery('#fbFrame').html('&nbsp;');
jQuery('#insideBox').removeClass('fbOpen');
boxWidth = jQuery(boxID).find('.boxDataStore').css('width');
boxHeight = jQuery(boxID).find('.boxDataStore').css('height');
boxScroll(boxID);
jQuery('#homePage .panel-pane').animate({
width: '160px',
height: '135px'
}, 300);
jQuery(boxID).animate({
width: boxWidth,
height: boxHeight
}, 300, function(){
jQuery('#homePage').masonry();
});
}
}

function refBoxAnimation(boxID) {
if (!jQuery(boxID).hasClass('activeBox')) {
jQuery('#referenzenPage .refBox').removeClass('activeBox');
jQuery(boxID).addClass('activeBox');
boxWidth = jQuery(boxID).find('.boxDataStore').css('width');
boxHeight = jQuery(boxID).find('.boxDataStore').css('height');
boxScroll(boxID);
jQuery('#referenzenPage .refBox').animate({
width: '160px',
height: '135px'
}, 300);
jQuery(boxID).animate({
width: boxWidth,
height: boxHeight
}, 300, function(){
jQuery('#referenzenPage').masonry();
});
}
}

function newsBoxAnimation(boxID) {
if (!jQuery(boxID).hasClass('activeBox')) {
jQuery('#newsPage .newsBox').removeClass('activeBox');
jQuery(boxID).addClass('activeBox');
boxWidth = jQuery(boxID).find('.boxDataStore').css('width');
boxHeight = jQuery(boxID).find('.boxDataStore').css('height');
boxScroll(boxID);
jQuery('#newsPage .newsBox').animate({
width: '160px',
height: '135px'
}, 300);
jQuery(boxID).animate({
width: boxWidth,
height: boxHeight
}, 300, function(){
jQuery('#newsPage').masonry();
});
}
}

function boxScroll(boxID) {	
jQuery.scrollTo(jQuery(boxID),1000,{offset: -250});
}

jQuery("#managementBox ul.tabs").tabs("#managementBox div.panes > div");

jQuery('#block-block-1.block').hover(
function () {
jQuery('#block-block-1.block').css('margin','0 0 0 0');
}, 
function () {
jQuery('#block-block-1.block').css('margin','-132px 0 0 0');
}
);
jQuery('#block-block-2 .actionBox').hover(
function () {
jQuery('#block-block-2.block').css('margin','0 0 0 0');
}, 
function () {
jQuery('#block-block-2.block').css('margin','-135px 0 0 0');
}
);
jQuery('#block-block-3 .actionBox').hover(
function () {
jQuery('#block-block-3.block').css('margin','0 0 0 0');
}, 
function () {
jQuery('#block-block-3.block').css('margin','-135px 0 0 0');
}
);

hashTag = window.location.hash;
if (hashTag == '' && jQuery('body').hasClass('front')) {
boxID = '#telemarketingBox';
currentID = '#telemarketingBox';
boxAnimation(boxID,currentID);
} else if (hashTag == '#anfahrtBox') {
boxID = hashTag;
currentID = hashTag;
boxAnimation(boxID,currentID);
jQuery('#anfahrtBox').addClass('mapOpen');
jQuery('#mapFrame').html(mapFrame);
} else if (hashTag == '#insideBox') {
boxID = hashTag;
currentID = hashTag;
boxAnimation(boxID,currentID);
jQuery('#insideBox').addClass('fbOpen');
jQuery('#fbFrame').html(fbFrame);
} else {
boxID = hashTag;
currentID = hashTag;
boxAnimation(boxID,currentID);
}

jQuery('.front #header .block ul a').click(function() {
hashTag = jQuery(this).attr('href');
boxID = hashTag;
currentID = hashTag;
if (currentID == '/news' || currentID == '/referenzen') {
// EOF
} else if (hashTag == '#anfahrtBox') {
boxAnimation(boxID,currentID);
jQuery('#anfahrtBox').addClass('mapOpen');
jQuery('#mapFrame').html(mapFrame);
} else if (hashTag == '#insideBox') {
boxAnimation(boxID,currentID);
jQuery('#insideBox').addClass('fbOpen');
jQuery('#fbFrame').html(fbFrame);
} else {
boxAnimation(boxID,currentID);
}
});


});;

