/************************************************************
    BEGIN code for flash player detection
*************************************************************/
//The below variable works in confunction with a VBScript
//outputted by the page template presentation XSL file
MSDetect = "false";

function getbrowserinfo(browser) {
	browser.version = parseInt(navigator.appVersion);

	browser.nav = (navigator.userAgent.indexOf("Opera") != -1)?"OPERA":
		(navigator.appName.indexOf("Netscape") != -1)?"NN":
		(navigator.appName.indexOf("Microsoft") != -1)?"IE":"UNK";

	browser.plat = (navigator.platform.indexOf("Win") != -1)?"WIN":
		(navigator.platform.indexOf("Mac") != -1)?"MAC":"UNK";

	//beginning of flash detect -- ie on win needs the vb include test to complete
	browser.flash = 0;
	if (navigator.mimeTypes && navigator.mimeTypes.length) {
		x = navigator.mimeTypes['application/x-shockwave-flash'];
		if (x && x.enabledPlugin) browser.flash = 2;
		else browser.flash = 1;
	} else { MSDetect = "true"; }

	browser.flashmajorversion = 0;
	if (navigator.mimeTypes && navigator.mimeTypes.length && navigator.plugins['Shockwave Flash']) {
		strFlashName = navigator.plugins['Shockwave Flash'].description;
		strFlashName = strFlashName.substring(strFlashName.indexOf(" ") + 1);
		strFlashName = strFlashName.substring(strFlashName.indexOf(" ") + 1);
		strFlashName = strFlashName.substring(0,strFlashName.indexOf("."));
		browser.flashmajorversion = strFlashName;
	}
}

var browser = new Object();
getbrowserinfo(browser);

/************************************************************
    END code for flash player detection
*************************************************************/

/************************************************************
    BEGIN code for dynamic menus
*************************************************************/
startList = function() {
	//ensure that this script only runs in IE (and Opera impersonating IE doesn't count)
	if (navigator.appName=="Microsoft Internet Explorer"
		&& navigator.userAgent.indexOf("Opera ")==-1
		&& document.getElementById ) {
		navRoot = document.getElementById("dyn_menu");
	    if (navRoot != null) {
    		for (i=0; i<navRoot.childNodes.length; i++) {
    			node = navRoot.childNodes[i];
    			if (node.nodeName=="LI") {
    				node.onmouseover=function() {
    					this.className+=" over";
    					this.style.styleFloat="left";
    				}
    				node.onmouseout=function() {
    					this.className=this.className.replace(" over", "");
    					this.style.styleFloat="none";
    				}
    			}
    		}
		}
	}
}
window.onload=startList;
/************************************************************
    END code for dynamic menus
*************************************************************/

/************************************************************
    BEGIN code pop-up windows for animations and images
*************************************************************/
function popResource(resourceURL, height, width) {
    
    isFlash = false;
    
    //determine if this is a flash animation  
    if (resourceURL.toUpperCase().indexOf('.SWF') != -1) {
        isFlash = true;
    }
    
    //determine window title
    if (isFlash) {
        windowTitle = 'Animation';
    } else {
        windowTitle = 'Image';
    }
    
    //determine window attributes
    windowAttributes = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,left=100,top=100';
    if ((height == null) || (width == null)) {
            height = 400;
            width = 400;
    }
    windowAttributes += ',width=' + width + ',height=' + height;
  
    //open the window
    win=window.open('about:blank',windowTitle,windowAttributes);    

    //determine if this is a flash animation  
    if (isFlash) {
        popFlash(resourceURL, win, height, width);
    } else {
        popImage(resourceURL, win);
    }
}

function popImage(imageURL, imgWin){

    imgWin.document.writeln('<html><head><title>Image</title><style>body{margin:0px;}</style>');
    imgWin.document.writeln('<script>');

    imgWin.document.writeln('function reSizeToImage(){');
    imgWin.document.writeln('  width=document.images[0].width + 25;');
    imgWin.document.writeln('  height=document.images[0].height + 30;');
    imgWin.document.writeln('  window.resizeTo(width,height);');
    imgWin.document.writeln('}');
    
    imgWin.document.writeln('</script>');
    imgWin.document.writeln('</head>');
    
    imgWin.document.writeln('<body  scroll="no" style="margin:0px;padding:0px;background-color:#FFFFFF;" onload="reSizeToImage();self.focus();">')        
    imgWin.document.writeln('<table border="0" align="center" valign="middle" width="100%" height="100%" cellspacing="0" cellpadding="0" style="margin:0px;padding:0px;vertical-align:middle;">');
    imgWin.document.writeln('<tr><td align="center" valign="middle" style="margin:0px;padding:0px;vertical-align:middle;">');    
    imgWin.document.writeln('<img border="0" src='+imageURL+' style="display:block;padding:0px;margin:0px;vertical-align:middle;">');
    imgWin.document.writeln('</td>');        
    imgWin.document.writeln('</table>');    
    imgWin.document.writeln('</body></html>');
    imgWin.document.close();		

}

function popFlash(flashURL, flashWin, movHeight, movWidth){
    flashWin.document.writeln('<html><head><title>Animation</title><style>body{margin:0px;}</style></head>');        
    flashWin.document.writeln('<body style="margin:0px;padding:0px;background-color:#FFFFFF;" onload="self.focus();">');
    flashWin.document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + movHeight + '" height="' + movHeight + '" align="middle">');
    flashWin.document.writeln('<param name="movie" value="' + flashURL + '" />');
    flashWin.document.writeln('<param name="menu" value="false" />');
    flashWin.document.writeln('<param name="quality" value="high" />');
    flashWin.document.writeln('<param name="bgcolor" value="#ffffff" />');
    flashWin.document.writeln('<embed src="' + flashURL + '" menu="false" quality="high" bgcolor="#ffffff" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"  height="' + movHeight + '" width="' + movWidth + '" />');
    flashWin.document.writeln('</object>');
    flashWin.document.writeln('</body></html>');
    flashWin.document.close();	        		
}
/************************************************************
    END code pop-up windows for animations and images
*************************************************************/
