//GENERIC DROP DOWN NAVIGATION
function goDropDown(strForm,strElement) {
    var objElement = eval('document.' + strForm + '.' + strElement);
    var objElementValue = objElement[objElement.selectedIndex].value;
    if (objElementValue !== "")
    {
      window.location = objElementValue;
    }
    else
    {
	    return false;  // Return false to cancel default behavior
  }
}

/* ---------------------------------------- */
/*
makePopUp() is used for the 360 videos. Lifted 
entirely from "The Javascript Anthology", a 
Sitepont book. isbn 0-9752402-6-9.
*/
function makePopUp(url, width, height, overflow)
	{
	if (width >640) {width=640;}
	if (height >480) {height=480;}
	
	if (overflow == '' || !/^(scroll|resize|both)$/.test(overflow))
	{
		overflow='both';
	}
	
	var win = window.open(url, '', 'width=' + width + ',height=' + height + ',scrollbars=' + (/^(scroll|both)$/.test(overflow) ? 'yes' : 'no') + ',resizable=' + (/^(resize|both)$/.test(overflow) ? 'yes' : 'no') + ',status=yes, toolbar=no, menubar=no, location=no, left=50, top=50');
	// return win;	
	}
/* ---------------------------------------- */

/* ---------------------------------------- */
/*
makePopUp_panaray() is used for the 360 videos. Lifted 
entirely from "The Javascript Anthology", a 
Sitepont book. isbn 0-9752402-6-9.
*/
function makePopUp_panaray(url, width, height, overflow)
	{
	if (width >650) {width=650;}
	if (height >650) {height=650;}
	
	if (overflow == '' || !/^(scroll|resize|both)$/.test(overflow))
	{
		overflow='both';
	}
	
	var win = window.open(url, '', 'width=' + width + ',height=' + height + ',scrollbars=' + (/^(scroll|both)$/.test(overflow) ? 'yes' : 'no') + ',resizable=' + (/^(resize|both)$/.test(overflow) ? 'yes' : 'no') + ',status=yes, toolbar=no, menubar=no, location=no, left=50, top=50');
	// return win;	
	}
/* ---------------------------------------- */


//RETURN FROM CHILD WINDOW
function returnParent(strURL) {
    if(window.opener) {
        window.opener.location = strURL;
    }
    else if(window.parent) {
        window.parent.location = strURL;
    }
    window.close();
}

//GLOBAL POPUP
var objChildWindow;
function doChildWindow(strURL, objWin, strOptions) {
    //check for open windows and close them
    if (objChildWindow && objChildWindow.closed == false) {
        objChildWindow.close();

        objChildWindow = window.open(strURL, objWin, strOptions);
        objChildWindow.focus();
    }
    else {
        objChildWindow = window.open(strURL, objWin, strOptions);
        objChildWindow.focus();
    }
}



function openPrintPage(strURL) {
    var strOptions;
    strOptions = "toolbar=yes,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no,left=100,top=100,width=620,height=500";

    doChildWindow(strURL, 'child_window', strOptions);
    objChildWindow.focus();
}

//GLOBAL NEW WINDOW
function openNewWin(strURL, intWidth, intHeight) {
    var strOptions;
    //check for parameters and set defaults
    if ((intWidth == '') || (intHeight == '')) {
        strOptions = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=100,top=100,width=615,height=345";
    }
    else {
        intWidth += 45;
        intHeight += 45;
        strOptions = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=100,top=100,width=" + intWidth + ",height=" + intHeight;
    }
    doChildWindow(strURL, 'child_window', strOptions);
    objChildWindow.focus();
}

//VIEW LARGE IMAGE
function openNewImgWin(strImg, strTitle, intWidth, intHeight) {
    var strOptions;
    //check for parameters and set defaults
    if ((intWidth == '') || (intHeight == '')) {
        strOptions = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=100,top=100,width=400,height=400";
    }
    else {
        intWidth += 45;
        intHeight += 45;
        strOptions = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=100,top=100,width=" + intWidth + ",height=" + intHeight;
    }
    //check for browser and execute
    if (!(objBrowser.bMacNN4)) {
        doChildWindow('', 'child_window', strOptions);
        var strHTML;
        strHTML  = '<html><head><title>Bose&#174; ' + strTitle + '</title></head><body marginwidth="10" marginheight="10" leftmargin="10" topmargin="10" alink="#999999" vlink="#666666" bgcolor="#ffffff"><font face="verdana" size="1">';
        strHTML += '<div align="center"><img src="' + strImg + '" /></div>';
        strHTML += '<div align="right"><a title="Close window" href="javascript:window.close();"><font color="#000000">Close window</font></a></div></font></body></html>';
        objChildWindow.document.open();
        objChildWindow.document.write(strHTML);
        objChildWindow.document.close();
    }
    else {
        doChildWindow(strImg, 'child_window', strOptions);
    }
    //focus the new window
    objChildWindow.focus();
}

