//******************************
var winPopup;
var urlWebsite = new String("");
 
 function showPage()
 {
 	dojo.style(dojo.body(), "visibility", "visible");
 }

function showContent()
{
setTimeout("dojo.style(dojo.byId('contentContainer'), 'visibility', 'visible')", 500);
//dojo.style(dojo.byId('contentContainer'), "visibility", "visible");
}

function openPage(s)
{
window.location = s;
}	


	function openPop(s)
	{
		urlWebsite = s;
		if (!winPopup || winPopup.closed) {
			winPopup = window.open(urlWebsite,"winPopup","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=yes");
		} else {
			winPopup.location.href = urlWebsite;
			if (window.focus) setTimeout('winPopup.focus()',1000);
		}
	}
 
	var videoSource, videoTitle, videoHeight, videoWidth; 
	var pageHeight, pageWidth;
	var qsParm = new Array(); 
	qsParm['vs'] = null;
	qsParm['vt'] = null;
	qsParm['h'] = null;
	qsParm['w'] = null;
	qs();  

	function qs()
	{
		var query = window.location.search.substring(1);
		var parms = query.split('&');
		for (var i=0; i<parms.length; i++)
		{
			var pos = parms[i].indexOf('=');
			if (pos > 0)
			{
				var key = parms[i].substring(0,pos);
				var val = parms[i].substring(pos+1);
				qsParm[key] = val;
			}
		}
	} 
	
	if (qsParm['vs'] == null)
	{
		videoSource = "";
	}
	else
	{
		videoSource = "videos/" + qsParm['vs'];
	}
	
	if (qsParm['vt'] == null)
	{
		videoTitle = "";
	}
	else
	{
		videoTitle = unescape(qsParm['vt']);
	}
	
	if (qsParm['h'] == null)
	{
		videoHeight = "600";
		pageHeight = "600";
	}
	else if (parseInt(qsParm['h']) < 600)
	{
	
		videoHeight = qsParm['h'];
		videoHeight = parseInt(videoHeight) + 40;
		pageHeight = "900";
	}
	else
	{
		videoHeight = qsParm['h'];
		videoHeight = parseInt(videoHeight) + 40;
		pageHeight = parseInt(videoHeight) + 100;
	}

	if (qsParm['w'] == null) {
		videoWidth = "800";
		pageWidth = "800";
	}
	else if (parseInt(qsParm['w']) < 800)
	{
		videoWidth = qsParm['w'];
		videoWidth = parseInt(videoWidth) + 20;
		pageWidth = "840";
	}
	else
	{
		videoWidth = qsParm['w'];
		videoWidth = parseInt(videoWidth) + 20; 
		pageWidth = parseInt(videoWidth) + 40; 
	}	
		
	function loadVideo()
	{
	var videoObject;
		if (videoSource.length > 0)
		{
			videoObject = "<object width=\" " + videoWidth + " \"  height=\" " + videoHeight + "\"";
			videoObject += "classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\">";
			videoObject += "<param name=\"src\" value=\"" + videoSource + "\"></param>";
			videoObject += "<param name=\"autoplay\" value=\"true\"></param>";
			videoObject += "<param name=\"controller\" value=\"true\"></param>";
			videoObject += "<embed src=\"" + videoSource + "\" width=\"" + videoWidth + "\" height=\"" + videoHeight + "\" ";
			videoObject += "autoplay=\"true\" controller=\"true\"  type=\"video/quicktime\" pluginspage=\"http://www.apple.com/quicktime/download/\"></embed>";
			videoObject += "</object>";
		}
			else
		{	
			videoObject = "<p style=\"margin: 100px;\">This video is not available to view.</p>";

		}
	//	document.getElementById("videoPageContainer").style.width = pageWidth + "px"; 
	//	document.getElementById("videoPageContainer").style.height = pageHeight + "px"; 	
		document.getElementById("titleVideo").innerHTML = videoTitle;
		document.getElementById("video").innerHTML = videoObject;
	}
	
	var pMenuBar;
	function showMenu()
	{
         pMenuBar = new dijit.MenuBar({});
         var pSubMenu1 = new dijit.Menu({});
        pSubMenu1.addChild(new dijit.MenuItem({
            label:"Spring 2009",
            onClick: function(){window.location = "news2009.htm";}
        }));
        pSubMenu1.addChild(new dijit.MenuItem({
            label:"Summer 2007",
            onClick: function(){window.location = "news2007.htm";}
        }));
         pSubMenu1.addChild(new dijit.MenuItem({
            label:"Fall 2006",
            onClick: function(){window.location = "news2006.htm";}
        }));
        pMenuBar.addChild(new dijit.PopupMenuBarItem({
            label:"Latest News",
            popup:pSubMenu1
        }));
        
        var pSubMenu2 = new dijit.Menu({});
        pSubMenu2.addChild(new dijit.MenuItem({
            label:"LIS Habitats",
            onClick: function(){window.location = "habitats_lis.htm";}
        }));
        pSubMenu2.addChild(new dijit.MenuItem({
            label:"Seagrass Marsh and Meadow ",
             onClick: function(){window.location = "habitats_grass.htm";}
        }));
		pSubMenu2.addChild(new dijit.MenuItem({
            label:"Boulder and Gravel Seafloor",
             onClick: function(){window.location = "habitats_rock.htm";}
        })); 
        pSubMenu2.addChild(new dijit.MenuItem({
            label:"Sand Seafloor",
            onClick: function(){window.location = "habitats_sand.htm";}
        }));       
         pSubMenu2.addChild(new dijit.MenuItem({
            label:"Mud, Silt and Clay Seafloor",
            onClick: function(){window.location = "habitats_mud.htm";}
        }));
         pSubMenu2.addChild(new dijit.MenuItem({
            label:"Pelagic Habitat",
            onClick: function(){window.location = "habitats_water.htm";}
        }));
        pMenuBar.addChild(new dijit.PopupMenuBarItem({
            label:"Discover Habitats",
            popup:pSubMenu2
        }));

        var pSubMenu3 = new dijit.Menu({});
        pSubMenu3.addChild(new dijit.MenuItem({
            label:"Dive In",
             onClick: function(){window.location = "explore_divein.htm";}
        }));
        pSubMenu3.addChild(new dijit.MenuItem({
            label:"Fly In",
             onClick: function(){window.location = "explore_flyin.htm";}
        }));
         pSubMenu3.addChild(new dijit.MenuItem({
            label:"LIS In High Def",
             onClick: function(){window.location = "explore_lishd.htm";}
        }));
         pSubMenu3.addChild(new dijit.MenuItem({
            label:"Slideshow",
             onClick: function(){window.location = "explore_slideshow.asp";}
        }));
        pMenuBar.addChild(new dijit.PopupMenuBarItem({
            label:"Explore Underwater",
            popup:pSubMenu3
        }));
        
         var pSubMenu4 = new dijit.Menu({});
        pSubMenu4.addChild(new dijit.MenuItem({
            label:"Underwater Vehicles",
             onClick: function(){window.location = "uw_tech.htm";}
        }));
        pSubMenu4.addChild(new dijit.MenuItem({
            label:"Underwater Video",
             onClick: function(){window.location = "uw_video.htm";}
        }));
        pMenuBar.addChild(new dijit.PopupMenuBarItem({
            label:"Underwater Technology",
            popup:pSubMenu4
        }));

		var pSubMenu5 = new dijit.Menu({});
        pSubMenu5.addChild(new dijit.MenuItem({
            label:"Then & Now",
             onClick: function(){window.location = "about_then_now.htm";}
        }));
        pSubMenu5.addChild(new dijit.MenuItem({
            label:"Geology",
             onClick: function(){window.location = "about_geology.htm";}
        }));
         pSubMenu5.addChild(new dijit.MenuItem({
            label:"Diversity",
             onClick: function(){window.location = "about_diversity.htm";}
        }));
         pSubMenu5.addChild(new dijit.MenuItem({
            label:"Impacts",
             onClick: function(){window.location = "about_impacts.htm";}
        }));
        pMenuBar.addChild(new dijit.PopupMenuBarItem({
            label:"About the Sound",
            popup:pSubMenu5
        }));    
        
        var pSubMenu6 = new dijit.Menu({});
        pSubMenu6.addChild(new dijit.MenuItem({
            label:"Links",
             onClick: function(){window.location = "info_links.htm";}
        }));
        pSubMenu6.addChild(new dijit.MenuItem({
            label:"Further Reading",
             onClick: function(){window.location = "info_read.htm";}
        }));
        pMenuBar.addChild(new dijit.PopupMenuBarItem({
            label:"More Info",
            popup:pSubMenu6
        }));    
        
        var pSubMenu7 = new dijit.Menu({});
        pSubMenu7.addChild(new dijit.MenuItem({
            label:"Discover Habitats",
             onClick: function(){window.location = "ed_habitats.htm";}
        }));
        pSubMenu7.addChild(new dijit.MenuItem({
            label:"Dive In",
             onClick: function(){window.location = "ed_divein.htm";}
        }));
         pSubMenu7.addChild(new dijit.MenuItem({
            label:"Fly In",
             onClick: function(){window.location = "ed_flyin.htm";}
        }));
        pMenuBar.addChild(new dijit.PopupMenuBarItem({
            label:"Teacher Resources",
            popup:pSubMenu7
        }));    
         pMenuBar.placeAt("menubardiv");
         pMenuBar.startup();
    }
    