/************************************************************
    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 + 80;');
    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
*************************************************************/

/************************************************************
    BEGIN code Expand / Collapse
*************************************************************/
function switchVisability( sectionNum ) {
	if (document.getElementById("ExpColBody" + sectionNum).style.display!="none") {
		document.getElementById("ExpColBody" + sectionNum).style.display = "none";
		document.getElementById("ExpColHeaderImg" + sectionNum).src = expandImg;
		document.getElementById("ExpColHeaderMsg" + sectionNum).innerHTML = expandMsg;
	} else {
		document.getElementById("ExpColBody" + sectionNum).style.display = "";
		document.getElementById("ExpColHeaderImg" + sectionNum).src = collapseImg;
		document.getElementById("ExpColHeaderMsg" + sectionNum).innerHTML = collapseMsg;
	}
}
/************************************************************
    END code Expand / Collapse
*************************************************************/

/************************************************************
    BEGIN code Expand / Collapse List
*************************************************************/
function listSwitchVisability( sectionNum ) {
	if (document.getElementById("ulDiv" + sectionNum).style.display!="none") {
		document.getElementById("ulDiv" + sectionNum).style.display = "none";
	} else {
		document.getElementById("ulDiv" + sectionNum).style.display = "";
	}
}
/************************************************************
    END code Expand / Collapse List
*************************************************************/

/************************************************************
    BEGIN code Tabbed
*************************************************************/
function tabSwitchVisability( tabNum ) {

	for (var i=1; (document.getElementById("tabContent" + i)!=null); i++)
	{
		if (tabNum != i)
		{
			document.getElementById("tab" + i).className = "tab";
			document.getElementById("tabContent" + i).style.display = "none";
		}
		else
		{
			document.getElementById("tab" + i).className = "tab activeTab";
			document.getElementById("tabContent" + i).style.display = "";
		}
	}
}
/************************************************************
    END code Tabbed
*************************************************************/
/************************************************************
    BEGIN code VendorSSO Component Window
*************************************************************/
function openVendorWindow( url, windowName, height, width ) {

    //determine window attributes
    windowAttributes = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,left=50,top=50';
    if ((height == null) || (width == null)) {
            height = 500;
            width = 700;
    }
    windowAttributes += ',width=' + width + ',height=' + height;
    
	win=window.open( url, windowName, windowAttributes);
}
function openVendorWindowControllable( url, windowName, height, width ) {

    //determine window attributes
    windowAttributes = 'toolbar=1,location=1,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,left=50,top=50';
    if ((height == null) || (width == null)) {
            height = 500;
            width = 700;
    }
    windowAttributes += ',width=' + width + ',height=' + height;
    
	win=window.open( url, windowName, windowAttributes);
}
/************************************************************
    END code VendorSSO Component Window
*************************************************************/
/************************************************************
    BEGIN code Bookmark or PageToolsComponent
*************************************************************/
function addBookmark() {
    agt=navigator.userAgent.toLowerCase();
    if (window.sidebar) { 
        // Mozilla Firefox Bookmark
        window.sidebar.addPanel(document.title, location.href,"");
    } else if (window.external && (!document.createTextNode || (typeof(window.external.AddFavorite)=='unknown'))) {
        // IE4 on Windows generates an error on "typeof(window.external.AddFavorite)"
        window.external.AddFavorite(location.href, document.title); // IE/Win
    } else if (agt.substr(agt.indexOf('opera')+6,1) < 9) {
        alert('We are unable to setup a bookmark automatically for you.\n\nPlease do so manually by pressing CTRL-T.');
    } else if (agt.substr(agt.indexOf('opera')+6,1) >= 9) {
        alert('We are unable to setup a bookmark automatically for you.\n\nPlease do so manually by pressing CTRL-D.');		
    } else {
        //rather than try to customize the message on a per browser / OS basis,
        //just put up a general message.
      alert('We are unable to setup a bookmark automatically for you.\n\nPlease do so manually with your browser\'s menu.');
    }

}
/************************************************************
    END code Bookmark or PageToolsComponent
*************************************************************/