function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

//======================================================
//Function:		opens new window and displays passed page
//Parameters:	sourcefile - url of page to display
//				w - width of window, h - height of window
//Date:			Kent Kobi - 01/06/2004
//======================================================
function openPopUp(sourcefile, w, h) { 
 newWin = window.open(sourcefile,"menu1","status=yes,menubar=yes,toolbar=yes,location=yes,scrollbars=yes,resizable=yes,width="+w+",height="+h+",screenX=100,screenY=100,left=100,top=100");
 newWin.focus 
}

function openPopUpNoChrome(sourcefile, w, h) { 
 newWin = window.open(sourcefile,"menu1","status=no,menubar=no,toolbar=no,location=no,scrollbars=no,resizable=no,width="+w+",height="+h+",screenX=100,screenY=100,left=100,top=100");
 newWin.focus 
}

//======================================================
//Function:		Creates spam proof email link
//Parameters:	user - recipients email name
//				domain - recipients domain name
//				display - displayed link text
//Date:			Kent Kobi - 08/06/2004
//======================================================
function courier(user, domain, display)
{
 at = "&#064;"
 openHref = "<a href=\"";
 mailto = "&#109;&#097;&#105;&#108;&#116;&#111;&#058;"
 escapeChar = "\">"
 closeHref = "</a>";
 dotCom = "&#046;&#099;&#111;&#109;"
 result = openHref + mailto + user + at + domain + escapeChar + display + closeHref;
 document.write(result);
}

//======================================================
//Function:		Drop down menu for securities details
//Date:			Ross Andersen - 14/06/2004
//======================================================
function securityLookUp() {
	var security = document.securityDetail.securityName.value;
	if (security == "") {
		return
	}
	else {
		document.securityDetail.submit();
	}
}


// orginally from plone_javascripts.js which is distributed as part of Plone 2.0.3
// Modified 6/18/2004 by DM at Karo.  We don't care about classes for the site,
// but want to set the target to _blank for PDF links and external links
function scanforlinks()
{

    // securing against really old DOMs 
    if (! document.getElementsByTagName){return false};
    if (! document.getElementById){return false};
    
   
    contentarea = document;
    if (! contentarea){return false}
    
    links = contentarea.getElementsByTagName('a');
    for (i=0; i < links.length; i++){      
        if ((links[i].getAttribute('href'))){
            var linkval = links[i].getAttribute('href')
            // check if the link href is a relative link, or an absolute link to the current host.
			if (linkval.toLowerCase().indexOf(window.location.protocol+'//'+window.location.host)==0) {
                //the link is an absolute pointer internal to our host
                // do nothing
            } 
            else if (linkval.indexOf('http') != 0){
				 // not a http-link. Possibly an internal relative link, but also possibly a mailto or other protocol
				 // we can ignore these
            }
			else if (linkval.indexOf('http://phx.corporate-ir.net/') == 0){
				 // link to CCBN, these need to stay in the same window
				 // do nothing
            }
			else if (linkval.indexOf('http://library.enbridge.com/') == 0){
				 // link to CCBN, these need to stay in the same window
				 // do nothing
            }
			else if (linkval.indexOf('http://careers.enbridge.com/') == 0){
				 // link to CCBN, these need to stay in the same window
				 // do nothing
            }
			else if (linkval.indexOf('http://www2.cdn-news.com/') == 0){
				 // link to CCN Matthews, these need to stay in the same window
				 // do nothing
            }
			else if (linkval.indexOf('http://www2.ccnmatthews.com/') == 0){
				 // link to CCN Matthews, these need to stay in the same window
				 // do nothing
            }
            else
            {
                // we are in here if the link points to somewhere else than our site.
                links[i].setAttribute('target','_blank')
            }
            
            // check if the link points to a PDF.  If so, open in new window
            if (linkval.toLowerCase().lastIndexOf('.pdf') == linkval.length-4){
				links[i].setAttribute('target','_blank')
            }
          
            
        }
    }
}

//======================================================
//Function:		Defined function that opens window for OPSS member login
//Date:			Ross Andersen - 14/06/2004
//======================================================
function openLogIn ()	{

	//Determine which option was selected.
	for (var i = 1; i < document.frmLogIn.cboLogIn.options.length; i++)	{
		if (document.frmLogIn.cboLogIn.options[i].selected)	{

	//Create variables to hold portions of the URL.
	//Separate static and dynamic portions of the URL.
	var url1 = "http://www.etidev.com/"
	var url2 = document.frmLogIn.cboLogIn.options[i].value
	var url3 = "/acl_users/docLogin?destination=http://www.etidev.com/"
	var url4 = "/index_html"

	//Create variables to hold features of new window
	var varBars = "location=yes,menubar=yes,scrollbars=yes,titlebar=yes,toolbar=yes,directories=yes,status=yes"
	var varOptions = "height=450,width=590,resizable=yes,screenX=200,screenY=200,left=200,top=200"
	var varFeatures = varBars + "," + varOptions

	//Open the login page that corresponds to the option chosen.
	//The window instance has the name newWin and the document in
	//the window is named winLogIn.
	var newWin = window.open(url1 + url2 + url3 + url2 + url4, "winLogIn", varFeatures)

	//Bring the window to the front.
	newWin.focus()

			}
		}
	}

// Expandable content script from flooble.com.
// For more information please visit:
//   http://www.flooble.com/scripts/expand.php
// Copyright 2002 Animus Pactum Consulting Inc.
//----------------------------------------------
//located in /inc/header.php

 
 
var currentURL = unescape(window.location.pathname);
var currentQuery = unescape(window.location.search);
function viewer(type)
{
    window.location.href = currentURL  + type;
}

function viewerTraining(type)
{
    window.location.href = currentURL + currentQuery + type;
}