﻿var haveqt = false;
var qtversion = 0;
function drawMenuItem(menuURL,menuText,menuHint,menuImage,menuSelImage,imageName)
{
if (menuURL != currentPage) {
document.write('<p class="menutext"><a onclick="javascript:document.location.href=\'' + menuURL + '\';" href="' + menuURL + '"><img name=' + imageName + ' src="' + menuImage + '" border="0" height="75" width="200"/><br/>' + menuText + '</a></p><link rel="prefetch" href="'+ menuURL + '">');
}
else {
document.write('<p class="menutextbold"><img src="' + menuSelImage + '" height="75" width="200"/><br/>' + menuText + '</p>');
}
}

function simpleDrawMovie(movieURL,posterURL)
{
var theMovieObject;
var theClassId = "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";
var theCodeBase = "http://www.apple.com/qtactivex/qtplugin.cab";
var thePluginsPage = "http://www.apple.com/quicktime/download/";
var objectHeight = "240";
var objectWidth = "320";
var objectId = "homemovieclip";
var theSrc = posterURL;
var theHREF = movieURL;
var autoplay = "TRUE";
var looping = "TRUE";
var showController = "TRUE";
var autoHREF = "TRUE";
var theType = "video/quicktime";
var theTarget = "myself";
var cache = "TRUE";
var enableJavascript = "true";
var shouldSaveEmbedTags = "TRUE";
	
theMovieObject = "<object classid=\"" + theClassId + "\" codebase=\"" + theCodeBase + "\" height=\"" + objectHeight + "\" width=\"" + objectWidth + "\" id=\"" + objectId + "\"><PARAM NAME=\"LOOP\" VALUE=\"" + looping + "\"><PARAM NAME=\"SAVEEMBEDTAGS\" VALUE=\"" + shouldSaveEmbedTags + "\"><PARAM NAME=\"enablejavascript\" VALUE=\"" + enableJavascript + "\"><PARAM NAME=\"src\" VALUE=\"" + posterURL + "\"><PARAM NAME=\"HREF\" VALUE=\"" + theHREF + "\"><PARAM NAME=\"AutoPlay\" VALUE=\"" + autoplay + "\"><PARAM NAME=\"CONTROLLER\" VALUE=\"" + showController + "\"><PARAM NAME=\"AutoHREF\" VALUE=\"" + autoHREF + "\"><PARAM NAME=\"Type\" VALUE=\"" + theType + "\"><PARAM NAME=\"TARGET\" value=\"" + theTarget + "\"><PARAM NAME=\"CACHE\" VALUE=\"" + cache + "\"><embed SRC=\"" + posterURL + "\" height=\"" + objectHeight + "\" width=\"" + objectWidth + "\" type=\"" + theType + "\" PLUGINSPAGE=\"" + thePluginsPage + "\" AUTOPLAY=\"" + autoplay + "\" CONTROLLER=\"" + showController + "\" NAME=\"" + objectId + "\" href=\"" + movieURL + "\" TARGET=\"" + theTarget + "\" cache=\"" + cache + "\" autohref=\"" + autoHREF + "\"  enablejavascript=\"" + enableJavascript + "\"  saveembedtags=\"" + shouldSaveEmbedTags + "\"  loop=\"" + looping + "\"/></object>";
if (haveqt == true){
document.write(theMovieObject);
}
else
{
document.write("<img src='images/thirtyframe.jpg' height='240' width='320'/>");
}
}

function testForQuicktime()
{
if (navigator.plugins) {
for (i=0; i < navigator.plugins.length; i++ ) {
if (navigator.plugins[i].name.indexOf("QuickTime") >= 0)
{ haveqt = true; }
}
}
if ((navigator.appVersion.indexOf("Mac") > 0)&& (navigator.appName.substring(0,9) == "Microsoft")&& (parseInt(navigator.appVersion) < 5) )
{ haveqt = true; }
}

/* Quicktime Version Check */
function checkQTVersion(theElement)
{
	if (document.getElementById(theElement) || eval("document." + theElement)) {
		qtversion = document.getElementById(theElement).GetQuickTimeVersion();
	}
}




/* Now Airing Rotator Code */

function changeCode(theElement,theCode)
{
if (document.getElementById(theElement) || eval("document." + theElement)) {
if (document.getElementById)
document.getElementById('moviestatus').innerHTML = theStatus;
else if (document.layers)
{
document.layers.moviestatus.document.open();
document.layers.moviestatus.document.write(theStatus);
document.layers.moviestatus.document.close();
}
else if (document.all)
moviestatus.innerHTML = theStatus;
}
}

function updateTheInterval()
{
setInterval('drawStatus()',3000);
}

/* Who we are scripts */
var imageShowing;
var selectedMini;

function setTheCurrentPic(fileName)
{
	imageShowing = fileName;
}

function clickPhoto(imageId,bioPhotoUrl,selectedImageUrl)
{
	document.bioimage.src=bioPhotoUrl;
	selectedMini = imageId;
	document.getElementById(selectedMini).src = selectedImageUrl;
}

