typeof console==="undefined"&&(console={log:function(){}});
$(document).ready(function(){function f(b){try{var a="";a+=b.getHours()>12?b.getHours()-12:b.getHours();a+=":";a+=b.getMinutes()<10?"0"+b.getMinutes():b.getMinutes();a+=b.getHours()>=12?" pm":" am";return a}catch(l){}}function g(b){b=new Date(b);return"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(",")[b.getMonth()]}function o(){$("#speaker_bubble").length==0&&$("body").append('<div id="speaker_bubble" style="position:absolute;z-index:5000;display:none;"><img src="/template/missing-photo.jpg" /></div>');$bubble=
$("#speaker_bubble");$(".sermon .speaker a").hover(function(){$this=$(this);$this.click(function(){return false});$bubble.stop(true,true);bubbleShadow=3;adjustWidth=($bubble.width()-bubbleShadow)/2;adjustHeight=$bubble.height();posLeft=$this.offset().left;posTop=$this.offset().top;thisWidth=parseInt($this.width());bubbleImg=$this.attr("href");$("#speaker_bubble img").attr("src",bubbleImg);$bubble.css("top",posTop-adjustHeight).css("left",posLeft+thisWidth/2-adjustWidth);$.browser.msie?$bubble.css("display",
"block"):$bubble.fadeIn("fast")},function(){$.browser.msie?$bubble.css("display","none"):$bubble.fadeOut("fast")})}adjustSidebar();adjustFooter();$("#wrap_photo img").length>0&&$("#wrap_photo img").load(function(){$("#wrap_photo").addClass("shadow");adjustSidebar();adjustFooter()});if($("#wrap_photo .featured").length>0){console.log("feature");var c=$("#wrap_photo");c.css("padding-bottom","0px");c.append('<br /><img id="wrap_photo_shadow" src="/template/slider_shadow.png" style="border:none; background-color:transparent; margin-left:0; margin-top:7px;" width="250" />');
$("#wrap_photo_shadow").css("width",c.width());adjustSidebar();adjustFooter()}else $("#wrap_photo object").length>0&&(console.log("object"),c=$("#wrap_photo"),c.css("padding-bottom","0px"),c.append('<br /><img id="wrap_photo_shadow" src="/template/slider_shadow.png" style="border:none; background-color:transparent; margin-left:0; margin-top:7px;" width="250" />'),$("#wrap_photo_shadow").css("width",c.width()),adjustSidebar(),adjustFooter());$("#wrap_photo iframe").load(function(){console.log("iframe");
$("#wrap_photo").addClass("shadow");adjustSidebar();adjustFooter()});$("#sidebar").load(function(){adjustFooter()});$("#nav1").hoverIntent({interval:0,sensitivity:4,timeout:50,over:function(){$("#nav-about").fadeIn("fast");$("#nav1 a").addClass("nav1hover")},out:function(){$("#nav-about").fadeOut("fast");$("#nav1 a").removeClass("nav1hover")}});$("#nav2").hoverIntent({interval:0,sensitivity:4,timeout:50,over:function(){$("#nav-ministries").fadeIn("fast");$("#nav2 a").addClass("nav2hover")},out:function(){$("#nav-ministries").fadeOut("fast");
$("#nav2 a").removeClass("nav2hover")}});$("ul.split").each(function(){$this=$(this);$li=$this.find("li");var b=Math.floor($li.length/2)+$li.length%2,a="";a+='<ul class="first">';$li.each(function(l,d){l==b&&(a+="</ul><ul>");a+="<li>"+d.innerHTML+"</li>\n"});a+="</ul>\n";a+='<div class="clear"></div>';$this.replaceWith(a)});$("body").append('<div id="feedback" style="width:30px;height:100px;position:fixed;bottom:50%;left:0;z-index:500;"><a href="/app/feedback/feedback.asp?u='+escape(location.href)+
'" class="tyFeedback"><img src="/app/feedback/images/feedback-tab.png" border="0" /></a></div>');$(".tyFeedback").colorbox({iframe:true,width:550,height:460});typeof PageSettings!=="undefined"&&(PageSettings.showInfo&&PageSettings.name!=="undefined"&&$.get("/json/sidebar/"+PageSettings.name+".html",function(b){$("#sidebarInfo").append(b);adjustFooter()}),PageSettings.showPromo&&$.get("/json/sidebar_promo.html",function(b){$("#promoArea").append(b);$(".promo img").hover(function(){$(this).addClass("hover")},
function(){$(this).removeClass("hover")});$(".home").length&&$(".promo li");adjustFooter()}));var c=new Date,h=c.getMonth()+1+"/"+c.getDate()+"/"+c.getFullYear(),e=new Date;e.setDate(c.getDate()+1);e.getMonth();e.getDate();e.getFullYear();var i="";$.getJSON("http://api.serviceu.com/rest/events/occurrences?orgKey=9163e350-328a-41f7-a0f9-f6c74ee6234d&format=json&nextDays=1&callback=?",function(b){var a="";i=b.length>10?"<p>+"+(b.length-10)+' more events for today. <a href="http://public.serviceu.com/calendar/frame.asp?OrgKey=9163e350-328a-41f7-a0f9-f6c74ee6234d&bShowCalendar=True" target="_blank">View full calendar.</a></p>':
'<p><a href="http://public.serviceu.com/calendar/frame.asp?OrgKey=9163e350-328a-41f7-a0f9-f6c74ee6234d&bShowCalendar=True" target="_blank">View full calendar.</a></p>';$.each(b,function(b,d){b<10&&(a+="<li><strong>"+f(new Date(d.OccurrenceStartTime))+"</strong> - "+d.Name+"</li>")});$("#events").html("<ul>"+a+"</ul>"+i);$("#today").text("Today at Mountain View - "+g(h)+" "+(new Date(h)).getDate())});!$("#fullCalendar").length==0&&$.getJSON("http://api.serviceu.com/rest/events/occurrences?nextDays=35&orgKey={9163E350-328A-41F7-A0F9-F6C74EE6234D}&format=json&callback=?",
function(b){var a="";prevDate=new Date(-1);$.each(b,function(b,d){var c=new Date(d.OccurrenceStartTime);a+="<li>";c.getDate()!=prevDate.getDate()&&(a+='<div class="cal">'+g(c)+"<div>"+c.getDate()+"</div></div>");a+="<strong>"+f(c)+"</strong> - "+d.Name+"</li>";prevDate=c});$("#fullCalendar").html("<ul>"+a+"</ul>")});$(".footerBottom").click(function(){adjustFooter()});$.get("/app/get-recent-sermons.php",function(b){for(var b=b.split(/\n/),a="",c=0;c<b.length;c++){var d=b[c].split("\t"),j=new Date(d[0]),
e=g(j),j=j.getDate();a+='<li><div class="cal">'+e+"<div>"+j+'</div></div><a href="/sermons.html">'+d[1]+"</a></li>"}$(a).appendTo(".calendar")});$.get("/app/get-sermons.php",function(b){for(var a="",b=b.split(/\n/),c=b.length-1;c>b.length-21;c--){var d=b[c].split("\t");if(d[0]==1){var e=g(d[1]),f=(new Date(d[1])).getDate(),h=d[2],i=!d[3]?"(no title available)":d[3],m=d[4],p=d[5],k=d[6],q=d[7],n=d[8];a+='<div class="sermon">';a+='\t<div class="date">';a+='\t\t<div class="month">'+e+"</div>";a+='\t\t<div class="day">'+
f+"</div>";a+="\t</div>";a+=d[2]?'\t<p class="series">'+h+"</p>":'\t<p class="series">&nbsp;</p>';a+='\t<p class="title">'+i;d[4]&&(a+=d[5]?' - <span class="speaker"><a href="/images/speakers/'+p+'">'+m+"</a></span>":' - <span class="speaker">'+m+"</span>");a+="</p>";a+='\t<ul class="controls horizontal">';n&&(a+='<li class="showText">'+n+"</li>");a+=d[6]?'<li class="listen enabled"><a href="#" attach="'+c+'" class="listen">Listen Now</a></li><li class="download enabled"><a href="http://cdn.poweredbyty.com/a/mountainviewlife.org/'+
k+'">MP3 Download</a></li>':'<li class="listen">Listen Now</li><li class="download">MP3 Download</li>';a+=d[7]?'<li class="notes enabled"><a href="http://cdn.poweredbyty.com/a/mountainviewlife.org/'+q+'" target="_blank">Notes (PDF file)</a></li>':'<li class="notes">Notes (PDF file)</li>';a+="</ul>";k&&(a+='\n<div id="player'+c+'" class="embedPlayer" file="http://cdn.poweredbyty.com/a/mountainviewlife.org/'+k+'"></div>\n');a+='<div class="clear"></div></div>'}}$("#sermons").append(a);$(".controls .enabled").hover(function(){$(this).addClass("hover")},
function(){$(this).removeClass("hover")});adjustFooter();o();$(".embedPlayer").each(function(){var a=$(this),b=a.attr("id"),a=a.attr("file");try{swfobject.embedSWF("/js/mediaplayer-5.4/player.swf",b,"300","24","9","false",{file:a,autostart:"false"},{allowfullscreen:"true",allowscriptaccess:"never",bgcolor:"#ffffff"},{"class":"player"})}catch(c){}});$(".player").css("display","none");$("a.listen").click(function(){$("#player"+$(this).attr("attach")).toggle();return false})})});
function adjustSidebar(){$sidebar=$("#sidebar");$("#wrap_photo").height()>0?(pos=$("#wrap_photo").height()+45+25,$sidebar.css("top",pos)):$sidebar.addClass("hasPhoto");$sidebar.css("position","absolute");$sidebar.css("left","640px")}
function adjustFooter(){$sidebar=$("#sidebar");if($sidebar.length)$("#footer").css("margin-top",0),topFooter=$("#footer").offset().top,bottomSidebar=$sidebar.offset().top+$sidebar.height(),topFooter<bottomSidebar+20&&$("#footer").css("margin-top",bottomSidebar-topFooter+40+"px")};

