var transitionTime = 350;

function previousContent(){
	var nextContent = currentContent - 1;
	var myName = "#subContent" + currentContent;
	$(myName).css({display:"none"});
	$("#subContentShowAll").css({display:"none"});
	
	myName = "#subContent" + nextContent; 
	if(nextContent > 0){
		currentContent = nextContent;
	}
	else{
		myName = "#subContent" + maxContent;
		currentContent = maxContent;
	}
	$(myName).fadeIn(transitionTime);
}

function nextContent(){
	var nextContent = currentContent + 1;
	var myName = "#subContent" + currentContent;
	$(myName).css({display:"none"});
	$("#subContentShowAll").css({display:"none"});
	
	myName = "#subContent"; 
	if(nextContent <= maxContent){
		myName += nextContent;
		currentContent = nextContent;
	}
	else{
		myName += 1
		currentContent = 1;
	}
	$(myName).fadeIn(transitionTime);
}

function showThisContent(myContent){
	currentContent = myContent - 1;
	nextContent();
} 
function showAllContent(){
	var myName = "#subContent" + currentContent;
	$(myName).css({display:"none"});
	$("#leftContentBottomNavigation").css({display:"none"});
	
	$("#subContentShowAll").fadeIn(transitionTime);
	$("#leftContentBottomNavigation").fadeIn(transitionTime);
}


function showContent(newContent){
	var myName = "#" + currentContentName;
	var myNewName = "#" + newContent;
	$(myName).css({display:"none"});
	
	$(myNewName).fadeIn(transitionTime);
	currentContentName = newContent;
}


function nextPhoto(){
	var nextPhoto = currentPhoto + 1;
	if(nextPhoto > maxPhoto){
		nextPhoto = 1;
	}
	var myPhoto = "<img src='images/behindScenes/bts" + nextPhoto + ".jpg'>";
	$("#photo").css({display:"none"});
	$("#photo").html(myPhoto).fadeIn(transitionTime);
	currentPhoto = nextPhoto;
}

function previousPhoto(){
	var nextPhoto = currentPhoto - 1;
	if(nextPhoto <= 0){
		nextPhoto = maxPhoto;
	}
	var myPhoto = "<img src='images/behindScenes/bts" + nextPhoto + ".jpg'>";
	$("#photo").css({display:"none"});
	$("#photo").html(myPhoto).fadeIn(transitionTime);
	currentPhoto = nextPhoto;
}


function loadIt(){
	
	if(document.location.toString().indexOf("index.html") > 1 || document.location.toString().indexOf(".html") < 0){
		getElement("menuHome").style.visibility = "hidden";
	}
}

function viewContent(myContent){
	
	getElement("menuHome").style.visibility = "visible"
	if(myContent == "rightContentHome"){
		$("#mainTable").css('background-image','url(images/homebkg2.jpg)');
		getElement("menuHome").style.visibility = "hidden"
	}
	if(myContent == "rightContentCast"){
		$("#mainTable").css('background-image','url(images/castlist-bkgrnd-DH.jpg)');
	}
	
	myContent = "#" + myContent;
	$("#rightContentHome").hide("fast");
	$("#rightContentCast").hide("fast");
	$(myContent).show("fast");
}

function getElement(element){
	return document.getElementById(element);
}
