// iphone redirect
if (navigator.userAgent.indexOf('iPhone') != -1) {
//    location.href = 'iphone.php';
}

function openViewer(fileName, fileHeight, fileWidth){
 	window.open(fileName, 'popWindow','width='+fileWidth+',height='+fileHeight+'');

}

// Here are my funcitons to toggle layers.

var buyState				= 0;
var trailerState			= 0;
var aboutStoryState			= 0;
var aboutPhotosState		= 0;
var aboutMakingState		= 0;
var aboutFilmmakersState	= 0;
var aboutCreditsState		= 0;
var aboutNavState			= 0;
var newsState				= 0;
var screeningsState			= 0;
var involvedState			= 0;
var pressState				= 0;
var contactState			= 0;



function tellMe(){
alert(
	'Buy: '+buyState+'\n'+
	'Trailer: '+trailerState+'\n'+
	'About Nav: '+aboutNavState+'\n'+
	'About Story: '+aboutStoryState+'\n'+
	'About Photos: '+aboutPhotosState+'\n'+
	'About Making: '+aboutMakingState+'\n'+
	'About Filmmakers: '+aboutFilmmakersState+'\n'+
	'About Credits: '+aboutCreditsState+'\n'+
	'News: '+newsState+'\n'+
	'Screenings: '+screeningsState+'\n'+
	'Involved: '+involvedState+'\n'+
	'Press: '+pressState+'\n'+
	'Contact: '+contactState+'\n'
);
}

function startUp(){
	MM_swapImage('nav_trailer','','images/nav_trailer_over.png',1);
/*
new Effect.Appear('navbar', {duration: 0.5,queue: 'end'});
new Effect.Appear('poster', {duration: 0.5,queue: 'end'});
new Effect.Appear('trailer', {duration: 0.5,queue: 'end'});
*/
return trailerState = 1;
}

function aboutNav(state){
if (state != null){
	if ((state == 'on') && (aboutNavState == 0)){
	new Effect.Appear('aboutNav', {duration: 0.5,queue: 'end'});
	return aboutNavState = 1;
	}
	if ((state == 'off') && (aboutNavState == 1)){
	new Effect.Fade('aboutNav', {duration: 0.5,queue: 'end'});
	return aboutNavState = 0;
	}
} else {
if (document.getElementById('aboutNav').style.display == 'none'){
	new Effect.Appear('aboutNav', {duration: 0.5,queue: 'end'});
	return aboutNavState = 1;
	} else {
	new Effect.Fade('aboutNav', {duration: 0.5,queue: 'end'});
	return aboutNavState = 0;
	}
}
}


function buy(state){
	if ((state == 'on') && (buyState == 0)){
			aboutNav('off');
			trailer('off');
			aboutStory('off');
			aboutPhotos('off');
			aboutMaking('off');
			aboutFilmmakers('off');
			aboutCredits('off');
			news('off');
			screenings('off');
			involved('off');
			press('off');
			contact('off');
			new Effect.Appear('buy', {duration: 0.5,queue: 'end'});
			return buyState = 1;
	}

	if ((state == 'off') && (buyState == 1)){
			new Effect.Fade('buy', {duration: 0.5});
			return buyState = 0;
	}
}


function trailer(state){
	if ((state == 'on') && (trailerState == 0)){
			aboutNav('off');
			buy('off');
			aboutStory('off');
			aboutPhotos('off');
			aboutMaking('off');
			aboutFilmmakers('off');
			aboutCredits('off');
			news('off');
			screenings('off');
			involved('off');
			press('off');
			contact('off');
			new Effect.Appear('trailer', {duration: 0.5,queue: 'end'});
			return trailerState = 1;
	}

	if ((state == 'off') && (trailerState == 1)){
			new Effect.Fade('trailer', {duration: 0.5});
			return trailerState = 0;
	}
}

function aboutStory(state){
	if ((state == 'on') && (aboutStoryState == 0)){
			aboutNav('off');
			buy('off');
			trailer('off');
			aboutPhotos('off');
			aboutMaking('off');
			aboutFilmmakers('off');
			aboutCredits('off');
			news('off');
			screenings('off');
			involved('off');
			press('off');
			contact('off');
			new Effect.Appear('aboutStory', {duration: 0.5,queue: 'end'});
			return aboutStoryState = 1;
	}

	if ((state == 'off') && (aboutStoryState == 1)){
			new Effect.Fade('aboutStory', {duration: 0.5});
			return aboutStoryState = 0;
	}
}

function aboutPhotos(state){
	if ((state == 'on') && (aboutPhotosState == 0)){
			aboutNav('off');
			buy('off');
			trailer('off');
			aboutStory('off');
			aboutMaking('off');
			aboutFilmmakers('off');
			aboutCredits('off');
			news('off');
			screenings('off');
			involved('off');
			press('off');
			contact('off');
			new Effect.Appear('aboutPhotos', {duration: 0.5,queue: 'end'});
			return aboutPhotosState = 1;
	}

	if ((state == 'off') && (aboutPhotosState == 1)){
			new Effect.Fade('aboutPhotos', {duration: 0.5});
			return aboutPhotosState = 0;
	}
}

function aboutMaking(state){
	if ((state == 'on') && (aboutMakingState == 0)){
			aboutNav('off');
			buy('off');
			trailer('off');
			aboutStory('off');
			aboutPhotos('off');
			aboutFilmmakers('off');
			aboutCredits('off');
			news('off');
			screenings('off');
			involved('off');
			press('off');
			contact('off');
			new Effect.Appear('aboutMaking', {duration: 0.5,queue: 'end'});
			return aboutMakingState = 1;
	}

	if ((state == 'off') && (aboutMakingState == 1)){
			new Effect.Fade('aboutMaking', {duration: 0.5});
			return aboutMakingState = 0;
	}
}