//EMAIL NEWS LETTER EMAIL VALIDATE
function checkInputEmail(theForm) {
    if ((theForm.enews.value=="") || (theForm.enews.value.indexOf("@") == -1) || (theForm.enews.value.indexOf(".") == -1)) {
        alert("Please enter a valid email address");
        return false;
    }
    return true;
}

//SEARCH FIELD VALIDATE
function checkInputSearch(theForm) {
    if ((theForm.words) && (theForm.words.value=="")) {
        alert("Please enter your search criteria.");
        return false;
    }
    return true;
}

//PRINT FUNCTION
function doPrint() {
    window.print();
}

//IMAGE PRELOAD
//imgObj - the name of the object associated with the image 
//imgSrc - the source filename (url) of the image
function doPreload(imgObj,imgSrc) {
    if (document.images) {
        eval(imgObj + ' = new Image()');
        eval(imgObj + '.src = "' + imgSrc + '"');
    }
}

//IMAGE EVENT FUNCTION
//layer - layer name if provided otherwise blank ''
//imgName - name or id of event image
//imgObj -  name or id of the preloaded image object
var glayer;
var gimgName;
var gimgObj;

function imgSwap(layer,imgName,imgObj) {
var layer;
var imgName;
var imgObj;
glayer = layer;
gimgName = imgName;
gimgObj = imgObj;
    if(document.images) {
        //NN 4.x DOM
        if(document.layers && layer != "") {
            eval('document.' + layer + '.document.images["' + imgName + '"].src = ' + imgObj + '.src');
        }
        //NN6 Gecko subroutine
        else if((objClient.application == "nn") && (objClient.version >= 5)) {
            //setTimeout("imgSwapTimeOut()",1);
            imgSwapTimeOut();
        }
        else {
            document.images[imgName].src = eval(imgObj + ".src");
        }
    }
}
//NN Gecko subroutine
function imgSwapTimeOut() {
    document.images[gimgName].src = eval(gimgObj + ".src");
}

//SUBMIT A FORM FUNCTION
//theForm - the name or id of the form to be submitted
//validateFunction - the name of the client side validation function to be called.
function submitForm(theForm, validateFunction) {
    document.forms[theForm].submit();
    if (validateFunction != "") {
        eval(validateFunction + '(' + theForm + ')');
    }
}

//HISTORY NAVIGATION
//i - the place in the history array ( can be a negative | positive number )
function goHistory(i) {
    var i;
    history.go(i);
}

//CONFIRM WINDOW GENERIC
//strMessage - the confirmation message to be displayed
function confirmDialogue(strMessage) {
        if (window.confirm(strMessage)) {
            return true;
        }
    return false;
}

// DISABLE SUBMIT BUTTON ON FORM SUBMISSION
// bFormSubmitted - indicates whether user has already submitted the form
var bFormSubmitted = false;

function disableSubmitButton() {
    if (bFormSubmitted) {
        return false;
    } 
    else {  
        bFormSubmitted = true;
        return true;
    }
}

//GENERIC METHOD FOR SETTING/UPDATING SITE CATALYST GLOBAL VARIABLES
//@ author - MPL
//@ param strPropertyName - the string name of the global Site Catalyst variable to be set
//@ param strPropertyValue - the string representation of the value the global Site Catalyst variable is set to
//@ see /jsp/includes/tracking/tracking_values.jsp for a listing of all Site Catalyst variables
function updateSiteCatalystProperty(strPropertyName, strPropertyValue) {

    var strLocalPropName = strPropertyName;
    var strLocalPropValue = strPropertyValue;
        
    if ((strLocalPropName == null || strLocalPropName.length == 0) || (strLocalPropValue == null || strLocalPropValue.length == 0)) {
        //do nothing and leave early - property name or property value is null or empty...
        
        return;
    }
    else {
        //OK to execute...
        
        if (eval(strLocalPropName) == '') {
           //property value has not been set already, so just set it to property value passed in 
           eval(strLocalPropName + ' = "' + strLocalPropValue + '"');
        }
        else {
           //property value has been set already, so must concatenate ";" + property value passed in
           eval(strLocalPropName + ' += ";' + strLocalPropValue + '"');
        }
    }
}

