// -- STYLESHEET CODE START --
/*
if ((navigator.appVersion.indexOf("Mac") != -1)) {
	if (navigator.userAgent.indexOf("MSIE")!= -1 || navigator.userAgent.indexOf("Netscape6")!= -1 || navigator.userAgent.indexOf("Safari")!= -1){ //ie4 & ns 6
		document.write('<link rel="stylesheet" href="css/mac_ie.css" type="text/css">');
	}else{ //ns
		document.write('<link rel="stylesheet" href="css/mac_ns.css" type="text/css">');
	}
}else{
	if (navigator.userAgent.indexOf("MSIE")!= -1 || navigator.userAgent.indexOf("Netscape6")!= -1 || navigator.userAgent.indexOf("Mozilla")!= -1){ //ie4 & ns 6
		document.write('<link rel="stylesheet" href="css/win_ie.css" type="text/css">');
	}else{ //ns
		document.write('<link rel="stylesheet" href="css/win_ns.css" type="text/css">');
	}
}
*/
// -- STYLESHEET CODE ENDS -- //

// -- MENU CODE STARTS -- //
if(!window.Node){
	var Node = { ELEMENT_NODE : 1, TEXT_NODE : 3 };
}
function checkNode(node, filter){
	return (filter == null || node.nodeType == Node[filter] || node.nodeName.toUpperCase() == filter.toUpperCase());
}
function getChildren(node, filter){
	var result = new Array();
	var children = node.childNodes;
	for(var i = 0; i < children.length; i++){
		if(checkNode(children[i], filter)) result[result.length] = children[i];
	}
	return result;
}
function getChildrenByElement(node){
	return getChildren(node, "ELEMENT_NODE");
}
function getFirstChild(node, filter){
	var child;
	var children = node.childNodes;
	for(var i = 0; i < children.length; i++){
		child = children[i];
		if(checkNode(child, filter)) return child;
	}
	return null;
}
function getFirstChildByText(node){
	return getFirstChild(node, "TEXT_NODE");
}
function getNextSibling(node, filter){
	for(var sibling = node.nextSibling; sibling != null; sibling = sibling.nextSibling){
		if(checkNode(sibling, filter)) return sibling;
	}
	return null;
}
function getNextSiblingByElement(node){
	return getNextSibling(node, "ELEMENT_NODE");
}

// ||||||||||||||||||||||||||||||||||||||||||||||||||
// Menu Functions & Properties

var activeMenu = null;

function showMenu(){
	if(activeMenu){
		activeMenu.className = "";
		getNextSiblingByElement(activeMenu).style.display = "none";
	}
	if(this == activeMenu){
		activeMenu = null;
	}else{
		this.className = "active";
		getNextSiblingByElement(this).style.display = "block";
		activeMenu = this;
	}
//	showSectionIntro(str);
	return false;
}

function initMenu(){
	var menus, menu, text, a, i;
	menus = getChildrenByElement(document.getElementById("menu"));
	for(i = 0; i < menus.length; i++){
		menu = menus[i];
		text = getFirstChildByText(menu);
		a = document.createElement("a");
		menu.replaceChild(a, text);
		a.appendChild(text);
		a.href = "#";
		a.onclick = showMenu;
		a.onfocus = function(){this.blur()};
	}
}

// ||||||||||||||||||||||||||||||||||||||||||||||||||

if(document.createElement){
	window.onload = initMenu;
}

// -- MENU CODE ENDS -- //

// -- IMAGE SWAPPING STARTS --

function imgSwap(img,ref) {
	if(document.images){
		document.images[img].src = ref;
	}
}

function showDescription(contentDescription){
	document.getElementById('contentDescription').innerHTML = contentDescription;	
}

