// Xerox Office Javascript    http://www.office.xerox.com
// Do not edit this file manually, use css_js_concatenate_alert.pl in data/scripts
//
// This is a dummy file for testing js include in prod30

// 27 Oct 2004		chrissm		added function that closes popups that create other popups
// 29 Oct 2004		chrissm		backed out same
// 01 Nov 2004		chrissm		another crack at popup closer
// 24 Feb 2005		edhille		updated requiredVersion to flash 7
// 20 Jul 2005      edhille     updated flash promo test to exclude Safari (poor interaction w/ DHTML)
// 05 Aug 2005		chrissm		added missing function borrowed from Xerox.com for search box
// 21 Apr 2006		edhille		added rewriteObjectTags to deal w/ MSIE/ActiveX issue
// 06 Nov 2006      ehdille     added hack to preload collapse menu "on" icon
// 07 Nov 2006      chrissm     add winopen function from xcom for footer urls
// 11 Jun 2008      lbell       added rewriteObjectTagsModuleWindow to deail with MSIE ActiveX ModalWindow
// 25 Jun 2008      lbell       updated toggleIconedElem to account for arrows to reside as a backtground-image
// 17 Sep 2009      lbell       Added read_only children and show_dynamic_elements
// 17 Nov 2009      lbell       Added toggleHiddenContentOnLoad
// 20 Nov 2009      lbell       Add launchHomePagePopUnder
// 02 Dec 2009      speterso    Modified launchHomePagePopUnder for UK, Ireland, India
// 22 Apr 2010      lbell       Added XRX_UTILS and the associated png_utilities
// 23 Apr 2010      lbell       Modified toggleIconElem to turn off the lower cell row with a grey bar line

var iClick = 0;
function clearInitVal( oInput ){ if( iClick++ == 1 ){ oInput.value = ''; } }

function flashPromosOK() {

  return flashOK() && agentOk();
}

function agentOk() {

	var agent = navigator.userAgent;

	if (agent.indexOf('AppleWebKit') == -1) return true;
	
	// since we only are concerned w/ version 1.1 and lower of Safari,
	// look for a "Version/" string to indentify version 3+
	if (agent.indexOf('Version') > 0) return true;

	// failing that, we need to parse the WebKit and look for a version less than 313
	var token  = 'AppleWebKit/';
	var offset = agent.indexOf(token);
	var webkit = agent.substr(offset+token.length, agent.indexOf(' ', offset)); 
	
	if (parseInt(webkit) > 312) return true;

	return false;
}

function flashOK() {

  // first, set the flash version global vars
  setFlashVersion();

  // We're finished getting the version on all browsers that support detection.
  // Time to take the appropriate action.

  // If the user has a new enough version...
  return (actualVersion >= requiredVersion);
}

// Routine for link in parent of popup window

function link_under(destination) {
	opener.location.href = destination;
	window.close();

}

function winopen(o1,o2,o3,o4,o5,o6,o7,o8,o9,o10,o11,o12,o13,o14,o15,o16,o17,o18)
 {
        var url="";
        for(var k=3;k<=18;k++) {
                if(eval("o"+k)) {
                url=url+eval("o"+k);
                }
        }
        window.open(url,eval("o"+1),eval("o"+2));
}






// --------------------- this block from misc.js -------------------------------


function GlobalSubmit()
{
    if (document.GlobalNav.GlobalNavMenu.selectedIndex > 0) {
        document.GlobalNav.submit();
    }
}

// sends user to URL located in value paramater of the selected <OPTION> tag
function go_menu(menu) {

	var choice = menu.selectedIndex;
	var new_url = menu.options[choice].value;
    if (new_url != "") {
	    //If the URL begins with "http://" we assume the link is external
		if (new_url.indexOf("xerox") < 1 && new_url.indexOf("http") == 0) {
			window.open(new_url, "_blank");
		} else {
			window.location.href = new_url;
		}
	}
}

function validate_checkboxes (table,minBoxes){

	var boxes = 0;

	for (var i=0; i < table.length; i++){

		if ( (table.elements[i].type).toUpperCase() == "CHECKBOX" ) {

			if ( table.elements[i].checked ) {

				boxes++;

			}
		}
	}
	if ( boxes < minBoxes ) {

		alert ( "Please select at least " + minBoxes );
		return (false);

	} else {

		return (true);
	}
}

function popfor(){
	if (window.focus) window.focus();
}

function navigate(where) {
	window.location.href = where;
}

function display_printmessage(config) {

	if(config.win || config.win16 || config.win32)
	{
        document.write('<br><center><FONT FACE="Arial, Geneva, Helvetica, sans-serif" SIZE="-2">Press \'CTRL-P\' to Print</FONT></center>');
	}
	else if(config.mac)
	{
        document.write('<br><center><FONT FACE="Arial, Geneva, Helvetica, sans-serif" SIZE="-2">Press \'Command-P\' to Print</FONT></center>');
	}
	else if(config.unix)
	{
        document.write('<br><center><FONT FACE="Arial, Geneva, Helvetica, sans-serif" SIZE="-2">Press \'Alt-P\' to Print</FONT></center>');
	}

}

// ------------------- cookie-related ------------------------------------------
function Cookie(name, path, domain, expiresInSec, isSecure)
{
	this.name     = name;
	this.path     = path;
	this.domain   = domain;
	this.expires  = expiresInSec;
	this.isSecure = isSecure;
	this.data     = new Object;
	this.raw      = document.cookie;

	this.get  = function(field) { return this.data[field]; };
	this.set  = function(field,value) { this.data[field] = value; };
	this.bake = function() {
		var cleanValues = new Array();
		for ( var prop in this.data )
		{
			var cleanValue = (prop == 'id') ? this.data[prop] : escape(this.data[prop]);
			cleanValues[cleanValues.length] = prop + '%3d' + cleanValue;
		}
		var newValue   = cleanValues.join('%26');
		var bakeString = this.name + '=' + newValue + ';';

		if(this.path)     bakeString += ' path='+ this.path + ';';
		if(this.domain)   bakeString += ' domain=' + this.domain + ';';
		if(this.expires)  bakeString += ' expires=' + getExpirationDate(this.expires) + ';';
		if(this.isSecure) bakeString += ' secure;';

		return bakeString;
	};
	function parseCookie(self)
	{
		var cookieStartIdx = self.raw.indexOf(self.name+'=');

		if (cookieStartIdx == -1) return;

	    var cookieSubStr = self.raw.substring(cookieStartIdx);
   		var cookieEndIdx = cookieSubStr.indexOf(';') != -1 ? cookieSubStr.indexOf(';') : cookieSubStr.length;
    	var cleanCookie  = unescape(cookieSubStr.substring(self.name.length+1, cookieEndIdx));
    	var fields       = cleanCookie.split('&');

    	for ( var i=0; i<fields.length; ++i )
		{
        	var data = fields[i].split('=');

			self.data[data[0]] = unescape(data[1]);
    	}
	}
	function getExpirationDate(secs)
	{
		var expiration = new Date();

		expiration.setMilliseconds(expiration.getTime() + secs);

		return expiration.toUTCString();
	}

	parseCookie(this);
}

function extractCookieData(cookieName,keys) {

	var cookie = new Cookie(cookieName);
	var data   = new Object();

	for ( var name in keys )
	{
		data[name] = cookie.get(name);
	}

    return data;
}

// --------------------- this block from popUPs.js -----------------------------


function open_Popup(name) {
    var newWindow = window.open((name), 'popOpen', 'width=500,height=350,scrollbars=yes,resizable=yes,toolbar=no,status=yes,menubar=no');
    if (newWindow && !newWindow.opener) newWindow.opener = self;
	if (self.opb_in_popup != null) window.close();
}

function WindowPopup(Name, Parameters)
{
    var newWindow = window.open( (Name), 'popWin', (Parameters) );
}

function flashWindowPopup(url, id, parameters)
{
    var newWindow = window.open(url, id, parameters);
	return newWindow != null && typeof(newWindow) != 'undefined';
}

if ((typeof wsmlMakeWebServiceHref) == "undefined")
{
  wsmlMakeWebServiceHref =  wsmlMakeResourceUrl = wsmlMakeLeakHref =
  wsmlMakeCssHref = new Function ("u", "return u;");
}

function photo_Popup(name,width,height,id) {
    var winName = id ? id : 'popPhoto';
	var newWindow = window.open((wsmlMakeLeakHref(name)), winName, 'width=' + width + ',height=' + height +',scrollbars=no,resizable=no,toolbar=no,status=no,menubar=no');
	if (self.opb_in_popup != null) window.close();
}

function resize_Popup(name,width,height) {
	var newWindow = window.open((wsmlMakeLeakHref(name)), 'popResize', 'width=' + width + ',height=' + height +',scrollbars=yes,resizable=yes,toolbar=no,status=no,menubar=no');
	if (self.opb_in_popup != null) window.close();
}

function external_link(name,width,height,scrollbars,resizable,toolbar,status,menubar) {
	var newWindow = window.open((name), 'popExternal', 'width=' + width + ',height=' + height + ',scrollbars=' + scrollbars + ',resizable=' + resizable + ',toolbar=' + toolbar + ',status=' + status + ',menubar=' + menubar + "'");
	if (self.opb_in_popup != null) window.close();
}

// same as above, but only has the first parameter
function external_link2(name) {
	var newWindow = window.open((name));
	if (self.opb_in_popup != null) window.close();
}

function Pcertify() {
	popupWin = window.open('http://www.bbbonline.org/cks.asp?id=1080314132317', 'Participant', 'location=yes,scrollbars=yes,width=450,height=300')
	window.name = 'opener';
}

function popAdvisor(path) {
  var openvars = "width=575,height=539,resizable=yes,scroll=auto";
  var wnd      = window.open(path, 'Advisor', openvars);
  if (self.opb_in_popup != null) window.close();
}


// --------------------- this block from webconnect.js -------------------------


function CreateCall(
	server,
	companyName,
	countryCode,
	areaCode,
	phoneNumber,
	phoneHash,
	dispName,
	logo,
	background,
	optionalStr
	)
{
	theURL = GetURL(
					server,
					companyName,
					countryCode,
					areaCode,
					phoneNumber,
					phoneHash,
					dispName,
					logo,
					background
					);

	// optional parameters
	if (null != optionalStr)
	{
		theURL += "OptionalStr=" + escape(optionalStr) + "&";
	}
	newWin = window.open(theURL, "CreateCall",'location=no,menubar=no,toolbar=no,hotkeys=no,resizable=no,titlebar=yes,scrollbars=no,status=yes,width=490,height=400');
	return;
}

function CreateCallRM(
	server,
	companyName,
	acdCountryCode,
	acdAreaCode,
	acdPhoneNumber,
	phoneHash,
	lastName,
	firstName,
	email,
	callType,
	callAttributes,
	cbExtType,
	cbCountryCode,
	cbAreaCode,
	cbPhoneNumber,
	cbExtension,
	dispName,
	logo,
	background,
	origPage,
	optionalStr
	)
{
	theURL = GetRMURL(
				server,
				companyName,
				acdCountryCode,
				acdAreaCode,
				acdPhoneNumber,
				phoneHash,
				lastName,
				firstName,
				email,
				callType,
				callAttributes,
				cbExtType,
				cbCountryCode,
				cbAreaCode,
				cbPhoneNumber,
				cbExtension,
				dispName,
				logo,
				background,
				origPage
				);

	// optional parameters
	if (null != optionalStr)
	{
		theURL += "OptionalStr=" + escape(optionalStr) + "&";
	}
	newWin = window.open(theURL, "CreateCall",'location=no,menubar=no,toolbar=no,hotkeys=no,resizable=no,titlebar=yes,scrollbars=no,status=yes,width=490,height=400');
}