//UPDATES SITE CATALYST s_prop5 VARIABLE FROM CLICKABLE NON-TEMPLATED AVBs WITH INTCMP VALUES IN LINKS
//NOTE: calls to this method MUST be placed in footers so that it runs AFTER calls
//      to updateSiteCatalystProperty() for s_prop5 in <body>
//NOTE: this only updates s_prop5 for NON-redundant intcmp values
//NOTE: variable s_prop5 has global scope (page scope)
function updateS_prop5FromLinkIntcmpValues() {
    
    var bln_s_prop5_isEmptyString = true;
    var arrIntcmpKeyVal = new Array();
    var sLink = new String("");
    var sIntcmpKeyVal = new String("");
    var sIntcmpVal = new String("");
    var numStart = 0;
    var numEnd = 0;
    
    //set flag for s_prop5 based on its existing value
    if (s_prop5.length > 0) {
        bln_s_prop5_isEmptyString = false;
    }
    
    //test all links in document for intcmp url param
    for (var i = 0; i < document.links.length; i++) {
    
        //get link
        sLink = document.links[i].href;
        
        /* IMPORTANT: Disregard any link that points to the current page!
         * NOTE: This avoids logging a false impression on current page for case if link clicked on previous page 
         * (that sent you to current page) has an intcmp url param in it. The false impression occurs when current 
         * page has an href such as href="#" (because # = the original link clicked on previous page). The resulting 
         * link contains an intcmp url param from the PREVIOUS page - NOT from the current page. Therefore, it should
         * not be considered for impression tracking.
         */
        if(sLink.indexOf(window.location.href) != -1) {
            //alert("contains original link: \n" + sLink);
            continue;
        }
        
        //test for intcmp url param
        if (sLink.indexOf("intcmp=") != -1) {
            //NOTE: intcmp url param IS present in link - OK to process...
            
            //get intcmp url param (key/value pair) from query string
            //NOTE: There should be only one intcmp url param in query string.
            numStart = sLink.indexOf("intcmp=");
            numEnd = sLink.indexOf("&", numStart);
            
            //if there is not another trailing key-value pair in query string...
            //see if there is a double quote (") char which signals the end of intcmp url param value in link
            if (numEnd == -1) {
                numEnd = sLink.indexOf("\"", numStart);
            }
            
            //if there is no double quote...
            //see if there is a single quote (') char which signals the end of intcmp url param value in link
            if (numEnd == -1) {
                numEnd = sLink.indexOf("\'", numStart);
            }
            
            //else, just take everything to the end of the link
            if (numEnd == -1) {
                numEnd = sLink.length;
            }
            
            sIntcmpKeyVal = sLink.slice(numStart,numEnd);
            
            //split into key and value components
            arrIntcmpKeyVal = sIntcmpKeyVal.split("=");
            
            //test for expected number of components
            if (arrIntcmpKeyVal.length == 2) {
                //NOTE: intcmp key and value components are present - OK to process...
                
                //get intcmp value component
                sIntcmpValue = arrIntcmpKeyVal[1];
                
                //decode (replace any wonky hexadecimal escape sequences with actual characters)
                sIntcmpValue = decodeURI(sIntcmpValue);
                
                //remove whitespace from value component if it exists
                sIntcmpValue = Trim(sIntcmpValue);
                
                //test to see if value component has an actual value
                if (sIntcmpValue.length > 0) {
                    //NOTE: intcmp value is NOT an empty string - OK to process...
                    
                    if (s_prop5.indexOf(sIntcmpValue) == -1) {
                        //NOTE: THIS intcmp value is NOT already present in s_prop5 - MUST add it to s_prop5...
                        
                        // update s_prop5 global variable...
                        if (bln_s_prop5_isEmptyString) {
                            s_prop5 = sIntcmpValue;
                            
                            //set flag - NOW s_prop5 is NOT an empty string
                            bln_s_prop5_isEmptyString = false; 
                        }
                        else {
                            s_prop5 += ";" + sIntcmpValue;
                        }
                    }
                }
            }
        }
    }//end for loop
}




//@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @
//      STRING UTILITY FUNCTIONS: START
//@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @

// JavaScript Functions Written by:
//    Scott Mitchell
//    mitchell@4guysfromrolla.com
//    http://www.4GuysFromRolla.com

//Trim(string) : Returns a copy of a string without leading or
//               trailing spaces
//=============================================================
function Trim(str)
/***
        PURPOSE: Remove trailing and leading blanks from our string.
        IN: str - the string we want to Trim

        RETVAL: A Trimmed string!
***/
{
        return RTrim(LTrim(str));
}

//LTrim(string) : Returns a copy of a string without leading spaces.
//==================================================================
function LTrim(str)
/***
        PURPOSE: Remove leading blanks from our string.
        IN: str - the string we want to LTrim

        RETVAL: An LTrimmed string!
***/
{
        var whitespace = new String(" \t\n\r");

        var s = new String(str);

        if (whitespace.indexOf(s.charAt(0)) != -1) {
            // We have a string with leading blank(s)...

            var j=0, i = s.length;

            // Iterate from the far left of string until we
            // don't have any more whitespace...
            while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
                j++;

            // Get the substring from the first non-whitespace
            // character to the end of the string...
            s = s.substring(j, i);
        }

        return s;
}

