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

<!--
function MM_changeProp(objId,x,theProp,theValue) { //v9.0
  var obj = null; with (document){ if (getElementById)
  obj = getElementById(objId); }
  if (obj){
    if (theValue == true || theValue == false)
      eval("obj.style."+theProp+"="+theValue);
    else eval("obj.style."+theProp+"='"+theValue+"'");
  }
}
//-->

// Here are my funcitons to toggle layers.

var directorMenuState	= 0;
var videoState			= 0;
var isPlaying			= 0;
var theFilm				= null;
var theFilmLayer		= null;





 function getFlashMovie(movieName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
 }
 
function fader(movie,direction,color,speed){
flashMovie=getFlashMovie(movie);
if (direction == "in"){
     flashMovie.JSFadeIn(color,speed);
	} else if (direction == "out"){
	flashMovie.JSFadeOut(color,speed);
	}

}



function tellMe(){
alert(window.document.getElementById('4_hi'));
}

var sPath = window.location.pathname;
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
//alert (sPage);

Array.prototype.in_array = function ( obj ) {
	var len = this.length;
	for ( var x = 0 ; x <= len ; x++ ) {
		if ( this[x] == obj ) return true;
	}
	return false;
}
function is_string( mixed_var ){
    // *     example 1: is_string('23');
    // *     returns 1: true
    // *     example 2: is_string(23.5);
    // *     returns 2: false
    return (typeof( mixed_var ) == 'string');
}


function directorNav(state){

if (state != null){
		if ((state == 'on') && (directorMenuState == 0)){
			document.getElementById('directorNav').style.visibility = 'visible';
			return directorMenuState = 1;
		}
		if ((state == 'off') && (directorMenuState == 1)){
			document.getElementById('directorNav').style.visibility = 'hidden';
			return directorMenuState = 0;
		}
	} else {
		if (document.getElementById('directorNav').style.visibility == 'hidden'){
			document.getElementById('directorNav').style.visibility = 'visible';
			return directorMenuState = 1;
		} else {
			document.getElementById('directorNav').style.visibility = 'hidden';
			return directorMenuState = 0;
		}
	}
	return isPlaying;
}

function contentNav(state){

if (state != null){
		if ((state == 'on') && (contentMenuState == 0)){
			document.getElementById('contentNav').style.visibility = 'visible';
			return contentMenuState = 1;
		}
		if ((state == 'off') && (contentMenuState == 1)){
			document.getElementById('contentNav').style.visibility = 'hidden';
			return contentMenuState = 0;
		}
	} else {
		if (document.getElementById('contentNav').style.visibility == 'hidden'){
			document.getElementById('contentNav').style.visibility = 'visible';
			return contentMenuState = 1;
		} else {
			document.getElementById('contentNav').style.visibility = 'hidden';
			return contentMenuState = 0;
		}
	}
	return isPlaying;
}