function mouseOverPhoto(miniImageName,overImgSrc)
{
	selectedMini=document.getElementById(miniImageName).src;
	document.getElementById(miniImageName).src = overImgSrc;
}

function mouseOutPhoto(imageId,unselectedImageUrl)
{
	document.getElementById(imageId).src=unselectedImageUrl;
}

function getMovieCode(movieURL)
{
var theMovieObject;
var theClassId = "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";
var theCodeBase = "http://www.apple.com/qtactivex/qtplugin.cab";
var thePluginsPage = "http://www.apple.com/quicktime/download/";
var objectHeight = "257";
var objectWidth = "320";
var objectId = "productionclip";
var theSrc = movieURL;
var autoplay = "TRUE";
var looping = "FALSE";
var showController = "TRUE";
var autoHREF = "TRUE";
var theType = "video/quicktime";
var theTarget = "myself";
var cache = "TRUE";
var enableJavascript = "true";
var shouldSaveEmbedTags = "FALSE";
var kioskmode = "TRUE";
	
theMovieObject = "<object classid=\"" + theClassId + "\" codebase=\"" + theCodeBase + "\" height=\"" + objectHeight + "\" width=\"" + objectWidth + "\" id=\"" + objectId + "\"><PARAM NAME=\"LOOP\" VALUE=\"" + looping + "\"><PARAM NAME=\"KIOSKMODE\" VALUE=\""+kioskmode+"\"><PARAM NAME=\"SAVEEMBEDTAGS\" VALUE=\"" + shouldSaveEmbedTags + "\"><PARAM NAME=\"enablejavascript\" VALUE=\"" + enableJavascript + "\"><PARAM NAME=\"src\" VALUE=\"" + theSrc + "\"><PARAM NAME=\"AutoPlay\" VALUE=\"" + autoplay + "\"><PARAM NAME=\"CONTROLLER\" VALUE=\"" + showController + "\"><PARAM NAME=\"AutoHREF\" VALUE=\"" + autoHREF + "\"><PARAM NAME=\"Type\" VALUE=\"" + theType + "\"><PARAM NAME=\"TARGET\" value=\"" + theTarget + "\"><PARAM NAME=\"CACHE\" VALUE=\"" + cache + "\"><embed SRC=\"" + theSrc + "\" height=\"" + objectHeight + "\" width=\"" + objectWidth + "\" type=\"" + theType + "\" PLUGINSPAGE=\"" + thePluginsPage + "\" AUTOPLAY=\"" + autoplay + "\" CONTROLLER=\"" + showController + "\" NAME=\"" + objectId + "\" TARGET=\"" + theTarget + "\" cache=\"" + cache + "\" autohref=\"" + autoHREF + "\"  kioskmode=\"" + kioskmode + "\" enablejavascript=\"" + enableJavascript + "\"  saveembedtags=\"" + shouldSaveEmbedTags + "\"  loop=\"" + looping + "\"/></object>";
return theMovieObject;
}

function updateMovieWindow(movieURL)
{
	var movieLocation = "images/clips/" + movieURL;
	if (document.getElementById) {
		if (document.getElementById("productionclip")) {
			document.productionclip.Stop();
			document.productionclip.SetURL(movieURL);
		} else {
			document.getElementById("theclip").innerHTML = getMovieCode(movieLocation);
			document.productionclip.SetControllerVisible(true);
		}
	} else {
		theclip.productionclip.Stop();
		theclip.innerHTML = getMovieCode(movieLocation);
	}
}


///////////////////////////////////////
//
// PRESS ARCHIVE SCRIPTS
//
// used to display pdfs and jpgs in their own window
//
///////////////////////////////////////

function displayImage(URL,imagename,imagewidth,imageheight) {
day = new Date();
id = day.getTime();
NewURL = "displayimage.php?imagefile="+URL+"&imagename="+imagename+"&imagewidth="+imagewidth+"&imageheight="+imageheight;
eval("page" + id + " = window.open(NewURL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=900,height=700');");
}

function displayPDF(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=900,height=700');");
}


/////////////
//
// Press image scripts
//
////////////

function displayPressImage(URL,imagename,imagewidth,imageheight) {
day = new Date();
id = day.getTime();
NewURL = "/pressarchive/displaypressimage.php?imagefile="+URL+"&imagename="+imagename+"&imagewidth="+imagewidth+"&imageheight="+imageheight;
eval("page" + id + " = window.open(NewURL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=900,height=700');");
}

function displayPressPDF(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=900,height=700');");
}



//////////////////////////////////////////
//
// EMAIL SIGNUP SCRIPTS
//
//////////////////////////////////////////

function displayEmailForm() {
	document.getElementById('arpsignup').style.visibility = "visible";
}
function hideEmailForm() {
	document.getElementById('arpsignup').style.visibility = "hidden";
}
function submitForm() {
	document.getElementById('emailsignup').submit();
	}


