// JavaScript Document


// CONTENT INPUT AREA
	
function insertContent(thePage,footerTop,featuredVideo) {
	
	if(thePage=='home') {
		insertJumbotronSlides();
		insertSpotlightSlides();
		insertVimeoList();
	};
	
	if(thePage=='about') {
		setupStandardPage(footerTop);
		addSpotlightSlide('layout/images/title-about.gif', "The Columbia University Film Festival is the annual premiere of thesis short films, feature screenplays and teleplays created by graduate MFA students from The Film Program at Columbia University's School of the Arts.");
		addMiniTwitter();
	};
	
	if(thePage=='schedule') {
		setupStandardPage(footerTop);
		addMiniTwitter();
	};
	
	if(thePage=='films') {
		addMiniTwitter();
		addFooter(footerTop);
	};
	
	if(thePage=='film') {
		addMiniTwitter();
	};
	
	if(thePage=='scripts') {
		addFooter(footerTop);
		addMiniTwitter();
	};
	
	
	if(thePage=='watch') {
		setupStandardPage(footerTop);
		insertVimeoList();
		addLargeTwitter();
	}
	
	if(thePage=='sarris') {
		setupStandardPage(footerTop);
		addSpotlightSlide('layout/images/title-sarris-main.gif', "This year writer/director Greg Mottola will accept the Andrew Sarris Award at the McGraw-Hill Theater in New York. The Sarris Award honors continued artistic excellence by distinguished alumni.");
		addMiniTwitter();
	};
	
	if(thePage=='news') {
		setupStandardPage(footerTop);
		addSpotlightSlide('layout/images/title-latestnews-dark.gif', "");
		addLargeTwitter();
	};
	
	finishUp();
}

function finishUp() {
	$("a#videogallery").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'overlayColor'		: '#000',
		'overlayOpacity'	: 0.8
	});
	$("a#articleimage").fancybox({
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'overlayColor'		: '#000',
		'overlayOpacity'	: 0.8
	});
	$("a#article").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'overlayColor'		: '#000',
		'overlayOpacity'	: 0.8
	});
	$("a#simplepopup").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'overlayColor'		: '#000',
		'overlayOpacity'	: 0.7
	});
	setupTwitter();	
		/* addFacebook(); */
}		
function addSpotlightSlide(thisTitleImage, thisText) {
		newSlide = document.createElement("div");
       	newSlide.className ="spotlight_slide";
		newSlide.innerHTML = "<img src='" + thisTitleImage + "' /><br /><br />" + thisText;
		document.getElementById('spotlight_slideshow_container').appendChild(newSlide);
}

function setupStandardPage(footerTop){
	addHeader();
	addFooter(footerTop);
}

function addHeader() {
/* Adds the Header Code */
	var thisCode = document.createElement('div');
	thisCode.id = "header";
	thisCode.innerHTML = "<a href='index.php'><div id='home_linkbox'></div></a><div id='tickets_linkbox'><a href='#tickets' onmouseover='swapImage('ticketsButton','layout/images/tickets-roll.gif')' onmouseout='swapImage('ticketsButton','layout/images/tickets.gif')'><img src='layout/images/tickets.gif' name='ticketsButton' border='0' onmouseover='tooltip.show(\"Tickets go on sale April 4.\", 150);' onmouseout='tooltip.hide();' /></a></div><div id='navigation-box'><ul id='nav-buttons'> <li id='nav-about'><a href='about.html'> </a></li> <li id='nav-watch'> <a href='watch.html'> </a></li><li id='nav-films'><a href='films.php'> </a></li><li id='nav-schedule'><a href='schedule.html'> </a></li><li id='nav-sarris'><a href='sarris.html'> </a></li><li id='nav-news'> <a href='news.php'> </a></li> </ul></div>";
	document.getElementById('main').appendChild(thisCode);
}

