// INITIAL DISPLAY FUNCTIONS -------------------------------



// GENERAL MENU MANAGEMENT FUNCTIONS -------------------------------


function markMenuBarChoice (selectedOption) {
	for (i=0;i<document.getElementsByTagName("span").length; i++) {
		if (document.getElementsByTagName("span").item(i).className == "menu_bar_item_on"){
			document.getElementsByTagName("span").item(i).className = "menu_bar_item_off";
			document.getElementsByTagName("span").item(i).MPStatus = "notSelected";
		}
	}
	document.getElementById(selectedOption).className = "menu_bar_item_on";
	document.getElementById(selectedOption).MPStatus = "selected";
}

function markMenuLeftChoice (selectedOption) {
	for (i=0;i<document.getElementsByTagName("span").length; i++) {
		if (document.getElementsByTagName("span").item(i).className == "menu_left_item_on"){
			document.getElementsByTagName("span").item(i).className = "menu_left_item_off";
			document.getElementsByTagName("span").item(i).MPStatus = "notSelected";
		}
	}
	document.getElementById(selectedOption).className = "menu_left_item_on";
	document.getElementById(selectedOption).MPStatus = "selected";
}


function showSelectedContent (selectedOption) {
	for (i=0;i<document.getElementsByTagName("div").length; i++) {
		if (document.getElementsByTagName("div").item(i).className == "body_content_on"){
			document.getElementsByTagName("div").item(i).className = "body_content_off";
		}
	}
	document.getElementById(selectedOption).className = "body_content_on";

}


function showSelectedFrameContent (selectedFile) {
	document.getElementById("SUBFRAME").src = selectedFile;
}




function displayGeneralELink (EName, EAddress, EType) {
	email = EName;
	address = EAddress;
	addressType =  EType;
	displayText = email + '@' + address + '.' + addressType;
	document.write('<a href=\"mailto:' + email + '@' + address + '.' + addressType + '\" Title=\"\">');
	document.write(displayText + '</a>');
	} 



// DISPLAY CONTENT --------------------------------------------------------

function displayRequestedContent (requestedArea) {

// THE MOVIE --------------------------------------
	if (requestedArea == "THEMOVIEABOUT") {
		FDsourceContentFile="themovie_about.html";
		displayOption="block";
		}

	if (requestedArea == "THEMOVIEWHY") {
		FDsourceContentFile="themovie_why.html";
		displayOption="block";
		}

	if (requestedArea == "THEMOVIESCREENINGS") {
		FDsourceContentFile="themovie_screenings.html";
		displayOption="block";
		}

	if (requestedArea == "THEMOVIEPHOTOS") {
		FDsourceContentFile="themovie_photos.html";
		displayOption="none";
		}

	if (requestedArea == "THEMOVIESPECS") {
		FDsourceContentFile="themovie_specs.html";
		displayOption="block";
		}

		
// CAST AND CREW --------------------------------------
	if (requestedArea == "CCABOUTVICKI") {
		FDsourceContentFile="cc_vicki.html";
		displayOption="block";
		}

	if (requestedArea == "CCMICHELLE") {
		FDsourceContentFile="cc_michelle.html";
		displayOption="block";
		}

	if (requestedArea == "CCKIM") {
		FDsourceContentFile="cc_kim.html";
		displayOption="block";
		}

	if (requestedArea == "CCSUSAN") {
		FDsourceContentFile="cc_susan.html";
		displayOption="block";
		}

	if (requestedArea == "CCMARK") {
		FDsourceContentFile="cc_mark.html";
		displayOption="block";
		}

	if (requestedArea == "CCMONICA") {
		FDsourceContentFile="cc_monica.html";
		displayOption="block";
		}

	if (requestedArea == "CCBILL") {
		FDsourceContentFile="cc_bill.html";
		displayOption="block";
		}

	if (requestedArea == "CCDARCEL") {
		FDsourceContentFile="cc_darcel.html";
		displayOption="block";
		}

	if (requestedArea == "CCFULLCREDITS") {
		FDsourceContentFile="cc_full_credits.html";
		displayOption="block";
		}

	if (requestedArea == "CCTHANKS") {
		FDsourceContentFile="cc_thanks.html";
		displayOption="block";
		}


// PRESS --------------------------------------
	if (requestedArea == "PRESSFILM415") {
		FDsourceContentFile="press_film-415.html";
		displayOption="block";
		}

	if (requestedArea == "PRESSEASTBAY") {
		FDsourceContentFile="press_east_bay.html";
		displayOption="block";
		}

	if (requestedArea == "PRESSCURVEMOVIE") {
		FDsourceContentFile="press_curve_FGST.html";
		displayOption="block";
		}

	if (requestedArea == "PRESSCURVEINTERVIEW") {
		FDsourceContentFile="press_curve_ML_interview.html";
		displayOption="block";
		}

	if (requestedArea == "PRESSNYT") {
		FDsourceContentFile="press_vicki_in_NYT.html";
		displayOption="block";
		}

	if (requestedArea == "PRESSQDOC") {
		FDsourceContentFile="press_qdoc.html";
		displayOption="block";
		}


// CONTACT US--------------------------------------
	if (requestedArea == "INFO") {
		FDsourceContentFile="contact_info.html";
		displayOption="block";
		}

	if (requestedArea == "EMAIL") {
		FDsourceContentFile="contact_email.html";
		displayOption="none";

		}

	document.getElementById("SUBFRAME").src=FDsourceContentFile;
	document.getElementById('FLOATLINKS').style.display=displayOption;

}

