﻿$(document).ready(function(){photos=$(".home-gallery-image");photos_length=photos.length;for(i=0;i<photos_length;i++){var a=photos[i];$(a).data("photo_num",i+1)}$(".home-gallery-total").text(photos_length);first_photo=$(".home-gallery-image").first();last_photo=$(".home-gallery-image").last();first_photo.addClass("active");$(".home-gallery-current").text(first_photo.data("photo_num"));$(".home-gallery-next, .home-gallery-image").click(function(a){a.preventDefault();next=$(".home-gallery-image.active").next();if(next.length){$(".home-gallery-current").html(next.data("photo_num"));$(".home-gallery-image").removeClass("active");next.addClass("active")}else{$(".home-gallery-current").html(first_photo.data("photo_num"));$(".home-gallery-image").removeClass("active");first_photo.addClass("active")}});$(".home-gallery-previous").click(function(a){a.preventDefault();prev=$(".home-gallery-image.active").prev();if(prev.length){$(".home-gallery-current").html(prev.data("photo_num"));$(".home-gallery-image").removeClass("active");prev.addClass("active")}else{$(".home-gallery-current").html(last_photo.data("photo_num"));$(".home-gallery-image").removeClass("active");last_photo.addClass("active")}})});$(document).ready(function(){$(".youtube-placeholder").live("click",function(c){c.preventDefault();c.stopPropagation();var a=$(this).attr("href"),b=a.length,d=a.substring(b-11,b);$(this).remove();var e=$('<iframe class="youtube-player" type="text/html" width="627" height="406" src="http://www.youtube.com/embed/'+d+'?autoplay=1&hd=1" frameborder="0"></iframe>');$("#embeddedVideo").append(e)})})