//RTrim(string) : Returns a copy of a string without trailing spaces.
//==================================================================
function RTrim(str)
/***
        PURPOSE: Remove trailing blanks from our string.
        IN: str - the string we want to RTrim

        RETVAL: An RTrimmed string!
***/
{
        // We don't want to trip JUST spaces, but also tabs,
        // line feeds, etc.  Add anything else you want to
        // "trim" here in Whitespace
        var whitespace = new String(" \t\n\r");

        var s = new String(str);

        if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
            // We have a string with trailing blank(s)...

            var i = s.length - 1;       // Get length of string

            // Iterate from the far right of string until we
            // don't have any more whitespace...
            while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
                i--;

            // Get the substring from the front of the string to
            // where the last non-whitespace character is...
            s = s.substring(0, i+1);
        }

        return s;
}


//@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @
//      STRING UTILITY FUNCTIONS: END
//@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @



//@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @
//      COOKIE UTILITY FUNCTIONS: START
//@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @

function setCookie (name,value,expires,path,domain,secure) {
    //test for params and set if provided
    document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function checkForCookie(strCookieName) {
    var objAllCookies = document.cookie;
    var checkPos = objAllCookies.indexOf(strCookieName);
    if (checkPos != -1) {
        return true;
    }
    return false;
}

function getCookieValue (offset) {
    var endstr = document.cookie.indexOf (";", offset);
        if (endstr == -1) {
            endstr = document.cookie.length;
        }
        return unescape(document.cookie.substring(offset, endstr));
}

function getCookie(name) {
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    if((document.cookie == null) || (document.cookie.length == null)) {
        return null;
    }
    var i = 0;
    while (i < clen) {
        var j = i + alen;

        if (document.cookie.substring(i,j) == arg) {
        return getCookieValue(j);
        }
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) {
            break;
        }
    }
    return null;
}

function deleteCookieNow(strName) {
    document.cookie=strName + "=;expires=-1;path=/";
}

//Survey Cookie Functions: Start

function setSurveyShownCookie() {
    // BUSINESS RULE: Do NOT show survey if ANY survey has been served to user within one year.
    // NOTE: ALL surveys now use the same generic survey shown cookie.
    // This cookie should persist for one year and should be available to all paths 
    // within the domain specified by server that serves this cookie for non-secure and secure.
    
    //lifespan = one year (expressed in milliseconds)
    var lifeSpan = 365 * 24 * 60 * 60 * 1000;
    
    //get current time in milliseconds
    var now = new Date();
    now.setTime(now.getTime());
    
    //set expiration date
    var expiryDate = new Date(now.getTime() + lifeSpan);
    
    setCookie("SurveyShown","true",expiryDate,"/","","");
}

function processLegacySurveyCookie(strLegacySurveyCookieName) {
    //BUSINESS RULE: If a legacy survey shown cookie exists, delete old cookie
    //and replace with new generic survey shown cookie (persists for one year). 
    //The decision is to "under serve" rather than "over serve" a survey.

    //new generic survey shown cookie name
    var surveyShownCookieName = "SurveyShown";

    deleteCookieNow(strLegacySurveyCookieName);

    //if new generic survey shown cookie does not exist yet, then create it
    if(getCookie(surveyShownCookieName) == null) {
        setSurveyShownCookie();
    }
}

function isSurveyShown() {

    var blnSurveyShown = false;

    //new generic survey shown cookie name
    var surveyShownCookieName = "SurveyShown";

    //old Pro 1 survey shown cookie name
    var legacySurveyShownCookieName = "ProCaseStudyQuestionnaire";

    //check for new generic survey shown cookie...
    if(getCookie(surveyShownCookieName) != null) {
        blnSurveyShown = true;
    }

    //check for legacy survey shown cookie...
	if(getCookie(legacySurveyShownCookieName) != null) {
		blnSurveyShown = true;
		processLegacySurveyCookie(legacySurveyShownCookieName);
	}

    return blnSurveyShown;
}

//Survey Cookie Functions: End

//@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @
//      COOKIE UTILITY FUNCTIONS: END
//@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @



/* *********************************************************************** */
/* Begin the DOM_Utilities object literal  ******************************* */
/* *********************************************************************** */
/* Functions & helper methods contained in  DOM_Utilities. DAC 1/03/08 *** */
/*
init:function()
addEvent(elm,evType,fn,useCapture)
last_Sibling:function(node)
closest_Sibling:function(node,direction):  direction is -1 for previous sibling, 1 for next sibling
get_Target:function(e):  Returns the target element of the event object
cancelClick:function(e): Cancels the default click behavior for clicked links
getDomModel:function(elm): Returns "className" (IE) or "class" (DOM compliant)
*/
/* *********************************************************************** */
DOM_Utilities = {

/*
	init:function()
	{
		if(!document.getElementById || !document.createTextNode){return;}
	},
*/

	addEvent:function(elm,evType,fn,useCapture)
	{
	  if (elm.addEventListener)
	  {
	    elm.addEventListener(evType, fn, useCapture);
	    return true;
	  }
	  else if (elm.attachEvent)
	  {
	    var r = elm.attachEvent('on' + evType, fn);
	    return r;    
	  }
	  else
	  {
	    elm['on' + evType] = fn;
	  }
	},

	last_Sibling:function(node)
	{
		var tempObj = node.parentNode.lastChild;
		while(tempObj.nodeType!=1 && tempObj.previousSibling!=null){
			tempObj = tempObj.previousSibling;
		}
		return (tempObj.nodeType == 1)?tempObj:false;
	},

	closest_Sibling:function(node,direction)
	{
		var tempObj;
		if(direction==-1 && node.previousSibling!=null){
			tempObj=node.previousSibling;
			while(tempObj.nodeType!=1 && tempObj.previousSibling!=null){
				 tempObj=tempObj.previousSibling;
			}
		}else if(direction==1 && node.nextSibling!=null){
			tempObj=node.nextSibling;
			while(tempObj.nodeType!=1 && tempObj.nextSibling!=null){
				 tempObj=tempObj.nextSibling;
			}
		}
		return tempObj.nodeType==1?tempObj:false;
	},

	get_Target:function(e)
	{
		var target = window.event ? window.event.srcElement : e ? e.target : null;
		if (!target){return false;}
		while(target.nodeType!=1 && target.nodeName.toLowerCase()!='body'){
			target=target.parentNode;
		}
		return target;
	},

	cancelClick:function(e)
	{
		if (window.event)
//		if (window.event && window.event.cancelBubble && window.event.returnValue)
		{		
			window.event.cancelBubble = true;
			window.event.returnValue = false;	
			return;
		}
		if (e && e.stopPropagation && e.preventDefault){
			e.stopPropagation();
			e.preventDefault();
		}
	},

  getDomModel:function(elm)
  {	
	  var Dom_Model;
	  var Class_Attr;
		if ( elm.getAttribute('className') !== null)    
		{
			Dom_Model="isIE";
			Class_Attr="className";
		}
		else
		{
			Dom_Model="isDOM2";
			Class_Attr="class";
		}
		return Class_Attr;
  }
}
/* *********************************************************************** */
/* End the DOM Utilities object literal  ********************************* */
/* *********************************************************************** */

