function jump(menuObj)
{
   var i = menuObj.selectedIndex;
   if(i > 0)
   {
      window.location = menuObj.options[i].value;
   }
}

function popUp(URL,h,w) 
{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=" + w +"," + h +"=700');");
}

function getElementsByClass (searchClass) {  
	// This function returns an array of all HTML objects with the  
	// specified className.  Tag is optional     
	var returnArray = [];  
	var els = document.getElementsByTagName('*');  
	var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');  
	for (var i = 0; i < els.length; i++) {    
		if ( pattern.test(els[i].className) ) { returnArray.push(els[i]); }  
	}  
	return returnArray;
}
function VideoPop(vid, filedesc, filepath, darken) {  
	// This function accepts a division ID (vid), either a string or the actual  
	// object itself.   vid is mandatory.   darken is optional, if it's true  
	// the page will be greyed out under the video.  
	if (vid == 'close') {
		document.getElementById('videoDiv').innerHTML = '';
		document.getElementById('videoDiv').style.display ='none';
		document.getElementById('darkenScreenObject').style.display ='none';
	
		return false;
	}
	
	/*
	var htmlStr = '<a href="#" onclick="return VideoPop(\'close\')" style="float: left; color: white;">Close</a><BR>\n\
					<center><b style ="font-size:18px;font-family:Lucida,sans-serif;line-height:1.6;color: white;">' + filedesc + '</b></center><br />';
	*/				
	var htmlStr = '<a href="#" onclick="return VideoPop(\'close\')" style="float: left; color: white;">Close</a><BR>\n';
					
	if(-1 != filepath.toLowerCase().indexOf("youtube"))
    {
		if (-1 != filepath.toLowerCase().indexOf("watch?v=")) {
			filepath = filepath.replace("watch?v=",'v/');
		}
		htmlStr = htmlStr + '<object width="445" height="364">\
			<param name="movie" value="' + filepath + '&fs=1&border=0"></param>\
			<param name="allowFullScreen" value="true"></param>\
			<param name="allowscriptaccess" value="always"></param>\
			<param name="wmode" value="transparent"></param> \
			<embed src="' + filepath + '&fs=1&border=0" \
				type="application/x-shockwave-flash" \
				 wmode="transparent" \
				allowscriptaccess="always" \
				allowfullscreen="true" \
				width="445" \
				height="364">\
			</embed>\
			</object>';
	}
	else if(-1 != filepath.toLowerCase().indexOf("mov") || -1 != filepath.toLowerCase().indexOf("mp4") || -1 != filepath.toLowerCase().indexOf("m4v") || -1 != filepath.toLowerCase().indexOf("3gp"))
    {
		htmlStr = htmlStr + '<object CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" \
			width="500" height="400" CODEBASE="https://www.apple.com/qtactivex/qtplugin.cab"> \
			<param name="src" value="' + filepath + '"> \
			<param name="controller" value="true"> \
			<param name="autoplay" value="true"> \
			<param name="loop" value="false"> \
			<param name="bgcolor" value="#000000"> \
			<embed src="' + filepath + '"  \
			width="500" height="400" bgcolor="#000000" controller="true" autoplay="true" loop="false" \
			pluginspage="https://www.apple.com/quicktime/"></embed>\
			</object>';
	}
	else 
	{
		if(-1 != navigator.userAgent.indexOf("MSIE"))
		{
			htmlStr = htmlStr + '<OBJECT id="Player"\
				 classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"\
				 >';
		}
		else if(-1 != navigator.userAgent.indexOf("Firefox"))
		{
			htmlStr = htmlStr + '<OBJECT id="Player"\
				 type="application/x-ms-wmp"\
				 width=500 height=400>';
		}
		htmlStr = htmlStr + '<PARAM NAME="AutoStart" VALUE="True"> \
				<PARAM NAME="Balance" VALUE="False"> \
				<PARAM NAME="DisplaySize" VALUE="True"> \
				<PARAM NAME="Filename" VALUE="' + filepath +'"> \
				<PARAM NAME="Mute" VALUE="False"> \
				<PARAM NAME="SelectionStart" VALUE="False"> \
				<PARAM NAME="SelectionEnd" VALUE="False"> \
				<PARAM NAME="ShowControls" VALUE="True"> \
				<PARAM NAME="ShowAudioControls" VALUE="True"> \
				<PARAM NAME="ShowDisplay" VALUE="False"> \
				<PARAM NAME="ShowPositionControls" VALUE="False"> \
				<PARAM NAME="Volume" VALUE="1"> \
				<PARAM NAME="AudioStream" VALUE="False"> \
				<PARAM NAME="AutoSize" VALUE="False"> \
				<PARAM NAME="stretchToFit" VALUE="False"> \
				<PARAM NAME="AnimationAtStart" VALUE="False"> \
				<PARAM NAME="AllowScan" VALUE="False"> \
				<PARAM NAME="AllowChangeDisplaySize" VALUE="False"> \
				<PARAM NAME="AutoRewind" VALUE="True"> \
				<PARAM NAME="BaseURL" VALUE=""> \
				<PARAM NAME="BufferingTime" VALUE="5"> \
				<PARAM NAME="CaptioningID" VALUE=""> \
				<PARAM NAME="ClickToPlay" VALUE="True"> \
				<PARAM NAME="CursorType" VALUE="0"> \
				<PARAM NAME="CurrentPosition" VALUE="True"> \
				<PARAM NAME="CurrentMarker" VALUE="True"> \
				<PARAM NAME="DefaultFrame" VALUE="mainframe"> \
				<PARAM NAME="DisplayBackColor" VALUE="True"> \
				<PARAM NAME="DisplayForeColor" VALUE="16777215"> \
				<PARAM NAME="DisplayMode" VALUE="1"> \
				<PARAM NAME="Enabled" VALUE="-1"> \
				<PARAM NAME="EnableContextMenu" VALUE="False"> \
				<PARAM NAME="EnablePositionControls" VALUE="False"> \
				<PARAM NAME="EnableFullScreenControls" VALUE="False"> \
				<PARAM NAME="EnableTracker" VALUE="False"> \
				<PARAM NAME="InvokeURLs" VALUE="False"> \
				<PARAM NAME="Language" VALUE="False"> \
				<PARAM NAME="PlayCount" VALUE="1"> \
				<PARAM NAME="PreviewMode" VALUE="False"> \
				<PARAM NAME="ShowStatusBar" VALUE="True"> \
				<PARAM NAME="TransparentAtStart" VALUE="False"> \
				</OBJECT>';
	}
	//alert(htmlStr);
	// This handles the darkening of the background while a video is playing.  
	// First we see if the dark layer exists.  
	var dark=document.getElementById('darkenScreenObject');  
	if (!dark) {    
		// The dark layer doesn't exist, it's never been created.  So we'll    
		// create it here and apply some basic styles.    
		var tbody = document.getElementsByTagName("body")[0];    
		var tnode = document.createElement('div');          // Create the layer.        
			tnode.style.backgroundColor='rgb(0, 0, 0)';     // Make it black.        
			tnode.style.opacity='0.2';                      // Set the opacity (firefox/Opera)        
			tnode.style.MozOpacity='0.1';                  // Firefox 1.5        
			tnode.style.filter='alpha(opacity=10)';         // IE.        
			tnode.style.zIndex='1';                         // Zindex of 50 so it "floats"        
			tnode.style.position='absolute';                // Position absolutely        
			tnode.style.top='0px';                          // In the top        
			tnode.style.left='0px';                         // Left corner of the page        
			tnode.style.overflow='hidden';                  // Try to avoid making scroll bars                    
			tnode.style.display='none';                     // Start out Hidden        
			tnode.id='darkenScreenObject';                  // Name it so we can find it later    
		tbody.appendChild(tnode);                           // Add it to the web page    
		dark=document.getElementById('darkenScreenObject'); // Get the object.  
	}  
	dark.style.display='none';  
	if (/^close$/i.test(vid)) { return false; }  
	if (typeof(vid)=="string") { vid=document.getElementById(vid); }  
	if (vid&&typeof(vid)=="object") {    
		if (darken) {      
			// Calculate the page width and height       
			if( window.innerHeight && window.scrollMaxY )  {         
				var pageWidth = window.innerWidth + window.scrollMaxX;        
				var pageHeight = window.innerHeight + window.scrollMaxY;      
			} else if( document.body.scrollHeight > document.body.offsetHeight ) {        
				var pageWidth = document.body.scrollWidth;        
				var pageHeight = document.body.scrollHeight;      
			} else {         
				var pageWidth = document.body.offsetWidth + document.body.offsetLeft;         
				var pageHeight = document.body.offsetHeight + document.body.offsetTop;       
			}      
			//set the shader to cover the entire page and make it visible.       
			dark.style.width= pageWidth+'px';      
			dark.style.height= pageHeight+'px';      
			dark.style.display='block';                                    
		}    
		// Make the video visible and set the zindex so its on top of everything else    
		vid.innerHTML = htmlStr;
		vid.style.zIndex='100';        
		vid.style.display='block';    
		var scrollTop = 0;    
		if (document.documentElement && document.documentElement.scrollTop)      
			scrollTop = document.documentElement.scrollTop;    
		else if (document.body)      
			scrollTop = document.body.scrollTop;    
		// set the starting x and y position of the video    
		vid.style.top=scrollTop+Math.floor((document.documentElement.clientHeight/2)-(vid.offsetHeight/2))+'px';    
		vid.style.left=Math.floor((document.documentElement.clientWidth/2)-(vid.offsetWidth/2))+'px';  
	}  
	return false;
}

