jQuery.films = {
	overlayapi : null,
	goodthru : "( Mar 12 - Mar 18 )",
	films : [
		{
			id : 1,
			active : true,
			title : "The Girl on the Train",
			rating : "Not Rated",
			poster : "train.jpg",
			runtime : "1 hr 52 min",
			auditorium : "Downstairs Auditorium",
			starring : "Catherine Deneuve, Emilie Dequenne, Nicolas Duvauchelle",
			director : "Andr&eacute; T&eacute;chin&eacute;",
			synopsis : "<p>Based on a play by Jean-Marie Besset, THE GIRL ON THE TRAIN is inspired by one of the most media-blitzed and polarizing events in recent French history: a young woman's lie about being the victim of an anti-semitic attack on a Paris suburban train. </p><p>Jobless, soul-searching and rollerblading Jeanne (Rosetta's Cannes Film Festival Best Actress Winner Emilie Dequenne,) lives in a Paris suburb with her widowed mother Louise, (Catherine Deneuve,) who makes a living as a baby-sitter. Louise helps her daughter get a job with her old flame Samuel Bleistein (Michel Blanc, Monsieur Hire, Grosse Fatigue), now a famous lawyer and Jewish activist. When Jeanne's budding relationship with aspiring wrestler Franck (Nicolas Devauchelle) is shattered by a violent turn of events, Jeanne and Bleistein's opposite worlds get set on a collision course, as the film becomes a complex psychological drama raising issues of race, religion and identity.</p>",
			trailer : '<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/pbE35DB-f5w&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/pbE35DB-f5w&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>',
			trailerLink : "http://www.youtube.com/watch?v=pbE35DB-f5w",
			rtlink : 'http://www.rottentomatoes.com/m/girl_on_the_train/',
			daily1 : '1:00 | 4:00 | 7:00 <span style="font-size:11px">(Mar. 12)</span>',
			hasDaily2 : true,
			daily2 : '1:00 | 4:00 <span style="font-size:11px">(Mar. 13)</span>',
			lateShows : true,
			late : '4:00 <span style="font-size:11px">(Mar 14-18)</span>',
			alert : false,
			alertBody : "No 7:00 show Thurs., Mar. 11<sup>th</sup>"
		},
		{
			id : 2,
			active : true,
			title : "The Last Station",
			rating : "R",
			poster : "station.jpg",
			runtime : "1 hr 52 min",
			auditorium : "Upstairs Auditorium",
			starring : "Helen Mirren, James McAvoy, Paul Giamatti, Christopher Plummer",
			director : "Michael Hoffman",
			synopsis : "<p>Fact and fiction converge in this talent-driven drama based on Jay Parini's novel about Leo Tolstoy. THE LAST STATION focuses on the marriage between Tolstoy (Christopher Plummer) and his wife Sofya (Helen Mirren) in its final years. James McAvoy stars as a young man who works for the couple, while Paul Giamatti plays an advisor to the writer who fights his wife over financial issues.</p>",
			trailer : '<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/bTh-vQho7UU&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/bTh-vQho7UU&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>',
			trailerLink : "http://www.youtube.com/watch?v=bTh-vQho7UU",
			rtlink : 'http://www.rottentomatoes.com/m/last_station/',
			daily1 : '1:20 | 4:20 | 7:20 <span style="font-size:11px">(Daily)</span>',
			hadDaily2 : false,
			daily2 : '',
			lateShows : false,
			late : '9:40 <span style="font-size:11px">(Fri & Sat)</span>',
			alert : false,
			alertBody : "No 9:20 show Fri., Jan. 29<sup>th</sup>"
		},
		{
			id : 3,
			active : false,
			title : "Asheville Jewish Film Festival",
			rating : "",
			poster : "ajff.png",
			runtime : "",
			auditorium : "",
			starring : "",
			director : "",
			synopsis : "<p>In Werner Herzog's new film \"The Bad Lieutenant: Port Of Call New Orleans,\" Nicolas Cage plays a rogue detective who is as devoted to his job as he is at scoring drugs -- while playing fast and loose with the law. He wields his badge as often as he wields his gun in order to get his way. In the aftermath of Hurricane Katrina he becomes a high-functioning addict who is a deeply intuitive, fearless detective reigning over the beautiful ruins of New Orleans with authority and abandon. Complicating his tumultuous life is the prostitute he loves (played by Eva Mendes). Together they descend into their own world marked by desire, compulsion, and conscience. The result is a singular masterpiece of filmmaking: equally sad and manically humorous.</p>",
			trailer : '<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/o-GpX3TTvrE&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/o-GpX3TTvrE&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>',
			trailerLink : "http://www.youtube.com/watch?v=o-GpX3TTvrE",
			rtlink : 'http://www.rottentomatoes.com/m/bad_lieutenant_port_of_call_new_orleans/',
			daily1 : '7:20 (Daily)',
			hasDaily2 : false,
			daily2 : '',
			lateShows : true,
			late : '9:50 (Fri & Sat)',
			alert : false,
			alertBody : "No 9:20 show Fri., Jan. 29<sup>th</sup>"
		},
		{
			id : 4,
			active : false,
			title : "American Harmony",
			rating : "Not Rated",
			poster : "harmony.jpg",
			runtime : "86 minutes",
			auditorium : "Downstairs",
			starring : "Patrick Claypool, Sean Devine, Cory Hunt, Shawn York",
			director : "Aengus James",
			synopsis : '<p>SPELLBOUND exposed the ambition at the national spelling bee, WORDPLAY revealed the struggles at crossword-puzzle championships, and now AMERICAN HARMONY chronicles the rivalries in the cutthroat world of...barbershop singing. At the International Championships of Barbershop Singing, 50 groups vie for the title, but only one quartet can sing its way to the top. Will it be OC Times, a handsome foursome? Or will the supergroup Max Q reign? Poised to spoil either team\'s chances are the green but talented Vocal Spectrum and their polar opposites, Reveille, who have been singing together for 30 years. This documentary explores a world that most have never seen, but these singers\' devotion to their craft is infectious.</p>',
			trailer : '<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/bRvvCslN3w0&hl=en&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/bRvvCslN3w0&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>',
			trailerLink : "http://www.youtube.com/watch?v=bRvvCslN3w0",
			rtlink : 'http://www.rottentomatoes.com/m/american_harmony/',
			daily : '1:20 (Saturday, Sept. 19)',
			lateShows : false,
			late : '7:00 (Thursday, Sept. 17)',
			alert : false,
			alertBody : ""
		}
	],
	
	loadFilmData : function() {
		$('span.goodthru').text(this.goodthru);
		$.each(this.films, function(i, film) {
			if(film.active == true)
			{
				var f = $('#film-template > div.film').clone();
				$('#films').append(f);
				$(f).attr('id', 'film-' + film.id);
				
				$(f).find('img.poster').attr('src', 'images/films/' + film.poster); // POSTER
				$(f).find('h3.film-title').html(film.title); // TITLE
				if(film.rating != "")
				{
					$(f).find('h3.film-rating').text(film.rating); // RATING
				}
				else
				{
					$(f).find('h3.film-rating').hide();
				}
				if(film.starring != "")
				{
					$(f).find('span.stars').text(film.starring); // STARRING
				}
				else
				{
					$(f).find('p.starring').hide();
				}
				if(film.director != "")
				{
					$(f).find('span.the-director').text(film.director); // DIRECTOR
				}
				else
				{
					$(f).find('p.director').hide();
				}
				if(film.runtime != "")
				{
					$(f).find('span.runtime').text(film.runtime); // RUNTIME
				}
				else
				{
					$(f).find('p.running-time').hide();
				}
				
				// FILM INFO LINK
				$(f).find('a.film-info-btn').click(function(){
					$('#film-synop-' + film.id).fadeIn('slow');
					$(f).css('margin-bottom', '0');
					return false;
				});
				
				// RT LINK
				$(f).find('a.film-rt-link').attr('href', film.rtlink);
				
				// TRAILER
				//$(f).find('a.film-trailer-btn').attr('id', 'trailer-' + i);
				$(f).find('a.film-trailer-btn').click(function() {
					$('#vid-targ').html(film.trailer);
					$.films.overlayapi.load();
					return false;
				});
				
				// Showtimes
				$(f).find('div.daily1').html(film.daily1);
				if(film.hasDaily2 == true)
				{
					$(f).find('div.daily2').html(film.daily2);
				}
				else
				{
					$(f).find('div.daily2').hide();
				}
				if(film.lateShows == true)
				{
					$(f).find('div.late').html(film.late);
				}
				else
				{
					$(f).find('div.late').hide();
				}
				$(f).find('div.auditorium').text(film.auditorium);
				if(film.alert == true)
				{
					$(f).find('div.alert').html(film.alertBody);
				}
				else
				{
					$(f).find('div.alert').hide();
				}
				
				// Synopsis
				var s = $('#film-template > div.film-synopsis').clone();
				$('#films').append(s);
				$(s).attr('id', 'film-synop-' + film.id);
				$(s).prepend(film.synopsis);
				$(s).find('a.close-btn').click(function() {
					$(this).parent().parent().fadeOut('slow', function() {
						$(f).css('margin-bottom','15px');
					});
					
					return false;
				});
			}
		});
	},
	
	loadiPhone : function() {
		$('span.goodthru').text(this.goodthru);
		$.each(this.films, function(i, film) {
			if(film.active == true)
			{
				var f = $('#iphone-film-template > div.film').clone();
				$('#films').append(f);
				$(f).attr('id', 'film-' + film.id);				
				
				$(f).find('img.poster').attr('src', "images/films/" + film.poster);
				$(f).find('h2.film-title').text(film.title);
				$(f).find('p.daily').text(film.daily);
				if(film.lateShows == true)
				{
					$(f).find('p.late').text(film.late);
				}
				else
				{
					$(f).find('p.late').hide();
				}
				$(f).find('p.auditorium').text(film.auditorium);
				if(film.alert == true)
				{
					$(f).find('p.alert').html(film.alertBody);
				}
				else
				{	
					$(f).find('p.alert').hide();
				}
				
				$(f).find('a.info-btn').attr('id', 'info-' + film.id);
				$(f).find('a#info-' + film.id).click(function() {
					$("#filminfo-" + film.id).fadeIn('slow');
					return false;
				});
				
				var s = $('#iphone-film-template > div.film-synop').clone();
				$('#films').append(s);
				$(s).attr('id', 'filminfo-' + film.id);
				
				$(s).find('p.rating').text('Rated ' + film.rating);
				$(s).find('span.runtime').text(film.runtime);
				$(s).find('span.stars').text(film.starring);
				$(s).find('span.director').text(film.director);
				$(s).find('div.synopsis').html(film.synopsis);
				$(s).find('a.trailer-link').attr('href', film.trailerLink);
				$(s).find('a.rt-link').attr('href', film.rtlink);
				
				$(s).find('a.close-btn').click(function() {
					$(this).parent().parent().fadeOut('fast', function() {
						window.location = "#top";
					});
					return false;
				});
			}
		});
	}
}