/* MouseWheel */
(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery);

/* ScrollTo */
;(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);

/* swfObject (Pagepeel) */
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();

/* ContextMenu */
(function($){var menu,shadow,trigger,content,hash,currentTarget;var defaults={menuStyle:{padding:'0px'},itemStyle:{margin:'0px'},itemHoverStyle:{margin:'0px'},eventPosX:'pageX',eventPosY:'pageY',shadow:true,onContextMenu:null,onShowMenu:null};$.fn.contextMenu=function(id,options){if(!menu){menu=$('<div id="jqContextMenu"></div>').hide().css({position:'absolute',zIndex:'500'}).appendTo('body').bind('click',function(e){e.stopPropagation()})}if(!shadow){shadow=$('<div class="contextwrapper"></div>').css({position:'absolute',zIndex:499}).appendTo('body').hide()}hash=hash||[];hash.push({id:id,menuStyle:$.extend({},defaults.menuStyle,options.menuStyle||{}),itemStyle:$.extend({},defaults.itemStyle,options.itemStyle||{}),itemHoverStyle:$.extend({},defaults.itemHoverStyle,options.itemHoverStyle||{}),bindings:options.bindings||{},shadow:options.shadow||options.shadow===false?options.shadow:defaults.shadow,onContextMenu:options.onContextMenu||defaults.onContextMenu,onShowMenu:options.onShowMenu||defaults.onShowMenu,eventPosX:options.eventPosX||defaults.eventPosX,eventPosY:options.eventPosY||defaults.eventPosY});var index=hash.length-1;$(this).bind('contextmenu',function(e){var bShowContext=(!!hash[index].onContextMenu)?hash[index].onContextMenu(e):true;if(bShowContext)display(index,this,e,options);return false});return this};function display(index,trigger,e,options){var cur=hash[index];content=$('#'+cur.id).find('ul:first').clone(true);content.css(cur.menuStyle).find('li').css(cur.itemStyle).hover(function(){$(this).css(cur.itemHoverStyle)},function(){$(this).css(cur.itemStyle)}).find('img').css({verticalAlign:'middle',paddingRight:'2px'});menu.html(content);if(!!cur.onShowMenu)menu=cur.onShowMenu(e,menu);$.each(cur.bindings,function(id,func){$('#'+id,menu).bind('click',function(e){hide();func(trigger,currentTarget)})});menu.css({'left':e[cur.eventPosX],'top':e[cur.eventPosY]}).show();if(cur.shadow)shadow.css({width:menu.width(),height:menu.height(),left:e.pageX+2,top:e.pageY+2}).show();$(document).one('click',hide)}function hide(){menu.hide();shadow.hide()}$.contextMenu={defaults:function(userDefaults){$.each(userDefaults,function(i,val){if(typeof val=='object'&&defaults[i]){$.extend(defaults[i],val)}else defaults[i]=val})}}})(jQuery);$(function(){$('div.contextMenu').hide()});


/* jqueryCookie */
jQuery.cookie = function (key, value, options) {if (arguments.length > 1 && String(value) !== "[object Object]") {options = jQuery.extend({}, options);if (value === null || value === undefined) {options.expires = -1;}if (typeof options.expires === 'number') {var days = options.expires, t = options.expires = new Date();t.setDate(t.getDate() + days);}value = String(value);return (document.cookie = [encodeURIComponent(key), '=',options.raw ? value : encodeURIComponent(value),options.expires ? '; expires=' + options.expires.toUTCString() : '', options.path ? '; path=' + options.path : '',options.domain ? '; domain=' + options.domain : '',options.secure ? '; secure' : ''].join(''));}options = value || {};var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;};

/* Viewport ermitteln */
 var viewportwidth;
 var viewportheight;
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }



