
var number=1;

//check the browser
var bName = navigator.appName;
var bVer = parseFloat(navigator.appVersion);
var myiPhone = navigator.platform.indexOf('iPhone') == 0;
var myiPad = navigator.platform.indexOf('iPad') == 0;
var myiPod = navigator.platform.indexOf('iPod') == 0;
var ie = bName == "Microsoft Internet Explorer" && bVer >= 4;
var n5 = (bName == "Netscape") && (bVer >= 5) && !myiPhone && !myiPad && !myiPod;
if(n5){document.all = document.getElementsByTagName("*");}
var resizeFlag = 1;
var audioZip = "";
var audioFile = "";
var imageUrl = "";
var imageZip = "";
var videoUrl = '';
var composer = '';
var piece = '';
var movement = '';
var orchestra = '';
var conductor = '';
var soloist = '';
var popupFlag = 0;

//these default settings apply if I want NOT to scale anything (such as the print window)
var myW = 1;
var myF = 1;
var myH = 1;
var myCW = 1280;
var myCH = 671;

//if I want to scale everything, then:
function PageDim(){
	if (ie) {
		myCW = parent.document.body.clientWidth;
		myCH = parent.document.body.clientHeight;
		myW = myCW/1280;
		myH = myCH/671*.95;
	}
	if (n5) {
		myCW = window.parent.innerWidth;
		myCH = window.parent.innerHeight;
		myW = myCW/1280*.95;
		myH = myCH/671*.95;
	}
	if (myiPad) {
		myCW = window.parent.innerWidth;
		myCH = window.parent.innerHeight;
		myW = 1;
		myH = 1;
	}
	if (myiPhone) {
		myCW = window.parent.innerWidth;
		myCH = window.parent.innerHeight;
		myW = 1;
		myH = 1;
	}
}


function PageDimSmallWindow() {
	if (ie) {
		myCW = document.body.clientWidth;
		myCH = document.body.clientHeight;
		myW = myCW/(413);
		myH = myCH/(300);
	}
	if (n5) {
		myCW = window.innerWidth;
		myCH = window.innerHeight;
		myW = myCW/(413);
		myH = myCH/(300);
	}
	if (myiPad) {
		myCW = window.parent.innerWidth;
		myCH = window.parent.innerHeight;
		myW = 1;
		myH = 1;
	}
	if (myiPhone) {
		myCW = window.parent.innerWidth;
		myCH = window.parent.innerHeight;
		myW = 1;
		myH = 1;
	}
}

function PageDimMoldau(){
		if (ie) {
			myCW = document.body.clientWidth;
			myCH = document.body.clientHeight;
			myW = myCW/(500);
			myH = myCH/(600);
		}
		if(n5) {
			myCW = window.innerWidth;
			myCH = window.innerHeight;
			myW = myCW/(500);
			myH = myCH/(600);
		}
}

function PageDimMozart(){
		if (ie) {
			myCW = parent.document.body.clientWidth;
			myCH = parent.document.body.clientHeight;
			myW = myCW/(800);
			myH = myCH/(600);
		}
		if(n5) {
			myCW = window.parent.innerWidth;
			myCH = window.parent.innerHeight;
			myW = myCW/(800);
			myH = myCH/(600);
		}
}