function showMovieInAWindow(theMovie){
//alert(theMovie);
	var theURL = 'theMovie.php?theMovie=' + theMovie;
	var editWindow = window.open(theURL,'movieWindow','width=480,height=286,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
	movieWindow.focus();
}


//function showContent(contentHeader, contentBody, contentDescription, movies){
function showContent(contentHeader, contentBody, movies){
//alert(movies);
	if(!movies){
		theMovies = false;
	}else{
		theMovies = movies;
	}

var tmpString = '';

var counter = 0;

tmpString += '<table border="0" width="100%" cellpadding="0" cellspacing="0"><tr>' + "\n";
$counter = 0;
for(var i = 0; i < theMovies.length; i++){
	if(counter <= 3){
		tmpString += '<td align="center" valign="top">' + "\n\t";
		
		tmpString += '<table align="center" border="0" height="100%" cellpadding="0" cellspacing="0" bgcolor="#000000"><tr><td align="center">';
		tmpString += '<table align="center" border="0" height="100%" cellpadding="1" cellspacing="1"><tr><td class="imagefilename" align="center" bgcolor="#ffffff">';

		if ((navigator.appVersion.indexOf("Mac") != -1)) {
			if (navigator.userAgent.indexOf("Safari")!= -1){ // Safari
				tmpString += '<a href="javascript:showMovie(\'' + movies[i][1] + '\')"><img src="movies/' + movies[i][2] + '" width="115" height="65" border="0" alt="" vspace="0" hspace="0" onMouseOver="javascript:showDescription(\'' + movies[i][0] + '\');" onMouseOut="javascript:showDescription(\'' + '' + '\');"></a>';
			}else{ //ns
				tmpString += '<a href="javascript:showMovie(\'' + movies[i][1] + '\')"><img src="movies/' + movies[i][2] + '" width="115" height="65" border="0" alt="" vspace="0" hspace="0" onMouseOver="javascript:showDescription(\'' + movies[i][0] + '\');" onMouseOut="javascript:showDescription(\'' + '' + '\');"></a>';
			}
		}else{
			if (navigator.userAgent.indexOf("MSIE")!= -1 || navigator.userAgent.indexOf("Mozilla")!= -1){
				tmpString += '<a href="javascript:showMovie(\'' + movies[i][1] + '\')"><img src="movies/' + movies[i][2] + '" width="115" height="65" border="0" alt="" vspace="0" hspace="0" onMouseOver="javascript:showDescription(\'' + movies[i][0] + '\');" onMouseOut="javascript:showDescription(\'' + '' + '\');"></a>';
			}else{ //ns
				tmpString += '<a href="movies/' + movies[i][1] + '" target="imageViewer"><img src="movies/' + movies[i][2] + '" width="115" height="65" border="0" alt="" vspace="0" hspace="0" onMouseOver="javascript:showDescription(\'' + movies[i][0] + '\');" onMouseOut="javascript:showDescription(\'' + '' + '\');"></a>';
			}
		}
		
		tmpString += '</td></tr></table>';
		tmpString += '</td></tr></table>';

		tmpString += '</td>' + "\n";
		counter++;
	}else{
		tmpString += '</tr>' + "\n" + '<tr><td height="10"></td></tr>' + '<tr>' + "\n" + '<td align="center" valign="top">' + "\n\t";

		tmpString += '<table align="center" border="0" height="100%" cellpadding="0" cellspacing="0" bgcolor="#000000"><tr><td align="center">';
		tmpString += '<table align="center" border="0" height="100%" cellpadding="1" cellspacing="1"><tr><td class="imagefilename" align="center" bgcolor="#ffffff">';

		if ((navigator.appVersion.indexOf("Mac") != -1)) {
			if (navigator.userAgent.indexOf("Safari")!= -1){ // Safari
				tmpString += '<a href="javascript:showMovie(\'' + movies[i][1] + '\')"><img src="movies/' + movies[i][2] + '" width="115" height="65" border="0" alt="" vspace="0" hspace="0" onMouseOver="javascript:showDescription(\'' + movies[i][0] + '\');" onMouseOut="javascript:showDescription(\'' + '' + '\');"></a>';
			}else{ //ns
				tmpString += '<a href="javascript:showMovie(\'' + movies[i][1] + '\')"><img src="movies/' + movies[i][2] + '" width="115" height="65" border="0" alt="" vspace="0" hspace="0" onMouseOver="javascript:showDescription(\'' + movies[i][0] + '\');" onMouseOut="javascript:showDescription(\'' + '' + '\');"></a>';
			}
		}else{
			if (navigator.userAgent.indexOf("MSIE")!= -1 || navigator.userAgent.indexOf("Mozilla")!= -1){
				tmpString += '<a href="javascript:showMovie(\'' + movies[i][1] + '\')"><img src="movies/' + movies[i][2] + '" width="115" height="65" border="0" alt="" vspace="0" hspace="0" onMouseOver="javascript:showDescription(\'' + movies[i][0] + '\');" onMouseOut="javascript:showDescription(\'' + '' + '\');"></a>';
			}else{ //ns
				tmpString += '<a href="movies/' + movies[i][1] + '" target="imageViewer"><img src="movies/' + movies[i][2] + '" width="115" height="65" border="0" alt="" vspace="0" hspace="0" onMouseOver="javascript:showDescription(\'' + movies[i][0] + '\');" onMouseOut="javascript:showDescription(\'' + '' + '\');"></a>';
			}
		}

		tmpString += '</td></tr></table>';
		tmpString += '</td></tr></table>';

		tmpString += '</td>' + "\n";
		counter = 1;
	}
}

tmpString += '</tr></table>' + "\n";

	document.getElementById('contentHeadline').innerHTML = contentHeader;

	if(!movies){
		document.getElementById('contentViewer').innerHTML = contentBody;
		if ((navigator.appVersion.indexOf("Mac") != -1)) {
			if (navigator.userAgent.indexOf("Safari")!= -1){ //ie4 & ns 6
				document.getElementById('imageViewer').innerHTML = '<img src="gfx/portrait.jpg" width="480" height="286" vspace="0" hspace="0" border="0" alt="">';
			}else{ //ns
				document.getElementById('imageViewer').innerHTML = '<img src="gfx/portrait.jpg" width="480" height="286" vspace="0" hspace="0" border="0" alt="">';
			}
		}else{
			if (navigator.userAgent.indexOf("MSIE")!= -1 || navigator.userAgent.indexOf("Mozilla")!= -1){ //ie4 & ns 6
				document.getElementById('imageViewer').innerHTML = '<img src="gfx/portrait.jpg" width="480" height="286" vspace="0" hspace="0" border="0" alt="">';
			}else{ //ns
				document.getElementById('imageViewer').innerHTML = '<img src="gfx/portrait.jpg" width="480" height="286" vspace="0" hspace="0" border="0" alt="">';
			}
		}
		document.getElementById('download').innerHTML = '';
	}else{
		document.getElementById('contentViewer').innerHTML = tmpString;
	}
//	alert(tmpString);
}

// SHOWIMAGES START //
function showImages(contentHeader, contentBody, theImages){
//alert(theImages);
	if(!theImages){
		theImages = false;
	}else{
		theImages = theImages;
	}

var tmpString = '';

var counter = 0;

tmpString += '<table border="0" width="100%" cellpadding="0" cellspacing="0"><tr>' + "\n";
$counter = 0;
for(var i = 0; i < theImages.length; i++){
	if(counter <= 3){
		tmpString += '<td align="center" valign="top">' + "\n\t";
		
		tmpString += '<table align="center" border="0" height="100%" cellpadding="0" cellspacing="0" bgcolor="#000000"><tr><td align="center">';
		tmpString += '<table align="center" border="0" height="100%" cellpadding="1" cellspacing="1"><tr><td class="imagefilename" align="center" bgcolor="#ffffff">';

		if ((navigator.appVersion.indexOf("Mac") != -1)) {
			if (navigator.userAgent.indexOf("Safari")!= -1){ // Safari
				tmpString += '<a href="javascript:showImage(\'' + theImages[i][1] + '\',' + theImages[i][2] + ')"><img src="images/t_' + theImages[i][1] + '" width="115" height="65" border="0" alt="" vspace="0" hspace="0" onMouseOver="javascript:showDescription(\'' + theImages[i][0] + '\');" onMouseOut="javascript:showDescription(\'' + '' + '\');"></a>';
			}else{ //ns
				tmpString += '<a href="javascript:showImage(\'' + theImages[i][1] + '\',' + theImages[i][2] + ')"><img src="images/t_' + theImages[i][1] + '" width="115" height="65" border="0" alt="" vspace="0" hspace="0" onMouseOver="javascript:showDescription(\'' + theImages[i][0] + '\');" onMouseOut="javascript:showDescription(\'' + '' + '\');"></a>';
			}
		}else{
			if (navigator.userAgent.indexOf("MSIE")!= -1 || navigator.userAgent.indexOf("Mozilla")!= -1){
				tmpString += '<a href="javascript:showImage(\'' + theImages[i][1] + '\',' + theImages[i][2] + ')"><img src="images/t_' + theImages[i][1] + '" width="115" height="65" border="0" alt="" vspace="0" hspace="0" onMouseOver="javascript:showDescription(\'' + theImages[i][0] + '\');" onMouseOut="javascript:showDescription(\'' + '' + '\');"></a>';
			}else{ //ns
				tmpString += '<a href="images/' + theImages[i][1] + '" target="imageViewer"><img src="images/t_' + theImages[i][1] + '" width="115" height="65" border="0" alt="" vspace="0" hspace="0" onMouseOver="javascript:showDescription(\'' + theImages[i][0] + '\');" onMouseOut="javascript:showDescription(\'' + '' + '\');"></a>';
			}
		}
		
		tmpString += '</td></tr></table>';
		tmpString += '</td></tr></table>';

		tmpString += '</td>' + "\n";
		counter++;
	}else{
		tmpString += '</tr>' + "\n" + '<tr><td height="10"></td></tr>' + '<tr>' + "\n" + '<td align="center" valign="top">' + "\n\t";

		tmpString += '<table align="center" border="0" height="100%" cellpadding="0" cellspacing="0" bgcolor="#000000"><tr><td align="center">';
		tmpString += '<table align="center" border="0" height="100%" cellpadding="1" cellspacing="1"><tr><td class="imagefilename" align="center" bgcolor="#ffffff">';

		if ((navigator.appVersion.indexOf("Mac") != -1)) {
			if (navigator.userAgent.indexOf("Safari")!= -1){ // Safari
				tmpString += '<a href="javascript:showImage(\'' + theImages[i][1] + '\',' + theImages[i][2] + ')"><img src="images/t_' + theImages[i][1] + '" width="115" height="65" border="0" alt="" vspace="0" hspace="0" onMouseOver="javascript:showDescription(\'' + theImages[i][0] + '\');" onMouseOut="javascript:showDescription(\'' + '' + '\');"></a>';
			}else{ //ns
				tmpString += '<a href="javascript:showImage(\'' + theImages[i][1] + '\',' + theImages[i][2] + ')"><img src="images/t_' + theImages[i][1] + '" width="115" height="65" border="0" alt="" vspace="0" hspace="0" onMouseOver="javascript:showDescription(\'' + theImages[i][0] + '\');" onMouseOut="javascript:showDescription(\'' + '' + '\');"></a>';
			}
		}else{
			if (navigator.userAgent.indexOf("MSIE")!= -1 || navigator.userAgent.indexOf("Mozilla")!= -1){
				tmpString += '<a href="javascript:showImage(\'' + theImages[i][1] + '\',' + theImages[i][2] + ')"><img src="images/t_' + theImages[i][1] + '" width="115" height="65" border="0" alt="" vspace="0" hspace="0" onMouseOver="javascript:showDescription(\'' + theImages[i][0] + '\');" onMouseOut="javascript:showDescription(\'' + '' + '\');"></a>';
			}else{ //ns
				tmpString += '<a href="images/' + theImages[i][1] + '" target="imageViewer"><img src="images/t_' + theImages[i][1] + '" width="115" height="65" border="0" alt="" vspace="0" hspace="0" onMouseOver="javascript:showDescription(\'' + theImages[i][0] + '\');" onMouseOut="javascript:showDescription(\'' + '' + '\');"></a>';
			}
		}

		tmpString += '</td></tr></table>';
		tmpString += '</td></tr></table>';

		tmpString += '</td>' + "\n";
		counter = 1;
	}
}

tmpString += '</tr></table>' + "\n";

	document.getElementById('contentHeadline').innerHTML = contentHeader;

	if(theImages.length < 1){
		document.getElementById('contentViewer').innerHTML = "No images available";
		if ((navigator.appVersion.indexOf("Mac") != -1)) {
			if (navigator.userAgent.indexOf("Safari")!= -1){ //ie4 & ns 6
				document.getElementById('imageViewer').innerHTML = '<img src="gfx/portrait.jpg" width="480" height="286" vspace="0" hspace="0" border="0" alt="">';
			}else{ //ns
				document.getElementById('imageViewer').innerHTML = '<img src="gfx/portrait.jpg" width="480" height="286" vspace="0" hspace="0" border="0" alt="">';
			}
		}else{
			if (navigator.userAgent.indexOf("MSIE")!= -1 || navigator.userAgent.indexOf("Mozilla")!= -1){ //ie4 & ns 6
				document.getElementById('imageViewer').innerHTML = '<img src="gfx/portrait.jpg" width="480" height="286" vspace="0" hspace="0" border="0" alt="">';
			}else{ //ns
				document.getElementById('imageViewer').innerHTML = '<img src="gfx/portrait.jpg" width="480" height="286" vspace="0" hspace="0" border="0" alt="">';
			}
		}
		document.getElementById('download').innerHTML = '';
	}else{
		document.getElementById('contentViewer').innerHTML = tmpString;
	}
//	alert(tmpString);
}
// SHOWIMAGES END //

function showMovie(movie, contentHeader, contentBody){
	
	if ((navigator.appVersion.indexOf("Mac") != -1)) {
		if (navigator.userAgent.indexOf("MSIE")!= -1){ //ie
			showMovieInAWindow(movie);
		}
	}

	if ((navigator.appVersion.indexOf("Mac") != -1)) {
		if (navigator.userAgent.indexOf("Safari")!= -1){ //ie
			showMovieInAWindow(movie);
		}
	}

	document.getElementById('imageViewer').innerHTML = '';

	var tmpString = '';
	var downloadString = '';

	var hiRes_movieSplit = movie.split("."); 
	
	var hi_movie_name = hiRes_movieSplit[0];
	var hi_movie_suffix = hiRes_movieSplit[1];
	
	tmpString += '<OBJECTCLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" HEIGHT="286" WIDTH="480">';

	tmpString += '<PARAM NAME="src" VALUE="movies/';
	tmpString += movie + '">';
	tmpString += '<PARAM NAME="AutoPlay" VALUE="true" >';
	tmpString += '<PARAM NAME="Controller" VALUE="true" >';
	
	tmpString += '<EMBED SRC="movies/';
	tmpString += movie;
	tmpString += '" HEIGHT="286" WIDTH="480" TYPE="video/quicktime" PLUGINSPAGE="http://www.apple.com/quicktime/download/" AUTOPLAY="true" CONTROLLER="true" />';
	tmpString += '</OBJECT>';
	
	document.getElementById('imageViewer').innerHTML = tmpString;
	
//	downloadString += 'Download movie: <a href="includes/download.php?movie=';
	downloadString += 'Download <a class="smallLink" href="http://www.apple.com/quicktime/download/" target="_blank">QuickTime</a>';

//	downloadString += hi_movie_name + '_hi.' + hi_movie_suffix;
//	downloadString += '">High</a> / <a href="includes/download.php?movie=' + movie + '">Low</a>';

	document.getElementById('download').innerHTML = downloadString;
}

function showImage(theImage, HasZip){
	
/*	if ((navigator.appVersion.indexOf("Mac") != -1)) {
		if (navigator.userAgent.indexOf("MSIE")!= -1){ //ie
			showMovieInAWindow(movie);
		}
	}
*/
	document.getElementById('imageViewer').innerHTML = '';

	var tmpString = '';
	var downloadString = '';

	var hiRes_movieSplit = theImage.split("."); 
	
	var hi_movie_name = hiRes_movieSplit[0];
//	var hi_movie_suffix = hiRes_movieSplit[1];
	var hi_movie_suffix = '.zip';
	
	tmpString += '<img name="" src="images/' + theImage + '" width="480" height="286" vspace="0" hspace="0" border="0" alt="">';
	
	document.getElementById('imageViewer').innerHTML = tmpString;
	
//	downloadString += 'Download movie: <a href="includes/download.php?movie=';
//	downloadString += 'Download <a class="smallLink" href="' + theImage  + '.zip' + '" target="_blank">High Resolution Image</a>';
	downloadString += 'Download <a class="smallLink" href="' + hi_movie_name  + '.zip' + '" target="_blank">High Resolution Image</a>';

//	downloadString += hi_movie_name + '_hi.' + hi_movie_suffix;
//	downloadString += '">High</a> / <a href="includes/download.php?movie=' + movie + '">Low</a>';

	if(HasZip != 0){
		document.getElementById('download').innerHTML = downloadString;
	}else{
		document.getElementById('download').innerHTML = '';	
	}
}