/* *********************************************************************** */
/* Start folding faq object literal  ************************************* */
/* *********************************************************************** */
foldingLists={  //Define object literal

	  expand_Link:"", // expand_Link and hide_Link are initialized by initExpandList
	  hide_Link:"", 
    arrowRight:"images/pro/i_red_arrow.gif",
    arrowDown:"images/pro/down_arrow.gif",
    class_Attr:"", 
/* 
initAll() - check for the existence of DOM related methods and HTML elements. 
If the methods or elements are not present exit the function.
*/
	initAll:function()
	{
    if (!document.getElementById || !document.createTextNode || !document.getElementById("faq2"))
    {
	    // alert("Something is amiss. Exiting initAll function.");
      return;
    }
    else
    {
	  	// alert("Running initAll functions and setting up listeners.");
			foldingLists.removeFaq2List();
			foldingLists.initFaq();
			foldingLists.initExpandList();
		}
	},

/* removeFaq2List() removes the list with id=faq2 from the DOM. */
  removeFaq2List:function()
  { 
		var answer_list = document.getElementById("faq2");
		var answer_list_parent = answer_list.parentNode;
		var expand_element = document.getElementById("expand_hide");
		// Remove #faq2 element from DOM if it is present.
		if (document.getElementById("faq2"))
		{
		  answer_list_parent.removeChild(answer_list);
		}
		// Displays the expand all/hide all link if JS is enabled.
		if (expand_element) 
		{
			foldingLists.class_Attr = DOM_Utilities.getDomModel(expand_element); 
			expand_element.setAttribute(foldingLists.class_Attr, "showitem_b");
		}
    return true;  
  },

  initFaq:function() // Set link attributes and attach events.
  {
    var j = 0;
    var faq_list = document.getElementById("faq");  
    var faq_list_links_all = faq_list.getElementsByTagName("a"); // All the links in the list.
    var faq_list_links = new Array;                              // Only the links to the main questions in the list.
    var faq_list_arrows = faq_list.getElementsByTagName("img");
    
    for (var i=0; i < faq_list_links_all.length; i++)
    {
      if (faq_list_links_all[i].getAttribute(foldingLists.class_Attr) == "mainQuestion")
      {
        faq_list_links[j]=faq_list_links_all[i]; // If the link has a class of mainQuestion, put it in the array.
        j++;
      }
    }    
    
    // Iterate through links list and attach linkClick() to click events of links.
    for (i=0; i < faq_list_links.length; i++)
    {
      // faq_list_links[i].href = "#answer" + (i+1); // Change the href attribute on the link.
			faq_list_links[i].href = ""; // Changed due to Site Catalyst tracking conflicts. PVA7220 8/8/07
      DOM_Utilities.addEvent(faq_list_links[i], 'click', foldingLists.linkClick, false);    
    }
    
    // Iterate through arrow links list and attach arrowClick() to click events of arrow images.
    for (i=0;i < faq_list_arrows.length; i++)
    {
      // faq_list_arrows[i].parentNode.href = "#answer" + (i+1); // Change the href attribute on the arrow link.
      faq_list_arrows[i].parentNode.href = ""; // Changed due to Site Catalyst tracking conflicts. PVA7220 8/8/07      
      DOM_Utilities.addEvent(faq_list_arrows[i], 'click', foldingLists.arrowClick, false);       
    }
    return true;
  },
 
  initExpandList:function()  // Set up links with expandAllListHandler and hideAllListHandler event listeners.
  {
	  expand_Link = document.getElementById("expandlink"); 
	  hide_Link = document.getElementById("hidelink");	 
/* If "expandLink" and "hideLink" id's are
	 not present on the page exit the function. */		
   if ((!expand_Link) && (!hide_Link))
		{
			return;
		}
		
/* If the ID of "expandLink" is present
   attach an event listener to the element. */				
	  if (expand_Link)  
		{
		  DOM_Utilities.addEvent(expand_Link, 'click', foldingLists.expandAllListHandler, false);
	  }
/* If the ID of "hideLink" is present
   attach an event listener to the element. */  
	  if (hide_Link)
		{
			DOM_Utilities.addEvent(hide_Link, 'click', foldingLists.hideAllListHandler, false);
		}
		return;
  },

/* Expand list click event handler. Display all the answers, replace
   bullet graphics, hide the expandall link and show the hideall link*/
	expandAllListHandler:function(e)  
	{
	  var ul_Lists = document.getElementsByTagName("UL");
		var elm0 = ul_Lists[0];
		foldingLists.expandAll(ul_Lists);
		DOM_Utilities.cancelClick(e);
		return;
  },
  
	expandAll:function(ul_Lists)
	{
		var list_Class;
		var arrow_element;	
		for (var i=0; i < ul_Lists.length; i++)
		{
			list_class = ul_Lists[i].getAttribute(foldingLists.class_Attr);
			if ((list_class === 'answer') || (list_class === 'hideanswer'))
			{
				ul_Lists[i].setAttribute(foldingLists.class_Attr, 'showanswer');
				arrow_element = ul_Lists[i].previousSibling.previousSibling.firstChild;
				arrow_element.setAttribute(foldingLists.class_Attr, '');				
				foldingLists.rotateArrow('down',arrow_element);
			}
		}
		expand_Link.setAttribute(foldingLists.class_Attr,'hideitem');
		hide_Link.setAttribute(foldingLists.class_Attr,'showitem');
	},
	
/* Hide list click event handler. Hide all the answers, replace 
	bullet graphics, hide the hideall link and show the expandall link. */
  hideAllListHandler:function(e)
	{
	  var ul_Lists = document.getElementsByTagName("UL");
		var elm0 = ul_Lists[0];
		var list_Class;
		foldingLists.hideAll(ul_Lists);
		DOM_Utilities.cancelClick(e);		
		return;
  },
  
  hideAll:function(ul_Lists)
	{
		for (var i=0; i < ul_Lists.length; i++)
		{
			list_class = ul_Lists[i].getAttribute(foldingLists.class_Attr);
			if ((list_class === 'answer') || (list_class === 'showanswer'))
			{
				ul_Lists[i].setAttribute(foldingLists.class_Attr, 'hideanswer');
				arrow_element = ul_Lists[i].previousSibling.previousSibling.firstChild; // This is VERY dependent upon the HTML structure
				arrow_element.setAttribute(foldingLists.class_Attr, '');				
				foldingLists.rotateArrow('right',arrow_element);
			}
		}
		expand_Link.setAttribute(foldingLists.class_Attr,'showitem');
		hide_Link.setAttribute(foldingLists.class_Attr,'hideitem');	
	},
	
  linkClick:function(e) // Attach to the click event of the li<a> elements.
  {
	  var target_link = DOM_Utilities.get_Target(e);  
	  var my_sibling = DOM_Utilities.closest_Sibling(target_link,1);
	  var arrow_element = my_sibling.firstChild;

    while (my_sibling.nodeName  !== 'UL')
    {
      my_sibling = my_sibling.nextSibling;
    }
    if ((my_sibling.getAttribute(foldingLists.class_Attr) == "answer") || (my_sibling.getAttribute(foldingLists.class_Attr) == "hideanswer"))
    {
      my_sibling.setAttribute(foldingLists.class_Attr, "showanswer"); // Show the answer.
      foldingLists.rotateArrow("down",arrow_element);
    }
    else if (my_sibling.getAttribute(foldingLists.class_Attr) == "showanswer")
    {
      my_sibling.setAttribute(foldingLists.class_Attr, "hideanswer"); // Hide the answer.
      foldingLists.rotateArrow("right",arrow_element);        
    }    
		DOM_Utilities.cancelClick(e);  
    return true;
  },
  
  arrowClick:function(e) // Attach to the click event of the orange arrow <img> elements.
  {
	  var target_link = DOM_Utilities.get_Target(e);
    var my_sibling = target_link.parentNode.nextSibling;
    while (my_sibling.nodeName !== 'UL')
    {
      my_sibling = my_sibling.nextSibling;
    }
    if ((my_sibling.getAttribute(foldingLists.class_Attr) == "answer") || (my_sibling.getAttribute("class") == "hideanswer"))
    {
      my_sibling.setAttribute(foldingLists.class_Attr, "showanswer"); // Show the answer and point arrow down.
      foldingLists.rotateArrow("down",target_link);
    }
    else if (my_sibling.getAttribute(foldingLists.class_Attr) == "showanswer")
    {
      my_sibling.setAttribute(foldingLists.class_Attr, "hideanswer"); // Hide the answer and point arrow right.
      foldingLists.rotateArrow("right",target_link);        
    }
		DOM_Utilities.cancelClick(e);    
    return true;
  },
  
  // Point the arrow graphic to the right when answers
  // are hidden and down when answers are displayed.
  rotateArrow:function(arrowDirection, arrowNode)
  {
   
    // var arrowRight = "images/pro/i_red_arrow.gif";
    // var arrowDown = "images/pro/down_arrow.gif";    

    switch (arrowDirection)
    {
      case "right":
        arrowNode.src = foldingLists.arrowRight;
        break;
      case "down":
        arrowNode.src = foldingLists.arrowDown;
        break;
      default:
        arrowNode.src = foldingLists.arrowRight;
        break;
    } 
    return arrowNode.src;     
  }
  
};