//re-size the fonts
function writefontsizes() {
	document.open();
	document.write("<STYLE TYPE=\"text/css\">");
	//classes
	document.write(".two {text-decoration: none; line-height: " + eval(2*myW) + "pt; font-size: " + eval(2*myW) + "pt;font-weight:bold;font-family: \"Arial\", \"Helvetica\";}");
	document.write(".three {text-decoration: none; line-height: " + eval(3*myW) + "pt; font-size: " + eval(3*myW) + "pt;font-weight:bold;font-family: \"Arial\", \"Helvetica\";}");
	document.write(".four {text-decoration: none; line-height: " + eval(4*myW) + "pt; font-size: " + eval(4*myW) + "pt;font-weight:bold;font-family: \"Arial\", \"Helvetica\";}");
	document.write(".five {text-decoration: none; line-height: " + eval(5*myW) + "pt; font-size: " + eval(5*myW) + "pt;font-weight:bold;font-family: \"Arial\", \"Helvetica\";}");
	document.write(".six {text-decoration: none; line-height: " + eval(6*myW) + "pt; font-size: " + eval(6*myW) + "pt;font-weight:bold;font-family: \"Arial\", \"Helvetica\";}");
	document.write(".seven {text-decoration: none; line-height: " + eval(7*myW) + "pt; font-size: " + eval(7*myW) + "pt;font-weight:bold;font-family: \"Arial\", \"Helvetica\";}");
	document.write(".eight {text-decoration: none; line-height: " + eval(8*myW) + "pt; font-size: " + eval(8*myW) + "pt;font-weight:bold;font-family: \"Arial\", \"Helvetica\";}");
	document.write(".nine {text-decoration: none; line-height: " + eval(9*myW) + "pt; font-size: " + eval(9*myW) + "pt;font-weight:bold;font-family: \"Arial\", \"Helvetica\";}");
	document.write(".ten {text-decoration: none; line-height: " + eval(10*myW) + "pt; font-size: " + eval(10*myW) + "pt;font-weight:bold;font-family: \"Arial\", \"Helvetica\";}");
	document.write(".eleven {text-decoration: none; line-height: " + eval(11*myW) + "pt; font-size: " + eval(11*myW) + "pt;font-weight:bold;font-family: \"Arial\", \"Helvetica\";}");
	document.write(".twelve {text-decoration: none; line-height: " + eval(12*myW) + "pt; font-size: " + eval(12*myW) + "pt;font-weight:bold;font-family: \"Arial\", \"Helvetica\";}");
	document.write(".thirteen {text-decoration: none; line-height: " + eval(13*myW) + "pt; font-size: " + eval(13*myW) + "pt;font-weight:bold;font-family: \"Arial\", \"Helvetica\";}");
	document.write(".fourteen {text-decoration: none; line-height: " + eval(14*myW) + "pt; font-size: " + eval(14*myW) + "pt;font-weight:bold;font-family: \"Arial\", \"Helvetica\";}");
	document.write(".fifteen {text-decoration: none; line-height: " + eval(15*myW) + "pt; font-size: " + eval(15*myW) + "pt;font-weight:bold;font-family: \"Arial\", \"Helvetica\";}");
	document.write(".sixteen {text-decoration: none; line-height: " + eval(16*myW) + "pt; font-size: " + eval(16*myW) + "pt;font-weight:bold;font-family: \"Arial\", \"Helvetica\";}");
	document.write(".seventeen {text-decoration: none; line-height: " + eval(17*myW) + "pt; font-size: " + eval(17*myW) + "pt;font-weight:bold;font-family: \"Arial\", \"Helvetica\";}");
	document.write(".eighteen {text-decoration: none; line-height: " + eval(18*myW) + "pt; font-size: " + eval(18*myW) + "pt;font-weight:bold;font-family: \"Arial\", \"Helvetica\";}");
	document.write("</STYLE>");
	document.close();
	return;
}

//must call from inside BODY
function newInit() {
	PageDim();
	writefontsizes();
}

function initMoldau() {
	if(ie||n5) {
		PageDimMoldau();
	}
	writefontsizes();
}
function initMozart() {
	if(ie||n5) {
		PageDimMozart();
	}
	writefontsizes();
}
var mySW;
var mySH;
function newInitSmallWindow(mySmallWidth,mySmallHeight) {
	mySW = mySmallWidth;
	mySH = mySmallHeight;
	PageDimSmallWindow();
	writefontsizes();
	if ((ie || n5) && !myiPad && !myiPhone) {
		if (myCW > mySW+50) {
			NewSmallWindow(location.href,mySW,mySH);
			history.back();
		}
	}
}


