 $(document).ready(function() {

	//DEVIN RAY OLSEN WORDPRESS LIGHT BOX
	$("a").each(function(){
		if($(this).attr("href") == "#lightbox")
		{
			$(this).css({cursor:"pointer"});
			$(this).click(function(){
				var scn = document.getElementById("lightbox");
				if(scn == null || scn == "")
				{
					var docBody = document.getElementsByTagName("body")[0];
					var wrap = document.getElementById("wrapper");
					

					var lb = document.createElement("div");
					lb.setAttribute("id","lightbox");
					lb.style.display="none";
					lb.style.top=this.offsetTop+"px";
					lb.style.marginTop = "40px";
					
					var lbi = document.createElement("img");
					lbi.setAttribute("id","lightboxImage")
					lbi.setAttribute("src",$(this).find("img").attr("src"));
					
					var close = document.createElement("span");
					close.setAttribute("id","lbClose");
					var closeTxt = document.createTextNode("Close");
					
					close.appendChild(closeTxt);
					lb.appendChild(close);
					lb.appendChild(lbi);
					wrap.appendChild(lb);

					$("#lbClose").click(function(){
						$("#lightbox").hide("slow");
					});
									
					$("#lightbox").show();
					
					$('html, body').animate({
						scrollTop: $("#lightbox").offset().top - 20
					},500);
					
				}else{
					$("#lightboxImage").attr("src",$(this).find("img").attr("src"));
					$("#lightbox").css({top:this.offsetTop+"px"});
					$("#lightbox").show();
					
					$('html, body').animate({
						scrollTop: $("#lightbox").offset().top - 20
					},500);										
				}
				
			});
		}
	});
 });
