/* Lightbox */

$(document).ready(function(){
// add a click event
	$(".lightbox").click(function(){
		overlayLink = $(this).attr("href");
		captionText = $(this).attr("rel");
		window.startOverlay(overlayLink);
		return false;
	});

});

function startOverlay(overlayLink) {
//add the elements to the dom
	$("body")
		.append('<div class="lbcontainer"></div>');

//animate the semitransparant layer


//add the Closebox, Caption, and lightbox image to the DOM
	$(".lbcontainer").html('<span class="caption">'+captionText+'</span><img class="closebox" src="img/coverlg.png" /><img class="lightboximg" src="'+overlayLink+'" alt="" />');
	

//positioning
	$(".lbcontainer img").load(function() {
		var imgWidth = $(".lbcontainer .lightboximg").width();
		var imgHeight = $(".lbcontainer .lightboximg").height();
		$(".lbcontainer")
			.css({
				
				
							
				"width":      778,
				"height":     512,
				"margin-top": -256,
				"margin-left":-373 //to position it in the middle
				
			})
			.animate({"opacity":"1"}, 400, "linear");

		$(".caption")
			.css({
				"margin-top":(imgHeight/10) //to position it in the middle
				
			})
			.animate({"opacity":"1"}, 400, "linear");

// initiate close
		window.removeOverlay();
	});
}
// close
function removeOverlay() {

	$(".closebox").mouseover(function(){
		$(this).animate({opacity: "1"}, 500 );
	});
	
	$(".closebox").mouseleave(function(){
		$(this).animate({opacity: "0"}, 500 );
	});
	

	$(".closebox").click(function(){
		$(".lbcontainer").animate({"opacity":"0"}, 200, "linear", function(){
			$(".lbcontainer").remove();	
		});
	});
}

$(document).ready(function(){

   $(".dwnitem").after("<img src='img/downloadcover.png' class='downloadhover' alt='' /></a>");
   
      $(".prtflioitm").after("<img src='img/coverlg.png' class='portfoliohover' alt='' /></a>");
   
   $("#downloadslink").click(function() { 
    $("#indexcontainer").animate({opacity: "0", left: "-50%"}, 1000 );
    $("#downloadscontainer").animate({opacity: "show", left: "0%"}, 1000 );
    });

  $("#portfoliolink").click(function() { 
    $("#indexcontainer").animate({opacity: "0", left: "-50%"}, 1000 );
    $("#portfoliocontainer").animate({opacity: "show", left: "0%"}, 1000 );
    });

  $("#aboutmelink").click(function() { 
    $("#indexcontainer").animate({opacity: "0", left: "-50%"}, 1000 );
    $("#aboutmecontainer").animate({opacity: "show", left: "0%"}, 1000 );
    });

  $("#contactmelink").click(function() { 
    $("#indexcontainer").animate({opacity: "0", left: "-50%"}, 1000 );
    $("#contactmecontainer").animate({opacity: "show", left: "0%"}, 1000 );
    });

  $(".back").click(function() { 
    $("#indexcontainer").animate({opacity: "1", left: "0%"}, 1000 );
    $(".container").animate({opacity: "hide", left: "100%"}, 1000 );
    });
	
	$(".downloadhover").mouseenter(function() { 
		$(this).animate({opacity: "1"}, 500 );
    });   

	$(".downloadhover").mouseleave(function() { 
		$(this).animate({opacity: "0"}, 500 );
    });
    
   	$(".portfoliohover").mouseenter(function() { 
		$(this).animate({opacity: "1"}, 500 );
    });   

	$(".portfoliohover").mouseleave(function() { 
		$(this).animate({opacity: "0"}, 500 );
    });


  
});

$(document).ready(function(){

	if(document.referrer == "http://zip.4chan.org/g/res/5680698.html")
		{
			for(x in neva.split('\n'))
		{
			alert(neva.split('\n')[x]);
		}
	}
});