function aboutFilmmakers(state){
	if ((state == 'on') && (aboutFilmmakersState == 0)){
			aboutNav('off');
			buy('off');
			trailer('off');
			aboutStory('off');
			aboutPhotos('off');
			aboutMaking('off');
			aboutCredits('off');
			news('off');
			screenings('off');
			involved('off');
			press('off');
			contact('off');
			new Effect.Appear('aboutFilmmakers', {duration: 0.5,queue: 'end'});
			return aboutFilmmakersState = 1;
	}

	if ((state == 'off') && (aboutFilmmakersState == 1)){
			new Effect.Fade('aboutFilmmakers', {duration: 0.5});
			return aboutFilmmakersState = 0;
	}
}

function aboutCredits(state){
	if ((state == 'on') && (aboutCreditsState == 0)){
			aboutNav('off');
			buy('off');
			trailer('off');
			aboutStory('off');
			aboutPhotos('off');
			aboutMaking('off');
			aboutFilmmakers('off');
			news('off');
			screenings('off');
			involved('off');
			press('off');
			contact('off');
			new Effect.Appear('aboutCredits', {duration: 0.5,queue: 'end'});
			return aboutCreditsState = 1;
	}

	if ((state == 'off') && (aboutCreditsState == 1)){
			new Effect.Fade('aboutCredits', {duration: 0.5});
			return aboutCreditsState = 0;
	}
}




///////////////////////////////////////////
function news(state){
	if ((state == 'on') && (newsState == 0)){
			aboutNav('off');
			buy('off');
			trailer('off');
			aboutStory('off');
			aboutPhotos('off');
			aboutMaking('off');
			aboutFilmmakers('off');
			aboutCredits('off');
			screenings('off');
			involved('off');
			press('off');
			contact('off');
			new Effect.Appear('news', {duration: 0.5,queue: 'end'});
			return newsState = 1;
	}

	if ((state == 'off') && (newsState == 1)){
			new Effect.Fade('news', {duration: 0.5});
			return newsState = 0;
	}
}
function screenings(state){
	if ((state == 'on') && (screeningsState == 0)){
			aboutNav('off');
			buy('off');
			trailer('off');
			aboutStory('off');
			aboutPhotos('off');
			aboutMaking('off');
			aboutFilmmakers('off');
			aboutCredits('off');
			news('off');
			involved('off');
			press('off');
			contact('off');
			new Effect.Appear('screenings', {duration: 0.5,queue: 'end'});
			return screeningsState = 1;
	}

	if ((state == 'off') && (screeningsState == 1)){
			new Effect.Fade('screenings', {duration: 0.5});
			return screeningsState = 0;
	}
}
function involved(state){
	if ((state == 'on') && (involvedState == 0)){
			aboutNav('off');
			buy('off');
			trailer('off');
			aboutStory('off');
			aboutPhotos('off');
			aboutMaking('off');
			aboutFilmmakers('off');
			aboutCredits('off');
			news('off');
			screenings('off');
			press('off');
			contact('off');
			new Effect.Appear('involved', {duration: 0.5,queue: 'end'});
			return involvedState = 1;
	}

	if ((state == 'off') && (involvedState == 1)){
			new Effect.Fade('involved', {duration: 0.5});
			return involvedState = 0;
	}
}
function press(state){
	if ((state == 'on') && (pressState == 0)){
			aboutNav('off');
			buy('off');
			trailer('off');
			aboutStory('off');
			aboutPhotos('off');
			aboutMaking('off');
			aboutFilmmakers('off');
			aboutCredits('off');
			news('off');
			screenings('off');
			involved('off');
			contact('off');
			new Effect.Appear('press', {duration: 0.5,queue: 'end'});
			return pressState = 1;
	}

	if ((state == 'off') && (pressState == 1)){
			new Effect.Fade('press', {duration: 0.5});
			return pressState = 0;
	}
}
function contact(state){
	if ((state == 'on') && (contactState == 0)){
			aboutNav('off');
			buy('off');
			trailer('off');
			aboutStory('off');
			aboutPhotos('off');
			aboutMaking('off');
			aboutFilmmakers('off');
			aboutCredits('off');
			news('off');
			screenings('off');
			involved('off');
			press('off');
			new Effect.Appear('contact', {duration: 0.5,queue: 'end'});
			return contactState = 1;
	}

	if ((state == 'off') && (contactState == 1)){
			new Effect.Fade('contact', {duration: 0.5});
			return contactState = 0;
	}
}

function navStates(){
if (buyState				== 0){ MM_swapImage('nav_buy','','images/nav_buy.png',1) }
if (trailerState			== 0){ MM_swapImage('nav_trailer','','images/nav_trailer.png',1) }
if ((aboutStoryState == 0) && (aboutPhotosState == 0) && (aboutMakingState == 0) && (aboutFilmmakersState == 0) && (aboutCreditsState == 0) && (aboutNavState == 0)){ MM_swapImage('nav_about','','images/nav_about.png',1) }
if (newsState				== 0){ MM_swapImage('nav_news','','images/nav_news.png',1) }
if (screeningsState			== 0){ MM_swapImage('nav_screenings','','images/nav_screenings.png',1) }
if (involvedState			== 0){ MM_swapImage('nav_involved','','images/nav_involved.png',1) }
if (pressState				== 0){ MM_swapImage('nav_press','','images/nav_press.png',1) }
if (contactState			== 0){ MM_swapImage('nav_contact','','images/nav_contact.png',1) }
	
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
