$(function() {

	$.get('/showcase/windows', function(d, s) {
	
		$('#jqmwin').html(d);
		
		// initialize all of the project data popups
		$('div.jqmWindow').jqm({
			overlay: 90,
			onShow: function(hash) {
				hash.w.css({
					left: (($(window).width()-976)/2)+'px',
					top: '100px',
					zIndex: 15000
				}).show();
			}
		});

		// set up the 'all featured projects' links to trigger the project data popups
		$('a.jqmli').click(function() {
			var id = this.id.split(/_/)[1];
			$('#jqm_win_'+id).jqmShow();
		});

		// initialize the slideshow in each project data popup
		$('ul.showcase').each(function() {
			var nav = $('div.rbShowcaseControls', this.parentNode.parentNode);
			var id = this.id.split(/-/)[1];
			$(this).css('height', '377px');
			$(this).css('width', '516px');
			$(this).cycle({
				next: '#jqm-win-sc-controls-right_'+id,
				prev: '#jqm-win-sc-controls-left_'+id,
				timeout: 0
			});
		});
		
	});
		
	// set up the coverflow effect
	var iflow = new ImageFlow();
	iflow.init({ 
		ImageFlowID: 'showcase',
		imageFocusMax: 1,
		imageMaxHeight: 317,
		imageQuality: 7,
		buttons: 'true',
		scrollbarP: 0.3,
		reflectionPNG: true,
		reflectionGET: '&fade_start=0.8',
		imageDivHeight: '420px',
		onClick: function() {
			var id = this.id.split(/_/)[1];
			$('#jqm_win_'+id).jqmShow();
		}
	});
			
});