var NewWin = "";
function NewSmallWindow(SrcToOpen,myWinWidth,myWinHeight) {
	if (NewWin) {NewWin.close()}
	var WinLeft = 100;
	var WinTop = 10;
	NewWin=window.open(SrcToOpen,'MySmallWindow','width=' + myWinWidth + 'px,height=' + myWinHeight + 'px,top=' + WinTop + 'px,left=' + WinLeft + 'px,resizable,scrollbars,menubar');	
	NewWin.focus();
	return;
}
function writeVideoPage() {
	var openingCode = '<table class=\'ten\' align=\'center\' valign=\'top\'><tr><td class=\'ten\' align=\'center\' valign=\'top\'>\n';
	if(composer.length > 0) openingCode += composer + '<br>\n';
	if(piece.length > 0) openingCode += '<u>' + piece + '</u><br>\n';
	if(movement.length > 0) openingCode += movement + '<br>\n';
	if(orchestra.length > 0) openingCode += orchestra + '<br>\n';
	if(conductor.length > 0) openingCode += conductor + '<br>\n';
	if(soloist.length > 0) openingCode += soloist + '<br>\n';
	openingCode += '</td></tr></table>\n';
	document.open();
	document.write(openingCode);
	document.close();

	document.open();
	document.write('<br><table align=\'center\' valign=\'top\'><tr><td align=\'center\' valign=\'top\'>');
	document.close();

	if (navigator.platform.indexOf('iPhone') > -1) { 
		var videoJpg = videoUrl + "-poster.jpg";
		var videoMov = videoUrl + ".mov";
		QT_WritePoster_XHTML('Click to Play',videoJpg,videoMov,
			'400', '330', '',
			'controller', 'true',
			'autoplay', 'true',
			'bgcolor', 'black',
			'scale', 'aspect');
	}

	else {
		var videoFlv = videoUrl + ".flv";
		var posterJpg = videoUrl + "_flvposter.jpg";
		var flashCode = "";
		flashCode += "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" "; 
		flashCode += "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab\#version=10,0,0,0\" ";
		flashCode += "width=\"400\" height=\"290\">";
		flashCode += "<param name=\"movie\" value=\"/StrobeMediaPlayback.swf\"></param>";
		flashCode += "<param name=\"flashvars\" value=\"src=http://stockbridgesinfonia.org" + videoFlv;
 		flashCode += "&poster=http://stockbridgesinfonia.org" + posterJpg + "\"></param>";
		flashCode += "<param name=\"allowFullScreen\" value=\"true\"></param>";
		flashCode += "<param name=\"allowscriptaccess\" value=\"always\"></param>";
		flashCode += "<embed src=\"/StrobeMediaPlayback.swf\" "; 
		flashCode += "type=\"application/x-shockwave-flash\" "; 
		flashCode += "allowscriptaccess=\"always\" "; 
		flashCode += "allowfullscreen=\"true\" "; 
		flashCode += "width=\"400\" "; 
		flashCode += "height=\"290\" "; 
		flashCode += "flashvars=\"src=http://stockbridgesinfonia.org" + videoFlv;
		flashCode += "&poster=http://stockbridgesinfonia.org" + posterJpg + "\">";
		flashCode += "</embed>";
		flashCode += "</object>";
		document.open();
		document.write(flashCode);
		document.close();
	}
	document.open();
	document.write('</td></tr></table>');
	document.close();
}


