var scrollItems=[];var timeoutID=0;expandMenu=function(id){if($("#"+id+" li.project").css("display")=="none")
{$("#menu li.project").hide(200);$("#"+id+" li.project").show(200);}}
startVideo=function(item){var flashvars={file:$(item.children()).attr("video"),image:"/videos/reel.jpg",skin:"/videos/8media-skin.zip",controlbar:"bottom",dock:"false",autostart:"true"};var params={allowfullscreen:"true"};var attributes={"class":"videoPlayer",name:"videoPlayer"};var videoDiv="player-"+$(item.children()).attr("id");item.append("<div id='"+videoDiv+"'></div>");swfobject.embedSWF("/videos/player.swf",videoDiv,"800","450","9.0.0","/js/expressInstall.swf",flashvars,params,attributes);}
stopVideo=function(item){var videoDiv="#player-"+$(item.children()).attr("id");item.children(videoDiv).remove();}
$(document).ready(function(){$("a.reel[rel]").overlay({expose:'#000'});scrollItems=[{name:"publicidad",offset:document.getElementById("publicidad").offsetTop},{name:"television",offset:document.getElementById("television").offsetTop},{name:"video",offset:document.getElementById("video").offsetTop},{name:"newsFeed",offset:document.getElementById("newsFeed").offsetTop},{name:"web",offset:document.getElementById("web").offsetTop},{name:"socialMedia",offset:document.getElementById("socialMedia").offsetTop}];clientesOffset=document.getElementById("clientes").offsetTop-200;$(".itemBody li a").tipsy({gravity:'w',html:true});$(window).scroll(function(e){if($(window).scrollTop()<400||$(window).scrollTop()>clientesOffset)
{$("#menu li.project").hide(200);return;}
for(var i=scrollItems.length-1;i>=0;--i)
{if($(window).scrollTop()>(scrollItems[i].offset-200)){expandMenu("menu_"+scrollItems[i].name);return;}}});$(".block a").click(function(e){$("html,body").scrollTo(this.hash,800);e.preventDefault();});$("#menu h2 a").click(function(e){$("html,body").scrollTo(e.target.hash,800);e.preventDefault();});$("#menu h3 a").click(function(e){$("html,body").scrollTo(e.target.hash,800,{offset:-50});e.preventDefault();});$("#header h1 a").click(function(){$("html,body").scrollTo(0,800);return false;});$(".play a").click(function(){try{$("html,body").scrollTo("#"+$(this).parent().parent().parent().parent().parent().attr("id"),800,{offset:-50});}catch(e){}
var api=$(this).parent().parent().parent().expose({color:'#444',api:true}).load();api.onLoad(function(){startVideo(this.getExposed());});api.onClose(function(){stopVideo(this.getExposed());});});$('.headerInfo a').mouseover(function(e){var body=$(e.target).parent().parent().next();body.children('.projectInfo').show();});$('.headerInfo a').mouseout(function(e){clearTimeout(timeoutID);timeoutID=setTimeout('hideProjectInfo()',2000);});hideProjectInfo=function(){$('.projectInfo').hide();};$('.slider').anythingSlider({autoPlay:false,delay:3000,startStopped:false,animationTime:600,hashTags:true,buildNavigation:true});});