jQuery(document).ready(function() {
	jQuery('.special_lightbox').click(function() {
		specialsLightbox(jQuery(this).find('img').attr("src"));
	});
	jQuery('.expando .expand').click(function() {
		toggleExpando();
	});
});

function specialsLightbox(src) {
	src = src.replace('/main-', '/');
	var div = document.createElement('div');
	div.id = 'blur';
	jQuery('body').append(div);
	jQuery('#blur').css('height', jQuery('body').height()+'px');
	var div = document.createElement('div');
	div.id = 'lightboxwrapper';
	jQuery('body').append(div);
	div = document.createElement('div');
	div.id = 'lightbox';
	jQuery('#lightboxwrapper').append(div);
	var img = document.createElement('img');
	img.setAttribute('src', src);	
	jQuery('#lightbox').append(img);
	jQuery('#blur, #lightboxwrapper').fadeIn('slow');
	jQuery('#blur, #lightboxwrapper, #lightbox').click(function() {clearLightbox();});
	jQuery(".video").fadeOut();
}

function clearLightbox() {
	jQuery('#lightboxwrapper, #blur').fadeOut('slow');
	setTimeout(function() {jQuery('#blur, #lightboxwrapper').remove();}, 1000);
	jQuery(".video").fadeIn();
}

function toggleExpando() {
	var h = jQuery('#expando').css("height");
	h = (h != "auto") ? 'auto' : '78px';
	var a = (h=="auto") ? 'Less' : 'More';
	jQuery('#expando').css("height", h);
	jQuery('#expando .expand').html(a);
}