function CreateCallRMNoWindow(
	server,
	companyName,
	acdCountryCode,
	acdAreaCode,
	acdPhoneNumber,
	phoneHash,
	lastName,
	firstName,
	email,
	callType,
	callAttributes,
	cbExtType,
	cbCountryCode,
	cbAreaCode,
	cbPhoneNumber,
	cbExtension,
	dispName,
	logo,
	background,
	origPage
	)
{
	theURL = GetRMURL(
				server,
				companyName,
				acdCountryCode,
				acdAreaCode,
				acdPhoneNumber,
				phoneHash,
				lastName,
				firstName,
				email,
				callType,
				callAttributes,
				cbExtType,
				cbCountryCode,
				cbAreaCode,
				cbPhoneNumber,
				cbExtension,
				dispName,
				logo,
				background,
				origPage
				);

	self.location = theURL;
}

function CreateCall2(
	server,
	companyName,
	countryCode,
	areaCode,
	phoneNumber,
	phoneHash,
	dispName,
	logo,
	background,
    WhisperOne,
    WhisperTwo,
    IVRString,
    OptionalStr
	)
{
	var theURL = GetURL(
						server,
						companyName,
						countryCode,
						areaCode,
						phoneNumber,
						phoneHash,
						dispName,
						logo,
						background
						);

	// new parameters
	theURL += "WhisperOne="
				+ escape(WhisperOne)
				+ "&WhisperTwo="
				+ escape(WhisperTwo)
				+ "&IVRString="
				+ escape(IVRString)
				+ "&OptionalStr="
				+ escape(OptionalStr)
				+ "&";

	newWin = window.open(theURL, "CreateCall",'location=no,menubar=no,toolbar=no,hotkeys=no,resizable=no,titlebar=yes,scrollbars=no,status=yes,width=490,height=500');
	return;
}

function CreateCall2RM(
	server,
	companyName,
	acdCountryCode,
	acdAreaCode,
	acdPhoneNumber,
	phoneHash,
	lastName,
	firstName,
	email,
	callType,
	callAttributes,
	cbExtType,
	cbCountryCode,
	cbAreaCode,
	cbPhoneNumber,
	cbExtension,
	dispName,
	logo,
	background,
	origPage,
    WhisperOne,
    WhisperTwo,
    IVRString,
    OptionalStr
	)
{
	theURL = GetRMURL2(
				server,
				companyName,
				acdCountryCode,
				acdAreaCode,
				acdPhoneNumber,
				phoneHash,
				lastName,
				firstName,
				email,
				callType,
				callAttributes,
				cbExtType,
				cbCountryCode,
				cbAreaCode,
				cbPhoneNumber,
				cbExtension,
				dispName,
				logo,
				background,
				origPage,
				WhisperOne,
				WhisperTwo,
				IVRString,
				OptionalStr
				);

	newWin = window.open(theURL, "CreateCall",'location=no,menubar=no,toolbar=no,hotkeys=no,resizable=no,titlebar=yes,scrollbars=no,status=yes,width=490,height=400');
}

function CreateCall2RMNoWindow(
	server,
	companyName,
	acdCountryCode,
	acdAreaCode,
	acdPhoneNumber,
	phoneHash,
	lastName,
	firstName,
	email,
	callType,
	callAttributes,
	cbExtType,
	cbCountryCode,
	cbAreaCode,
	cbPhoneNumber,
	cbExtension,
	dispName,
	logo,
	background,
	origPage,
	WhisperOne,
	WhisperTwo,
	IVRString,
	OptionalStr
	)
{
	theURL = GetRMURL2(
				server,
				companyName,
				acdCountryCode,
				acdAreaCode,
				acdPhoneNumber,
				phoneHash,
				lastName,
				firstName,
				email,
				callType,
				callAttributes,
				cbExtType,
				cbCountryCode,
				cbAreaCode,
				cbPhoneNumber,
				cbExtension,
				dispName,
				logo,
				background,
				origPage,
				WhisperOne,
				WhisperTwo,
				IVRString,
				OptionalStr
				);

	self.location = theURL;
}

// ------ Util functions -----

// all parameters are required.
function GetURL(
	server,
	companyName,
	countryCode,
	areaCode,
	phoneNumber,
	phoneHash,
	dispName,
	logo,
	background,
	origPage
	)
{
	sTimer=new Date();
	uniq = sTimer.valueOf();

	var theURL = "http://" + server + "/w2ig/CreateCall.ASP?uniqID="
                    + uniq
					+ "&Company="
					+ companyName
					+ "&acdPhCountryCode="
					+ countryCode
					+ "&acdPhAreaCode="
					+ areaCode
					+ "&acdPhNumber="
					+ phoneNumber
					+ "&acdPhHash="
					+ phoneHash
					+ "&dispName="
					+ escape(dispName)
					+ "&displogo="
					+ logo
					+ "&dispbg="
					+ background;

	// send the originating page
	theURL += "&origpage=";
	if ((null == origPage) || ('' == origPage))
	{
		theURL += escape(top.location);
	}
	else
	{
		theURL += escape(origPage);
	}
	theURL += "&";

	return (theURL);
}

function GetRMURL(
	server,
	companyName,
	acdCountryCode,
	acdAreaCode,
	acdPhoneNumber,
	phoneHash,
	lastName,
	firstName,
	email,
	callType,
	callAttributes,
	cbExtType,
	cbCountryCode,
	cbAreaCode,
	cbPhoneNumber,
	cbExtension,
	dispName,
	logo,
	background,
	origPage
	)
{
	// get the basic URL
	var theURL = GetURL(
						server,
						companyName,
						acdCountryCode,
						acdAreaCode,
						acdPhoneNumber,
						phoneHash,
						dispName,
						logo,
						background,
						origPage
						);

	// values for callType are "n2p", "pstn" or "h323", convert them to number
	// values for callType are "pstn" or "h323", convert them to number
	if (callType.toUpperCase() == "H323")
		callType = "1";
	else if (callType.toUpperCase() == "N2P")
		callType = "4";
	// default to PSTN
	else
		callType = "2";

	// values for extType are "operator" or "auto" or "none", convert them to number
	if (cbExtType.toUpperCase() == "OPERATOR")
		extType = "3";
	else if (cbExtType.toUpperCase() == "AUTO")
		extType = "2";
	// default to none
	else
		extType = "1";

	theURL += "lastName="
				+ lastName
				+ "&firstName="
				+ firstName
				+ "&email="
				+ email
				+ "&callType="
				+ callType
				+ "&extType="
				+ extType
				+ "&cbPhCountryCode="
				+ cbCountryCode
				+ "&cbPhAreaCode="
				+ cbAreaCode
				+ "&cbPhNumber="
				+ cbPhoneNumber
				+ "&cbPhExtension="
				+ cbExtension
				+ "&";

	if ('singleline' == callAttributes.toLowerCase())
	{
		theURL += "callAttributes=1&";
	}

	return theURL;
}

function GetRMURL2(
	server,
	companyName,
	acdCountryCode,
	acdAreaCode,
	acdPhoneNumber,
	phoneHash,
	lastName,
	firstName,
	email,
	callType,
	callAttributes,
	cbExtType,
	cbCountryCode,
	cbAreaCode,
	cbPhoneNumber,
	cbExtension,
	dispName,
	logo,
	background,
	origPage,
	WhisperOne,
	WhisperTwo,
	IVRString,
	OptionalStr
	)
{
	var theURL = GetRMURL(
						server,
						companyName,
						acdCountryCode,
						acdAreaCode,
						acdPhoneNumber,
						phoneHash,
						lastName,
						firstName,
						email,
						callType,
						callAttributes,
						cbExtType,
						cbCountryCode,
						cbAreaCode,
						cbPhoneNumber,
						cbExtension,
						dispName,
						logo,
						background,
						origPage
						);

	theURL += "WhisperOne="
				+ escape(WhisperOne)
				+ "&WhisperTwo="
				+ escape(WhisperTwo)
				+ "&IVRString="
				+ escape(IVRString)
				+ "&OptionalStr="
				+ escape(OptionalStr)
				+ "&";

	return theURL;
}


//------------- this block is from fpi-init.js ---------------------------------


// moock fpi [f.lash p.layer i.nspector]
// version: 1.3.7
// written by colin moock
// code maintained at: http://www.moock.org/webdesign/flash/detection/moockfpi/
// terms of use posted at: http://www.moock.org/terms/

// =============================================================================
// These are the user defined globals.
// Modify the following variables to customize the inspection behaviour.

var requiredVersion = 9;   // Version the user needs to view site (max 9, min 2)
var useRedirect = true;    // Flag indicating whether or not to load a separate
                           // page based on detection results. Set to true to
                           // load a separate page. Set to false to embed the
                           // movie or alternate html directly into this page.

// Only set next three vars if useRedirect is true...
var flashPage   = ""    // Leave blank unless needed to redirect to another page.
var noFlashPage = "/flash_detection/index.html"  // Page displayed if the user doesn't have the
                                  // plugin or we can't detect it.
var upgradePage = "/flash_detection/index.html"  // Page displayed if we detect an old plugin

// ---- acessor functions set up for controlling the global config vars (in case we get smart and make these an object)

function requiredVersion(newVersion) {
    var tmp = requiredVersion;
    if (newVersion) {
        requiredVersion = tmp;
    }
    return tmp;
}

function useRedirect(newFlagValue) {
    var tmp = useRedirect;
    if (newFlagValue) {
        useRedirect = tmp;
    }
    return tmp;
}

function flashPage(newPage) {
    var tmp = flashPage;
    if (newPage) {
        flashPage = tmp;
    }
    return tmp;
}

function noFlashPage(newPage) {
    var tmp = noFlashPage;
    if (newPage) {
        noFlashPage = tmp;
    }
    return tmp;
}

function upgradePage(newPage) {
    var tmp = upgradePage;
    if (newPage) {
        upgradePage = tmp;
    }
    return tmp;
}

// =============================================================================

// *************
// Everything below this point is internal until after the BODY tag.
// Do not modify! Proceed to the BODY tag for further instructions.
// *************

// System globals
var flash2Installed = false;    // boolean. true if flash 2 is installed
var flash3Installed = false;    // boolean. true if flash 3 is installed
var flash4Installed = false;    // boolean. true if flash 4 is installed
var flash5Installed = false;    // boolean. true if flash 5 is installed
var flash6Installed = false;    // boolean. true if flash 6 is installed
var flash7Installed = false;    // boolean. true if flash 7 is installed
var flash8Installed = false;    // boolean. true if flash 8 is installed
var flash9Installed = false;    // boolean. true if flash 9 is installed
var maxVersion = 9;             // highest version we can actually detect
var actualVersion = 0;          // version the user really has
var hasRightVersion = false;    // boolean. true if it's safe to embed the flash movie in the page
var jsVersion = 1.0;            // the version of javascript supported


