/**
 * @author egrissom
 */
$(document).ready(function() {
	//Examples of how to assign the ColorBox event to elements.
	
	$(".externalVideo a").each(function(){
		
		var videoId = $(this).attr("href");
		/*
		var dimensions = $(this).attr("rel");
		dimensions = dimensions.split("x");
		var width = dimensions[0];
		var height = dimensions[1];
		
		
		var paddedWidth = parseInt(dimensions[0]) + 70;
		var paddedHeight = parseInt(dimensions[1]) + 92;
		*/
		
		var width = 640;
		var height = 385;
		var paddedWidth = width + 60;
		var paddedHeight = height + 92;
		
		if (videoId.indexOf("youtube.com") != -1) {
			videoId = videoId.split("watch?v=");
			videoId = videoId[1];
			videoPage = "youtube.php";
		} else if (videoId.indexOf("vimeo.com") != -1) {
			videoId = videoId.split("vimeo.com/");
			videoId = videoId[1];
			videoPage = "vimeo.php";
		} else {
			width = 480;
			height = 385;
			paddedWidth = width + 60;
			paddedHeight = height + 92;
			videoId = videoId.split("video=");
			videoId = videoId[1];
			videoPage = "inlineFlash.php";
		}
		
		$(this).colorbox({
			fixedWidth: paddedWidth + "px",
			fixedHeight: paddedHeight + "px",
			initialWidth: width,
			initialHeight: height,
			iframe: true,
			href: "/includes/js/jQuery/colorbox/templates/" + videoPage + "?video=" + videoId + "&width=" + width + "&height=" + height
		})
	});
	
	$(".photos a[rel='photos']").colorbox({
		transition:"elastic", contentCurrent:"{current} / {total}"
	});
	
	$("a.workshop").click(function(){ 
	alert("hi");
		$(this).colorbox({width:"50%", inline:true, href:"hidden_" + $(this).id, title:"hello"});
		return false;
 	});
});