function directorNavOld(state){
t=new Array("f00v","f02v","f03v","f04v","f05v","f06v","f07v");

	if (state != null){
		if ((state == 'on') && (directorMenuState == 0)){
			
			/* this was all the junk to pause the movies for the dirnav
			if(navigator.appVersion.indexOf("MSIE")!=-1){
				thisDirectorVideo = window.document.theVideo;
			} else {
				thisDirectorVideo = document.embeds['theVideo'];
			}

			if ((thisDirectorVideo)&&(sPage == 'director.php')){
				isPlaying = thisDirectorVideo.GetRate();
				thisDirectorVideo.Stop();
				document.getElementById('directorVideo').style.visibility = 'hidden';
			}
			if (t.in_array(theFilm) == 1) {
				if (navigator.appVersion.indexOf("MSIE")!=-1){
					thisVideo = document.getElementById(theFilm);
				} else {
					thisVideo = document.embeds[theFilm];
				}

				isPlaying = thisVideo.GetRate();
				thisVideo.Stop();
				document.getElementById(theFilmLayer).style.visibility = 'hidden';
				}
			and here that stuff ends */
			new Effect.Appear('directorNav', {duration: 0.5,queue: 'end'});
			return directorMenuState = 1;
		}
		if ((state == 'off') && (directorMenuState == 1)){
			new Effect.Fade('directorNav', {duration: 0.2,queue: 'end'});
			/* this was all the junk to pause the movies for the dirnav
			if(navigator.appVersion.indexOf("MSIE")!=-1){
				thisDirectorVideo = window.document.theVideo;
			} else {
				thisDirectorVideo = document.embeds['theVideo'];
			}
			if ((thisDirectorVideo)&&(sPage == 'director.php')){
				document.getElementById('directorVideo').style.visibility = 'visible';
				if (isPlaying == 1){
					setTimeout('thisDirectorVideo.Play()',1000);
				}
			}
			if ((theFilm)&&(t.in_array(theFilm)) == 1) {
				document.getElementById(theFilmLayer).style.visibility = 'visible';
				if (navigator.appVersion.indexOf("MSIE")!=-1){
					thisVideo = document.getElementById(theFilm);
				} else {
					thisVideo = document.embeds[theFilm];
				}
				if (isPlaying == 1){
					setTimeout('thisVideo.Play()',1000);
				}
			}
			*/
			return directorMenuState = 0;
		}
	} else {
		if (document.getElementById('directorNav').style.display == 'none'){
			/* this was all the junk to pause the movies for the dirnav
			if(navigator.appVersion.indexOf("MSIE")!=-1){
				thisDirectorVideo = window.document.theVideo;
			} else {
				thisDirectorVideo = document.embeds['theVideo'];
			}
			if ((thisDirectorVideo)&&(sPage == 'director.php')){
				isPlaying = thisDirectorVideo.GetRate();
				thisDirectorVideo.Stop();
				document.getElementById('directorVideo').style.visibility = 'hidden';
			}
			if ((theFilm)&&(t.in_array(theFilm) == 1)) {
				if (navigator.appVersion.indexOf("MSIE")!=-1){
					thisVideo = document.getElementById(theFilm);
				} else {
					thisVideo = document.embeds[theFilm];
				}

				isPlaying = thisVideo.GetRate();
				thisVideo.Stop();
				document.getElementById(theFilmLayer).style.visibility = 'hidden';
				}
				*/
			new Effect.Appear('directorNav', {duration: 0.5,queue: 'end'});
			return directorMenuState = 1;
		} else {
			new Effect.Fade('directorNav', {duration: 0.2,queue: 'end'});
			/* this was all the junk to pause the movies for the dirnav
			if(navigator.appVersion.indexOf("MSIE")!=-1){
				thisDirectorVideo = window.document.theVideo;
			} else {
				thisDirectorVideo = document.embeds['theVideo'];
			}
			if ((thisDirectorVideo)&&(sPage == 'director.php')){
				document.getElementById('directorVideo').style.visibility = 'visible';
				if (isPlaying == 1){
					setTimeout('thisDirectorVideo.Play()',1000);
				}
			}
			if ((theFilm)&&(t.in_array(theFilm)) == 1) {
				document.getElementById(theFilmLayer).style.visibility = 'visible';
				if (navigator.appVersion.indexOf("MSIE")!=-1){
					thisVideo = document.getElementById(theFilm);
				} else {
					thisVideo = document.embeds[theFilm];
				}
				if (isPlaying == 1){
					setTimeout('thisVideo.Play()',1000);
				}
			}
			*/
				return directorMenuState = 0;
		}
	}
	return isPlaying;
}

function directorPage(director_id){
// ajax call to get director info
//	getDirectorData(director_id);
/*
	document.getElementById('O').style.display = 'none';
	document.getElementById('O').src = 'images/logo.png';
	new Effect.Appear('O', {duration: 0.5,queue: 'end'});
*/
//	new Effect.Appear('footer', {duration: 0.5,queue: 'end'});
	new Effect.Appear('directorPage', {duration: 0.5,queue: 'end'});
	}

function getDirectorData(director_id){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('directorPage');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}

	var director_id = director_id;
	var queryString = "?director_id="+director_id;
	ajaxRequest.open("GET", "directors.php" + queryString, true);
	ajaxRequest.send(null); 
}


function directorVideo(video_id){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('directorVideo');
			if (haveqt == false) {
				ajaxDisplay.innerHTML = qtmessage;
			} else {
			if (video_id != null){
				ajaxDisplay.innerHTML = ajaxRequest.responseText;
				videoState = 1;
			} else {
				ajaxDisplay.innerHTML = "";
			}
			}
		}
	}

	var video_id = video_id;
	var queryString = "?video_id="+video_id;
	ajaxRequest.open("GET", "video.php" + queryString, true);
	ajaxRequest.send(null); 
}