//------------- this block is from fpi-writevb.js ------------------------------


// Check the browser...we're looking for ie/win, but not aol
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true if we're on ie
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; // true if we're on windows

// This is a js1.1 code block, so make note that js1.1 is supported.
jsVersion = 1.1;

// Write vbscript detection on ie win. IE on Windows doesn't support regular
// JavaScript plugins array detection.
if(isIE && isWin){
  document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');
  document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
  document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
  document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
  document.write('flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');
  document.write('<\/SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
}


//------------- this block is from fpi-main.js ---------------------------------


// Next comes the standard javascript detection that uses the
// navigator.plugins array. We pack the detector into a function so that
// it preloads before being run.

function detectFlash() {

  // first, set the flash version global vars
  setFlashVersion();

  // We're finished getting the version on all browsers that support detection.
  // Time to take the appropriate action.

  // If the user has a new enough version...
  if (actualVersion >= requiredVersion) {
    // ...then we'll redirect them to the flash page, unless we've
    // been told not to redirect.
    if (useRedirect && flashPage) {
      // Need javascript1.1 to do location.replace
      if(jsVersion > 1.0) {
        // It's safe to use replace(). Good...we won't break the back button.
        window.location.replace(flashPage);
      } else {
        // JavaScript version is too old, so use .location to load
        // the flash page.
        window.location = flashPage;
      }
    }

    // If we got here, we didn't redirect. So we make a note that we should
    // write out the object/embed tags later.
    hasRightVersion = true;
  } else {
    // The user doesn't have a new enough version.
    // If the redirection option is on, load the appropriate alternate page.
    if (useRedirect) {
      // Do the same .replace() call only if js1.1+ is available.
      if(jsVersion > 1.0) {
        window.location.replace((actualVersion >= 2) ? upgradePage : noFlashPage);
      } else {
        window.location = (actualVersion >= 2) ? upgradePage : noFlashPage;
      }
    }
  }
}

function setFlashVersion() {

  // If navigator.plugins exists...
  if (navigator.plugins) {
    // ...then check for flash 2 or flash 3+.
    if (navigator.plugins["Shockwave Flash 2.0"]
        || navigator.plugins["Shockwave Flash"]) {

      // Some version of Flash was found. Time to figure out which.

      // Set convenient references to flash 2 and the plugin description.
      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;

      // DEBUGGING: uncomment next line to see the actual description.
      // alert("Flash plugin description: " + flashDescription);

      // A flash plugin-description looks like this: Shockwave Flash 4.0 r5
      // We can get the major version by grabbing the character before the period
      // note that we don't bother with minor version detection.
      // Do that in your movie with $version or getVersion().
      var flashVersion = parseInt(flashDescription.substring(16));

      // We found the version, now set appropriate version flags. Make sure
      // to use >= on the highest version so we don't prevent future version
      // users from entering the site.
      flash2Installed = flashVersion == 2;
      flash3Installed = flashVersion == 3;
      flash4Installed = flashVersion == 4;
      flash5Installed = flashVersion == 5;
      flash6Installed = flashVersion == 6;
      flash7Installed = flashVersion == 7;
      flash8Installed = flashVersion == 8;
      flash9Installed = flashVersion >= 9;
    }
  }

  // Loop through all versions we're checking, and
  // set actualVersion to highest detected version.
  for (var i = 2; i <= maxVersion; i++) {
    if (eval("flash" + i + "Installed") == true) actualVersion = i;
  }

  // If we're on msntv (formerly webtv), the version supported is 4 (as of
  // January 1, 2004). Note that we don't bother sniffing varieties
  // of msntv. You could if you were sadistic...
  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 4;

  // DEBUGGING: uncomment next line to display flash version
  // alert("version detected: " + actualVersion);

  return;
}

//----------------------- DHTML functions --------------------------------------

function toggleTabs(groupID, toggleElemId)
{
	if (!document.getElementById) return false;

	var groupChildren = document.getElementById(groupID).childNodes;

	for ( var i = 0; i < groupChildren.length; ++i )
	{
		var child = groupChildren[i];

		if ( child.className == 'tab_container' )
		{
			var tabID   = child.id;
			var iconID  = 'icon_' + tabID;
			var labelID = 'label_' + tabID;

			var labelElem  = document.getElementById(labelID);
			var toggleElem = document.getElementById(tabID);

			if ( toggleElem )
			{
				if ( tabID == toggleElemId )
				{
					if ( toggleElem.style.display == 'none' )
					{
						if ( labelElem ) labelElem.className = 'on_tab_label';

						toggleIconedElem(toggleElem, iconID);
					}
				}
				else if ( toggleElem.style.display == 'block' )
				{
					if ( labelElem ) labelElem.className = 'off_tab_label';

					toggleIconedElem(toggleElem, iconID);
				}
			}
		}
	}

	return false;
}

function toggleTabLabel(iconElemId)
{
	if (!document.getElementById) return false;

	var iconElem = document.getElementById(iconElemId);

	if ( iconElem )
	{
		var iconElem = document.getElementById(iconElemId);
		var iconSrc  = iconElem ? iconElem.src : '';
		var iconRE   = /^([\w:\/\.\_\-]+)_(off|over)\.gif$/;
		var matches  = iconRE.exec(iconSrc);

		if ( matches && matches.length )
		{
			if ( matches[2] == 'off' )
			{
				iconElem.src = matches[1] + '_over.gif';
			}
			else // must be 'over'
			{
				iconElem.src = matches[1] + '_off.gif';
			}
		}
	}

	return false;
}

function sizeQuickPoll(quickPollId, quickPollHeight)
{
	if( document.getElementById && !document.all )
	{
		var theFrame = document.getElementById(quickPollId);

		theFrame.style.height = quickPollHeight + 'px';
	}
	else if( document.all )
	{
		var quickPoll = eval('document.all.'+quickPollId);

		quickPoll.style.height = quickPollHeight + 'px';
	}
	// else we are unable to do anything...
}

function hideQuickPoll(quickPollId)
{
	var quickPoll;

	if( document.getElementById && !document.all )
	{
		quickPoll = document.getElementById(quickPollId);
	}
	else if( document.all )
	{
		quickPoll = eval('document.all.'+quickPollId);
	}

	if (quickPoll) quickPoll.style.display = 'none';
}

function toggleIconedElem(toggleElem, iconElemId)
{
	var iconElem = document.getElementById(iconElemId);
    if(iconElem.nodeName === 'DIV')
    {
        /*  This is the holding cell (TD Element) of the icon. 
            We want to change the color of the strip in an off state 
        */
        var tdElem = document.getElementById(iconElemId).parentNode;
        var currClassname = iconElem.className;
        var currTDClassname = tdElem.className;
        iconElem.className = currClassname == 'tab_arrow_off' ? 'tab_arrow_on' : 'tab_arrow_off';
        /* We just mask the class attribute with ttn_tab_icon_off */
        tdElem.className = currTDClassname == 'ttn_tab_icon' ? 'ttn_tab_icon ttn_tab_icon_off' : 'ttn_tab_icon'; 
   	    toggleElemDisplay(toggleElem);
    }
    else
    {
	    var iconSrc  = iconElem ? iconElem.src : '';
	    var iconRE   = /^([\w:\/\.\_\-]+)_(off|on|over)\.gif$/;
	    var matches  = iconRE.exec(iconSrc);

	    if ( matches && matches.length == 3 )
	    {
	    	iconElem.src = matches[1] + (toggleElem.style.display == 'none' ? '_on.gif' : '_off.gif');

	    	toggleElemDisplay(toggleElem);
	    }

	    return false;
    }
}

function toggleElemDisplay(toggleElem)
{
	toggleElem.style.display = toggleElem.style.display == 'block' ? 'none' : 'block';
}

function toggleCollapseMenus(groupID, toggleElemId, labelClassName, iconClassName, subMenuClassName)
{
	if (!document.getElementById) return false;

	var groupChildren   = document.getElementById(groupID).childNodes;
	var iconID = menuID = '';

	for ( var i = 0; i < groupChildren.length; ++i )
	{
		var child = groupChildren[i];

		if ( child.className == labelClassName )
		{
			iconID = idOfFirstElemInClass(child.childNodes, iconClassName);
		}
		else if ( child.className == subMenuClassName )
		{
			menuID = child.id;
		}

		if ( iconID && menuID )
		{
			var toggleElem = document.getElementById(menuID);

			if ( typeof(_hbLink) !== 'undefined' )
			{
				var linkElem = document.getElementById(toggleElemId+'_link');

				if ( linkElem )
				{
					var linkLID = linkElem.getAttribute('name');

					if ( linkLID )
					{
						var lidRegex   = new RegExp('&lid=(.+)$');
						var lidResults = lidRegex.exec(linkLID);

						if ( lidResults !== null && lidResults[1] !== null )
						{
							var state = toggleElem.style.display == 'block' ? 'collapsing' : 'expanding';

							_hbLink(lidResults[1]+'-'+state);
						}
					}
				}
			}

			if ( menuID == toggleElemId || toggleElem.style.display == 'block' )
			{
				toggleIconedElem(toggleElem, iconID);
			}

			iconID = menuID = '';
		}
	}

	return false;
}

function idOfFirstElemInClass(nodeList, className)
{
	var elemId = '';

	for ( var i = 0; i < nodeList.length; ++i )
	{
		var node = nodeList[i];

		if (node.hasChildNodes()) elemId = idOfFirstElemInClass(node.childNodes, className);

		if ( elemId )
		{
			break;
		}
		else if( node && node.className && node.className == className )
		{
			elemId = node.id;
			break;
		}
	}

	return elemId;
}

function toggleLinearNavContent(holderId, paneId, contentClassName)
{
	if (!document.getElementById) return false;

	var holderChildren = document.getElementById(holderId).childNodes;

	for ( var i = 0; i < holderChildren.length; ++i )
	{
		var child = holderChildren[i];

		if ( child.className == contentClassName && child.style.display == 'block' )
		{
			toggleElemDisplay(child);
		}
	}

	toggleElemDisplay(document.getElementById(paneId));

	return false;
}

function toggleTwoColTabNav(menuGroupId, menuId, contentGroupId, contentId, onClassName, offClassName)
{
	if (!document.getElementById) return false;

	var menuElem = document.getElementById(menuId);

	if ( menuElem.className == offClassName )
	{
		toggleTwoColTabNavMenu(menuGroupId, menuId, onClassName, offClassName);
		toggleTwoColTabNavContent(contentGroupId, contentId);
	}

	return false;
}

function toggleTwoColTabNavMenu(menuGroupId, menuId, onClassName, offClassName)
{
	var menuElems = document.getElementById(menuGroupId).childNodes;

	for ( var i = 0; i < menuElems.length; ++i )
	{
		var elem      = menuElems[i];
		var className = elem.className;

		if ( elem.id == menuId )
		{
			elem.className = onClassName;
		}
		else if ( className == onClassName )
		{
			elem.className = offClassName;
		}
	}
}

function toggleTwoColTabNavContent(contentGroupId, contentId)
{
	var contentElems = document.getElementById(contentGroupId).childNodes;

	for ( var i = 0; i < contentElems.length; ++i )
	{
		var elem = contentElems[i];

		if ( elem.style && elem.style.display == 'block' )
		{
			elem.style.display = 'none';
			document.getElementById(contentId).style.display = 'block';

			break;
		}
	}
}

function toggleSortMenus(groupID, toggleElemId)
{
	toggleCollapseMenus(groupID, toggleElemId, 'collapse_submenu_label', 'collapse_submenu_icon', 'collapse_submenu');
}

function togglePseudoLink(linkElem, parentElemId, inActiveClassName)
{
	if (!document.getElementById) return;

	var parentElem = document.getElementById(parentElemId);

	if ( parentElem && parentElem.className == inActiveClassName )
	{
		var currLinkStyle = linkElem.style.textDecoration;

		linkElem.style.textDecoration = (!currLinkStyle || currLinkStyle == 'none') ? 'underline' : 'none';
		//linkElem.style.color          = (!currLinkStyle || currLinkStyle == 'none') ? '#0000FF'   : '#3333CC';

		// since Safari lets you set the value, but not read it,
		// reset it to 'none' so that it's not always set to 'underline'
		if (!linkElem.style.textDecoration)
		{
			//linkElem.style.textDecoration = 'none';
			//linkElem.style.color          = '#3333CC';
		}
	}
	else // must be the active class which should always have 'none'
	{
		linkElem.style.textDecoration = 'none';
		//linkElem.style.color          = 'black';
	}
}

function toggleTopTabMenu(clickedElem)
{
	if (!document.getElementById) return;
	if (!clickedElem.id)          return;

	var id = (clickedElem.id.split('_'))[0];

	var tabParent  = clickedElem.parentNode;
	var lastTabIdx = Math.ceil(tabParent.childNodes.length/2) - 1;

	for ( var i = 0; i <= lastTabIdx; ++i )
	{
		var contentElem = document.getElementById(id+'_content_'+i);

		if (!contentElem) break; // quit once we cannot find anymore tabs

		if (contentElem && contentElem.style.display != 'none') // currently displayed element
		{
			var tabElem = document.getElementById(id+'_menu_'+i);

			if (!tabElem) continue; // don't try to toggle if we have no tab...

			toggleTopTabElem(tabElem, contentElem, id, i);
		}
	}

	var clickedElemId  = clickedElem.id;
	var clickedIdx     = clickedElemId.substring(clickedElemId.length-1, clickedElemId.length);
	var clickedContent = document.getElementById(id+'_content_'+clickedIdx);

	if ( clickedContent )
	{
		if (window._hbLink) 
		{
			var hbxTabId = buildHbxLinkId(clickedElem);

			_hbLink(hbxTabId, 'tabs');
		}

		toggleTopTabElem(clickedElem, clickedContent, id, clickedIdx);
	}
}

function buildHbxLinkId(tabElem)
{
	var tabAnchor = tabElem.firstChild;

	if ( tabAnchor && tabAnchor.tagName.toUpperCase() == 'A' )
	{
		var anchorText = tabAnchor.firstChild.nodeValue;

		if ( anchorText )
		{
			var cleanText = anchorText.replace(/\s+/gm, '').replace(/[^A-Z0-9_\-]+/igm, '_');

			if (cleanText.length > 0) return cleanText;
		}
	}

	return 'UKNOWN_TAB_ID';
}

function toggleTopTabElem(tabElem, contentElem, menuId, iconIdx)
{
        toggleIconedElem(contentElem, menuId+'_tab_'+iconIdx+'_icon');

        var currTabElemClass = tabElem.className;

        var linkElem = null;
        for(var i = 0; i < tabElem.childNodes.length; i++) {
                var current_child = tabElem.childNodes[i];
                if(current_child.nodeType != 3) {
                        linkElem = current_child;
                        break;
                }
        }

        if (linkElem != null)
        {
                linkElem.className = currTabElemClass == 'ttn_curr_tab_label' ? 'ttn_opt_tab_link' : 'ttn_curr_tab_link';
        }

        tabElem.className = currTabElemClass == 'ttn_curr_tab_label' ? 'ttn_opt_tab_label' : 'ttn_curr_tab_label';
}

function rewriteObjectTags()
{
	if (navigator.appName != 'Microsoft Internet Explorer') return;
	if (!document.getElementsByTagName)                     return;

	var elems = ['embed', 'object', 'applet'];

	for ( var i = 0; i < elems.length; ++i )
	{
		var activeTagElems = document.getElementsByTagName(elems[i]);

		for ( var j = 0; j < activeTagElems.length; ++j )
		{
			var tagElem = activeTagElems[j];
			if (tagElem.getAttribute('class') == 'swfobject') continue;

			var parent     = tagElem.parentNode;
			var parentHTML = parent.innerHTML;
			parent.removeChild(tagElem);
			parent.innerHTML = parentHTML;
		}
	}
}

function rewriteObjectTagsForModuleWindow(tagElem)
/* Something very peculiar is happening to the dom when a modal is created with a video object
 * We have load the innerHTML of the parent back in as if it was the outerHTML. It doesn't make
 * any logical sense but it works.
 */
{
	if (navigator.appName != 'Microsoft Internet Explorer') return;

      
			var parent     = tagElem.parentNode;
			var parentHTML = parent.innerHTML;
			parent.outerHTML = parentHTML;
}

function toggleHiddenContent(elem, containerClassName)
{
        var iconElem     = (elem.getElementsByTagName('img'))[0];
        var iconSrcRegex = /^(.+)_(on|off).gif$/;
        var results      = iconElem.src.match(iconSrcRegex);

        if (containerClassName==undefined) containerClassName = 'hidden_content_container';

        if ( results && results.length == 3 )
        {
                iconElem.src = results[1] + '_' + (results[2]=='on'?'off':'on') + '.gif';

                var containerElem = getParentByClassName(iconElem, containerClassName);

                var elements = getElementsByClassName('hidden_content',containerElem);

                for(var i = 0; i < elements.length; i++) {
                        var e = elements[i];
                        if ( getParentByClassName(e, containerClassName) == containerElem )
                        {
                                if(e.displayed == null) {
                                        e.displayed = 0;
                                }
                                e.displayed = 1 ^ e.displayed;
                                if(e.displayed) {
                                        e.style.display = "block";
                                } else {
                                        e.style.display = "none";
                                }
                        }
                }
        }
}

/* This function is called from OPB::Prod30::HiddenContentBox. 
 * Whenever the tag HIDDEN_CONTENT_BOX has the attr display_hidden_content set to true
 * the content will be displayed via a onload handler event. This method checks to verify
 * if the event has been fired and if not it will clear the handler and call toggleHiddenContent
 * If the handler is not cleared, the toggler will enter an infinite loop.
*/
function toggleHiddenContentOnLoad(elem, containerClassName) {
    if (elem.already_loaded == null)
    {
        elem.already_loaded = 1;    
        elem.onload         = null;
        toggleHiddenContent(elem.parentNode, containerClassName);
    }
}

function getElementsByClassName(elem, parentClass, elements) {
        if(elements == null) {
                elements = new Array();
        }
        for(var i = 0; i < parentClass.childNodes.length; i++) {
                var e = parentClass.childNodes[i];
                if (e.className == elem) {
                        elements.push(e);
                }
                getElementsByClassName(elem, e, elements);
        }

        return elements;
}

function getParentByClassName(elem, parentClass)
{
	var i = 0;
	while (elem.className != parentClass && i++ < 10) elem = elem.parentNode;

	return elem;
}

function toggleAjaxContent(clickElem, containerClassName, url, method, params)
{
	var containerElem = getAjaxContainer(clickElem);

	if (Element.hasClassName(containerElem, 'ajax_error')) Element.removeClassName(containerElem, 'ajax_error');

	makeAjaxRequest(containerElem, url, method, params);

	toggleHiddenContent(clickElem, containerClassName)
}

function getAjaxContainer(elem)
{
  return (document.getElementsByClassName('ajax_content', getParentByClassName(elem, 'hidden_content_container')))[0];
}

function makeAjaxRequest(containerElem, url, method, params)
{
	if (method == undefined) method = 'get';
	if (params == undefined) params = '';

	new Ajax.Updater(
		{success: containerElem},
		url,
		{
			method:      method,
			parameters:  params,
			evalScripts: true,
			onError:     function(request){ajaxContainerError(containerElem, request)},
			onFailure:   function(request){ajaxContainerError(containerElem, request)}
		}
	);

	$(containerElem).innerHTML = '<div class="ajax_progress"></div>';
}

function ajaxContainerError(containerElem, request)
{
	Element.addClassName(containerElem, 'ajax_error');
	containerElem.innerHTML = 'Hello. We\'re sorry for the inconvenience, but we were unable to retrieve a product list.<br/>The error is captured in our daily bug report.  We\'ll respond promptly to fix it';
}

function ajaxFormSubmit(containerElem, formElem)
{
	makeAjaxRequest(containerElem, formElem.action, formElem.method, Form.serialize(formElem));

	return false;
}

//----------------------- Dynamic Form functions --------------------------------------

//
// Hides previously selected dynamic form elements and
// makes currently selected dynamic form elements visible.
//
function show_dynamic_element(element_id_array, old_index, new_index)
{
   if (old_index != -1)
   {
      // Hide the previously selected element.
      var element = document.getElementById(element_id_array[old_index]);

      if (element)
      {
         element.style.display = 'none';
         element.visible = 'no';
      }
   }

   // Un-hide the currently selected element.
   var element = document.getElementById(element_id_array[new_index]);

   if (element)
   {
      element.style.display = 'inline';
      element.visible = 'yes';
      old_index = new_index;
   }

   // parent.sizeQuickPoll('quickpoll_frame');
   callParentToResize() // replaces parent.sizeQuickPoll('quickpoll_frame');

   return old_index;
}

//
// Hides previously selected dynamic form elements and
// makes currently selected dynamic form elements visible.
//

function enable_dynamic_element(element_id_array, old_index, new_index)
{
    if (new_index === 0){
        var element = document.getElementById(element_id_array[new_index]);
        var element_label = document.getElementById(element_id_array[new_index] + '_label');

        disable_children(element, 'INPUT', 0);
        readonly_children(element, 'textarea', 0);

        element.className = '';
        if (element_label){
            element_label.className = '';
        }
        element.disabled = false;
        old_index = new_index;

        var hidden_element = document.getElementById('show_field_' + element_id_array[new_index]);
        hidden_element.value = 'enabled';

    }else{
        var element = document.getElementById(element_id_array[new_index]);
        var element_label = document.getElementById(element_id_array[new_index] + '_label');
        var hidden_element = document.getElementById('show_field_' + element_id_array[new_index]);
        hidden_element.value = 'disabled';
        disable_children(element, 'INPUT', 1);
        readonly_children(element, 'textarea', 1);
        hidden_element.disabled=false;
        element.className = 'disabled';
        if (element_label){
            element_label.className = 'disabled';
        }
    }

    return old_index;
}

//
// Disables dynamic form elements that are non-visible if disable_flag is
// true else enables.
//
function disable_dynamic_elements(element_id_arrays, controls, disable_flag)
{
   for (var i = 0; i < element_id_arrays.length; i++)
   {
      var element_id_array = element_id_arrays[i];

      for (var j = 0; j < element_id_array.length; j++)
      {
         var id = element_id_array[j];
         var element = document.getElementById(id);

         if (! element)
            continue;

         if (element.visible == 'no')
         {
            for (var k = 0; k < controls.length; k++)
            {
               disable_children(element, controls[k], disable_flag);
            }
         }
      }
   }
}

//
// Disable the controls that are children (i.e. match the 'child' variable) of a
// given element (i.e. 'parent') if disable_flag is true else enables.
//
function disable_children(parent, child, disable_flag)
{
   var children = parent.getElementsByTagName(child);

   for (var index = 0; index < children.length; index++)
   {
      if (disable_flag)
      {
         // DISABLE children of parent.
         children[index].disabled = true;
      }
      else
      {
         // ENABLE children of parent.
         children[index].disabled = false;
      }
   }
}

function readonly_children(parent, child, disable_flag)
//
// Sets children of an element to read only, similar to the disable_children function
//
{
   var children = parent.getElementsByTagName(child);

   for (var index = 0; index < children.length; index++)
   {
      if (disable_flag)
      {
         // DISABLE children of parent.
         children[index].readOnly = true;
      }
      else
      {
         // ENABLE children of parent.
         children[index].readOnly = false;
      }
   }
}

//
// Initializes non-visible dynamic form elements by giving them the
// visible='no' attribute/value pair and by ensuring that their
// controls are enabled.
//
function init_dynamic_elements(element_id_arrays, controls)
{
   for (var i = 0; i < element_id_arrays.length; i++)
   {
      var element_id_array = element_id_arrays[i];

      for (var j = 0; j < element_id_array.length; j++)
      {
         var id = element_id_array[j];
         var element = document.getElementById(id);

         if (! element)
            continue;

         element.visible = 'no';

         for (var k = 0; k < controls.length; k++)
         {
            disable_children(element, controls[k], false);
         }
      }
   }
}

function callParentToResize()
{
   var bodyElem     = (document.getElementsByTagName('body'))[0];
   var scrollHeight = document.body.scrollHeight;

   /* For some reason, IE has interaction issues with the JavaScript
      from Accipiter that causes the scrollHeight to come out zero.
      To get around this, we reload the quickpoll (which seems to
      clear this issue up...)*/
   if ($not_empty_form && scrollHeight == 0){window.location.reload(true);}

   parent.sizeQuickPoll('quickpoll_frame', scrollHeight);
}

// For the PSG selector, this function hides an entire column based
// on it's class attribute

function hideColumn(theClass){
 var allTags = document.getElementsByTagName('*');
 for(i=0; i<allTags.length; i++){
  if(allTags[i].className == theClass) allTags[i].style.display = 'none';
 }
}


// ---------------- Functions for Interface to PSG Comparator -----------------

//
// Toggles the submit button on/off for the PSG Comparator Interface.
//
function psgComparatorInterfaceSubmitButtonToggle(submit_image_obj)
{
   var cmp_on_url  = submit_image_obj.on_url;
   var cmp_off_url = submit_image_obj.off_url;

   var psg_top_submit    = document.getElementById("psg_top_submit");
   var psg_bottom_submit = document.getElementById("psg_bottom_submit");

   if (countOfItems > 0)
   {
      psg_top_submit.src    = cmp_on_url;
      psg_bottom_submit.src = cmp_on_url;

      psg_top_submit.disabled    = false;
      psg_bottom_submit.disabled = false;
   }
   else
   {
      psg_top_submit.src    = cmp_off_url;
      psg_bottom_submit.src = cmp_off_url;

      psg_top_submit.disabled    = true;
      psg_bottom_submit.disabled = true;
   }
}


//
// Toggles the arrows on/off for the PSG Comparator Interface.
//
function psgComparatorInterfaceArrowsToggle()
{
   var arw_dwn_on_url  = '/gifs/components/bnt_compare_arrow_down_on.gif';
   var arw_dwn_off_url = '/gifs/components/bnt_compare_arrow_down_off.gif';

   var arw_up_on_url   = '/gifs/components/bnt_compare_arrow_up_on.gif';
   var arw_up_off_url  = '/gifs/components/bnt_compare_arrow_up_off.gif';

   var psg_down_arrow  = document.getElementById("psg_down_arrow");
   var psg_up_arrow    = document.getElementById("psg_up_arrow");

   if (countOfItems > 0)
   {
      psg_down_arrow.src = arw_dwn_on_url;
      psg_up_arrow.src   = arw_up_on_url;
   }
   else
   {
      psg_down_arrow.src = arw_dwn_off_url;
      psg_up_arrow.src   = arw_up_off_url;
   }
}


//
// Enable/disable the checkboxes.
//
function psgComparatorInterfaceCheckboxesEnabledToggle(toggleOn)
{
   for (element_id in elem_id_hash)
   {
      var control = document.getElementById(element_id);

      if (! elem_id_hash[element_id])
      {
         control.disabled = toggleOn ? false : true;
      }
   }
}


//
// Operates at the checkbox level. Clicking on the checkbox will
// enable the submit button and increase the count of selected items.
//
function psgComparatorInterfaceCheckBox(element_id, submit_image_obj)
{
   var link_id = element_id + "_LINK";

   var elem = document.getElementById(element_id);
   var link = document.getElementById(link_id);

   if (elem_id_hash[element_id])
   {
      --countOfItems;

      elem.checked = false;
      link.checked = false;

      elem_id_hash[element_id] = 0;
      elem_id_hash[link_id]    = 0;

      if (countOfItems < MAX_CHECKBOXES)
      {
         psgComparatorInterfaceCheckboxesEnabledToggle(true);
      }
   }
   else
   {
      if (countOfItems < MAX_CHECKBOXES)
      {
         ++countOfItems;

         elem.checked = true;
         link.checked = true;

         elem_id_hash[element_id] = 1;
         elem_id_hash[link_id]    = 1;

         if (countOfItems == MAX_CHECKBOXES)
         {
            psgComparatorInterfaceCheckboxesEnabledToggle(false)
         }
      }
   }

   psgComparatorInterfaceSubmitButtonToggle(submit_image_obj);
   psgComparatorInterfaceArrowsToggle();
}

//
// Resets the state when the page loads.
//
function psgComparatorInterfaceInit()
{

   for (element_id in elem_id_hash)
   {
      var control = document.getElementById(element_id);

      if (! control)
         continue;

      control.checked = false;
      elem_id_hash[element_id] = 0;

      countOfItems = 0;
      psgComparatorInterfaceSubmitButtonToggle(submit_image_obj);
      psgComparatorInterfaceArrowsToggle();
   }
   psgComparatorInterfaceCheckboxesEnabledToggle(true);
}

//
// Allows you to treat a collection of checkboxes with the same kind of
// property that a radio group has, that is, only one of many can be checked.
//
function radioCheckBoxes(activeId, ids)
{
   for (var i = 0; i < ids.length; i++)
   {
      var elem = document.getElementById(ids[i]);
		if (elem)
		{
      	if (activeId == ids[i])
	      {
	         elem.checked = (elem.checked) ? true : false;
	      }
	      else
	      {
	         elem.checked = false;
	      }
		}
   }

   return;
}

//
// child iframes can close the modal window that holds them
//
function closeModal(newUri) {
	jQuery.modal.close();
	if ( newUri == undefined || newUri == '' ) {
		document.location.reload(true);
	} else {
		document.location.href = newUri;
	}
}

// Launches a popunder so that a user can decide if they want to take a survey for ColorQube.
function launchColorQubePopUnder()
{
	
	// *** This call has been deprecated ***
	return;
	
	var cookie = 'TEKPROFILE';
	var path   = '/';
	var domain = 'xerox.com';
	var expiration_in_seconds = 2*365*24*60*60;

	var cookieObj = new Cookie(cookie, path, domain, expiration_in_seconds);

	var last_survey_date = cookieObj.get('last_survey_date');

	if (! last_survey_date)
	{
		// We only want to launch the pop-under if this field wasn't set.

		var today = new Date();
		cookieObj.set('last_survey_date', today.toUTCString());
		document.cookie = cookieObj.bake();

		// Determine where to place the pop-under window
		var parentTop = (window.screenTop) ? window.screenTop : window.screenY;
		var parentLeft = (window.screenLeft) ? window.screenLeft : window.screenX;

		if (!parentLeft)	// IE6 may not have reported these if maximized
			parentLeft = 0;
		if (!parentTop)
			parentTop = 0;

		parentTop += 20;
		parentLeft += 20;

		var width = 550;
		var height = 440;

		var popUnder = window.open(
			'', 
			"QualtricsSurveyWindow", 
			"resizable=yes,scrollbars=yes,status=yes,width=" + width + ",height=" + height + ",left=" + parentLeft + ",top=" + parentTop
		);

		if (popUnder)
		{
			try 
			{
				if (popUnder.location.href == 'about:blank')
				{
					popUnder.location = '/perl-bin/colorqube_popunder.pl';
				}
			}
			catch(error)
			{
				// Stub
				popUnder.location = '/perl-bin/colorqube_popunder.pl';
			}
			popUnder.blur();
		}
	}
}

function launchHomePagePopUnder()
/* Qualtrics homepage survey - created on 11/19/09
 * Called from /W3Dev/data/onUnload_code.inc
 */
{
    return; //Turned off on 12/21/2009 by Lbell
	var cookie = 'TEKPROFILE';
	var path   = '/';
	var domain = 'xerox.com';
	var expiration_in_seconds = 30*24*60*60;

	var cookieObj = new Cookie(cookie, path, domain, expiration_in_seconds);

	var last_survey_date = cookieObj.get('last_survey_date');
    var country          = cookieObj.get('country');
    if ( document.URL.match(/^http:\/\/psgdev.opbu.xerox.com\/index\/(engb|miss-engb|enie|miss-enie|enin|miss-enin|enus|miss-enus).html$/) || //DEV
         document.URL.match(/^http:\/\/psgdev.opbu.xerox.com\/$/) ||  //DEV
         document.URL.match(/^http:\/\/[a-z]{3}.xerox.com\/index\/(engb|miss-engb|enie|miss-enie|enin|miss-enin|enus|miss-enus).html$/) ||  //PROD
         document.URL.match(/^http:\/\/[a-z]{3}.xerox.com\/$/) //PROD
        ) {
	    if ( !last_survey_date && country == 'UK' ){
		    var today = new Date();
		    cookieObj.set('last_survey_date', today.toUTCString());
		    document.cookie = cookieObj.bake();
            WindowPopup('http://xerox.qualtrics.com/SE?SID=SV_bEO3n86s4zjbQqw&SVID=Prod','width=550,height=500');
	    }
	    if ( !last_survey_date && country == 'Ireland' ){
		    var today = new Date();
		    cookieObj.set('last_survey_date', today.toUTCString());
		    document.cookie = cookieObj.bake();
            WindowPopup('http://xerox.qualtrics.com/SE?SID=SV_25E9xnF4liCeOsQ&SVID=Prod','width=550,height=500');
	    }
	    if ( !last_survey_date && country == 'India' ){
		    var today = new Date();
		    cookieObj.set('last_survey_date', today.toUTCString());
		    document.cookie = cookieObj.bake();
            WindowPopup('http://xerox.qualtrics.com/SE?SID=SV_3k1f2pJQXrbwf1G&SVID=Prod','width=550,height=500');
	    }
    }
}


// Code for opb_multi_tier_pulldown->two_tier_menu().

function TwoTierMenu() {}

TwoTierMenu.prototype.menuDataArray = [];

TwoTierMenu.prototype.init = function (params) {
	var updateHandler = params.handler;
	TwoTierMenu.prototype.menuDataArray = params.data;

	// Add handler to Tier One <SELECT>
	var elem = document.getElementById('tier_one');
	if (elem.addEventListener)
	{
		// Firefox behavior
		elem.addEventListener('click', updateHandler, true);
	}
	else
	{
		// Internet Explorer behavior
		elem.attachEvent('onclick', updateHandler);
	}

	// Add handler to Tier Two <SELECT>
	var elem = document.getElementById('tier_two');
	if (elem.addEventListener)
	{
		// Firefox behavior
		elem.addEventListener('click', updateHandler, true);
	}
	else
	{
		// Internet Explorer behavior
		elem.attachEvent('onclick', updateHandler);
	}
};

TwoTierMenu.prototype.addRelevantTierTwoElements = function (selectTagElem, secondaryKeys) {

	for (var index = 0; index < secondaryKeys.length; index++)
	{
		var secondaryKeyHash = secondaryKeys[index];

		var optionElem = document.createElement('OPTION');

		optionElem.id = secondaryKeyHash.id;
		optionElem.innerHTML = secondaryKeyHash.label;
		selectTagElem.appendChild(optionElem);
	}
}

TwoTierMenu.prototype.getAllSecondaryKeys = function () {
	var primaryKeys = this.getPrimaryKeys();
	var allSecondaryKeys = [];
	var aindex = 0;

	for (var index = 0; index < primaryKeys.length; index++)
	{
		var secondaryKeys = this.getSecondaryKeysByPrimaryKey(primaryKeys[index]);
		for (var sindex = 0; sindex < secondaryKeys.length; sindex++)
		{
			allSecondaryKeys[aindex++] = secondaryKeys[sindex];
		}
	}

	return allSecondaryKeys;
};

TwoTierMenu.prototype.getLabelForSecondaryId = function (id) {
	var label = '';
	for (var index = 0; index < this.menuDataArray.length; index++)
	{
		for (var key in this.menuDataArray[index])
		{
			if (key == 'secondary_keys_ar')
			{
				var secondaryKeysArray = this.menuDataArray[index].secondary_keys_ar;
				for (var sindex = 0; sindex < secondaryKeysArray.length; sindex++)
				{
					var secondaryKeysHash = secondaryKeysArray[sindex];
					if (secondaryKeysHash.id == id)
					{
						label = secondaryKeysHash.label;
						break;
					}
				}
			}
		}
	}

	return label;
};

TwoTierMenu.prototype.getPrimaryKeys = function () {
	var primaryKeys = [];

	for (var index = 0; index < this.menuDataArray.length; index++)
	{
		primaryKeys[index] = this.menuDataArray[index].primary_key_id;
	}
			
	return primaryKeys;
};

TwoTierMenu.prototype.getPrimaryKeyBySecondaryKey = function (secondaryKeyId) {

	var primaryKey = '';

	for (var index = 0; index < this.menuDataArray.length; index++)
	{
		secondaryKeys = this.menuDataArray[index].secondary_keys_ar;
	
		for (var sindex = 0; sindex < secondaryKeys.length; sindex++)
		{
			var secondaryId = secondaryKeys[sindex].id;

			if (secondaryId == secondaryKeyId)
			{
				primaryKey = this.menuDataArray[index].primary_key_id;
				break;	
			}
		}
	}

	return primaryKey;
};

TwoTierMenu.prototype.getSecondaryKeysByPrimaryKey = function (primaryKeyId) {
	var secondaryKeys = [];

	for (var index = 0; index < this.menuDataArray.length; index++)
	{
		if (this.menuDataArray[index].primary_key_id != primaryKeyId)
			continue;

		secondaryKeys = this.menuDataArray[index].secondary_keys_ar;
	}
			
	return secondaryKeys;
};

TwoTierMenu.prototype.removeAllTierTwoElements = function (selectTagElem) {

	var optionElems = selectTagElem.getElementsByTagName('OPTION');

	for (var index = (optionElems.length - 1); index > -1; index--)
	{
		var optionElem = optionElems[index];

		if (optionElem)
		{
			selectTagElem.removeChild(optionElem);
		}
	}

	// We must toggle the display of the select tag otherwise IE will not 
	// update the element.
   selectTagElem.style.display = 'none';
   selectTagElem.style.display = 'block';

};

TwoTierMenu.prototype.isPrimaryKey = function (id) {
	var primaryKeys = this.getPrimaryKeys();
	var flag = false;

	for (var index = 0; index < primaryKeys.length; index++)
	{
		if (primaryKeys[index] == id)
		{
			flag = true;
			continue;
		}
	}	

	return flag;
};
				
TwoTierMenu.prototype.showInPageElementsByClassName = function (className, flag) {
	var collection = $('DIV.' + className);

	for (var index = 0; index < collection.length; index++)
	{
		var elem = collection[index];
		
		if (! elem)
			continue;

		elem.style.display = (flag) ? 'block' : 'none';
	}
};

// This handler is used on the XGS Case Studies page.
TwoTierMenu.prototype.showInPageElementsHandler = function (e) {

	var parentElem = getSelectedOptionElem(e);

	var key = parentElem.id;	

	if (TwoTierMenu.prototype.isPrimaryKey(key))
	{
		// The 'key' is a primary key

		var secondaryKeys    = TwoTierMenu.prototype.getSecondaryKeysByPrimaryKey(key);
		var selectElem       = document.getElementById('tier_two');
	
		if (secondaryKeys.length)
		{
			// Build the secondary key options.

			// Firstly, remove all of the secondary key options.
			TwoTierMenu.prototype.removeAllTierTwoElements(selectElem);

			// Now, add the relevant secondary key options for the given primary key.
			TwoTierMenu.prototype.addRelevantTierTwoElements(selectElem, secondaryKeys);
		}
		else
		{
			// We don't have any secondary keys so display all objects on page.

			// Firstly, hide all secondary keys.
			TwoTierMenu.prototype.removeAllTierTwoElements(selectElem);
		
			// Now, display all objects on page.
			TwoTierMenu.prototype.showInPageElementsByClassName('view_all', true);

			// This call is purely for XGS Case Study Pages intro copy.
			showAppropriateCaseStudyIntroCopy(key);
		}
	}
	else
	{
		// The 'key' is a secondary key

		// Firstly, hide all objects on page.
		TwoTierMenu.prototype.showInPageElementsByClassName('view_all', false);

		// Now, show only the relevant objects on page. 
		TwoTierMenu.prototype.showInPageElementsByClassName(key, true);

		var primaryKey = TwoTierMenu.prototype.getPrimaryKeyBySecondaryKey(key); 

		// This call is purely for XGS Case Study Pages intro copy.
		showAppropriateCaseStudyIntroCopy(primaryKey);
	}
};

// This handler is used in the EH&S PDF Upload Tool.
TwoTierMenu.prototype.addOMARIDToInputElementHandler = function (e) {

   var parentElem = getSelectedOptionElem(e);

   var key = parentElem.id;

   if (TwoTierMenu.prototype.isPrimaryKey(key))
   {
      // The 'key' is a primary key

   	var secondaryKeys    = TwoTierMenu.prototype.getSecondaryKeysByPrimaryKey(key);
      var selectElem       = document.getElementById('tier_two');

      if (secondaryKeys.length)
      {
         // Build the secondary key options.

         // Firstly, remove all of the secondary key options.
         TwoTierMenu.prototype.removeAllTierTwoElements(selectElem);

         // Now, add the relevant secondary key options for the given primary key.
         TwoTierMenu.prototype.addRelevantTierTwoElements(selectElem, secondaryKeys);
      }
      else
      {
         // We don't have any secondary keys...

         // Firstly, remove all of the secondary key options.
         TwoTierMenu.prototype.removeAllTierTwoElements(selectElem);
      }
   }
   else
   {
      // The 'key' is a secondary key

		// Get the friendly or marketing label for the OMARID.
		var label = TwoTierMenu.prototype.getLabelForSecondaryId(key)

      // Add the key (which should be an OMARID) to an <INPUT> tag.
      var inputElem = document.getElementById('products');

		if (key != 'tier_two')
		   inputElem.value += key + ' [' + label + '], ';
   }
};


// This is used by TwoTierMenu but is generally applicable to pulldown menus.
// Given that this handler has been associated with a pulldown, it will basically 
// allow you to find the option that was selected in either Internet Explorer or
// Mozilla Firefox. Should also work in Google Chrome and Apple Safari.
getSelectedOptionElem = function (e) {

	var parentElem = (e.target) ? e.target : e.srcElement ;

	if (parentElem.tagName == 'SELECT')
	{
		// Special-case for Internet Explorer

		var optionElems = parentElem.getElementsByTagName('OPTION');

		for (var index = 0; index < optionElems.length; index++)
		{
			var optionElem = optionElems[index];

			if (! optionElem)
				continue;

			if (optionElem.selected)
			{
				parentElem = optionElem;
				continue;
			}
		}
	}

	return parentElem;
};


// This is special-case code for XGS Case Study Pages to show the appropriate
// intro copy when a selection has been made in the tier one column of the 
// two tier menu.
function showAppropriateCaseStudyIntroCopy (key)
{
	var introCopyIds = ['casestudies_view_all_copy', 'casestudies_by_dept_copy', 'casestudies_by_offer_copy'];

	// First hide all intro copy.
	for (var index = 0; index < introCopyIds.length; index++)
	{
		var elem = document.getElementById(introCopyIds[index]);

		if (! elem)
			continue;

		elem.style.display = 'none';
	}
	

	if (key == 'view_all')	
	{
		var elem = document.getElementById(introCopyIds[0]);
		if (elem)
			elem.style.display = 'block';
	}
	else if (key == 'your_department')
	{
		var elem = document.getElementById(introCopyIds[1]);
		if (elem)
			elem.style.display = 'block';
	}
	else if (key == 'service_offering')
	{
		var elem = document.getElementById(introCopyIds[2]);
		if (elem)
			elem.style.display = 'block';
	}
}


// Start of <ROLLOVER_IMAGES> and <ROLLOVER_IMAGE_LINKS> tags code.
var rolloverImages = new Array();

function rolloverImageUpdate(base_id, id) {
	var src  = rolloverImages[id];
	var elem = document.getElementById(base_id);
	if (elem)
	{
		elem.src = src;
	}
}

function rolloverImagesUpdater(base_ids, image_ids) {
	var id_array      = image_ids.split(',');
	var base_id_array = base_ids.split(',');
	for (var index = 0; index < base_id_array.length; index++)
	{
		var id      = id_array[index];
		var base_id = base_id_array[index];
		rolloverImageUpdate(base_id, id);
	}
}

function rolloverLinksInit(link_ids, base_ids) {
	var link_id_array   = link_ids.split(',');
	var handlers_array  = new Array();

	for (var index = 0; index < link_id_array.length; index++)
	{
		var link_id   = link_id_array[index];

		$('#' + link_id).mouseover(function (e) {
			 rolloverImagesUpdater(base_ids, e.target.getAttribute('image_ids'))
		});
		$('#' + link_id).mouseout(function (e) {
			rolloverImagesUpdater(base_ids, base_ids);
		});
	}
}

// End of <ROLLOVER_IMAGES> and <ROLLOVER_IMAGE_LINKS> tags code.


//
// Define QualtricsSurveyKiller Class. This class and its associated handler
// allow us to kill the survey popup when an end-user transitions from a 
// xerox.com to a xerox.it (localized) domain.
//
// CAVEATS: You need to define the country2LocalDomainObj datastructure before
// using this. The key values specify the country (e.g. 'United States', 'Italia')
// and the values are true (if the country has a localized domain) or false.
//
function QualtricsSurveyKiller(paramsObj){
	this.selectTagId = paramsObj.selectTagId;
	this.optionTagAttributeName = paramsObj.optionTagAttributeName;
	this.qualtricsSurveyWindowName = paramsObj.qualtricsSurveyWindowName;
	this.currentCountry = paramsObj.currentCountry;

	this.registerEventHandler();
}
QualtricsSurveyKiller.prototype.isLocalDomainCountry = function (country) {
	return country2LocalDomainObj[country];
};
QualtricsSurveyKiller.prototype.registerEventHandler = function () {
   var elem = document.getElementById(this.selectTagId);
   if (elem.addEventListener)
   {
      // Firefox behavior
      elem.addEventListener('click', qualtricsSurveyKillerHandler, true);
   }
   else
   {
      // Internet Explorer behavior
      elem.attachEvent('onclick', qualtricsSurveyKillerHandler);
   }
};
QualtricsSurveyKiller.prototype.killWindow = function () {
	// alert("killing Qualtrics Survey Window");
	//var newWindow = window.open( '', this.qualtricsSurveyWindowName, '');	
	//newWindow.close();
};

function qualtricsSurveyKillerHandler (e) {
	var parentElem = (e.target) ? e.target : e.srcElement ;
	var selectedElem = null;

	if (parentElem.tagName == 'SELECT')
	{
		// Internet Explorer: doesn't allow event handlers on <OPTION> tags 
		// so we have to iterate over the children of the <SELECT> tag to see 
		// if any of the <OPTION> tags are selected.
		var optionElems = parentElem.getElementsByTagName('OPTION');
		for (var index = 0; index < optionElems.length; index++)
		{
			var optionElem = optionElems[index];
			if (! optionElem)
				continue;
	
			if (optionElem.selected)
			{
				selectedElem = optionElem;
				continue;
			}
		}
	}
	else
	{
		// Firefox: Allows event handlers on <OPTION> tags so we can get the 
		// selected elem easily.
		selectedElem = e.target;
	}

	var currentCountry = qualtricsSurveyKillerObj.currentCountry;
	var optionTagAttributeName = qualtricsSurveyKillerObj.optionTagAttributeName;
	var targetCountry  = selectedElem.attributes[optionTagAttributeName].value;
	if (! qualtricsSurveyKillerObj.isLocalDomainCountry(currentCountry) && qualtricsSurveyKillerObj.isLocalDomainCountry(targetCountry))
	{
	// alert("CurrentCountry: " + currentCountry + " isLocalDomain? '" + qualtricsSurveyKillerObj.isLocalDomainCountry(currentCountry) + "' TargetCountry: " + targetCountry + " isLocalDomain? '" + qualtricsSurveyKillerObj.isLocalDomainCountry(targetCountry) + "'");
		qualtricsSurveyKillerObj.killWindow();
	}
};



// End QualtricsSurveyKiller.

// Start redirectDMOCustomers
//
// Purpose:  This redirects DMO customers who accidentally go to the following Xerox Europe Formeng form:
//
//		http://psgdev.opbu.xerox.com/perl-bin/formeng.pl?form=xerox-contact-request
//

function DMORedirect() { }

DMORedirect.prototype.init = function () {

	this.first      = '';
	this.last       = '';
	this.email      = '';
	this.address1   = '';
	this.address2   = '';
	this.city       = '';
	this.state      = '';
	this.postcode   = '';
	this.country    = '';
	this.phone      = '';

	this.XOGlang    = false;
	this.hasWebServiceResponded = false;

	this.urls = {
		dmo_webservice: '/perl-bin/dmo_webservice.pl',
		inquiry_page:   'http://www.xerox.com/digital-printing/perl-bin/response.pl?X2105&XOGlang='
		
	};
};

DMORedirect.prototype.getFieldsFromPulldown = function () {
	var self = this;

	this.first    = $("input#first").val();
	this.last     = $("input#last").val();
	this.email    = $("input#email").val();
	this.address1 = $("input#address1").val();
	this.address2 = $("input#address2").val();
	this.city     = $("input#city").val();
	this.state    = $("input#state_prov").val();
	this.postcode = $("input#postcode").val();
	this.phone    = $("input#phone").val();

	$("select[name=country] option:selected").each(function () {
		self.country = this.getAttribute('value');
	});

};

DMORedirect.prototype.redirectForXeroxContactRequest = function () {
	var self = this;

	if (this.hasWebServiceResponded)
	{
		if (this.XOGlang)
		{
			// We want to save the fields that are currently set in the form
			// to the cookie so that the inquiry form can pick them up after
			// the redirect.
			this.populateTekProfileCookie();

			window.location = this.urls.inquiry_page + this.XOGlang;
		}
	}
	else
	{
		setTimeout(function () {
			self.redirectForXeroxContactRequest();
		}, 1000);
	}
};

DMORedirect.prototype.fetchXOGlang = function () {
	var self = this;

   $.get(this.urls.dmo_webservice + '?command=is_dmo&country=' + this.country, function(str){
		self.XOGlang    = str;
      self.hasWebServiceResponded = true;
   });
};

DMORedirect.prototype.populateTekProfileCookie = function () {
	var cookie = 'TEKPROFILE';
	var path   = '/';
	var domain = 'xerox.com';
	var expiration_in_seconds = 2*365*24*60*60;

	var cookieObj = new Cookie(cookie, path, domain, expiration_in_seconds);

	cookieObj.set('first',    this.first);
	cookieObj.set('last',     this.last);
	cookieObj.set('email',    this.email);
	cookieObj.set('address1', this.address1);
	cookieObj.set('address2', this.address2);
	cookieObj.set('city',     this.city);
	cookieObj.set('state',    this.state);
	cookieObj.set('postcode', this.postcode);
	cookieObj.set('country',  this.country);
	cookieObj.set('phone',    this.phone);

	document.cookie = cookieObj.bake();
};

function redirectDMOCustomers()
{
	var dmoObj = new DMORedirect();

	dmoObj.init();
	dmoObj.getFieldsFromPulldown();
	dmoObj.fetchXOGlang();
	dmoObj.redirectForXeroxContactRequest();
}

// End redirectDMOCustomers

var XRX_UTILS = {};

/* PNG Utilities
   Purpose: Utilities to walk the dom and fix the alpha transparency bug in IE 5/6 
*/
var XRX_UTILS = (function(self) {

    /* PUBLIC METHODS */

    /* fix_pngs()
       Purpose: Traverses the DOM looking for potential elements that could have a png image
       Input:   None
       Output:  None
    */ 
    self.fix_pngs = function(){
        if (!/MSIE (5\.5|6\.)/.test(navigator.userAgent))
        {
            return;
        } 
        for ( var i = 0; i < TAGS_TO_ITERATE.length; ++i ) {
     
		    var elements = document.getElementsByTagName(TAGS_TO_ITERATE[i]);

		    for ( var j = 0; j < elements.length; ++j )
		    {
                var element = elements[j];
                var element_background = element.currentStyle.backgroundImage || element.style.backgroundImage;
                if (/\.png$/i.test(element.src))
                {
                    filt(element,element.src,'scale');
                    element.src = blankImg;
                }
                else if (/^url[("']+(.*\.png)[)"']+$/i.test(element_background))
                {
                    var src = RegExp.$1;
                    filt(element,src, 'crop');
                    element.style.backgroundImage = 'none';
                }
            }
        }
    }; 

    /* PRIVATE METHODS */

    /* filt()
       Purpose: Applies CSS filter property to an element
       Input:   DOM Elem
       Output:  None
    */ 
    filt = function(element,src, m) {
        if (src){
             element.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+src+'",sizingMethod="'+m+'")';
        }
    };

    var TAGS_TO_ITERATE = [ 'LI', 'DIV', 'IMG' ];
    var blankImg        = '/assets/js/jquery/blank.gif';

    return self;
}(XRX_UTILS));



/** cnPrimaryNavMenuManager

Purpose:
	
	Singleton class to manage "primary" navigation menus on Xerox web sites

Assumptions:

	This class assumes that the menus it manages are structured such that,
	initially, there is a visible "header" element representing a menu in it's
	"off" state.  Also, there is a "menu" element that, initially, is not
	rendered representing the menu in it's "on" state.  When a menu is
	"turned on", the "header" is removed from the displayed content and the
	"menu" is inserted in it's place.
	
Usage:
	
	cnPrimaryNavMenuManager.toggleMenu(menuElemToTurnOn);
	cnPrimaryNavMenuManager.turnOffNow(disableMenuCompletelyFlag);
	cnPrimaryNavaMenuManager.VERSION; // version number of this libary
		
Configuration:

	The following attributes can be adjusted to fit your liking
	
		MENU_ON_DELAY    - delay (in milliseconds) before menu is turned on
		MENU_OFF_DELAY   - delay (in milliseconds) before menu is turned off
		MENU_OFF_CLASS   - String CSS class for "off" menu header elements
		MENU_ON_CLASS    - String CSS class for "on" menu header elements (i.e. menu header for current site)
		MENU_HOVER_CLASS - String CSS class for menu header element currently under mouse pointer
		MENU_MAT_CLASS   - String CSS class for "mat" <IFRAME> used on Windows/IE to prevent <SELECT> elements from occluding menus
		MENU_MAT_SRC     - String to use as "src" attribute value in "mat" <IFRAME>s (must be local to domain hosting page to prevent SSL errors)
		MENU_ELEM_SUFFIX - String of suffix appended to CSS id of "header" element to find "menu" element
		MENU_GROUP_ID    - String of CSS id for element containing all menu elements
		MENU_EXCLUDE_USER_AGENTS - Array of strings (partial or complete) to match against the navigator.userAgent strings when determining whether or not to display menus
		MENU_PRELOAD_URL - String of server URL to use when loading images (assumes all images are in the same directory)
		MENU_PRELOAD_IMAGES - Array of string-names of images to preload
**/

cnPrimaryNavMenuManager = new function()
{
	// public configuration data
	this.VERSION          = '1.1';
	this.MENU_ON_DELAY    = 150;
	this.MENU_OFF_DELAY   = 5;
	this.MENU_OFF_CLASS   = 'cn_pnav_link';
	this.MENU_ON_CLASS    = 'cn_pnav_link_on';
	this.MENU_HOVER_CLASS = 'cn_pnav_link_hover';
	this.MENU_MAT_CLASS   = 'cn_pnav_fmenu_ie_select_block';
	this.MENU_MAT_SRC     = '/gifs/spacer.gif';
	this.MENU_ELEM_SUFFIX = '_menu';
	this.MENU_GROUP_ID    = 'cn_pnav';
	this.MENU_EXCLUDE_USER_AGENTS = [];
	this.MENU_PRELOAD_URL    = '/gifs/navigation/common/';
	this.MENU_PRELOAD_IMAGES = [];
	
	// "private" data/methods for set/clearInterval calls
	this._onTimerId     = null;
	this._offTimerId    = null;
	this._turnOnMenu    = function(){};
	this._turnOffMenu   = function(){};
	
	this._clearOnTimer = function ()
	{
		clearTimeout(this._onTimerId);
		
		this._onTimerId  = null;
		this._turnOnMenu = function(){};
	};
	
	this._clearOffTimer = function ()
	{
		clearTimeout(this._offTimerId);
		
		this._offTimerId  = null;
		this._turnOffMenu = function(){};
	};
	
	// "private" data
	this._skipMenuDisplay = false; // assume we want to show the menu
	this._onHdrElemId     = null;  // current "on" element
	this._activeHdrElemId = null;  // header of "active" site
	this._hdrMenuObjs     = null;  // array of Objects holding header/menu data
	this._menuDisabled    = false; // flag indicating that menus are disabled
	
	// declare our public methods
	this.turnOffMenuNow = function(){}; // this is actually defined when a menu is activated
	
	this.toggleMenu = function(toggleElem)
	{
		if (this._menuDisabled)       return;
		if (!document.getElementById) return;
		if (!this._hdrMenuObjs)       this._initialize();
		if (this._onTimerId)          this._clearOnTimer();
		
		var self = this; // set up local copy of instance for use via closure by on/off functions
		
		for ( var i = 0; i < this._hdrMenuObjs.length; ++i )
		{
			var hdrMenuObj = this._hdrMenuObjs[i];
			var hdrElem    = hdrMenuObj['hdr'];
			var menuElem   = hdrMenuObj['menu'];
		
			if ( toggleElem.id && toggleElem.id == hdrElem.id && menuElem )
			{
				var onHdrElem  = document.getElementById(toggleElem.id);
				var onMenuElem = menuElem;
				
				onHdrElem.className = this.MENU_HOVER_CLASS;
				
				// register mouseout handler in case they leave before menu displays
				registerEventHandler(onHdrElem, 'mouseout', mouseOutHandler);
				
				if (this._skipMenuDisplay) continue;

				this._turnOnMenu = function()
				{
					if (onMenuElem == null) return;

					if ( self._onHdrElemId )
					{
						self._turnOffMenu();
						self._clearOffTimer();
					}
					
					self._showMenu(onHdrElem, onMenuElem);
	
					unregisterEventHandler(onHdrElem, 'mouseout', mouseOutHandler);
					
					registerEventHandler(document,   'mousedown', mouseDownHandler);
					registerEventHandler(onMenuElem, 'mouseout',  mouseOutHandler);
					
					self._clearOnTimer();
					self._onHdrElemId = onHdrElem.id;
					
					self._resetHdrClass(onHdrElem);
				};
				
				this._onTimerId = setTimeout('cnPrimaryNavMenuManager._turnOnMenu()', this.MENU_ON_DELAY);
				
				this.turnOffMenuNow = function(disableCompletely)
				{
					turnOffMenu(onHdrElem, onMenuElem);
					
					self._clearOffTimer();
					self._onHdrElemId = null;
					
					if (disableCompletely) this._menuDisabled = true;
				};
			}
			else if ( menuElem && menuElem.style.display == 'block' )
			{
				var offHdrElem  = hdrElem;
				var offMenuElem = menuElem;
				
				this._resetHdrClass(offHdrElem);
				
				if (this._skipMenuDisplay) continue;
				
				this._turnOffMenu = function()
				{
					turnOffMenu(offHdrElem, offMenuElem);
					
					self._clearOffTimer();
					self._onHdrElemId = null;
				};
				
				this._offTimerId = setTimeout('cnPrimaryNavMenuManager._turnOffMenu()', this.MENU_OFF_DELAY);
			}
		}
		
		// define our handler functions to take advantage of closure
		function mouseOutHandler(e)
		{
			var event  = pullEvent(e);
			var target = pullTarget(event);
			var toElem = pullDestination(event);

			if ( !self._skipMenuDisplay && toElem && !isChildOf(toElem, onMenuElem) )
			{
				var myHdrElem  = onHdrElem;
				var myMenuElem = onMenuElem;
				
				if (self._onTimerId) self._clearOnTimer();
				
				self._turnOffMenu = function()
				{
					turnOffMenu(myHdrElem, myMenuElem);
					
					self._clearOffTimer();
				};

				self._offTimerId = setTimeout('cnPrimaryNavMenuManager._turnOffMenu()', self.MENU_OFF_DELAY);
			}
			// no else, just cancel bubbling
			
			self._resetHdrClass(onHdrElem);
			
			if (event.stopPropagation) event.stopPropagation();
			else event.cancelBubble = true;
		}
		
		function mouseDownHandler(e)
		{
			var event  = pullEvent(e);
			var target = pullTarget(event);
	
			if ( !isChildOf(target, onMenuElem) )
			{
				turnOffMenu(onHdrElem, onMenuElem);
						
				self._turnOffMenu();
				self._clearOffTimer();
				self._resetHdrClass(onHdrElem);
			}
		}
		
		function turnOffMenu(hdrElem, menuElem)
		{
			hideMenu(hdrElem, menuElem);
			
			unregisterEventHandler(hdrElem,  'mouseout',  mouseOutHandler);
			unregisterEventHandler(document, 'mousedown', mouseDownHandler);
		}
	};
	
	this.preloadImages = function()
	{
		var preloadImages = this.MENU_PRELOAD_IMAGES;
		var tmpLoad       = new Array(preloadImages.length);
		
		for ( var i = 0; i < preloadImages.length; ++i )
		{
			tmpLoad[i]     = new Image();
			tmpLoad[i].src = this.MENU_PRELOAD_URL + preloadImages[i];
		}
	}
	
	// "private" methods
	this._initialize = function ()
	{
		this._skipMenuDisplay = this._verifyUserAgent();
		
		this._hdrMenuObjs = new Array();
		
		var hdrElems = getElementsByClassNames(this.MENU_GROUP_ID, [this.MENU_OFF_CLASS, this.MENU_ON_CLASS]);
		
		for ( var i = 0; i < hdrElems.length; ++i )
		{
			var hdrElem   = hdrElems[i];
			var hdrElemId = hdrElem.id;
			
			if ( hdrElemId )
			{
				var menuElem = document.getElementById(hdrElemId + this.MENU_ELEM_SUFFIX);

				if ( menuElem )
				{
					var menuId = menuElem.id;
					
					if (menuId) this._hdrMenuObjs[this._hdrMenuObjs.length] = { hdr: hdrElem, menu: menuElem };
					
					if (hdrElem.className == this.MENU_ON_CLASS) this._activeHdrElemId = hdrElemId;
				}
			}
		}
		
		return;
	};
	
	this._resetHdrClass = function (hdrElem)
	{
		hdrElem.className = (hdrElem.id == this._activeHdrElemId) ? this.MENU_ON_CLASS : this.MENU_OFF_CLASS;
	}
	
	this._showMenu = function (hdrElem, menuElem)
	{
		hdrElem.style.display  = 'none';
		menuElem.style.display = 'block';
		if ( document.all && navigator.appVersion.indexOf('Win') != -1 )
		{
			var matId = menuElem.id+'_ie_mat';
			var ieMat = document.getElementById(matId);

			if ( !ieMat )
			{
				ieMat = document.createElement('IFRAME');
				ieMat.setAttribute('scrolling', 'no');
				ieMat.setAttribute('frameborder', 0);
				ieMat.setAttribute('src', this.MENU_MAT_SRC);
				
				var menu  = (menuElem.getElementsByTagName('div'))[1];
	
				ieMat.id            = matId;
				ieMat.className     = this.MENU_MAT_CLASS;
				ieMat.style.width   = menu.offsetWidth;
				ieMat.style.height  = menu.offsetHeight;
				ieMat.style.zIndex  = menu.style.zIndex - 1;
				ieMat.style.display = 'block';
								
				menu.appendChild(ieMat);
			}
		}
	}
	
	this._verifyUserAgent = function()
	{
		var userAgent = navigator.userAgent;
		
		for ( var i = 0; i < this.MENU_EXCLUDE_USER_AGENTS.length ; ++i )
		{
			if ( userAgent.indexOf(this.MENU_EXCLUDE_USER_AGENTS[i]) != -1 )
			{
				return true;
			}
		}
		
		return false;
	};
	
	/** PRIVATE FUNCTIONS (alphabetized) **/
	
	function getElementsByClassNames(rootElemId, classNames)
	{
		var rootElem         = document.getElementById(rootElemId);	
		var elements         = new Array();
		var captureClassName = new Object();

		for ( var i = 0; i < classNames.length; ++i ) captureClassName[classNames[i]] = true;
		
		if (rootElem) _pullElements(rootElem);
	
		function _pullElements(node)
		{
			if (captureClassName[node.className]) elements[elements.length] = node;
			
			if ( node.hasChildNodes )
			{
				var children = node.childNodes;
				
				for ( var i = 0; i < children.length; ++i )
				{
					_pullElements(children[i]);
				}
			}
		}
	
		return elements;
	}
	
	function hideMenu(hdrElem, menuElem)
	{
		hdrElem.style.display  = 'block';
		menuElem.style.display = 'none';
	}
	
	function isChildOf(node, parentNode)
	{
		var isChild = parentNode == node;
		
		if ( !isChild && node.parentNode )
		{
			isChild = isChildOf(node.parentNode, parentNode);
		}
		
		return isChild;
	}
	
	function pullDestination(e)
	{
		return (e.relatedTarget) ? e.relatedTarget : (e.toElement) ? e.toElement : null;
	}
	
	function pullEvent(e)
	{
		return (e) ? e : (window.event) ? window.event : null;
	}
	
	function pullTarget(e)
	{
		return (e.target) ? e.target : (e.srcElement) ? e.srcElement : null;
	}
	
	function registerEventHandler(elem, event, handler)
	{
		if ( document.addEventListener )
		{
			elem.addEventListener(event, handler, false);
		}
		else if ( document.attachEvent )
		{
			elem.attachEvent('on'+event,  handler);
		}
		else // probably on a Mac IE
		{
			elem['on'+event] = handler;
		}
	}
	
	function unregisterEventHandler(elem, event, handler)
	{
		if ( document.removeEventListener )
		{
			elem.removeEventListener(event, handler, false);
		}
		else if ( document.detachEvent )
		{
			elem.detachEvent('on'+event, handler);
		}
		else // probably on a Mac on IE
		{
			elem['on'+event] = null;
		}
	}
}

// function used for secondary navigation
function changeClass(elemId, newClass)
{
	var elem = null;
	
	if ( document.getElementById )
	{
		elem = document.getElementById(elemId);
	}
	else if ( document.all )
	{
		elem = document.all[elemId];
	}
	
	if (elem) elem.className = newClass;
}

cnPrimaryNavMenuManager.preloadImages();

// end of Xerox Office Javascript    http://www.office.xerox.com
// 
