// JavaScript Document

flowplayer('player', 'swf/flowplayer-3.1.5.swf', {
	  clip: {
			autoPlay: true
		},
		plugins: {
			controls: {
				url: 'swf/flowplayer.controls-3.1.5.swf',
				backgroundColor: '#000000',
				backgroundGradient: 'none',
				buttonColor: '#444444',
				timeColor: '#5fa90c',
				timeBGColor: '#444444'
			}
		}
	});
	var mycarousel_itemList = [
  {title: "<br />iApplicate", thumb: "thumb_iapplicate.jpg", description: "The web's premiere<br />iPhone application<br />review show", lnk: "portfolio_iapplicate.html"},														 
	{title: "<br />UGVC", thumb: "thumb_ugvc.jpg", description: "High-spirited weekly<br />review of the best/worst<br />user-generated videos", lnk: "portfolio_ugvc.html"},
	{title: "<br />American Detour", thumb: "thumb_americandetour.jpg", description: "Writer Bruce Northam<br />travels the globe seeking<br />wisdom &amp; local cultures", lnk: "portfolio_americandetour.html"},
	{title: "<br />Pass the Popcorn", thumb: "thumb_passthepopcorn.jpg", description: "A fun online video<br />campaign promoting<br />the popular board game", lnk: "portfolio_passthepopcorn.html"},
	{title: "<br />MontageH2H.com", thumb: "thumb_montageh2h.jpg", description: "Today's top montage<br />editors compete in a <br />head2head  competition", lnk: "portfolio_montageh2h.html"},
	{title: "<br />Nike", thumb: "thumb_nike.jpg", description: "Nike field reporter<br />Serena Morales reviews<br />the Nike Training Club", lnk: "portfolio_nike.html"},
	{title: "<br />Travelbytes", thumb: "thumb_travelbytes.jpg", description: "A family travel guide<br />highlighting the best places<br />to sleep, eat and play", lnk: "portfolio_travelbytes.html"},
	{title: "<br />Modern Man", thumb: "thumb_modernman.jpg", description: "A semi-scripted sit-com<br />that offers a glimpse<br />into the male psyche", lnk: "portfolio_modernman.html"},
	{title: "<br />Maxim Prime", thumb: "thumb_maximprime.jpg", description: "Special launch video<br />for Maxim Prime <br />Steakhouse in Atlanta", lnk: "portfolio_maximprime.html"},
	{title: "<br />Glam.com", thumb: "thumb_glamsexcity.jpg", description: "An intimate preview with<br />the cast prior to the premiere<br />of Sex and the City", lnk: "portfolio_glamsexcity.html"},
	{title: "<br />The Rant (pilot)", thumb: "thumb_rant.jpg", description: "Top funny man<br />Kevin Flynn rants about<br />the most Googled terms", lnk: "portfolio_therant.html"},
	{title: "<br />Adam 8*1*2", thumb: "thumb_adam812.jpg", description: "The debut video<br />from LA's exciting new<br />indie dance band", lnk: "portfolio_adam812.html"},
	{title: "<br />Hot Pink List", thumb: "thumb_hotpinklist.jpg", description: "Glam.com's reviews the<br />best movies, TV &amp; music<br />for women of all time", lnk: "portfolio_hotpinklist.html"},
	{title: "<br />Villa Paletti", thumb: "thumb_villapaletti.jpg", description: "A fun viral promotional<br />video for the stacking,<br />building & balancing game", lnk: "portfolio_villapaletti.html"},
	{title: "<br />Motor Mouth", thumb: "thumb_motormouth.jpg", description: "This exciting new product<br />brings ring-tones and<br />personality to your car", lnk: "portfolio_motormouth.html"},	
];
function mycarousel_itemLoadCallback(carousel, state)
{
    for (var i = carousel.first; i <= carousel.last; i++) {
        if (carousel.has(i)) {
            continue;
        }

        if (i > mycarousel_itemList.length) {
            break;
        }

        carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[i-1]));
    }
};
function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
 // The index() method calculates the index from a
 // given index who is out of the actual item range.
 var idx = carousel.index(i, mycarousel_itemList.length);
 carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1]));
};

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
 carousel.remove(i);
};
/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(item)
{
    return '<p class="orange italic showName"><a href="' + item.lnk + '">' + item.title + '</a></p><a href="' + item.lnk + '"><img src="images/' + item.thumb + '" /></a><p class="description">' + item.description + '</p>';
};
	$(function(){
	  $('#showNav').jcarousel({
		  size: mycarousel_itemList.length,
      itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback},												
		});
	});