function writeAudioPlayer() {
	var ua = navigator.userAgent;
	var iPhoneCheck = ua.indexOf("iPhone");
	if(iPhoneCheck > -1){
		var AudioCode = "";
		AudioCode += " <object";
		AudioCode += " align=\"absmiddle\""; 
		AudioCode += " type=\"audio/mpeg\""; 
		AudioCode += " data=\"http://stockbridgesinfonia.org" + audioFile + "\""; 
		AudioCode += " width=\"50\""; 
		AudioCode += " height=\"16\">\n"; 
		AudioCode += " <param name=\"autoplay\" value=\"false\" />\n"; 
		AudioCode += " <param name=\"src\" value=\"http://stockbridgesinfonia.org" + audioFile + "\" />\n"; 
		AudioCode += " <object"; 
		AudioCode += " classid=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\""; 
		AudioCode += " width=\"250\""; 
		AudioCode += " height=\"60\">\n"; 
		AudioCode += " <param name=\"autostart\" value=\"false\" />\n"; 
 		AudioCode += " <param name=\"url\" value=\"http://stockbridgesinfonia.org" + audioFile + "\" />\n"; 
 		AudioCode += " <param name=\"showcontrols\" value=\"true\" />\n"; 
 		AudioCode += " <param name=\"volume\" value=\"100\" />\n";
 		AudioCode += " </object></object><br><br>\n";
	}
	else { 
		var AudioCode = "";

//		AudioCode += " <embed type=\"application/x-shockwave-flash\" wmode=\"transparent\" "; 
//		AudioCode += " src=\"http://www.google.com/reader/ui/3523697345-audio-player.swf?audioUrl=http://stockbridgesinfonia.org" + audioFile + "\" "; 
//		AudioCode += " height=\"27\" width=\"250\">";
//		AudioCode += " </embed>";



		AudioCode += " <object\n"; 
		AudioCode += " codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\"\n"; 
		AudioCode += " height=\"27\" width=\"250\"\n"; 
		AudioCode += " align=\"middle\"\n"; 
		AudioCode += " classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\">\n"; 
		AudioCode += " <param name=\"_cx\" value=\"10583\">\n"; 
		AudioCode += " <param name=\"_cy\" value=\"714\">\n"; 
		AudioCode += " <param name=\"FlashVars\" value=\"\">\n"; 
		AudioCode += " <param name=\"Movie\" value=\"http://www.google.com/reader/ui/3523697345-audio-player.swf?audioUrl=http://stockbridgesinfonia.org" + audioFile + "\">\n"; 
		AudioCode += " <param name=\"Src\" value=\"http://www.google.com/reader/ui/3523697345-audio-player.swf?audioUrl=http://stockbridgesinfonia.org" + audioFile + "\">\n"; 
	//	AudioCode += " <param name=\"Movie\" value=\"http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=http://stockbridgesinfonia.org" + audioFile + "\">\n"; 
	//	AudioCode += " <param name=\"Src\" value=\"http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=http://stockbridgesinfonia.org" + audioFile + "\">\n"; 
		AudioCode += " <param name=\"WMode\" value=\"Window\">\n"; 
		AudioCode += " <param name=\"Play\" value=\"0\">\n"; 
		AudioCode += " <param name=\"Loop\" value=\"-1\">\n"; 
		AudioCode += " <param name=\"Quality\" value=\"High\">\n"; 
		AudioCode += " <param name=\"SAlign\" value=\"lt\">\n"; 
		AudioCode += " <param name=\"Menu\" value=\"-1\">\n"; 
		AudioCode += " <param name=\"Base\" value=\"\">\n"; 
		AudioCode += " <param name=\"AllowScriptAccess\" value=\"never\">\n"; 
		AudioCode += " <param name=\"Scale\" value=\"NoScale\">\n"; 
		AudioCode += " <param name=\"DeviceFont\" value=\"0\">\n"; 
		AudioCode += " <param name=\"EmbedMovie\" value=\"0\">\n"; 
		AudioCode += " <param name=\"BGColor\" value=\"\">\n"; 
		AudioCode += " <param name=\"SWRemote\" value=\"\">\n"; 
		AudioCode += " <param name=\"MovieData\" value=\"\">\n"; 
		AudioCode += " <param name=\"SeamlessTabbing\" value=\"1\">\n"; 
		AudioCode += " <param name=\"Profile\" value=\"0\">\n"; 
		AudioCode += " <param name=\"ProfileAddress\" value=\"\">\n"; 
		AudioCode += " <param name=\"ProfilePort\" value=\"0\">\n"; 
		AudioCode += " <param name=\"AllowNetworking\" value=\"all\">\n"; 
		AudioCode += " <param name=\"AllowFullScreen\" value=\"false\">\n"; 
		AudioCode += " <embed type=\"application/x-shockwave-flash\"\n";  
		AudioCode += " src=\"http://www.google.com/reader/ui/3523697345-audio-player.swf?audioUrl=http://stockbridgesinfonia.org" + audioFile + "\"\n";  
	//	AudioCode += " src=\"http://www.google.com/reader/ui/3247397568-audio-player.swf?audioUrl=http://stockbridgesinfonia.org" + audioFile + "\"\n";  
		AudioCode += " allowscriptaccess=\"never\"\n";  
		AudioCode += " quality=\"best\"\n";  
		AudioCode += " bgcolor=\"#ffffff\"\n";  
		AudioCode += " wmode=\"window\"\n";  
		AudioCode += " flashvars=\"playerMode=embedded\"\n";  
		AudioCode += " pluginspage=\"http://www.macromedia.com/go/getflashplayer\" height=\"27\" width=\"250\">\n"; 
		AudioCode += " </object>\n";
		if(audioZip.length > 0) {
			AudioCode += "<br><a class=\"ten\" "; 
			AudioCode += "href=\"" + audioZip + "\" "; 
			AudioCode += "onmouseover=\"status='';return true;\">";
			AudioCode += "<FONT COLOR=\"#00339\" onMouseOver=\"this.style.color='#cc0000'\" "; 
			AudioCode += "onMouseOut=\"this.style.color='#003399'\">";
			AudioCode += "DOWNLOAD AUDIO FILE</font></a><br>";
		}
	}
document.open();
document.write(AudioCode);
document.close();
}