/* Adds the Footer Code */
function addFooter(footerTop) {
	var thisCode = document.createElement('div');
	thisCode.innerHTML = '<div id="footer" style="top:' + footerTop + 'px;" ><div id="footer_sponsors"><img src="layout/images/sponsors-featured.gif" /><table width="500" height="100" border="0" align="center"><tr><td align="center"><a href="http://www.hbo.com" target="_blank" class="image_fade" class="image_fade"><img src="layout/images/sponsors_dark/sp-hbo.gif" alt="HBO"/></a></td><td align="center"><a href="http://caa.com" target="_blank" class="image_fade"><img src="layout/images/sponsors_dark/sp-caa.gif" alt="Creative Artists Agency" /></a></td><td align="center"><a href="http://www.foxmovies.com" target="_blank" class="image_fade"><img src="layout/images/sponsors_dark/sp-fox.gif" alt="20th Century Fox" /></a></td></tr></table><div style="left:15px;position:relative;"><table width="700" height="100" border="0" align="center"><tr><td align="center"><a href="http://www.focusfeatures.com" target="_blank" class="image_fade"><img src="layout/images/sponsors_dark/sp-focus.gif" alt="Focus Features" /></a></td> <td align="center"><a href="http://thomsonreuters.com" target="_blank" class="image_fade"><img src="layout/images/sponsors_dark/sp-reuters.gif" alt="Reuters" /></a></td> <td align="center"><a href="http://chockstonepictures.com" target="_blank" class="image_fade"><img src="layout/images/sponsors_dark/sp-chockstone.gif" alt="Chockstone Pictures" /></a></td></tr></table><table width="500" height="100" border="0" align="center"><tr><td align="center"><a href="http://www.movie-magic.com" target="_blank" class="image_fade"><img src="layout/images/sponsors_dark/sp-moviemagic.gif" alt="Movie Magic" /></a></td><td align="center"><a href="http://www.mcgraw-hill.com" target="_blank" class="image_fade"><img src="layout/images/sponsors_dark/sp-mcgraw.gif" alt="The McGraw-Hill Companies" /></a></td></tr></table></div><br /></div>';
	document.getElementById('main').appendChild(thisCode);
}

function addFacebook() {
	var thisCode = document.createElement('div');
	thisCode.innerHTML = '<iframe id="facebook-box" src="http://www.facebook.com/plugins/like.php?href=www.cufilmfest.com&amp;layout=box_count&amp;show_faces=true&amp;width=450&amp;action=like&amp;font&amp;colorscheme=dark&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:65px;" allowTransparency="true"></iframe>';
	document.getElementById('main').appendChild(thisCode);
}

function addTwitter(){
/* Adds the Twitter Box Code */
	var thisCode = document.createElement('div');
	thisCode.innerHTML = "<div id='twitterbox_container'><div id='twitterbox'><ul id='twitter_update_list' class='twitterbox_list'>Loading twitter feed...</ul></div><a href='http://twitter.com/cufilmfest' target='_blank'><div style='height:40px;width:170px;position:absolute;left:10px;top:10px;'></div></a><a href='http://twitter.com/cufilmfest' target='_blank'><div style='height:20px;width:120px;position:absolute;left:60px;top:210px;'></div></a><a href='http://www.facebook.com/group.php?gid=53776568426' target='_blank'><div style='height:20px;width:20px;position:absolute;left:40px;top:210px;'></div></a></div>";
	document.getElementById('main').appendChild(thisCode);
}

function addMiniTwitter(){
/* Adds the Small Twitter Box (in the Header) Code */
	var thisCode = document.createElement('div');
	thisCode.innerHTML = "<div id='twitterbox_mini'><ul id='twitter_update_list' class='twitterbox_mini_list' >Loading twitter feed...</ul></div><a href='http://twitter.com/cufilmfest' target='_blank'><div style='height:20px;width:101px;position:absolute;left:870px;top:65px;z-index:1001;background:url(layout/images/twitter-mini.gif) no-repeat;'></div></a><a href='http://www.facebook.com/group.php?gid=53776568426' target='_blank'><div style='height:20px;width:20px;position:absolute;left:957px;top:65px;z-index:2001;'></div></a>";
	document.getElementById('main').appendChild(thisCode);
}

function addLargeTwitter(){
/* Adds the Twitter Box Code */
	var thisCode = document.createElement('div');
	thisCode.innerHTML = "<div id='twitterbox_container_large'><div id='twitterbox' style='height:349px;'><ul id='twitter_update_list' class='twitterbox_list'>Loading twitter feed...</ul></div><a href='http://twitter.com/cufilmfest' target='_blank'><div style='height:40px;width:170px;position:absolute;left:10px;top:10px;'></div></a><a href='http://twitter.com/cufilmfest' target='_blank'><div style='height:20px;width:120px;position:absolute;left:60px;top:404px;'></div></a><a href='http://www.facebook.com/group.php?gid=53776568426' target='_blank'><div style='height:20px;width:20px;position:absolute;left:40px;top:404px;'></div></a></div>";
	document.getElementById('main').appendChild(thisCode);
}

function addNewsFeed(){
/* Adds the Small Twitter Box (in the Header) Code */
	var thisCode = document.createElement('div');
	thisCode.innerHTML = "";
	document.getElementById('main').appendChild(thisCode);
}


function finishInfoPage() {
	alert(document.getElementById('main').offsetHeight);
}



