function onYouTubePlayerReady(playerId) {
	ytplayer = document.getElementById("traileryt");
}


moreScreenFunc = function() {
	
	var moreScreen;
	var mainContent;
	var thisSection;
	var thisSectionID;
	var clonedNode;
	var scrollers;
	var closeScreen;
	var scrollerTopAnchor;
	var scrollerBottomAnchor;
	var moreScreenHeight = 580;
	
	function hideMores() {
		var toHides = document.getElementsByTagName("div");
		
		for(var i=0; i < toHides.length; i++) {
			if(toHides[i].getAttribute("class") == "toHide"){
				toHides[i].style.height = "0";
				toHides[i].style.overflow = "hidden";
			}
		}
	}
	
	function hideCloneHides() {
		var toHides = moreScreen.getElementsByTagName("div");
		
		for(var i=0; i < toHides.length; i++) {
			var thisClass = toHides[i].getAttribute("class");
			
			if(thisClass) thisClass = thisClass.slice(0,9);
			
			if(thisClass == "cloneHide"){
				toHides[i].style.visibility = "hidden";
			}
		}
	}
	
	function showMore() {
		//check browser compatibility
		if (!document.getElementById) return false;
		if (!document.getElementsByTagName) return false;
		
		
		//function
		//create MORE Screen
		createMoreScreen();
		 
		 
		//hide the extra blurbs
		hideMores();
		
		
		//create array for all MORE links
		mainContent = document.getElementById("mainContent");
		var allContentLinks = document.getElementsByTagName("a");
		var moreLinks = [];
		
		for(var i=0; i < allContentLinks.length; i++) {
			var thisClass = allContentLinks[i].getAttribute("class") ? allContentLinks[i].getAttribute("class") : "empty";
			if(thisClass.indexOf("more") == 0) {
				moreLinks.push(allContentLinks[i]);
			}
		}
		
		//create onclick functionality for all MORE links
		for(i=0; i < moreLinks.length; i++) {
			moreLinks[i].onclick = function() {
				cloneSection(this);
				whichSection(this);
				moveElementBott("moreScreen",0,0,15);
				return false;
			}
		}
	}
	
	
	function cloneSection(elem) {
		if(clonedNode) {
			var ridSME = document.getElementById("scrollMoreElement");
			ridSME.style.top = "0";
			ridSME.setAttribute("id","");
			moreScreen.removeChild(clonedNode);
			clonedNode.style.height = "0";
			mainContent.appendChild(clonedNode);
		}
		
		var thisElementSect = elem.getAttribute("href").slice(1);
			
		if(!document.getElementById(thisElementSect)) return false;
		
		clonedNode = document.getElementById(thisElementSect);
		clonedNode.style.height = "100%";
		moreScreen.appendChild(clonedNode);
			
		var clonedDivs = clonedNode.getElementsByTagName("div");
		
		for(i=0; i < clonedDivs.length; i++) {
			var thisDivClass = clonedDivs[i].getAttribute("class");
			if (thisDivClass == "moreContentBlurb") {
				clonedDivs[i].setAttribute("id", "scrollMoreElement");
			}
		}
	
	
		var scrollElem = document.getElementById("scrollMoreElement");
		
		if(moreScreenHeight - 50 < scrollElem.clientHeight && thisElementSect != "trailer") {
			scrollers.style.visibility = "visible";
		
			var downLimt = moreScreenHeight - scrollElem.clientHeight -50;
			
			scrollerTopAnchor.onmouseover = function (){
				this.style.background = "transparent url(imgs/scrollerTopOv.png) no-repeat";
			}
			
			scrollerTopAnchor.onmouseout = function (){
				this.style.background = "transparent url(imgs/scrollerTop.png) no-repeat";
			}
			
			scrollerTopAnchor.onmousedown = function () {
				scrElem.scrollElement("scrollMoreElement",true,10,0,downLimt);
			}
			
			scrollerTopAnchor.onmouseup = function () {
				scrElem.stopScrollElement();
			}
			
			scrollerTopAnchor.onclick = function () {
				return false;
			}
			
			scrollerBottomAnchor.onmouseover = function (){
				this.style.background = "transparent url(imgs/scrollerBottomOv.png) no-repeat";
			}
			
			scrollerBottomAnchor.onmouseout = function (){
				this.style.background = "transparent url(imgs/scrollerBottom.png) no-repeat";
			}
			
			scrollerBottomAnchor.onmousedown = function () {
				scrElem.scrollElement("scrollMoreElement",false,10,0,downLimt);
			}
			
			scrollerBottomAnchor.onmouseup = function () {
				scrElem.stopScrollElement();
			}
			
			scrollerBottomAnchor.onclick = function () {
				return false;
			}
		} else {	
			 scrollers.style.visibility = "hidden";
		}
		
	}
	
	function whichSection(elem){
		var thisSectionClass = elem.getAttribute("href").slice(1);
		
		switch(thisSectionClass) {
			case "buyDvd":
				hideCloneHides();
				dvdUseScroll(clonedNode);
				break;
				
			case "news":
				/*var script= document.createElement('script');
				script.type= 'text/javascript';
				script.src= 'http://goodfortunefilm.tumblr.com/js?num=7';
				var tumblrDiv= document.createElement('div');
				
				tumblrDiv.style.width = "400px";
				tumblrDiv.style.height = "400px";
				tumblrDiv.style.backgroundColor = "#ff0";
				
				tumblrDiv.appendChild(script);
				clonedNode.appendChild(tumblrDiv);*/
				break;
				
			case "getInvolved":
				hideCloneHides();
				learnMoreScroll(clonedNode);
				break;
		}
		

		thisSection = document.getElementById(thisSectionID);
	}
	
	function createMoreScreen() {
		var edgeHeight = 40;
		
		moreScreen = document.createElement("div");
		moreScreen.setAttribute("id","moreScreen");
		
		moreScreen.style.position = "fixed";
		moreScreen.style.bottom = "-" + (moreScreenHeight + edgeHeight) + "px";
		moreScreen.style.width = "100%";
		moreScreen.style.height = moreScreenHeight + "px";
		moreScreen.style.overflow = "visible";
		moreScreen.style.backgroundColor = "#fff";
		moreScreen.style.zIndex = "400";
		
		
		closeScreen = document.createElement("div");
		var closeScreenAnchor = document.createElement("a");
		closeScreenAnchor.setAttribute("href","#")
		var closeAnchorImage = document.createElement("img");
		closeAnchorImage.setAttribute("src", "imgs/closeBtn.png");
		
		
		closeScreen.style.background = "transparent url(imgs/whiteEdge.png) repeat-x";
		closeScreen.style.textAlign = "right"
		closeScreen.style.height = edgeHeight +"px";
		closeScreen.style.padding = "0";
		closeScreen.style.paddingRight = "10px";
		closeScreen.style.marginTop = "-" + edgeHeight + "px";
		closeScreen.style.zIndex = "300";
		
		closeAnchorImage.style.marginTop = edgeHeight + "px";
		
		closeScreen.onclick = function() {
			if(ytplayer) {
				//alert("yt: " + ytplayer.getPlayerState());
				ytplayer.stopVideo();
			}
			moveElementBott("moreScreen",0,-(moreScreenHeight + edgeHeight),15);
			return false;
		}
		
		closeScreenAnchor.appendChild(closeAnchorImage);
		closeScreen.appendChild(closeScreenAnchor);
		
		
		scrollers = document.createElement("div");
		var scrollerTop = document.createElement("div");
		var scrollerBottom = document.createElement("div");
		scrollerTopAnchor = document.createElement("a");
		scrollerBottomAnchor = document.createElement("a");
		scrollerTopAnchor.setAttribute("href", "#");
		scrollerBottomAnchor.setAttribute("href", "#");
		
		scrollerTop.appendChild(scrollerTopAnchor);
		scrollerBottom.appendChild(scrollerBottomAnchor);
		scrollers.appendChild(scrollerTop);
		scrollers.appendChild(scrollerBottom);
		
		scrollers.style.position = "relative";
		scrollers.style.zIndex = "220";
		
		scrollerTopAnchor.style.display = "block";
		scrollerTopAnchor.style.position = "absolute";
		scrollerTopAnchor.style.background = "transparent url(imgs/scrollerTop.png) no-repeat";
		scrollerTopAnchor.style.width = "20px";
		scrollerTopAnchor.style.height = "50px";
		scrollerTopAnchor.style.left = "500px";
		scrollerTopAnchor.style.top = "240px";
		
		scrollerBottomAnchor.style.display = "block";
		scrollerBottomAnchor.style.position = "absolute";
		scrollerBottomAnchor.style.background = "transparent url(imgs/scrollerBottom.png) no-repeat";
		scrollerBottomAnchor.style.width = "20px";
		scrollerBottomAnchor.style.height = "50px";
		scrollerBottomAnchor.style.left = "500px";
		scrollerBottomAnchor.style.top = "310px";
		
		
		moreScreen.appendChild(closeScreen);
		moreScreen.appendChild(scrollers);
		document.body.appendChild(moreScreen);
	}
	
	return {
		showMore:showMore,
		hideMores:hideMores
	}
}();

addLoadEvent(moreScreenFunc.showMore);

//if(navigator.userAgent.match(/iPhone/i)) 