function writeAudioPhoto(size) {
	if(imageUrl.length > 0) {
		var imageCode = "";
		imageCode += " <p class=\"ten\" align=center valign=top><img src=\"" + imageUrl + "\"";
		imageCode += "\" width=" + 300*myW + " alt=\"\" border=0>";
		imageCode += "<br><table width=" + 300*myW + "class=\'ten\' align=\'center\' valign=\'top\'><tr><td align=\'center\' valign=\'top\'>"; 
		if((navigator.userAgent.indexOf("iPhone") == -1) && (imageZip.length >0)){
			imageCode += "<a class=\"ten\""; 
			imageCode += "href=\"/" + imageZip + "\""; 
			imageCode += "onmouseover=\"status='';return true;\">";
			imageCode += "<FONT COLOR=\"#003399\" onMouseOver=\"this.style.color='#cc0000'\""; 
			imageCode += "onMouseOut=\"this.style.color='#003399'\">"; 
			imageCode += "DOWNLOAD PHOTO</font></a>";
		}
		document.open(); 
		document.write(imageCode);
		document.close();
	}
}

function reLoadIt() {
	if (ie || n5) {setTimeout("location.reload()",2000);}
}

var NewWin = "";
function NewAudioWindow(SrcToOpen,myWinWidth,myWinHeight) {
	if (!NewWin.closed && NewWin.location) {
		NewWin.close();
	}
	var WinLeft = 100;
	var WinTop = 10;
	NewWin = window.open(SrcToOpen,'MyAudioWindow','width=' + myWinWidth + 'px,height=' + myWinHeight + 'px,top=' + WinTop + 'px,left=' + WinLeft + 'px,resizable,scrollbars,menubar');
	if (window.focus) {NewWin.focus()};
	return false;
}



