jQuery(document).ready(function($) {
//	alert('woohoo jquery');
	$('.portfolioList').click(function() {
		name = $(this).attr('id');
		url = $(this).attr('url');	
		type = $(this).attr('type');	
		lightBox(name,type,url);	
	});		




});


function lightBox(name,type,url) {
	$('#overlay').fadeIn();
	$('#viewer').fadeIn();
	$.ajax({
		type: 'GET',
		url: '/viewer.php?project=' + name,
		success: function(html) {
			$('#infoInner').html(html);
		}
	});
//	$('#viewerInfo').fadeIn();
	$('#viewer').html('<a href=' + url + ' class=embed>'+ name + '</a>');
	vheight = ($('#viewer').height())-40;
	vwidth = ($('#viewer').width())-20;
	if (type == 'pdf') {
		$('a.embed').gdocsViewer({ height:  vheight, width: vwidth });
	}
	if (type == 'iframe') {
		$('.iframe').width(vwidth);
		$('.iframe').height(vheight);
		html ='<iframe class=iframe src="http://' + url + '" width="98%" height="90%"><p>Your browser does not support iframes.</p></iframe>';
		$('#viewer').html(html);
	}
	$('#infoClose').click(function() {
		$('#viewerInfo').fadeOut();
	});
	$('#overlay').click(function() {
		$('#viewer').html('');
		$('#viewer').fadeOut();
		$('#viewerInfo').fadeOut();
		$(this).fadeOut();
	});
}