function directorPlayAll(director_id){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('directorVideo');
			if (haveqt == false) {
				ajaxDisplay.innerHTML = qtmessage;
			} else {
			if (director_id != null){
				//alert(ajaxRequest.responseText);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
			videoState = 1;
			} else {
			ajaxDisplay.innerHTML = "";
			}
			}
		//alert(ajaxDisplay.innerHTML);
		}
	}

	var director_id = director_id;
	var queryString = "?director_id="+director_id;
	ajaxRequest.open("GET", "playall.php" + queryString, true);
	ajaxRequest.send(null); 
}



function getQueryVariable(variable) {

  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
}

function startUp(){
var sPath = window.location.pathname;
//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
var page = sPath.substring(sPath.lastIndexOf('/') + 1);

	switch(page)
	{
	case 'index.php':
//		new Effect.Fade('O', {duration: 0.5,queue: 'end'});
//		document.getElementById('O').src = 'images/logo.png';
//		new Effect.Appear('O', {duration: 0.5,queue: 'end'});
		new Effect.Appear('homeLayer', {duration: 0.5,queue: 'end'});
		new Effect.Appear('roots', {duration: 0.5,queue: 'end'});
		break;
	case 'films.php':
//		document.getElementById('O').style.display = 'none';
//		document.getElementById('O').src = 'images/logo.png';
//		document.getElementById('footer').style.top = '750px';
//		new Effect.Appear('O', {duration: 0.5,queue: 'end'});
//		new Effect.Appear('footer', {duration: 0.5,queue: 'end'});
		new Effect.Appear('filmPage', {duration: 0.5,queue: 'end'});
		break;
	case 'tomato.php':
//		document.getElementById('O').style.display = 'none';
//		document.getElementById('O').src = 'images/logo.png';
//		document.getElementById('footer').style.top = '865px';
//		new Effect.Appear('O', {duration: 0.5,queue: 'end'});
//		new Effect.Appear('footer', {duration: 0.5,queue: 'end'});
		new Effect.Appear('filmPage', {duration: 0.5,queue: 'end'});
		break;
	case 'tomato-reel.php':
//		document.getElementById('O').style.display = 'none';
//		document.getElementById('O').src = 'images/logo.png';
//		document.getElementById('footer').style.top = '750px';
//		new Effect.Appear('O', {duration: 0.5,queue: 'end'});
//		new Effect.Appear('footer', {duration: 0.5,queue: 'end'});
		new Effect.Appear('filmPage', {duration: 0.5,queue: 'end'});
		break;
	case 'contact.php':
		//fixContacts();
/*
		document.getElementById('O').style.display = 'none';
		document.getElementById('O').src = 'images/logo.png';
		new Effect.Appear('O', {duration: 0.5,queue: 'end'});
*/
//		new Effect.Appear('footer', {duration: 0.5,queue: 'end'});
		new Effect.Appear('contactPage', {duration: 0.5,queue: 'end'});
		break;
	case 'about.php':
/*
		document.getElementById('O').style.display = 'none';
		document.getElementById('O').src = 'images/logo.png';
		new Effect.Appear('O', {duration: 0.5,queue: 'end'});
*/
//		new Effect.Appear('footer', {duration: 0.5,queue: 'end'});
		new Effect.Appear('aboutPage', {duration: 0.5,queue: 'end'});
		break;
	case 'director.php':
		var director_id = getQueryVariable('director_id');
		if (director_id != null){
			directorPage(director_id);
		} else {
			self.location = 'index.php';
		}
		break;
	default:
/*
		document.getElementById('O').src = 'images/logo.png';
		new Effect.Appear('O', {duration: 0.5,queue: 'end'});
*/
		new Effect.Appear('homeLayer', {duration: 0.5,queue: 'end'});
		new Effect.Appear('roots', {duration: 0.5,queue: 'end'});
		break;    
	}
}

function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

function showContact(thisContact,thisAnchor){
	var x;
	var contacts = new Array();
	contacts[0] = "london-ep-1_contact";
	contacts[1] = "london-ep-2_contact";
	contacts[2] = "kat_contact";
	contacts[3] = "boss_contact";
	contacts[4] = "sue_contact";
	contacts[5] = "la_contact";
	contacts[6] = "ny_contact";
	contacts[7] = "lon_contact";
	contacts[8] = "brad_contact";
	contacts[9] = "bethany_contact";
	contacts[10] = "morgan_contact";


	Array.prototype.remove=function(s){
	  for(i=0;i<this .length;i++){
		if(s==this[i]) this.splice(i, 1);
	  }
	}
	contacts.remove(thisContact);
	
	for (x in contacts){
			if (document.getElementById(contacts[x])){
			new Effect.Fade(contacts[x], {duration: 0.5});
			}
		}
	setTimeout("new Effect.Appear('"+thisContact+"', {duration: 0.5})",500);
}