/* Showreel-Player */
	$(document).ready(function() {
  		if (viewportwidth<1200 || viewportheight<695) $('.vergroessern').css('display','none');
		if (viewportwidth<1400  || viewportheight<798) $('.vergroessern2').css('display','none');	
		flowplayer("videoshowreel", {src: 'http://www.machart-studios.de/fileadmin/templates/v2/fp/flowplayer.commercial-3.1.5.swf', wmode: 'transparent'},  { 
			key: '#@7feaddfac28aaf25bd9',     
			clip: { 
				autoPlay: true,  
				autoBuffering: true,
				onFinish: function() {
					$(".overlay").fadeIn(3000);
					$(".vergroessern").fadeOut(500);
					$(".vergroessern2").fadeOut(500);
					$("#showreelplayer").animate({
						opacity: '0.2',
						height: '540px',
						width: '960px'
					}, 1200, function() {
						$(".vergroessern2").fadeOut(3000);
						$.ajax({
							type: "POST",
							url: "/static/fb_like.html",
							data: {data: 'eure_url'},
							success: function(msg){
								$("#fb-button").html(msg);
								$("#fb-button").css("background-image","none");
							}
						});
					});
					$(".message").animate({
						right: '0'
					}, 1200, function() {
						
					});
				}
			}, 
			play: {label: null,replayLabel: "Nochmal?"},
			plugins:  {   
				controls:  { 
					backgroundColor: '#ffffff', 
					backgroundGradient: 'none',             
					all:false, 
					scrubber:true, 
					mute:true, 
					height:16, 
					progressColor: '#000000', 
					bufferColor: '#aaaaaa' 
				}
			}   
		});
		

/* jQuery-Spielereien */
	/* Message Schließer */
		$(".close").click(function () {
			$(".message").animate({
				right: "-=1100px"
			}, 1200, function() {
				
			});
			$(".overlay").fadeOut(1000);
			$("#showreelplayer").stop(true,false).animate({
				opacity: '1'
			}, 500, function() {
				
			});
			  
		});
		/* Social Nachfrage???*/
		if( $.cookie('social')) {
			}else{
			if ( $.cookie('socialnachfrage') =='ichfragnimmer'){

			}else if ( $.cookie('socialnachfrage') =='2'){
				$('footer .wrapper').before('<img src="/daten/content/socialjanein.png" alt="" class="socialhinweis" />');
				$.cookie('socialnachfrage','ichfragnimmer', {path: '/', expires: 100000});			
			}else if( $.cookie('socialnachfrage') =='1') {
				$('footer .wrapper').before('<img src="/daten/content/socialjanein.png" alt="" class="socialhinweis" />');
				$.cookie('socialnachfrage','2', {path: '/', expires: 100000});
			}else{
				$.cookie('socialnachfrage','1', {path: '/', expires: 100000});
				$('footer .wrapper').before('<img src="/daten/content/socialjanein.png" alt="" class="socialhinweis" />');
			}
		}
		$('.socialhinweis').click(function() {
			$(this).fadeOut(500);	
			$.cookie('socialnachfrage','ichfragnimmer', {path: '/', expires: 100000});
		});
		
		/* Socialmodus einschalten */
		if( $.cookie('social') =='inaktiv') {
			$('.changelikemode').html('Off');
		}
		if( $.cookie('social') =='aktiv') {
			$('.socialpanel').css('right','0');
			$('.changelikemode').html('On');
			$.ajax({
							type: "POST",
							url: "/static/social_footer.html",
							data: {data: 'eure_url'},
							success: function(msg){
								$(".socialpanel").html(msg);
							}
			});


$.ajax({
  type: "POST",
  url: "/static/social_kommentar.php",
  data: ("seite="+document.URL)
}).done(function( msg ) {
		$(".socialcomments").html(msg);
});
			/*
			$.ajax({
							type: "POST",
							url: "/static/social_kommentar.php",
							data: {data: 'eure_url'},
							success: function(msg){
								$(".socialcomments").html(msg);
							}
			});
*/
}
		$('.changelikemode').click(function() {
				$('.socialhinweis').fadeOut(500);	
				if( $.cookie('social') =='aktiv') {
					$.cookie('social','inaktiv', {path: '/', expires: 100000});
				    $('.changelikemode').html('Off');
					$(".socialpanel").animate({
						right: "-440px"
					}, 1200, function() {
						
						
					});	
				}
				else {
					$('.changelikemode').html('On');
					$.cookie('social','aktiv', {path: '/', expires: 100000}); 
					$(".socialpanel").animate({
						right: "0px"
					}, 1200, function() {
						if( $(".socialpanel").html() =='') {
							$.ajax({
								type: "POST",
								url: "/static/social_footer.html",
								data: {data: 'eure_url'},
								success: function(msg){
									$(".socialpanel").html(msg);
								}
							});
						}
					});	
				}
			
		});
		
		
		
		
		
		
		
		
		
		
		
		
	/* Overlay-Handling */
		$(".overlay").click(function () {
			  	$('.europaspiel').slideUp(1200);
				$(".overlay").stop(true,false).fadeOut(800);
			  	$(".message").animate({
					right: "-=1100px"
				}, 1200, function() {
				});
				$('#sendkunden').fadeIn(1200);
				$('#sendbewerber').fadeIn(1200);
				$('#sendpartner').fadeIn(1200);
				$('#imagebropost').fadeIn(1200);
				

		});
		$('body').mousewheel(function(event, delta) {
			/*$(".overlay").stop(true,false).fadeOut(500); */
		});

	/* Videoplayer-Handling */
		$(".zumreel").click(function () {
			  $("body").scrollTo( {top:'0', left:'0'}, 1200 );
		}); 
		$(".vergroessern").click(function () {
			$("video").animate({
				width: '1200px',
				height: '675px'
			}, 500, function() {
				$(".vergroessern").fadeOut(1000);
				if (viewportwidth>=1400 &&  viewportheight>=798) $(".vergroessern2").fadeIn(1000);
				$("body").scrollTo( {top:'90px', left:'0'}, 800 ); // @ Sven: Du müsstest die 100px ersetzen durch: 100px -Minus oder+ (Höhe des Viewports -Minus- 675px (Filmhöhe))/2)
			});
		}); 
		$(".vergroessern2").click(function () {
			$("video").animate({
				width: '1400px',
				height: '788px'
			}, 500, function() {
				$("body").scrollTo( {top:'95px', left:'0'}, 800 );
			});
		}); 



	/* ContextMenu-Logodownload */
		$('.logodownload').contextMenu('logodownload', {});
		
	/* Mehr-Böppel */
		$(".mehrkunde div:first").css('height','187px');
		$(".mehrbranche div:first").css('height','187px');
		$(".mehrthema div:first").css('height','187px');
		$(".mehrthema2 div:first").css('height','187px');
		$(".mehrkunde .lademehr").click(function () {
			$(".mehrkunde .mehrlink").animate({
				height: '187px'
			}, 500, function() {
				$(".mehrkunde .lademehr").fadeOut(1000);
			});
		});
		$(".mehrbranche .lademehr").click(function () {
			$(".mehrbranche .mehrlink").animate({
				height: '187px'
			}, 500, function() {
				$(".mehrbranche .lademehr").fadeOut(1000);
			});
		});
		$(".mehrthema .lademehr").click(function () {
			$(".mehrthema .mehrlink").animate({
				height: '187px'
			}, 500, function() {
				$(".mehrthema .lademehr").fadeOut(1000);
			});
		});
		$(".mehrthema2 .lademehr").click(function () {
			$(".mehrthema2 .mehrlink").animate({
				height: '187px'
			}, 500, function() {
				$(".mehrthema2 .lademehr").fadeOut(1000);
			});
		});
		
		$(".replaybtn").click(function () {
			$('#showreelplayer').get(0).play();	
			$(".message").animate({
				right: "-=1100px"
			}, 1200, function() {
				
			});
			$("body").scrollTo( {top:'0', left:'0'}, 800 );
			$("#showreelplayer").animate({
				opacity: '1',
				height: '540px',
				width: '960px'
			}, 1200, function() {
			if (viewportwidth>=1200 &&   viewportheight>=695)	$(".vergroessern").fadeIn(500);
			});
		});
		/* Team */
		$(".teamm.frauke").click(function () {
			$(".teamt").slideUp();
			$(".teamt.frauke").stop(true,false).slideToggle();
		});
		$(".teamm.sven").click(function () {
			$(".teamt").slideUp();
			$(".teamt.sven").stop(true,false).slideToggle();
		});
		$(".teamm.eduard").click(function () {
			$(".teamt").slideUp();
			$(".teamt.eduard").stop(true,false).slideToggle();
		});
		$(".teamm.melissa").click(function () {
			$(".teamt").slideUp();
			$(".teamt.melissa").stop(true,false).slideToggle();
		});
		$(".teamm.rainer").click(function () {
			$(".teamt").slideUp();
			$(".teamt.rainer").stop(true,false).slideToggle();
		});
		$(".teamm.carlos").click(function () {
			$(".teamt").slideUp();
			$(".teamt.carlos").stop(true,false).slideToggle();
		});
		$(".teamm.diana").click(function () {
			$(".teamt").slideUp();
			$(".teamt.diana").stop(true,false).slideToggle();
		});
		$(".teamm.matthias").click(function () {
			$(".teamt").slideUp();
			$(".teamt.matthias").stop(true,false).slideToggle();
		});
		$(".teamm.manuel").click(function () {
			$(".teamt").slideUp();
			$(".teamt.manuel").stop(true,false).slideToggle();
		});
		
		/* Cookie */
		if( $.cookie('ms_nav_dis') =='auf') {
			$('.nav_dis').css('display','block');
			$('.lin_dis').removeClass('plus');
			$('.lin_dis').addClass('minus');			
		}
		$('.lin_dis').click(function() {
			$('.nav_dis').slideToggle(800,function(){
				if ($(this).css('display')=='list-item') {
					$.cookie('ms_nav_dis','auf', {path: '/', expires: 100000}); 
					$('.lin_dis').removeClass('plus');	$('.lin_dis').addClass('minus');	
				}
				else {
					$.cookie('ms_nav_dis','zu', {path: '/', expires: 100000});
				    $('.lin_dis').removeClass('minus');	$('.lin_dis').addClass('plus');	
				}
			});
		});
		
		
		if( $.cookie('ms_nav_bra') =='auf') {
			$('.nav_bra').css('display','block');
    		$('.lin_bra').removeClass('plus'); 
			$('.lin_bra').addClass('minus');	
		}
		$('.lin_bra').click(function() {
			$('.nav_bra').slideToggle(800,function(){
				if ($(this).css('display')=='list-item'){
					$.cookie('ms_nav_bra','auf', {path: '/', expires: 100000});
		    		$('.lin_bra').removeClass('plus'); 	$('.lin_bra').addClass('minus');
			   }
				else {
					$.cookie('ms_nav_bra','zu', {path: '/', expires: 100000});
		    		$('.lin_bra').removeClass('minus'); 	$('.lin_bra').addClass('plus');
				}
			});
		});
		
		$(".short a").click(function() { /* Referenzen-Teaser */
			filterclass = $("#refs").attr("class");
			cookievalue = filterclass.replace("refs ","");
        	$.cookie('filter_cookie', cookievalue, {path: '/', expires: 1});
       	});

		$(".left").click(function() { /* Links-Pfeil */
			filterclass = $("#refs").attr("class");
			cookievalue = filterclass.replace("refs ","");
        	$.cookie('filter_cookie', cookievalue, {path: '/', expires: 1});
       	});

		$(".right").click(function() { /* Rechts-Pfeil */
			filterclass = $("#refs").attr("class");
			cookievalue = filterclass.replace("refs ","");
        	$.cookie('filter_cookie', cookievalue, {path: '/', expires: 1});
       	});

		$("#mehrlink21").click(function() { /* Disziplin 1 */
			filterclass = $("#mehrlink21").attr("class");
			cookievalue = filterclass.replace("mehrlink ","");
        	$.cookie('filter_cookie', cookievalue, {path: '/', expires: 1});
       	});

		$("#mehrlink22").click(function() { /* Disziplin 2 */
			filterclass = $("#mehrlink22").attr("class");
			cookievalue = filterclass.replace("mehrlink ","");
        	$.cookie('filter_cookie', cookievalue, {path: '/', expires: 1});
       	});

		$("#mehrlink23").click(function() { /* Sector */
			filterclass = $("#mehrlink23").attr("class");
			cookievalue = filterclass.replace("mehrlink ","");
        	$.cookie('filter_cookie', cookievalue, {path: '/', expires: 1});
       	});

		$("#mehrlink31").click(function() { /* Disziplin 1 */
			filterclass = $("#mehrlink31").attr("class");
			cookievalue = filterclass.replace("mehrlink ","");
        	$.cookie('filter_cookie', cookievalue, {path: '/', expires: 1});
       	});

		$("#mehrlink32").click(function() { /* Disziplin 2 */
			filterclass = $("#mehrlink32").attr("class");
			cookievalue = filterclass.replace("mehrlink ","");
        	$.cookie('filter_cookie', cookievalue, {path: '/', expires: 1});
       	});

		$("#mehrlink33").click(function() { /* Sector */
			filterclass = $("#mehrlink33").attr("class");
			cookievalue = filterclass.replace("mehrlink ","");
        	$.cookie('filter_cookie', cookievalue, {path: '/', expires: 1});
       	});

		$("#mehrlink41").click(function() { /* Disziplin 1 */
			filterclass = $("#mehrlink41").attr("class");
			cookievalue = filterclass.replace("mehrlink ","");
        	$.cookie('filter_cookie', cookievalue, {path: '/', expires: 1});
       	});

		$("#mehrlink42").click(function() { /* Disziplin 2 */
			filterclass = $("#mehrlink42").attr("class");
			cookievalue = filterclass.replace("mehrlink ","");
        	$.cookie('filter_cookie', cookievalue, {path: '/', expires: 1});
       	});

		$("#mehrlink43").click(function() { /* Sector */
			filterclass = $("#mehrlink43").attr("class");
			cookievalue = filterclass.replace("mehrlink ","");
        	$.cookie('filter_cookie', cookievalue, {path: '/', expires: 1});
       	});

		/* Kontakt-Formular */
		/* welches Formular wurde geschickt? */
		$("#sendkunden").click(function() { /* Kunden-Formular */
			$("#sendkontakt").attr("value", "1");
       	});

		$("#sendbewerber").click(function() { /* Bewerber-Formular */
			$("#sendkontakt").attr("value", "2");
       	});

		$("#sendpartner").click(function() { /* Partner-Formular */
			$("#sendkontakt").attr("value", "3");
       	});
		$(".loadingwrapper")
			.ajaxStart(function() {$(this).show();})
			.ajaxStop(function() {$(this).hide();})
			.appendTo('body');
		/* Kontaktformular senden */
		var contactoptions = {
			url: '/pool/contact-form.php',
            target: '.errortext',
			success: contactcallback
		}
		$("#kontaktformular").submit(function() {
			$(this).ajaxSubmit(contactoptions);
			return false;
		});
		/* contactcallback */
		function contactcallback(data) {
			$(".overlay").fadeIn(3000);
			$(".message").animate({
				right: '0'
			}, 1200, function() {
			});
			$('#sendkunden').fadeOut(3000);
			$('#sendbewerber').fadeOut(3000);
			$('#sendpartner').fadeOut(3000);
		}
		
		$(".contactcloser").click(function() {
			$('#sendkunden').fadeIn(1200);
			$('#sendbewerber').fadeIn(1200);
			$('#sendpartner').fadeIn(1200);
		});
		
		$(".imagebropostcloser").click(function() {
			$('#imagebropost').fadeIn(1200);
		});
		
		/* Imagebroschüre Post */
		var imagebropostoptions = {
			url: '/pool/imagebropost-form.php',
            target: '.errortext',
			success: imagebropostcallback
		}
		$("#imagebropost-form").submit(function() {
			$(this).ajaxSubmit(imagebropostoptions);
			return false;
		});
		/* contactcallback */
		function imagebropostcallback(data) {
			$(".overlay").fadeIn(3000);
			$(".message").animate({
				right: '0'
			}, 1200, function() {
			});
			$('#imagebropost').fadeOut(3000);
		}
		
		$(".contactcloser").click(function() {
			$('#sendkunden').fadeIn(1200);
			$('#sendbewerber').fadeIn(1200);
			$('#sendpartner').fadeIn(1200);
		});
		
		/* Feedbackformular senden */
		var feedbackoptions = {
			url: '/pool/feedback-form.php',
            target: '.errortext',
			success: feedbackcallback
		}
		$("#feedbackformular").submit(function() {
			$(this).ajaxSubmit(feedbackoptions);
			return false;
		});
		
//		function feedbackfader() {
//			$(".feedbackfadeout").animate({
//				background: '#f0f'
//			}, 3200, function() {
//				$(".feedbackform").fadeOut(3000);
//				$(".overlay").delay(3000).fadeIn(3000);
//				$(".message").delay(3000).animate({
//					right: '-=1100px'
//				}, 1200, function() {
//				});
//			});
//		}
		
		/* feedbackcallback */
		function feedbackcallback(data) {
			/* Tu irgendwas tolles!!!!! */
		}
		
		/* News-Steps */
		$(".morenews").click(function() {
			$(this).parent().next('div.newssteps').slideDown(2000);
			$(this).delay(300).slideUp(1000);
		});

		/* Tabs */
		$(".tab_content").hide(); //Hide all content
		$("ul.tabs li:first").addClass("active").show(); //Activate first tab
		$(".tab_content:first").show(); //Show first tab content
		$("ul.tabs li").click(function() {
			$("ul.tabs li").removeClass("active"); //Remove any "active" class
			$(this).addClass("active"); //Add "active" class to selected tab
			$(".tab_content").hide(); //Hide all tab content
			var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
			$(activeTab).fadeIn(); //Fade in the active content
			return false;
		});

		/* Agentur */
		$(".agewrap").hover(
		  function () {
			$("img", this).stop(false,true).css("display","block").fadeOut(150);
		  }, 
		  function () {
			$("img", this).stop(false,true).css("display","none").fadeIn(650);
		  }
		);
		/* Newslike */
		$(".fb-buttonnews").click(function() {
		$.ajax({
					type: "POST",
					url: "/static/fb_like_this.html",
					data: {data: 'eure_url'},
					success: function(msg){
						$("#fb-button_news").html(msg);
						$("#fb-button_news").css("background-image","none");
					}
				});
		});
		/* Showreel */
		/* VORSICHT: CODE WIRD NOCHMAL OBEN IN FLOWPLAYER FÜR DAS FLASH FALLBACK GENUTZT! */
		$("#showreelplayer").bind('ended', function(){
			$(".overlay").fadeIn(3000);
			$(".vergroessern").fadeOut(500);
			$(".vergroessern2").fadeOut(500);
			$("#showreelplayer").animate({
				opacity: '0.2',
				height: '540px',
				width: '960px'
			}, 1200, function() {
				$(".vergroessern2").fadeOut(3000);
				$.ajax({
					type: "POST",
					url: "/static/fb_like.html",
					data: {data: 'eure_url'},
					success: function(msg){
						$("#fb-button").html(msg);
						$("#fb-button").css("background-image","none");
					}
				});
			});
			$(".message").animate({
				right: '0'
			}, 1200, function() {
				
			});
  		});
		$("#showreelplayer").bind('pause', function(){
			$(".overlay").stop(true,false).fadeOut(800);
			$("#showreelplayer").stop(true,false).animate({
				opacity: '0.5'
			}, 500, function() {
				
			});
  		});
		$("#showreelplayer").bind('play', function(){
			$(".overlay").fadeIn(800);
			$("#showreelplayer").stop(true,false).animate({
				opacity: '1'
			}, 500, function() {
				
			});
  		});

/* Imagebroschüre - PageFlip */
		var flashvars = {};
			flashvars.XMLFileName = "/pageflipdata.xml";
			flashvars.DataFolder = "/pageflipdata/";
			flashvars.StartPage = "1";
			flashvars.StartAutoFlip = "false";
		var params = {};
			params.scale = "noscale";
			params.salign = "TL";
			params.wmode = "transparent";
			params.allowscriptaccess = "always";
			params.allowfullscreen = "true";
			params.menu = "true";
			params.bgcolor = "#FFFFFF";
		var attributes = {};
			swfobject.embedSWF("/swf/pageFlip.swf", "pageflip", "100%", "700px", "10.0.0", false, flashvars, params, attributes);




/* Cufon-Replacements */
		Cufon.replace('h1', {hover: true, fontFamily: 'Clarendon LT Std' });
		Cufon.replace('h2', {hover: true, fontFamily: 'Clarendon LT Std' });
		Cufon.replace('h3', {hover: true, fontFamily: 'Clarendon LT Std' });
		Cufon.replace('h4', {hover: true, fontFamily: 'Clarendon LT Std' });
		Cufon.replace('.info_1', {hover: true, fontFamily: 'Clarendon LT Std' });
		Cufon.replace('.info_2', {hover: true, fontFamily: 'Clarendon LT Std' });
		Cufon.replace('.jobkreise .kreis', {hover: true, fontFamily: 'Clarendon LT Std' });
		Cufon.replace('.jobsteaser .kreis', {hover: true, fontFamily: 'Clarendon LT Std' });
		Cufon.replace('.joblinks a', {hover: true, fontFamily: 'Clarendon LT Std' });
		Cufon.replace('.donloadinfo', {hover: true, fontFamily: 'Clarendon LT Std' });
		Cufon.replace('.linklist', {hover: true, fontFamily: 'Clarendon LT Std' });
		Cufon.replace('.loadmore', {hover: true, fontFamily: 'Clarendon LT Std' });
		Cufon.replace('header a', {hover: true, fontFamily: 'Frutiger' });
		Cufon.replace('.articleinfo h3 span', {hover: true, fontFamily: 'Clarendon LT Std' });
		Cufon.replace('.accesskeys ul li strong', {hover: true, fontFamily: 'Clarendon LT Std' });
		Cufon.replace('.lexikontitle', {hover: true, fontFamily: 'Clarendon LT Std' });
		Cufon.replace('.infolist li a', {hover: true, fontFamily: 'Clarendon LT Std' });
		Cufon.replace('.morenews', {hover: true, fontFamily: 'Frutiger' });
		Cufon.replace('.sitemapheader', {hover: true, fontFamily: 'Clarendon LT Std' });
	
	});
	
var updateLayout = function() {
  if (window.innerWidth != currentWidth) {
    currentWidth = window.innerWidth;
    var orient = (currentWidth == 320) ? "profile" : "landscape";
    document.body.setAttribute("orient", orient);
    window.scrollTo(0, 1);
  }
};
iPhone.DomLoad(updateLayout);
setInterval(updateLayout, 400);


