<!--

/* 

This code is from Dynamic Web Coding 

at http://www.dyn-web.com/

Copyright 2001-3 by Sharon Paine 

See Terms of Use at http://www.dyn-web.com/bus/terms.html

Permission granted to use this code 

as long as this entire notice is included.

*/


//-->



// this is the email a page URL script 

<!--

function element(id) {  // universal way to get elemnt by id

	if (document.getElementById != null) {	// 1st choice

		return document.getElementById(id);	//no N4, IE4

	}

	if (document.all != null) {		// 2nd choice

		return document.all[id];	// IE only

	}

	if (document.layers != null) {	// 3rd choice

		return document.layers[id];	// N4 only

	}

	return null;

}



function openEmailLinkWindow() {

	var senderName = element("sender-name").value;

	var senderEmail = element("sender-email").value;

	var senderIsRecipient = element("sender-is-recipient-true").checked;

	var recipientName = element("recipient-name").value;

	var recipientEmail = element("recipient-email").value;

	var link = window.location.href;



	var emailLinkWindow = window.open(

		"/core/process?" + 

		"public-email-link.sender-name=" + 

		senderName + 

		"&public-email-link.sender-email=" + 

		senderEmail + 

		"&public-email-link.sender-is-recipient=" + 

		senderIsRecipient +

		"&public-email-link.recipient-name=" + 

		recipientName + 

		"&public-email-link.recipient-email=" + 

		recipientEmail +

		"&public-email-link.link=" + 

		link

		, "emailLinkWindow",

		"location=no," +

		"height=450," +

		"width=500," +

		"zlock=no,"

	);





	return true;

}



function height500(Url){
	window.open(Url, "newWindow","location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=750,height=500");
}


function width800(Url){
	window.open(Url, "newWindow","location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=780,height=500");
}


function bigWindow(Url){

				window.open(Url, "newWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=516,height=500");

			}

function scriptWindow(Url){

                                window.open(Url, "newWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=616,height=400");

                       }