function fixContacts(){
if (navigator.appVersion.indexOf("MSIE")!=-1){
	var x;
	var contacts = new Array();
	contacts[0] = "fiona_contact";
	contacts[1] = "jamie_contact";
	contacts[2] = "kat_contact";
	contacts[3] = "boss_contact";
	contacts[4] = "sue_contact";
	contacts[5] = "la_contact";
	contacts[6] = "ny_contact";
	contacts[7] = "lon_contact";
	contacts[8] = "brad_contact";
	contacts[9] = "bethany_contact";

	for (x in contacts){
		if (document.getElementById(contacts[x])){
			if ((x == 5) || (x == 6) || (x == 7)){ // contact bubbles
				topIE = parseInt(document.getElementById(contacts[x]).style.top) - 38;
				leftIE = parseInt(document.getElementById(contacts[x]).style.left) - 10;
			} else {
				topIE = parseInt(document.getElementById(contacts[x]).style.top) - 18;
				leftIE = parseInt(document.getElementById(contacts[x]).style.left) + 10;
			}
				
			document.getElementById(contacts[x]).style.top = topIE;
			document.getElementById(contacts[x]).style.left = leftIE;
		}
	}
}
}



function showFilm(thisFilm){
	var films = new Array();
	films[0] = "f00";
	films[1] = "f01";
	films[2] = "f02";
	films[3] = "f03";
	films[4] = "f04";
	films[5] = "f05";
	films[6] = "f06";
	films[7] = "f07";
	films[8] = "f08";
	films[9] = "f09";
	films[10] = "f10";
	films[11] = "f11";
	films[12] = "f12";
	films[13] = "f13";
	films[14] = "f14";
	films[15] = "f15";
	films[16] = "f16";
	films[17] = "f17";
	films[18] = "f18";
	films[19] = "f19";
	films[20] = "f20";

	Array.prototype.remove=function(s){
	  for(i=0;i<this .length;i++){
		if(s==this[i]) this.splice(i, 1);
	  }
	}
	
	if ((navigator.appVersion.indexOf("MSIE")!=-1) && (document.getElementById(theFilm))){
	try {
	document.getElementById(theFilm).Stop();
	} catch (err) {
	alert(err);	
	}

}

	theFilm = thisFilm+'v';

	theFilmLayer = thisFilm;
	films.remove(thisFilm);
	
	for (x in films){
			if (document.getElementById(films[x])){
				new Effect.Fade(films[x], {duration: 0.5});
			}
	}

	setTimeout("new Effect.Appear('"+thisFilm+"', {duration: 0.5})",500);
}


function showHideElement(theElement){
if (document.getElementById(theElement).style.visibility == 'visible'){
	document.getElementById(theElement).style.visibility = 'hidden';
	} else {
	document.getElementById(theElement).style.visibility = 'visible';
	}
}


function rollover(obj,frame){
obj.GotoFrame(frame);
obj.Play();
}


function showGridContent(thisGridItem){
	var gridItems = new Array();
	gridItems[0] = "gridContent0";
	gridItems[1] = "gridContent1";
	gridItems[2] = "gridContent2";
	gridItems[3] = "gridContent3";
	gridItems[4] = "gridContent4";
	gridItems[5] = "gridContent5";
	gridItems[6] = "gridContent6";
	gridItems[7] = "gridContent7";
	gridItems[8] = "gridContent8";
	gridItems[9] = "gridContent9";
	gridItems[10] = "gridContent10";
	gridItems[11] = "gridContent11";
	gridItems[12] = "gridContent12";
	gridItems[13] = "gridContent13";
	gridItems[14] = "gridContent14";
	gridItems[15] = "gridContent15";
	gridItems[16] = "gridContent16";

	Array.prototype.remove=function(s){
	  for(i=0;i<this .length;i++){
		if(s==this[i]) this.splice(i, 1);
	  }
	}
	

	gridItems.remove(thisGridItem);
	
	for (x in gridItems){
			if (document.getElementById(gridItems[x])){
				new Effect.Fade(gridItems[x], {duration: 0.5});
			}
	}

	setTimeout("new Effect.Appear('"+thisGridItem+"', {duration: 0.5})",500);
}





/* Macromedia image rollover code */
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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];}
}
/* Macromedia image rollover code */