function toggleFloatLinks (state) {
	if (state == "off") {
		document.getElementById('FLOATLINKS').style.display="none";
		}
	else {
		document.getElementById('FLOATLINKS').style.display="block";
		}
}


function showSubPageBanner () {

   if ( !parent.frames['sub_content'] ) {
 
		document.getElementById("SUBFRAMEBANNER").className="FGST_banner_frame_on";

		}
		
	else {

		document.getElementById("SUBFRAMEBANNER").className="FGST_banner_frame_off";
	
		}
	}
	
function launchShell(shellPage,frameTargetCode) {

   if ( !parent.frames['sub_content'] ) {
 	frameTarget = shellPage + "?requestedINFO=" + frameTargetCode;
	window.location = frameTarget ;
		}
	}


// PHOTO SHOW ----------------------------------------------------

var timer; 

var curImage=-1;
var curCaption=-1;


function runPhotoShow () {
stopPhotoShowHere () ;
timer=setTimeout("swapPicture()", 6000);
}

function stopPhotoShow () {
clearTimeout(timer);
curImage=-1;
curCaption=-1;
// alert("curImage: " + curImage);
}

function stopPhotoShowHere () {
clearTimeout(timer);
// alert("curImage: " + curImage);
}


function swapPicture() {

var dimages=new Array();
var numImages=10;
dimages[0]=new Image();
dimages[0].src="images/show/photo_show_01.jpg";
dimages[1]=new Image();
dimages[1].src="images/show/photo_show_02.jpg";
dimages[2]=new Image();
dimages[2].src="images/show/photo_show_03.jpg";
dimages[3]=new Image();
dimages[3].src="images/show/photo_show_04.jpg";
dimages[3]=new Image();
dimages[3].src="images/show/photo_show_05.jpg";
dimages[3]=new Image();
dimages[3].src="images/show/photo_show_06.jpg";
dimages[3]=new Image();
dimages[3].src="images/show/photo_show_07.jpg";
dimages[3]=new Image();
dimages[3].src="images/show/photo_show_08.jpg";
dimages[3]=new Image();
dimages[3].src="images/show/photo_show_09.jpg";
dimages[3]=new Image();
dimages[3].src="images/show/photo_show_10.jpg";

curPhotoCaptionGroupSize = 10;
var captions=new Array();
var numCaptions=curPhotoCaptionGroupSize;
captions[0]="1";
captions[1]="2";
captions[2]="3";
captions[3]="4";
captions[4]="5";
captions[5]="6";
captions[6]="7";
captions[7]="8";
captions[8]="9";
captions[9]="10";



  var nextImage=curImage+1;
  var nextCaption=curCaption+1;

//alert("Image Index " + nextImage);
//alert("Caption Index " + nextCaption);

  if (document.images)
  {
    if (nextImage>=numImages)
      nextImage=0;
    if (dimages[nextImage] && dimages[nextImage].complete)
    {
      var target=0;
      if (document.images.PRODPHOTO)
        target=document.images.PRODPHOTO;
      if (document.all && document.getElementById("PRODPHOTO"))
        target=document.getElementById("PRODPHOTO");
  
      // make sure target is valid.  It might not be valid
      //   if the page has not finished loading
      if (target)
      {
        target.src=dimages[nextImage].src;
 //	alert(nextImage);



	if (nextCaption>=numCaptions) {

		nextCaption=0;

		}

				
//alert("Next Image " + nextImage);
//alert("Next Caption " + nextCaption);


		nextPhotoCaptionId = "PHOTOCAP" +  captions[nextCaption];

				
//alert("Current PhotoID " + curPhotoCaptionId);
//alert("Next PhotoID " + nextPhotoCaptionId);

	for (i=0;i<document.getElementsByTagName("div").length; i++) {
		if (document.getElementsByTagName("div").item(i).className == "photo_show_text_on"){
			document.getElementsByTagName("div").item(i).className = "photo_show_text_off";
		}
	}

	document.getElementById(nextPhotoCaptionId).className="photo_show_text_on";

        curImage=nextImage;
	curCaption=nextCaption;
      }

     timer=setTimeout("swapPicture()", 6000);

    }
    else
    {
      timer=setTimeout("swapPicture()", 6000);
    }
  }
}


