// "Main" Scripts

function addContent(thisContent, thisContainer) {
alert("I'm doing it.");
	document.getElementById(thisContainer).appendChild(thisContent);
}

function addImageSlide(thisImage, thisCaption, thisLink) {
		newSlide = document.createElement("div");
       	newSlide.className ="image_slide";
		newSlide.innerHTML = "<a href='" + thisLink + "' target='_top'><img src='" + thisImage + "' width='581' height='302' onmouseover='tooltip.show(\"" + thisCaption + "\", 200);' onmouseout='tooltip.hide();'/></a>";
		document.getElementById('images_slideshow_container').appendChild(newSlide);
}

function addImageTextSlide(thisImage, thisText, thisLink) {
		newSlide = document.createElement("div");
       	newSlide.className ="image_slide";
		newSlide.innerHTML = "<a href='" + thisLink + "' target='_top'><img src='" + thisImage + "' width='581' onmouseover='tooltip.show(\"Read the full article...\", 150);' onmouseout='tooltip.hide();'/></a><div class='image_text_slide'>" + thisText + "</div>";
		document.getElementById('images_slideshow_container').appendChild(newSlide);
}




function addNewsSlide(thisText) {
		newSlide = document.createElement("div");
       	newSlide.className ="news_slide";
		newSlide.innerHTML = thisText;
		document.getElementById('news_slideshow_container').appendChild(newSlide);
}

function addNewsArticle(thisArticleID,thisHeadline,thisDate,thisDescription,thisArticle) {
		newSlide = document.createElement("div");
       	newSlide.className ="news_article_list";
		newSlide.innerHTML = "<a id='article' href='#article" + thisArticleID + "'><span class='article_list_headline'>" + thisHeadline + "</span></a> <span class='article_list_date'>" + thisDate + "</span><br /><span class='article_list_description'>" + thisDescription + "</span><br /><br />";
		document.getElementById('article_list').appendChild(newSlide);
		newSlide = document.createElement("div");
       	newSlide.id = "article" + thisArticleID;
       	newSlide.className = "news_article";
		newSlide.innerHTML = thisArticle;
		document.getElementById('article_hidebox').appendChild(newSlide);
}

function setupImageSlideshow() {
	//Creates the slideshow
			$('.images_slideshow').cycle({
				fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
				timeout: 5000
			});
}

function setupNewsImageSlideshow() {
	//Creates the slideshow
			$('.images_slideshow').cycle({
				fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
				timeout: 8000,
				pause: 1,
				pager: '#images_slideshow_dots',
				pagerAnchorBuilder: function(idx, slide) {  
					return '<li><a href="#"></a></li>'; 
   				}
			});
}

function setupSpotlightSlideshow() {
	//Creates the slideshow
			$('.spotlight_slideshow').cycle({
				fx: 'scrollLeft', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
				timeout: 8000,
				pause: 1,
				pager: '#spotlight_slideshow_dots',
				pagerAnchorBuilder: function(idx, slide) {  
					return '<li><a href="#"></a></li>'; 
   				} 
			});
}

function setupNewsSlideshow() {
	//Creates the slideshow
			$('.news_slideshow').cycle({
				fx: 'scrollLeft', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
				timeout: 50000,
				pause: 1,
				pager: '#news_slideshow_dots',
				pagerAnchorBuilder: function(idx, slide) {  
					return '<li><a href="#"></a></li>'; 
   				} 
			});
}

function swapImage(thisImageName, thisImageFile) {
	document[thisImageName].src = thisImageFile;
}
	




function playThisVideo(thisVideo,thisTitle,thisDescription) {
	thisPlayer = document.getElementById("watch_player");
	thisPlayer.src = "http://player.vimeo.com/video/" + thisVideo + "?title=0&amp;byline=0&amp;portrait=0&amp;color=ff9933;";
	thisInfo = document.getElementById("watch_infobox");
	thisInfo.innerHTML = "<span class='watch_title'>" + thisTitle + "</span><br /><span class='watch_description'>" + thisDescription + "</span>";
	
}

function popupVimeo(thisVideo) {
	thisPlayer = document.getElementById("vimeo_player");
	thisPlayer.src = "http://player.vimeo.com/video/" + thisVideo + "?title=0&amp;byline=0&amp;portrait=0&amp;color=ff9933;";
	
}

function setupTwitter() {
	loadScript("http://twitter.com/javascripts/blogger.js");
	loadScript("http://twitter.com/statuses/user_timeline/cufilmfest.json?callback=twitterCallback2&amp;count=10");
}

function loadScript(filename) {
  var fileref=document.createElement('script')
  fileref.setAttribute("type","text/javascript")
  fileref.setAttribute("src", filename)
  document.getElementsByTagName("body")[0].appendChild(fileref);
}