function ajaxRequest(){
 var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE
 if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
  for (var i=0; i<activexmodes.length; i++){
   try{
    return new ActiveXObject(activexmodes[i])
   }
   catch(e){
    //suppress error
   }
  }
 }
 else if (window.XMLHttpRequest) // if Mozilla, Safari etc
  return new XMLHttpRequest()
 else
  return false
}


function ProcessRequest() {
    if ( ajax.readyState == 4 && ajax.status == 200 ) {
		alert(ajax.responseText);
    }
    
}

function emailToFriend(vid, filedesc, darken) {  
	// This function accepts a division ID (vid), either a string or the actual  
	// object itself.   vid is mandatory.   darken is optional, if it's true  
	// the page will be greyed out under the video.  
	if (vid == 'close') {
		document.getElementById('emailDiv').innerHTML = '';
		document.getElementById('emailDiv').style.display ='none';
		document.getElementById('darkenScreenObject').style.display ='none';
	
		return false;
	}	
					
	var htmlStr = '<a href="#" onclick="return emailToFriend(\'close\')" style="float: right; color: black;">Close</a><BR>\n';
	
	htmlStr = htmlStr + '<form><p><font color="red" size="+2">Email a Friend</font></p> \
		<p>Fill out the details below to send a copy of this performance page to your friends. Use commas to separate multiple email addresses. \
		<hr width="100%"></p> \
		<p>Email address of friend: <br> \
		<input name="email_address" id="email_address" size="60" /> \
		</p> \
		<p>Add your comments to the message below: <br> \
		<textarea name="email_comments" id="email_comments" cols="60" rows="3">This looks like a great show!</textarea></p> \
		<p>Your name or email address: <br> \
		<input name="sender_name_address" id="sender_name_address" size="60" /><br> \
		<i>This information is only used to indicate the sender of the message.</i> </p> \
		<p><input type="button" name="send_email" id="send_email" value="Send" \
		 onclick="javascript:sendEmail(document.getElementById(\'email_address\').value, document.getElementById(\'email_comments\').value, document.getElementById(\'sender_name_address\').value );"> \
		&nbsp;&nbsp;or&nbsp;&nbsp;<input type="reset" name="clear" id="clear" value="Clear"></p> \
		</form>';		
	
	//alert(htmlStr);
	// This handles the darkening of the background while a video is playing.  
	// First we see if the dark layer exists.  
	var dark=document.getElementById('darkenScreenObject');  
	if (!dark) {    
		// The dark layer doesn't exist, it's never been created.  So we'll    
		// create it here and apply some basic styles.    
		var tbody = document.getElementsByTagName("body")[0];    
		var tnode = document.createElement('div');          // Create the layer.        
			tnode.style.backgroundColor='rgb(0, 0, 0)';     // Make it black.        
			tnode.style.opacity='0.2';                      // Set the opacity (firefox/Opera)    

    
			tnode.style.MozOpacity='0.1';                  // Firefox 1.5        
			tnode.style.filter='alpha(opacity=10)';         // IE.        
			tnode.style.zIndex='1';                         // Zindex of 50 so it "floats"        
			tnode.style.position='absolute';                // Position absolutely        
			tnode.style.top='0px';                          // In the top        
			tnode.style.left='0px';                         // Left corner of the page        
			tnode.style.overflow='hidden';                  // Try to avoid making scroll bars    

                
			tnode.style.display='none';                     // Start out Hidden        
			tnode.id='darkenScreenObject';                  // Name it so we can find it later    
		tbody.appendChild(tnode);                           // Add it to the web page    
		dark=document.getElementById('darkenScreenObject'); // Get the object.  
	}  
	dark.style.display='none';  
	if (/^close$/i.test(vid)) { return false; }  
	if (typeof(vid)=="string") { vid=document.getElementById(vid); }  
	if (vid&&typeof(vid)=="object") {    
		if (darken) {      
			// Calculate the page width and height       
			if( window.innerHeight && window.scrollMaxY )  {         
				var pageWidth = window.innerWidth + window.scrollMaxX;        
				var pageHeight = window.innerHeight + window.scrollMaxY;      
			} else if( document.body.scrollHeight > document.body.offsetHeight ) {        
				var pageWidth = document.body.scrollWidth;        
				var pageHeight = document.body.scrollHeight;      
			} else {         
				var pageWidth = document.body.offsetWidth + document.body.offsetLeft;         
				var pageHeight = document.body.offsetHeight + document.body.offsetTop;       
			}      
			//set the shader to cover the entire page and make it visible.       
			dark.style.width= pageWidth+'px';      
			dark.style.height= pageHeight+'px';      
			dark.style.display='block';                                    
		}    
		// Make the video visible and set the zindex so its on top of everything else    
		vid.innerHTML = htmlStr;
		vid.style.zIndex='100';        
		vid.style.display='block';    
		var scrollTop = 0;    
		if (document.documentElement && document.documentElement.scrollTop)      
			scrollTop = document.documentElement.scrollTop;    
		else if (document.body)      
			scrollTop = document.body.scrollTop;    
		// set the starting x and y position of the video    
		vid.style.top=scrollTop+Math.floor((document.documentElement.clientHeight/2)-

(vid.offsetHeight/2))+'px';    
		vid.style.left=Math.floor((document.documentElement.clientWidth/2)-(vid.offsetWidth/2))+'px'; 

 
	}  
	return false;
}