/* *********************************************************************** */
/* Start case study popup questionnaire object literal ******************* */
/* *********************************************************************** */
questionnairePopup={  //Define object literal

/* 
1. Check to see if we are on the Case Studies video page.
2. If we are not, don't run the rest of the script.
3. If we are, check for a cookie that says this computer has seen the survey.
4. If the survey has not been shown popup the survey form and write a cookie 
to say that this computer has seen the survey.
*/

	initsurvey1:function()
	{
    if (!document.getElementById || !document.createTextNode || !document.getElementById("campaign_top"))
    {
      return;
    }
	  else
    {
			questionnairePopup.processPro1Survey();
	  }
	},
	  
	processPro1Survey:function() 
	{
    //OCG BUSINESS RULE: Do NOT show survey if ANY survey has been served to this user within one year.
    //NOTE: ALL surveys now use a generic survey shown cookie that persists for 365 days.
    //See ScriptLib.js survey functions.
    //PRO SURVEY SWITCH
    var blnRunPro1Survey = true;
    var blnSurveyShown = false;
    //NOTE: isSurveyShown() is defined around line 560.
    blnSurveyShown = isSurveyShown();	
    if(blnRunPro1Survey && (!blnSurveyShown)) 
    {
      questionnairePopup.showPro1Survey();
    }
  },

	showPro1Survey:function() {
	    var strSurveyURL = "https://www.consumerinsightsforum.com/R.aspx?a=48";
	    var strWinName = "Pro1Survey";
	    var strWinOptions = "directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,height=850,width=800";
	    var iSamplePercentage = 100;
	    //generate a random integer from 0-99
	    var ranNum = Math.floor(Math.random() * 100);
	    if(ranNum < iSamplePercentage) {
	        //NOTE: survey window is a popunder!
	        var objProPopWin = window.open(strSurveyURL,strWinName,strWinOptions);
					// If a pop-up blocker is on the window is not created and referencing objProPopWin throws an error.
	        // Check that objProPopWin exists. If not, set the Survey Shown cookie and exit the function.
	        if (!objProPopWin)
	        {
		        setSurveyShownCookie();
		        return;
	        }
	        else 
	        {
		        objProPopWin.blur();
		        window.focus();
					}
	        //NOTE: this method is defined in scriptLib.js
	        setSurveyShownCookie();
	    }
	},

// Checks to see if cookies are enabled by trying to write and read a Test Cookie.
	checkCookiesEnabled:function()
	{
		var cookieName = "Test_Cookie";
		var cookieValue = "test";
		var cookieDurationInDays = .041667; // One twenty-fourth of a day (one hour).
		var getValue = 0;
		var createTestCookie = questionnairePopup.setCookie(cookieName,cookieValue,cookieDurationInDays); // Create a test cookie
		var cookieTestResults = questionnairePopup.checkCookie(cookieName,getValue) // Retreive value of the test cookie
		var deleteTestCookie = questionnairePopup.setCookie(cookieName,cookieValue, -.041667); // Delete the test cookie
		return cookieTestResults;
	},

// Writes a cookie named cookieName with a value of cookieValue
// and an expiration date calculated from timeInDays.
  setCookie:function(cookieName,cookieValue,timeInDays) 
  {
		var cookieExpirationDate = "";
  	if (timeInDays)
  	{
			var expirationDate = new Date();
			expirationDate.setTime(expirationDate.getTime()+(timeInDays*24*60*60*1000));
			cookieExpirationDate = "; expires="+expirationDate.toGMTString();
		}
 	  var proCookie = cookieName + "=" + cookieValue + ";expires =" + cookieExpirationDate; 	  
 	  document.cookie = proCookie;
	  return;
  },
  
  checkCookie:function(cookieName,getValue)
  /* 
  Check to see if cookieName exists. If it does, and getValue is not 0 or null,
  retrieve the current value of cookieName. cookieName is name of the cookie.
  getValue optionally causes the function to return either true/false
  if getValue=0 or null, or the value in the cookie if getValue!=0 or null.
  */
  {	  
	  var cookieIs = cookieName + "=";
	  var cookies = document.cookie.split(";");
  	var pattern = /\s/;	  // Whitespace.
	  var cookieCrumbs ="";  	
	  var cookieValue ="";
	  var cookieLookUp =""; 
	  for (var i = 0; i < cookies.length; i++)
	  {
		  cookieCrumbs = cookies[i].split("=");
		  cookieLookUp = cookieCrumbs[0].replace(pattern, ""); // Strip out whitespace.
  	  cookieValue = cookieCrumbs[1];
  	  if (cookieLookUp===cookieName) // If cookieName is found then proceed.
		  {
	  	  if ((getValue===0) || (getValue===null))// Optional return value switch.
	  	  {
		  	  return true; // If the cookie is found return true.
		  	}
		  	else
		  	{
			  	return cookieValue; // If the cookie is found, return its value.
		  	}
	  	  
		  }
  	}
	  return false;	  // If the cookie is not found or cookies are disabled return false.
  }

};