<!-- used for chat popup-->
function PopIt()
{
	window.open(Url, "newWindow","location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=300,height=350");
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function width350(Url){
	window.open(Url, "newWindow","location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=416,height=300");
}

function email(Url){
	window.open(Url, "newWindow","location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=376,height=300");
}

function info(Url){
	window.open(Url, "newWindow","location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=300,height=100");
}

function certRequest(Url){
	window.open(Url, "newWindow","location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=300,height=170");
}

function merchant() {

   if ( document.merchantAcct.merchant.checked == true ) {

      self.location="https://register-payflow.verisign.com/testreg.cfm?partner=VeriSign&merchantaccount=y&returnurl=https://register-payflow.verisign.com/confirmlast.cfm&memo1=WebLink49&product=1003";

   } else {

      self.location="https://register-payflow.verisign.com/testreg.cfm?partner=VeriSign&merchantaccount=n&memo1=WebLink49&product=1003";

   }
}
function supportchat(){window.open("https://www.websitealive.net/32/rRouter.asp?groupid=32&departmentid=37","guest","height=420,width=450")

}

function cschat(){window.open("/chat/chat_intro.html","newWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=516,height=500")
}
function tschat(){window.open("/chat/chat_techsupport.html","newWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=516,height=500")
}
 
function timezone(){window.open("/popups/SUPPORT/timezone.html","newWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=370,height=240")
}

function support(Url){
	window.open(Url, "newWindow","location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=370,height=165");
}
function support2(Url){
	window.open(Url, "newWindow","location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=370,height=281");
}
function tutorial(Url){
	window.open(Url, "newWindow","location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=950,height=800");
}

// this used to expand & display text that is hidden 
function initialiseMenu() {

   // Second tier nav object which was last opened
   lastExpandedObject = null;
   // Third tier nav objects which were last opened
   lastFlyoutObject = null;
   lastFlyoutBridgeObject = null;
   netscapeBrowser = (navigator.appName == "Netscape");
   // Initialise x and y co-ordinate values for user's mouse
   xPosition = 0;
   yPosition = 0;
   if (netscapeBrowser) {
      document.captureEvents(Event.MOUSEMOVE);
   }
   document.onmousemove = getMouseCoordinates;
   if (netscapeBrowser) {
      document.captureEvents(Event.MOUSEDOWN);
   }
   document.onmousedown = listenForMouseClick;
   // If a fly out navigation block is partially off the bottom of the browser window store the difference
   difference = 0;
   thirdTierDisplayed = new Array();
   // Initialise array object used to store whether the IFRAME DIV element has been added to a fly out block
   thirdTierIframeAdded = new Array();
   milliseconds = 1500;
   flyOutNavsDisplayed = 0;
   lastHeight = new Array();
   lastWindowHeight = new Array();
   lastScrolledHeight = new Array();
   // Which second tier block needs to be expanded when the page is loaded
   idStoredInCookie = "";
   if (getCookieValue('siteStoreExpandableState')) {
      idStoredInCookie = getCookieValue('siteStoreExpandableState');
      idStoredInCookie = idStoredInCookie.replace(/_second_tier/g,'')
      idStoredInCookie = idStoredInCookie.replace(/_third_tier/g,'')
   }
}

function getExpandedBlock() {
   if (idStoredInCookie != null && idStoredInCookie != "") {
      if (eval("document.getElementById('"+idStoredInCookie+"')")) {
         eval("showNavs(document.getElementById('"+idStoredInCookie+"'))");
      }
   }
}

function getMouseCoordinates(e) {
   if (netscapeBrowser) {
      xPosition = e.pageX;
      yPosition = e.pageY;
   } else {
      xPosition = event.clientX;
      yPosition = event.clientY;
   }
}

function listenForMouseClick(e)  {
   if (!e) {
      if( window.event ) {
         // DOM
         e = window.event;
      } else {
         // Cannot reference event
         return;
      }
   }
   if (e.target) {
      targetElement = e.target;
   }
   if (e.srcElement) {
      targetElement = e.srcElement;
   }
   if(typeof(e.which) == 'number') {
      // Netscape
      e = e.which;
   } else {
      if(typeof(e.button) == 'number') {
         // DOM
         e = e.button;
      } else {
         // Cannot determine
         return;
      }
   }
   // Check first mouse button is clicked
   if (e == 1) {
      if (xPosition == null && !(isNaN(xPosition))) { xPosition = 152; }
      if (xPosition <= 151) {
         if (targetElement.disabled == false && targetElement.parentNode.className != null && targetElement.parentNode.className.match(/navLeftSecond/g)) {
            writeSessionCookie('siteStoreExpandableState',lastExpandedObject.id);
         } else {
            writeSessionCookie('siteStoreExpandableState','');
         }
      } else {
         if (flyOutNavsDisplayed == 0) {
            //writeSessionCookie('siteStoreExpandableState','');
         } else {
            writeSessionCookie('siteStoreExpandableState',lastExpandedObject.id);
         }
      }
      // Clear the expanded second tier state variable if the user clicks on the footer and header links
      if (targetElement.disabled == false && targetElement.parentNode.className != null && targetElement.parentNode.className != "") {
         if (targetElement.parentNode.className == "topZone" || targetElement.parentNode.className == "topSearch" || targetElement.parentNode.className == "footer") {
            writeSessionCookie('siteStoreExpandableState','');
         }
      }
   }
}

function writeSessionCookie (cookieName, cookieValue) {
  if (testSessionCookie()) {
      document.cookie = escape(cookieName) + "=" + escape(cookieValue) + "; path=/";
      return true;
   } else {
      return false;
   }
}

function getCookieValue (cookieName) {
   var exp = new RegExp (escape(cookieName) + "=([^;]+)");
   if (exp.test (document.cookie + ";")) {
      exp.exec (document.cookie + ";");
      return unescape(RegExp.$1);
   } else {
      return false;
   }
}

function testSessionCookie () {
   document.cookie ="testSessionCookie=Enabled";
   if (getCookieValue("testSessionCookie")=="Enabled") {
      return true;
   } else {
      return false;
   }
}

function showNavs(navObject) {
   var secondTierObject = null;
   var secondTierName = navObject.id + "_second_tier";
   if (document.getElementById(secondTierName)) {
      secondTierObject = document.getElementById(secondTierName);
      var navArrowName = navObject.id + "_arrow";
      var navArrowObject = document.getElementById(navArrowName);
   }
   if (lastExpandedObject != null && secondTierObject != lastExpandedObject) {
      // Collapse previously expanded second tier block if still visible
      lastExpandedObject.style.display = "none";
      var lastExpandedObjectArrowName = lastExpandedObject.id;
      lastExpandedObjectArrowName = lastExpandedObjectArrowName.substr(0,lastExpandedObjectArrowName.length - 12) + "_arrow";
      if (document.getElementById(lastExpandedObjectArrowName)) {
         var lastExpandedObjectArrow = document.getElementById(lastExpandedObjectArrowName);
         lastExpandedObjectArrow.className = "arrowUp";
      }
   }
   if (lastFlyoutObject != null) {
      // Previously opened third tier flyout block must dispappear
      lastFlyoutObject.style.display = "none";
   }
   if (secondTierObject != null) {
      // Determine whether to expand or collapse second tier block
      if (secondTierObject.style.display == "none") {
         secondTierObject.style.display = "block";
         if (navArrowObject) {
            navArrowObject.className = "arrowDown";
         }
      } else {
         secondTierObject.style.display = "none";
         if (navArrowObject) {
            navArrowObject.className = "arrowUp";
         }
      }
      lastExpandedObject = secondTierObject;
   }
}

function flyoutNavs(navObject,displayNavs) {
   var thirdTierObject = null;
   var thirdTierName = navObject.id + "_third_tier";
   var thirdTierBridge = navObject.id + "_bridge";
   thirdTierDisplayed[navObject.id] = displayNavs;
   flyOutNavsDisplayed = displayNavs;
   if (document.getElementById(thirdTierName)) {
      thirdTierObject = document.getElementById(thirdTierName);
      thirdTierBridgeObject = document.getElementById(thirdTierBridge);
   }
   if (thirdTierObject != null) {
      if (displayNavs == 1) {
         if (lastFlyoutObject != null && lastFlyoutObject != thirdTierObject) {
            lastFlyoutObject.style.display = "none";
            lastFlyoutObject.style.marginTop = "-15px";
            if (lastFlyoutBridgeObject != null) {
               lastFlyoutBridgeObject.style.display = "none";
            }
            difference = 0;
         }
         thirdTierObject.style.display = "block";
         thirdTierObject.style.left = "150px";
         thirdTierObject.style.zIndex = "10";
         thirdTierBridgeObject.style.display = "block";
         thirdTierBridgeObject.style.left = "147px";
         thirdTierBridgeObject.style.marginTop = "-18px";
         thirdTierBridgeObject.style.zIndex = "11";

         if (difference == 0 && xPosition <= 150) {
            var browserWindowHeight = getWindowHeight();
            var scrolledHeight = getScrollHeight();
            var numberOfElements = getNumberOfElements(thirdTierObject);
            // Third tier link height is 20 pixels
            var flyOutNavsHeight = eval(numberOfElements * 20);
            if ((thirdTierIframeAdded[navObject.id] == null || !(thirdTierIframeAdded[navObject.id])) && !(netscapeBrowser) && !(isNaN(flyOutNavsHeight))) {
               backgroundWithIframe = '<div style="position: absolute; top: -3px;">'
                                    + '<iframe width="157" height="' + eval(flyOutNavsHeight + 3) + '" SRC="/iframe_blank.html" MARGINWIDTH="0" MARGINHEIGHT="0" HSPACE="0" VSPACE="0" FRAMEBORDER="0" SCROLLING="no"></iframe>'
                                    + '</div>';
               thirdTierObject.innerHTML = backgroundWithIframe + thirdTierObject.innerHTML;
               thirdTierIframeAdded[navObject.id] = true;
            }
            difference = eval(yPosition + flyOutNavsHeight + 5 - browserWindowHeight);
            if (netscapeBrowser) {
               difference -= scrolledHeight;
            }
            // If browser window height and scrolled height values are unchanged then use the previous height difference value
            if (lastWindowHeight[thirdTierName] != null && lastScrolledHeight[thirdTierName] != null) {
               if (lastWindowHeight[thirdTierName] == browserWindowHeight && lastScrolledHeight[thirdTierName] == scrolledHeight) {
                  difference = lastHeight[thirdTierName];
               }
            }
            // Remember the current height difference, browser window height and scrolled height values
            lastHeight[thirdTierName] = difference;
            lastWindowHeight[thirdTierName] = browserWindowHeight;
            lastScrolledHeight[thirdTierName] = scrolledHeight;
            // Only move the third tier fly out block if part of the links are cut off
            if (difference > 0) {
               // Make sure the bridge object locks at the bottom of the fly out block
               var offsetAmount = 0;
               if ((15 + difference) > flyOutNavsHeight) {
                  offsetAmount = eval((15 + difference) - flyOutNavsHeight) ;
               }
               thirdTierObject.style.marginTop = eval(offsetAmount - 15 - difference)+"px";
            } else {
               thirdTierObject.style.marginTop = "-15px";
            }
         }

      } else {
         eval("setTimeout('hideObject(\""+navObject.id+"\")',"+milliseconds+")");
      }
   }
   lastFlyoutObject = thirdTierObject;
   lastFlyoutBridgeObject = thirdTierBridgeObject;
}

function hideObject(navObjectID) {
   var thirdTierName = navObjectID + "_third_tier";
   var thirdTierBridge = navObjectID + "_bridge";
   if (document.getElementById(thirdTierName)) {
      thirdTierObject = document.getElementById(thirdTierName);
      thirdTierBridgeObject = document.getElementById(thirdTierBridge);
      // If cursor is still off third tier block and its parent nav after the delay then make it disappear
      if (thirdTierDisplayed[navObjectID] == 0) {
         thirdTierObject.style.display = "none";
         thirdTierBridgeObject.style.display = "none";
         difference = 0;
      }
   }
}

function getNumberOfElements(nodeObject) {
   var countElements = 0;
   var children = nodeObject.childNodes;
   for(var i=0; i < children.length; i++) {
      if (children[i].className != null && children[i].className == "navLeftThird") {
         countElements++;
      }
      // Recursively call this function
      countElements += getNumberOfElements(children[i]);
   }

   return countElements;
}


function getWindowHeight() {
   var browserWinWidth = 0, browserWinHeight = 0;
   if( typeof( window.innerWidth ) == 'number' ) {
      // Non-IE
      browserWinWidth = window.innerWidth;
      browserWinHeight = window.innerHeight;
   } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      // IE 6+
      browserWinWidth = document.documentElement.clientWidth;
      browserWinHeight = document.documentElement.clientHeight;
   } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
      // IE 4 
      browserWinWidth = document.body.clientWidth;
      browserWinHeight = document.body.clientHeight;
   }
   return browserWinHeight;
}

function getScrollHeight() {
   var scrolledWidth = 0, scrolledHeight = 0;
   if ( typeof( window.pageYOffset ) == 'number' ) {
      // Netscape
      scrolledHeight = window.pageYOffset;
      scrolledWidth = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
      // DOM
      scrolledHeight = document.body.scrollTop;
      scrolledWidth = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
      // IE6
      scrolledHeight = document.documentElement.scrollTop;
      scrolledWidth = document.documentElement.scrollLeft;
  }
  return scrolledHeight;
}

initialiseMenu();