function nextPhoto () {

stopPhotoShowHere () ;

	curPhotoFile = document.getElementById("PRODPHOTO").src;
	curPhotoFileRoot = curPhotoFile.substr(0, curPhotoFile.length-6);
	curPhotoFileGroupSize = 10;
	curPhotoFileEnd = curPhotoFile.substr(curPhotoFile.length-6);
	curPhotoNumber = curPhotoFileEnd.substr(0, 2);

	if (Number(curPhotoNumber)>=curPhotoFileGroupSize) {
		nextPhotoNumber = "01"
		nextPhotoCaptionId = "PHOTOCAP1";
		}

	else	{
		nextPhotoNumber = Number(curPhotoNumber) + 1;
		curCaptionNo = Number(curPhotoNumber);
		nextCaptionNo = curCaptionNo +1;
		nextPhotoCaptionId = "PHOTOCAP" + nextPhotoNumber;
	
		}

	nextPhotoNumber = nextPhotoNumber + "";

	if (nextPhotoNumber.length==1) {
		nextPhotoNumber = "0" + nextPhotoNumber + "";
		}

	nextPhotoFileName = curPhotoFileRoot + nextPhotoNumber + ".jpg";

	document.getElementById("PRODPHOTO").src=nextPhotoFileName;

	for (i=0;i<document.getElementsByTagName("div").length; i++) {
		if (document.getElementsByTagName("div").item(i).className == "photo_show_text_on"){
			document.getElementsByTagName("div").item(i).className = "photo_show_text_off";
		}
	}

	document.getElementById(nextPhotoCaptionId).className="photo_show_text_on";

}


function previousPhoto () {
stopPhotoShowHere () ;


	curPhotoFile = document.getElementById("PRODPHOTO").src;
	curPhotoFileRoot = curPhotoFile.substr(0, curPhotoFile.length-6);
	curPhotoFileGroupSize = 10;
	curPhotoFileEnd = curPhotoFile.substr(curPhotoFile.length-6);
	curPhotoNumber = curPhotoFileEnd.substr(0, 2);

	if (curPhotoNumber==1) {
		nextPhotoNumber = "10"
		nextPhotoCaptionId = "PHOTOCAP4";
		}

	else	{
		nextPhotoNumber = Number(curPhotoNumber) - 1;
		curCaptionNo = Number(curPhotoNumber);
		nextCaptionNo = curCaptionNo - 1;
		nextPhotoCaptionId = "PHOTOCAP" + nextPhotoNumber;
	
		}

	nextPhotoNumber = nextPhotoNumber + "";

	if (nextPhotoNumber.length==1) {
		nextPhotoNumber = "0" + nextPhotoNumber + "";
		}

	nextPhotoFileName = curPhotoFileRoot + nextPhotoNumber + ".jpg";

	document.getElementById("PRODPHOTO").src=nextPhotoFileName;

	for (i=0;i<document.getElementsByTagName("div").length; i++) {
		if (document.getElementsByTagName("div").item(i).className == "photo_show_text_on"){
			document.getElementsByTagName("div").item(i).className = "photo_show_text_off";
		}
	}

	document.getElementById(nextPhotoCaptionId).className="photo_show_text_on";

}