/* ********************************************************************* */
/* End case study popup questionnaire object literal ******************* */
/* ********************************************************************* */

/* ************************************************************ */
/* Start pdfLibraryDropdowns object literal ******************* */
/* ************************************************************ */
pdfLibraryDropdowns = {  //Define object literal
/* 
initAll() - check for the existence of required DOM related methods. 
If the methods are not present exit the function.
*/
	initAll:function()
	{
		var targetDropDown = document.getElementById("category_form_dropdown");
    if (!document.getElementById || !targetDropDown) // Verify that getElementById is supported
    {
      return;
    }
    else
    {
    // Check for an eligible select element - if one is found attach the event listener to it 
	    if (targetDropDown)
	    {
			  DOM_Utilities.addEvent(targetDropDown,'change',pdfLibraryDropdowns.goDropDown , false);
		  }
		}
	},
	
	// Run this function (event listener) when the change event for the select element fires
	// Used mostly on the pdf library pages on pro.bose.com
	goDropDown:function (e)
	{
		var objElementValue = "";
	  if (window.event)	// Check for IE
	  {
	    objElementValue = window.event.srcElement[window.event.srcElement.selectedIndex].value; // Use window.event for IE
	  }
	  else
	  {
	    objElementValue = e.target[e.target.selectedIndex].value;	// Use the event object e for W3C compliant browsers
    }

    if (objElementValue !== "")
    {
      window.location = objElementValue;
    }
    else
    {
	    return false;  // Return false to cancel default behavior
    }
  }    
};
/* ********************************************************** */
/* End pdfLibraryDropdowns object literal ******************* */
/* ********************************************************** */

/* ******************************************** */
/* Attach listeners following window load event */
/* ******************************************** */
DOM_Utilities.addEvent(window,'load', foldingLists.initAll, false); // Expanding/collapsing FAQ lists.
DOM_Utilities.addEvent(window,'load', pdfLibraryDropdowns.initAll, false); // pdfLibrary select elements
DOM_Utilities.addEvent(window,'load', questionnairePopup.initsurvey1, false);