function pausecomp(millis)
{
date = new Date();
var curDate = null;

do { var curDate = new Date(); }
while(curDate-date < millis);
}


// NOTE: the month entered must be one less. ie; 0=January, 11=December
// NOTE: the hour is in 24 hour format. 0=12am, 15=3pm etc
// format: dateFuture = new Date(year,month-1,day,hour,min,sec)
// example: dateFuture = new Date(2003,03,26,14,15,00) = April 26, 2003 - 2:15:00 pm
function getCoundownUntilBW() {
result = "";
dateFuture = new Date(2006,2,8,22,00,00);
dateNow = new Date();									//grab current date
amount = dateFuture.getTime() - dateNow.getTime();		//calc milliseconds between dates

// time is already past
if(amount < 0){
	return "";
}
// date is still good
else{

	days=0;
	hours=0;
	mins=0;
	secs=0;

	amount = Math.floor(amount/1000);//kill the "milliseconds" so just secs

	days=Math.floor(amount/86400);//days
	amount=amount % 86400;

	hours=Math.floor(amount/3600);//hours
	amount=amount % 3600;

	mins=Math.floor(amount/60);//minutes
	amount=amount % 60;

	secs=Math.floor(amount);//seconds

	if(days != 0) {
		result += days +" day"+((days!=1)?"s":"")+", ";
	}
	if(days != 0 || hours != 0) {
	result += hours +" hour"+((hours!=1)?"s":"")+", ";
	}
	if(days != 0 || hours != 0 || mins != 0) {
		result+= mins +" minute"+((mins!=1)?"s":"")+" ";
	}
	return result;
}

}
/*
function drawBWCountdown() {
result = "";
dateFuture = new Date(2006,2,8,22,00,00);
dateNow = new Date();									//grab current date
amount = dateFuture.getTime() - dateNow.getTime();		//calc milliseconds between dates

// time is already past
if(amount < 0){
	result = "";
}
// date is still good
else{

	days=0;
	hours=0;
	mins=0;
	secs=0;

	amount = Math.floor(amount/1000);//kill the "milliseconds" so just secs

	days=Math.floor(amount/86400);//days
	amount=amount % 86400;

	hours=Math.floor(amount/3600);//hours
	amount=amount % 3600;
	
	mins=(Math.floor(amount/60))+1;//minutes
	if (mins==60) { mins = 59; }
	amount=amount % 60;

	secs=Math.floor(amount);//seconds

	if(days != 0) {
		result += days +" day"+((days!=1)?"s":"")+", ";
	}
	if(days != 0 || hours != 0) {
	result += hours +" hour"+((hours!=1)?"s":"")+", ";
	}
	if(days != 0 || hours != 0 || mins != 0) {
		result+= mins +" minute"+((mins!=1)?"s":"")+" and ";
	}
	if(days != 0 || hours != 0 || mins != 0 || secs != 0) {
		result+= secs +" second"+((secs!=1)?"s":"")+" ";
	}
	

	document.getElementById("bwcountdown").innerHTML = result + " until the <a href='production.html?production=blackwhite'>Black.White</a> premiere.";
}
}
*/
function drawBWCountdown() {
result = "";
dateFuture = new Date(2006,2,8,22,00,00);
dateNow = new Date();									//grab current date
amount = dateFuture.getTime() - dateNow.getTime();		//calc milliseconds between dates

// time is already past
if(amount < 0){
	result = "";
}
// date is still good
else{

	days=0;
	hours=0;
	mins=0;
	secs=0;

	amount = Math.floor(amount/1000);//kill the "milliseconds" so just secs

	days=Math.floor(amount/86400);//days
	amount=amount % 86400;

	hours=Math.floor(amount/3600);//hours
	amount=amount % 3600;
	
	mins=(Math.floor(amount/60))+1;//minutes
	if (mins==60) { mins = 59; }
	amount=amount % 60;

	secs=Math.floor(amount);//seconds

	if(days != 0) {
		result += days +" day"+((days!=1)?"s":"")+", ";
	}
	/*
	if(days != 0 || hours != 0) {
	result += hours +" hour"+((hours!=1)?"s":"")+", ";
	}
	if(days != 0 || hours != 0 || mins != 0) {
		result+= mins +" minute"+((mins!=1)?"s":"")+" and ";
	}
	if(days != 0 || hours != 0 || mins != 0 || secs != 0) {
		result+= secs +" second"+((secs!=1)?"s":"")+" ";
	}
	*/
	if (hours < 10) {
		result += "0" + hours + ":";
	} else {
		result += hours + ":";
	}
	if (mins < 10) {
		result += "0" + mins + ":";
	} else {
		result += mins + ":";
	}
	if (secs < 10) {
		result += "0" + secs + "";
	} else {
		result += secs + " ";
	}
	

	document.getElementById("bwcountdown").innerHTML = result + "<br/>until the premiere of<br/><a href='production.html?production=blackwhite'>Black.White</a>.";
}
}

function setBWInterval() {
	drawBWCountdown();
	setInterval('drawBWCountdown()',1000);
}
