/* ----------------------------------------------------------------------------	
Begin extending JQuery
*/
// add query string to element
jQuery.fn.addQuery = function() {
	try {
    var curSrc;
    var newSrc;
    return this.each(function() {
      curSrc = jQuery(this).attr("src");
      newSrc = (curSrc.indexOf("?") == -1) ? window.location.search : window.location.search.toString().replace(/\?/, "&");
      jQuery(this).attr("src", curSrc + newSrc);
    });
	} catch (err) {
		// do nothing
	}
};
// add test to see if element exists
jQuery.fn.exists = function() {
	try {
		return jQuery(this).length != 0 ? true : false ;
	} catch (err) {
		// do nothing
	}
};

// Truncation script that accounts for HTML tags (<strong>, <em>, etc)
// usage: jQuery(".modify").trunc(400);
jQuery.fn.extend({
      trunc: function(count) {
            if(jQuery('body').hasClass('Firefox3')) { 
                  if(jQuery(this).parents().hasClass('thumbContentText')) {
                        return false; 
                  }
            }
            return (isNaN(count)) ? this : this.each(function() {
                  var _this = jQuery(this);
                  var curCount = 0;
                  var boolCount = true;
                  var curChar = "";
                  var curString = _this.html();
                  var tempString = "";
                 for(var i=0; i<curString.length; i++) {
					curChar = curString.charAt([i]);
					tempString += curChar;
					switch(curChar) {
						  case "<":
								boolCount = false;
								break;
						  case ">":
								boolCount = true;
								break;
						  default:
								if(boolCount) {
									  curCount++;
								}
					}
					if(curCount == count) {
						  _this.html(tempString + "...");
						  break;
					}
                  }
            });
      }
});


/* ----------------------------------------------------------------------------	
Set global variables
*/

// Set user agent
var userAgent = navigator.userAgent.toLowerCase();

/* ----------------------------------------------------------------------------	
Begin onload events
*/

// Local and server environment setting
var EnvironmentPath = window.location.pathname;
EnvironmentPath = parent.location.protocol + "//" + document.domain + EnvironmentPath.substr(0,EnvironmentPath.lastIndexOf('/')+1);

//Determine base domain
var rootDomain = document.location.hostname;
var finalDomain = "";

if(window.rootDomain.match(/localhost/gi)){
  window.finalDomain = "localhost";
}
else{
  var split = window.rootDomain.split('.');
  window.finalDomain = "." + split[split.length-2] + "." + split[split.length-1];
}

// browser detection

// Load scripts
jQuery(browserDetection);
jQuery(loadScripts);


/* ----------------------------------------------------------------------------	
Begin functions
*/

// Shortcut to get cookie value
var getGlobalCookie = function(cookieName) {
	return getCookieValue(cookieName);
};

// Shortcut to set cookie value
var setGlobalCookie = function(cookieName, value) {
	document.cookie = (cookieName + "=" + value);
};

// Get cookie value
function getCookieValue (cookieName) {
	try {
    var exp = new RegExp (escape(cookieName) + "=([^;]+)");
    if (exp.test (document.cookie + ";")) {
      exp.exec (document.cookie + ";");
      return unescape(RegExp.$1);
    }
    else return false;
  	} catch (err) {
		// do nothing
	}
};






/* ----------------------------------------------------------------------------	
Begin functions
*/

// -------------------------------------------------------------------------
// Begin "Browser detection"
function browserDetection() {
	jQuery.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase()); 
	if(jQuery.browser.msie) { // Is this a version of IE?
		jQuery("body").addClass("IE");        
		jQuery("body").addClass("IE" + jQuery.browser.version.substring(0,1));
	}
	if(jQuery.browser.chrome) { // Is this a version of Chrome?
		jQuery("body").addClass("Chrome");
		userAgent = userAgent.substring(userAgent.indexOf("chrome/") +7);
		userAgent = userAgent.substring(0,1);
		jQuery("body").addClass("Chrome" + userAgent);  
		jQuery.browser.safari = false; // If it is chrome then jQuery thinks it's safari so we have to tell it it isn't
	}
	if(jQuery.browser.safari) { // Is this a version of Safari?
		jQuery("body").addClass("Safari");        
		userAgent = userAgent.substring(userAgent.indexOf("version/") +8);
		userAgent = userAgent.substring(0,1);
		jQuery("body").addClass("Safari" + userAgent);
	}
	if(jQuery.browser.mozilla) { // Is this a version of Mozilla?
		if(navigator.userAgent.toLowerCase().indexOf("firefox") != -1) { //Is it Firefox?
			jQuery("body").addClass('Firefox');
			userAgent = userAgent.substring(userAgent.indexOf("firefox/") +8);
			userAgent = userAgent.substring(0,1);
			jQuery("body").addClass("Firefox" + userAgent);
		} else { // If not then it must be another Mozilla
			jQuery("body").addClass("Mozilla");
		}
	}
}
// End "Browser detection"

// -------------------------------------------------------------------------
// Begin "Load scripts"
// On each page you store paths into loadScripts like this:
// var loadScripts = new Array("/somepath/_JS/script-called-2nd.js","/somepath/_JS/script-called-1st.js");
function loadScripts() {
	try {
		for(var i = loadScripts.length - 1; i >= 0; i--) {
			jQuery.getScript(loadScripts[i]);
		}
	} catch (err) {
		// do nothing
	}
}
// End "Load scripts"

// -------------------------------------------------------------------------
// Begin "Initiate Tab Navigation"
function iniKeyboardAccess(){
	// Private vars
	var parentObj;
	var childObj;
	var openMenu;
	var findMenu;
	var toggleClass;
	
	var toggleMenu = function(){
		// Close all open nav items
		openMenu = jQuery(findMenu);
		openMenu.removeClass(toggleClass);
		
		// [!] Method to hide all Visible Dropdown Menus
		jQuery("#utilityNav div.utilityLinkMenu").removeClass(toggleClass);
		jQuery("#primaryNav div.primaryLinkMenu").removeClass(toggleClass);
		
		// Open
		parentObj.addClass(toggleClass);
		
		// Force Hide menu on mouse out
		parentObj.mouseout(function(){
			openMenu.removeClass(toggleClass);
		});
	};
	
	return{
		menuVars: function(oMenu, tClass){
			findMenu = oMenu;
			toggleClass = tClass;
		},
		menuObjects: function(setFocus, pObj, cObj){
			jQuery(setFocus).focus(function(){
				// Get current menu objects
				parentObj = jQuery(this).parents(pObj);
				childObj = jQuery(this).parent().next(cObj);
				toggleMenu();
			});
		}
	};
}
// End "Initiate Tab Navigation"

// -------------------------------------------------------------------------
// Begin "Initializing Blades - Expand / Collapse"
function iniBlades(objTarget, objSlider, objStatus, textTarget, closedText, openText, position) {
	jQuery(objTarget).click(function(e){
		e.preventDefault();
		if(position=="after") {
			jQuery(this).parents(objStatus).find(objSlider).slideToggle('fast');
		} else if(position=="before") {
			jQuery(this).parents(objStatus).find(objSlider).slideToggle('fast');
		} else {
			jQuery(this).parents(objStatus).find(objSlider).slideToggle('fast');
		}
		jQuery(this).parents(objStatus).toggleClass("active");
		if(closedText && openText) {
			if(jQuery(this).parents(objStatus).hasClass("active")) {
				jQuery(textTarget).text(openText);
			} else {
				jQuery(textTarget).text(closedText);	
			}	
		}
	});
}
// End "Initializing Blades - Expand / Collapse"

// -------------------------------------------------------------------------
// Begin "Ellipsis - after max character | slice points - Strips HTML tags"
function useEllipsisNoHTML(maxChars, className) {
	if(jQuery('body').hasClass('Firefox3')) { 
		if(jQuery(this).parents().hasClass('thumbContentText')) {
			return false; 
		}
	}
	var slicePoint = maxChars;
	jQuery(className).each(function() {
		var allText = jQuery(this).html();
		var editText;
		// This removes all HTML Tags
		editText = allText.replace(/<\/?[^>]+>/gi, '');
		if (editText.length > slicePoint) {			
			// Add original text as "title" attribute
			jQuery(this).attr("title", editText);
			// This cuts off after maxChars characters but up to the word
			var startText = editText.slice(0, slicePoint).replace(/\w+$/, '');
			// Add ellipsis
			startText = startText + "...";
			jQuery(this).html(startText);
		}
	});
}
// End "Ellipsis - after max character | slice points - Strips HTML tags"

// -------------------------------------------------------------------------
// Begin "Hero Rotator with Navigation Controls"
function iniHeroCycle(transitionEffect) {
	// Check if transitionEffect exists, else default to 'scrollHorz'
	var effect = '';
	if(transitionEffect) {
		effect = transitionEffect;
	} else {
		effect = 'scrollHorz'
	}
	// If Thumbnail is a Video, then add the Play button
	jQuery("#hero .hasVideo").each(function(){
		// Thumbnail contains Content Text - push Play button to the right
		if (jQuery(this).find(".thumbContent").length > 0){
			jQuery(this).find(".videoPlayOverlay:first").css("left",150);
		}
	});
	
	var onBefore = function(curr,next,opts) {
		// IE6 - Fix for Transparent PNG Cycle Transition
		if (jQuery("body").hasClass("IE6")) {
			jQuery(this).find(".videoPlayOverlay").hide();
		}
	}
	var onAfter = function(curr,next,opts) {
		// IE6 - Fix for Transparent PNG Cycle Transition
		if (jQuery("body").hasClass("IE6")) {
			jQuery(this).find(".hasVideo .videoPlayOverlay").show();
		}
		// onAfter remove Prev / Next navigation buttons
		var index = opts.currSlide;
		jQuery('#heroNavPrev, #heroNavPrevMini')[index == 0 ? 'hide' : 'show']();
		jQuery('#heroNavNext, #heroNavNextMini')[index == opts.slideCount - 1 ? 'hide' : 'show']();
	}
	
	if ( jQuery('#heroSlides').children().length >= 1 ) {
		jQuery('#heroSlides').cycle({
			fx:				effect,
			cleartype:		1,	/* IE Fix */
			cleartypeNoBg: 1,	/* IE Fix */
			pause:         1,
			pauseOnPagerHover: 1,
			timeout:			5000,
			startingSlide:	0,
			prev: '#heroNavPrev, #heroNavPrevMini',
			next: '#heroNavNext, #heroNavNextMini',
			pager:			'#pageLinks',
			pagerAnchorBuilder:function(idx, slide) {
				return '<a href="javascript:void(0);">' + (idx<9?"0":"") + (idx+1) + '</a>';
			},
			before:			onBefore,
			after:			onAfter
		});
		/* Show Navigation */
		jQuery('#heroNavPaging, #heroNavPrev, #heroNavNext').css({visibility:"visible"});
		/* Show Title */
		jQuery("#heroSectionTitle").show();
	}
	if ( jQuery('#heroSlides').children().length == 1 ) {
		jQuery('#heroNavPaging, #heroNavPrev, #heroNavNext').css({visibility:"hidden"});
	}
	// Begin "Cycle Pause/Resume Functions"
	/* Hide Play Button */
	jQuery('#heroNavPlayMini').hide();
	
	/* Show/Hide Pause or Resume Play */
	jQuery('#heroNavPauseMini').click(function() {
		jQuery(this).hide();
		jQuery('#heroNavPlayMini').show();
		jQuery('#heroSlides').cycle('pause');
	});
	jQuery('#heroNavPlayMini').click(function() {
		jQuery(this).hide();
		jQuery('#heroNavPauseMini').show();
		jQuery('#heroSlides').cycle('resume');
	});
}
// End "Hero Rotator with Navigation Controls"

// -------------------------------------------------------------------------
// Begin "Initialize Hero rotator with jCarousel"
function iniHeroCarousel() {
	// If Thumbnail is a Video, then add the Play button
	jQuery("#hero .hasVideo").each(function(){
		// Thumbnail contains Content Text - push Play button to the right
		if (jQuery(this).children(".thumbContent").length > 0){
			jQuery(this).find(".videoPlayOverlay:first").css("left",155);
		}
	});

	// Only Triger Carousel if there are more than 3 Thumbnails
	if ( jQuery('#heroCarousel').children().length >= 3 ) {
		
		var timeout = 5;
		
		var mycarousel_initCallback = function(carousel) {
			jQuery("#heroSectionTitle").show();
			
			var numItems = carousel.size();
			var j;
			for (j=1; j<=numItems; j++){
				jQuery("#heroCarousel li").eq(j-1).attr("value",j).show();
			}
			
			if (numItems>3) {
				//console.log('TEST');
				// Variable track if carousel has been forced to Pause or Play
				carousel.paused = new Boolean;
				carousel.paused = false;
				
				/* Show Navigation */
				jQuery('#heroNavPaging, #heroCarouselPrev, #heroCarouselNext, #heroNavPrev, #heroNavNext').css({visibility:"visible"});
				/* Hide Play Button */
				jQuery('#heroNavPlayMini').hide();
				
				/* Create Item List Links */
				var i;
				for (i=1; i<=numItems; i++){
					jQuery("#pageLinks").append('<a href="javascript:void(0);">' + (i<10?"0":"") + (i) + '</a>');
					
					// Give custom index to each li (using attribute "value") - because after the last hero slide, 
					// wrap:circular appends incrementing index numbers, so we need to keep track of our index #
					//jQuery("#heroCarousel li").eq(i-1).attr("value",i).show();
				}
				jQuery("#pageLinks a").each(function(i){ jQuery(this).bind('click', function(){ carousel.scroll(i+1); }); });
				
				/* Show/Hide Pause or Resume Play */
				jQuery('#heroNavPauseMini').click(function() {
					jQuery(this).hide();
					jQuery('#heroNavPlayMini').show();
					carousel.stopAuto();
					carousel.paused = true;
				});
				jQuery('#heroNavPlayMini').click(function() {
					jQuery(this).hide();
					jQuery('#heroNavPauseMini').show();
					carousel.startAuto();
					carousel.paused = false;
				});
				
				// Only Pause on hover if carousel.pause = false;
				jQuery('#heroNavPaging,#heroCarouselPrev,#heroCarouselNext,#heroNavPrev, #heroNavNext,.jcarousel-skin-heroCarousel').hover(function() {
					if (!carousel.paused) {
						carousel.stopAuto();
					}
				},function() {
					if (!carousel.paused){
						carousel.startAuto();
					}
				});
				
				/* Prev / Next Buttons */
				jQuery('#heroCarouselNext,#heroNavNextMini,#heroNavNext').bind('click', function() {
					carousel.scroll(carousel.first+1);
					return false;
				});
				jQuery('#heroCarouselPrev,#heroNavPrevMini,#heroNavPrev').bind('click', function() {
					carousel.scroll(carousel.first-1);
					return false;
				});
			} else {
				timeout = 0;	
				carousel.stopAuto();
			}
			jQuery('#heroCarousel').parents(".jcarousel-container").css('visibility','visible');
		};
			
		/**
		* This is the callback function which receives notification
		* when an item becomes the first one in the visible range.
		*/
		function mycarousel_itemFirstInCallback(carousel, item, idx, state) {
			//display('Item #' + idx + ' is now the first item');
			if (idx == 1 || (idx%carousel.size() == 1)) {
				jQuery('#heroCarouselPrev,#heroNavPrevMini,#heroNavPrev').hide();
			} else {
				jQuery('#heroCarouselPrev,#heroNavPrevMini,#heroNavPrev').show();
			}
			
			/* Select Mini Nav Link */
			jQuery("#pageLinks a").removeClass("activeSlide");
			jQuery("#pageLinks a").eq(item.value-1).addClass("activeSlide");
			
			
		};
	
		/**
		 * This is the callback function which receives notification
		 * when an item becomes the first one in the visible range.
		 */
		function mycarousel_itemLastInCallback(carousel, item, idx, state) {
			//display('Item #' + idx + ' is now the last item');
			if (idx == carousel.size() || (idx%carousel.size() == 0)) {
				jQuery('#heroCarouselNext,#heroNavNextMini,#heroNavNext').hide();
			} else {
				jQuery('#heroCarouselNext,#heroNavNextMini,#heroNavNext').show();
			}
		};

		jQuery('#heroCarousel').jcarousel({
			scroll: 3,
			visible: 3,
			animation: 1000,
			auto: timeout,
			wrap: "circular",
			
			initCallback: mycarousel_initCallback,
			itemFirstInCallback:  mycarousel_itemFirstInCallback,
			itemLastInCallback:   mycarousel_itemLastInCallback
		});
	}
}
// End "Initialize Hero rotator with jCarousel"


// ---------------------------------------------------------------------------------------
// Begin "getQueryVariable"
// getQueryVariable - looks for the first query variable. 
// If there are repeating variables in the query string, it'll return the 1st match.
function getQueryHash() {
	var hash = window.location.hash;
	if (hash != "")
		return hash;
	else
		return false;
}
// End "getQueryVariable"

// ---------------------------------------------------------------------------------------
// Begin "Initializing Tabs"
function iniTabs(parent,tabLink,tabActive,content,contentActive) {
	var parentObj = parent;
	var tabObj = tabLink;
	var tabActiveClass = tabActive;
	var contentObj = content;
	var contentActiveClass = contentActive;
	
	jQuery(tabObj).click(function(){
		// Get Current Index
		var CurrIndex = jQuery(this).parents("ul:first").find("li").index(jQuery(this).parent());
		// Switch Active Tab
		jQuery(this).parents("ul:first").find("."+tabActiveClass).removeClass(tabActiveClass);
		jQuery(this).addClass(tabActiveClass);
		// Switch Active Tab Content
		jQuery(this).parents(parentObj).find("."+contentActiveClass).removeClass(contentActiveClass);
		jQuery(jQuery(this).parents(parentObj).find(contentObj).get(CurrIndex)).addClass(contentActiveClass);
	});
	
	var hashValue;
	this.checkQueryHash = function() {
		hashValue = getQueryHash();
		/* Hash trumps any server side active tab state */	
		if (hashValue && jQuery(tabObj+"[href='"+hashValue+"']").length) {
			jQuery(parent+" ul.tabs li a[href='"+hashValue+"']").click();
		}
	}
}
// End "Initializing Tabs"

// ---------------------------------------------------------------------------------------
// Begin "popupWindow"
function popupWindow(classObj,name,width,height){
	var winName = name;
	var width = (width)?width:700;
	var height = (height)?height:500;
	
	var winSpecs = 'width='+width+',height='+height+',location=0,menuBar=1,resizable=1,scrollbars=1,status=1,toolbar=0,directories=0';
	
	jQuery(classObj).click(function(){
		window.open(this.href, winName, winSpecs);
		return false;
	});
}
// End "popupWindow"

// ------------------------------------------------------------------------------
// Begin "Clear Input Value"
// On load - remove clear_value_off class if text box is pre-loaded with non-default value
function clearField(triggerClass,offStateClass) {
	jQuery(triggerClass).each(function(){
		if (jQuery(this).val() != jQuery(this).attr("title")) {
			jQuery(this).removeClass(offStateClass);
		} else {
			if (!jQuery(this).hasClass(offStateClass)) {
				jQuery(this).addClass(offStateClass);
			}
		}
	});
	// Removes default input text value when it's on focus. Default text value should be set in the "title" attribute
	jQuery(triggerClass).focus(function() {
		if (jQuery(this).val() == jQuery(this).attr("title")) {
			jQuery(this).val("");
			jQuery(this).removeClass(offStateClass);
		}
	}).blur(function() {
		if (jQuery(this).val() == "") {
			jQuery(this).val(jQuery(this).attr("title"));
			jQuery(this).addClass(offStateClass);
		}
	});
	
	/* Password swap specific functionality */
	if(jQuery(triggerClass).hasClass('loginPasswordFake')) {
		jQuery('.loginPasswordFake').focus(function() {
			jQuery(this).hide();
			jQuery(this).next('.loginPassword').show().focus();
		});
		jQuery('.loginPassword').blur(function() {
			if(jQuery(this).val() == "" || jQuery(this).val() == jQuery('.loginPasswordFake').attr("title")) {
				jQuery(this).hide();
				jQuery(this).prev('.loginPasswordFake').show().blur();
			}
		});
	}
}
// End "Clear Input Value"

// ------------------------------------------------------------------------------
// Begin "Initialize SearchBar/Filter Dropdowns"
function iniSearchBarDropdown(triggerID,targetID) {
	var thisParentClass = "";
	
	jQuery(triggerID).click(function() {
		
		// check if trigger is wrapper itself or within a wrapper
		if(jQuery(this).parent(':first').attr('class').indexOf('Sort') != -1) {
			jQuery(this).parent(':first').toggleClass("open");
			thisParentClass = jQuery(this).parent(':first').attr('class');
			
			jQuery(this).parent(':first').find(targetID).each(function() {
				if(jQuery(this).hasClass("active")) {
					jQuery(this).toggleClass("open");	
				}
			});
		} else {
			jQuery(this).toggleClass("open");
			
			jQuery(targetID).each(function() {
				if(jQuery(this).hasClass("active")) {
					jQuery(this).toggleClass("open");	
				}
			});
		}
		
	});	
	var filterMenuTimeout = 0;
	jQuery(targetID).hover(function(e){
		clearTimeout(filterMenuTimeout);
	},function(){
		filterMenuTimeout = setTimeout('jQuery(".open").removeClass("open")', 500);
	});
	
	// Bind a hover class to each list item to ensure cross-browser compatibility
	jQuery(targetID).find("li").hover(function(e) {
		jQuery(this).addClass("hover");
	}, function(e) {
	  	jQuery(this).removeClass("hover");
	});
}
// End "Initialize SearchBar/Filter Dropdowns"

// ------------------------------------------------------------------------------
// Begin "On Dropdown select, close Dropdown and update input"
function iniMenuSelectClose(menuWrapper, openMenuLink, triggerItems) {
	
    jQuery(triggerItems).live('click', function() {
        jQuery('.primary-selected input').each(function(index) {
            var $this = $(this);
            $this.attr('checked', 'checked');
        });

        jQuery(this).find('input').attr("checked", "checked");
        var thisInput = jQuery(this).find('input');

        jQuery(openMenuLink).children('span').text(jQuery(thisInput).val());
        jQuery(openMenuLink).children('input').val(jQuery(thisInput).val());

        if (jQuery(openMenuLink).attr('id') == 'newsSearchPrimaryDropDown') {
            useEllipsisNoHTML(20, jQuery(openMenuLink).find('span'));
        }

        jQuery(".open").removeClass("open");
    });
	
}
// End "On Dropdown select, close Dropdown and update input"

// ------------------------------------------------------------------------------
// Begin "Initialize Modal Overlay Background"
function iniModalOverlay() {
	// Overlay on cols2and3 Header
	if(jQuery(".threeColsCol2and3Head").children().length > 0) {
		jQuery(".threeColsCol2and3Head").append('<div class="dialogOverlay dialogOverlayText"></div>');
	}
	// Overlay on col2
	if(jQuery(".threeColsCol2").children().length > 0) {
		var colHeight = jQuery(".threeColsCol2").height() - 210;
		
		jQuery(".threeColsCol2").append('<div class="dialogOverlay dialogOverlayText" style="height:'+colHeight+'px"></div>');
		/*
		if(jQuery(".threeColsCol2").width() < 530) {
			jQuery(".threeColsCol2").append('<div class="dialogOverlay dialogOverlayText" style="height:'+colHeight+'px"></div>');
		} else {
			jQuery(".threeColsCol2").append('<div class="dialogOverlay dialogOverlayText" style="height:'+colHeight+'px""></div>');
		}
		*/
	}
	
	// Overlay on col2
	if(jQuery(".threeColsCol3").children().length > 0) {
		if(jQuery(".threeColsCol3").width() > 160) {
			jQuery(".threeColsCol3").append('<div class="dialogOverlay dialogOverlayCalloutWide"></div>');
		} else {
			jQuery(".threeColsCol3").append('<div class="dialogOverlay dialogOverlayCalloutNarrow"></div>');
		}
	}
	
	// Overlay on cols2and3 Footer
	if(jQuery(".threeColsCol2and3Foot").children().length > 0) {
		jQuery(".threeColsCol2and3Foot").append('<div class="dialogOverlay dialogOverlayFoot"></div>');
	}
	
	jQuery(".dialogOverlay").show();
}
// End "Initialize Modal Overlay Background"

// ------------------------------------------------------------------------------
// Begin "Initialize Create Account Fields"
function iniCreateAccount(checkboxID, createAccountFieldsID, submitBtn) {
	jQuery(checkboxID).live( 'change', function() {
		jQuery( this ).is( ':checked' ) ? jQuery(createAccountFieldsID).slideDown('fast') : jQuery(createAccountFieldsID).slideUp('fast');
		jQuery( this ).is( ':checked' ) ? jQuery(submitBtn).val('Create An Account') : jQuery(submitBtn).val(jQuery(submitBtn).attr('title'));
	});
}
// End "Initialize Create Account Fields"


// ------------------------------------------------------------------------------
// Begin "Initialize Dialog"
function iniDialog(dialogWrapID, tabsID) {
	jQuery(dialogWrapID).fadeIn('fast');
	if(tabsID) {
		var dialogTags = new iniTabs(tabsID,"ul.tabs li a","current",".pane","activePane");
		dialogTags.checkQueryHash();	// check location Hash value
		iniCreateAccount("#createAccount","#createAccountFields","#accessCreate");
	}
}
// End "Initialize Dialog"


// -------------------------------------------------------------------------
// Begin "Initialize Featured Experts rotator with jCarousel"
function iniFeaturedExpertsCarousel(carouselID, numVisibleItems, numScrollBy, numScrollInterval, prevBtnID, nextBtnID, teaserSource, teaserDest, expertDescID, isAutoSelect) {
	// Only Trigger Carousel if there are more than [numVisibleItems] Thumbnails
	if ( jQuery(carouselID).children().length >= numVisibleItems ) {
		var numChildren = jQuery(carouselID).children().length;
		var origFirst = "";
		var origLast = "";
		var origPosit = "";
		var isAnimating = false;
		
		var mycarousel_initCallback = function(carousel) {
			var numItems = carousel.size();
			if (numItems>numVisibleItems) {
				/* Show Navigation */
				jQuery(prevBtnID+','+nextBtnID).css({visibility:"visible", display:"block"});
								
				/* Prev / Next Buttons */
				jQuery(nextBtnID).bind('click', function() {
					carousel.scroll(carousel.first+numScrollBy);
					return false;
				});
				jQuery(prevBtnID).bind('click', function() {
					carousel.scroll(carousel.first-numScrollBy);
					return false;
				});
			}
			
			// Bind click/mouseover function to each item for 'selected' class and teaser update
			jQuery(carouselID).children("li").bind('mouseenter', function() {
				jQuery(this).addClass("selected").siblings().removeClass("selected");
				mycarousel_onSelectedItemCallback(jQuery(this));
				jQuery(this).addClass("mouseover").siblings().removeClass("mouseover");
				mycarousel_onMouseoverItemCallback(jQuery(this), carousel);
			});
			
			/*
			// This call was commented out to optimize all functionality - this function is retained in case of functionality change
			// Bind mouseenter function to each item for 'mouseover' class and carousel update
			jQuery(carouselID).children("li").bind('mouseenter', function() {
				jQuery(this).addClass("mouseover").siblings().removeClass("mouseover");
				mycarousel_onMouseoverItemCallback(jQuery(this), carousel);
			});
			*/
			
			
		};
		
		// Function to update teaser for each carousel item
		function mycarousel_onSelectedItemCallback(selectedItem) {
			jQuery(teaserDest).html(jQuery(selectedItem).find(teaserSource).html());
		}
		
		// Function to expand thumbnail on mouseover
		function mycarousel_onMouseoverItemCallback(selectedItem, carousel) {
			//console.log(carousel);
			origFirst = carousel.get(carousel.first);
			origLast = carousel.get(carousel.last);
			origPosit = jQuery(selectedItem);
			
			var cloneOffset = origPosit.offset();
			var origFirstOffset = origFirst.offset();
			var descW = (jQuery(carouselID).parent('.jcarousel-clip:first-child').width())-20;
			
			if(!jQuery(".clone").exists()) {
				isAnimating = true;
				
				var clone = jQuery(selectedItem).clone().removeClass().addClass("clone").insertAfter(selectedItem);
				var cloneDesc = clone.find(expertDescID);
				cloneDesc.css("width","0");
				clone.css({ 'width' : '84px', 'height' : '84px' });
				
				var carouselLeftOffset = jQuery(carouselID).css("left");
				carouselLeftOffset = parseInt(carouselLeftOffset.substring(0, carouselLeftOffset.length-2)) * -1;
				
				if(jQuery('body').hasClass('IE7')) {
					var ie7Offset = (cloneOffset.left - origFirstOffset.left) + carouselLeftOffset;
					clone.css({'left':ie7Offset+'px'});
				} else {
					clone.offset({ top: cloneOffset.top, left: cloneOffset.left+10 });
				}
				
				if(jQuery(selectedItem).attr('jcarouselindex') != carousel.first) {
					clone.animate({left: carouselLeftOffset+10+"px"},400,function() { isAnimating = false; });
					cloneDesc.animate({width: descW-95+"px"},400);
				} else {
					clone.animate({left: carouselLeftOffset+10+"px"},0,function() { isAnimating = false; });
					cloneDesc.animate({width: descW-95+"px"},400);
				}
				
				// Bind mouseleave function to each clone for 'mouseout' class and carousel update
				jQuery(clone).bind('mouseleave', function() {
					if(!isAnimating) {
						mycarousel_onMouseoutItemCallback(clone, carousel);
					}
				});
			}
		}
		
		// Function to collapse mouseovered thumbnail
		function mycarousel_onMouseoutItemCallback(selectedItem, carousel) {
			var origFirstOffset = origFirst.offset();
			var origOffset = origPosit.offset();
			var carouselLeftOffset = jQuery(carouselID).css("left");
			carouselLeftOffset = parseInt(carouselLeftOffset.substring(0, carouselLeftOffset.length-2)) * -1;
			
			var collapseLeft = carouselLeftOffset+(origOffset.left - origFirstOffset.left)+10;
			
			selectedItem.find(expertDescID).animate({width:'0px'},400);
			selectedItem.animate({left: collapseLeft+"px"},400, function() { 
				selectedItem.remove(); 
			});
		}
		
		/**
		* This is the callback function which receives notification
		* when an item becomes the first one in the visible range.
		*/
		function mycarousel_itemFirstInCallback(carousel, item, idx, state) {
			//on next set of items, highlight the first and update teaser
			if(isAutoSelect) {
				jQuery(item).addClass("selected").siblings().removeClass("selected");
				mycarousel_onSelectedItemCallback(item);
			}
			
			//on first item, prev arrow is not clickable
			if (idx == 1) {
				jQuery(prevBtnID).hide();
			} else {
				jQuery(prevBtnID).show();
			}
		};
		
		function mycarousel_itemLastInCallback(carousel, item, idx, state) {
			//on last item, next arrow is not clickable
			if (idx >= numChildren) {
				jQuery(nextBtnID).hide();
			} else {
				jQuery(nextBtnID).show();
			}
		};

		jQuery(carouselID).jcarousel({
			scroll: numScrollBy,
			visible: numVisibleItems,
			animation: 500,
			wrap: "none",
			auto: numScrollInterval,
			
			initCallback: mycarousel_initCallback,
			itemFirstInCallback:  mycarousel_itemFirstInCallback,
			itemLastInCallback: mycarousel_itemLastInCallback
		});
	}
}
// End "Initialize Featured Experts rotator with jCarousel"

// -------------------------------------------------------------------------
// Begin "Initialize Featured Customer Stories rotator with jCycle"
function iniFeaturedModuleCycle(carouselID, prevBtnID, nextBtnID, pagerNavID) {
	var onAfter = function(curr,next,opts) {
		// onAfter remove Prev / Next navigation buttons
		jQuery(next).addClass("selected").siblings().removeClass("selected");
		var index = opts.currSlide;
		jQuery(prevBtnID)[index == 0 ? 'hide' : 'show']();
		jQuery(nextBtnID)[index == opts.slideCount - 1 ? 'hide' : 'show']();
	}
	jQuery(carouselID).cycle({
		fx:						'scrollHorz',
		cleartype:				1,	/* IE Fix */
		cleartypeNoBg:			1,	/* IE Fix */
		pause:					1,
		pauseOnPagerHover:		1,
		timeout:				0,
		startingSlide:			0,
		prev:					prevBtnID,
		next:					nextBtnID,
		pager:					pagerNavID,
		pagerAnchorBuilder:		function(idx, slide) {
			return '<li><a href="javascript:void(0);" alt="'+idx+'"><img src="' + jQuery(slide).find("img").attr('src') + '" width="53" height="37" /><span class="overlay"></span></a></li>';
		},
		after:					onAfter
	});
	/* Show Navigation */
	jQuery(prevBtnID+', '+nextBtnID).css({visibility:"visible"});
}
// End "Initialize Featured Customer Stories rotator with jCycle"

// -------------------------------------------------------------------------
// Begin "Initialize Featured Articles rotator with jCarousel"
function iniFeaturedArticlesCarousel(carouselID, numVisibleItems, numScrollBy, numScrollInterval, prevBtnID, nextBtnID) {
	// Only Trigger Carousel if there are more than [numVisibleItems] Thumbnails
	if ( jQuery(carouselID).children().length > numVisibleItems ) {
		jQuery(carouselID).append("<li></li>");
		var numChildren = jQuery(carouselID).children().length;
		
		var mycarousel_initCallback = function(carousel) {
			var numItems = carousel.size();
			if (numItems>numVisibleItems) {
				/* Show Navigation */
				jQuery(prevBtnID+','+nextBtnID).css({visibility:"visible"});
								
				/* Prev / Next Buttons */
				jQuery(nextBtnID).bind('click', function() {
					carousel.scroll(carousel.first+numScrollBy);
					return false;
				});
				jQuery(prevBtnID).bind('click', function() {
					carousel.scroll(carousel.first-numScrollBy);
					return false;
				});
			}
		};
		
		/**
		* This is the callback function which receives notification
		* when an item becomes the first one in the visible range.
		*/
		function mycarousel_itemFirstInCallback(carousel, item, idx, state) {
			//on next set of items, highlight the first and update teaser
			jQuery(item).addClass("selected").siblings().removeClass("selected");
			
			//on first item, prev arrow is not clickable
			if (idx == 1) {
				jQuery(prevBtnID).hide();
			} else {
				jQuery(prevBtnID).show();
			}
		};
		
		function mycarousel_itemLastInCallback(carousel, item, idx, state) {
			//on last item, next arrow is not clickable
			if (idx >= numChildren) {
				jQuery(nextBtnID).hide();
				//carousel.last.hide();
			} else {
				jQuery(nextBtnID).show();
			}
		};
		
		jQuery(carouselID).jcarousel({
			scroll: numScrollBy,
			visible: numVisibleItems,
			animation: 1000,
			wrap: "none",
			auto: numScrollInterval,
			
			initCallback: mycarousel_initCallback,
			itemFirstInCallback:  mycarousel_itemFirstInCallback,
			itemLastInCallback: mycarousel_itemLastInCallback
		});
	}
}
// End "Initialize Featured Articles rotator with jCarousel"

// Begin "Initialize Select box transform"
function customTransform(){
  var _objectType;
  var _objectAddClassContainer;
  var _objectAddClassLabel;
  var _objectAddClassDrop;

  return{
    getObject: function(targetObject, configValues){
      try{
      _object = jQuery(targetObject);
      jQuery(targetObject).css('display','none');
      var myConfig = {"bindings":[ configValues ]};
      //_this = myConfig.bindings[0].containerClass;
      var labelClass = myConfig.bindings[0].labelClass;
      var dropClass = myConfig.bindings[0].dropClass;
      var dopostback = myConfig.bindings[0].postBack;
      _objectType = jQuery(targetObject).get(0).tagName.toLowerCase();
      _objectAddClassContainer = typeof(myConfig.bindings[0].containerClass) == 'undefined' ? '' : myConfig.bindings[0].containerClass;
      _objectAddClassLabel = typeof(labelClass) == 'undefined' ? '' : labelClass;
      _objectAddClassDrop = typeof(dropClass) == 'undefined' ? '' : dropClass;
      _objectDoPostBack = typeof(dopostback) == 'undefined' ? '' : dopostback;

      if(_objectType == 'select'){

        var selected = jQuery(':selected', _object).text();
        jQuery(targetObject).after(
         '<div class=\"uxselect select ' + _objectAddClassContainer + '\">'
          +'<a class=\"label ' + _objectAddClassLabel + '\" href=\"javascript:void(0);\"><span>' + selected + '</span></a>'
          +'<div class=\"dropdown ' + _objectAddClassDrop + '\"><ul></ul></div></div>'
         );

        var currentObj = jQuery('.uxselect.' + targetObject);
        jQuery('option', jQuery(targetObject)).each(function(){
            jQuery('.dropdown ul', currentObj).append('<li><a href=\"javascript:void(0);\">' + jQuery(this).text() + '</a></li>');
        });  
        
        jQuery('.dropdown a', currentObj).live('click', function(e){
          e.preventDefault();
          var text = jQuery(this).text();
          var index = jQuery(this).parent('li').index();
          jQuery('.label span', currentObj).html(jQuery(this).text());
          useEllipsisNoHTML(19,".label span");
          jQuery('option:eq(' + index + ')', jQuery(targetObject)).attr('selected', 'selected');
          jQuery('div.dropdown', currentObj).css('display','none');
          if(_objectDoPostBack != ''){
            javascript:setTimeout('__doPostBack(\'' + jQuery(targetObject).attr('name') + '\',\'\')', 50);
           }
        });
        
      jQuery('a.label', currentObj).live('click', function(){
        jQuery(this).next('div.dropdown').css('display','block');
        jQuery(this).parents('.uxselect').one('mouseleave', function(){
          jQuery('.dropdown', this).css('display','none');
        });
        });
      
      }
    }catch(e){
        //Fail silently
    }      
    }
  };
}
// End "Initialize Select box transform"

// Begin "Jump to anchor"
function JumpToAnchor(e) {
    location.href = '#'+e.value;
}
// End "Jump to anchor"

// Begin "Initialize iframe content height adjustment"
function iniIframeAdjust(target) {	
	var iframeFormHeight = jQuery(target,top.document).contents().find('form').height();
	jQuery(target,top.document).height(iframeFormHeight+20);

	var iframeFormWidth= jQuery(target,top.document).contents().find('form').width();
	var iframeHtmlWidth = jQuery(target,top.document).contents().find('html').width();
	(iframeFormWidth > iframeHtmlWidth) ? jQuery(target,top.document).contents().find('form').width(iframeHtmlWidth) : jQuery(target,top.document).contents().find('html').width(iframeFormWidth);
}
// End "Initialize iframe content height adjustment"

// ------------------------------------------------------------------------------
// Begin "News Tag Opacity adjustment"
function iniTagOpacity(tags, lightestClass, lighterClass, mediumClass, heavyClass) {
	jQuery(tags).each(function() {
		if(jQuery('body').hasClass('IE8') ) {
			jQuery(this).append('<div class="overlay"/>');
			jQuery(this).children('.overlay').width(jQuery(this).width());
			jQuery(this).children('.overlay').height(jQuery(this).height());
			jQuery(this).css({
				'opacity': '1.0',
				'-ms-filter':'"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"',
				'filter': 'alpha(opacity=100)'
			});
		} else {
			if(jQuery(this).hasClass(lightestClass)) { 
				jQuery(this).fadeTo(0, .20); 
				jQuery(this).hover(function() {
					jQuery(this).fadeTo(0, .70); 
				}, function() {
					jQuery(this).fadeTo(0, .20); 
				});
			}
			if(jQuery(this).hasClass(lighterClass)) { 
				jQuery(this).fadeTo(0, .45); 
				jQuery(this).hover(function() {
					jQuery(this).fadeTo(0, .70); 
				}, function() {
					jQuery(this).fadeTo(0, .45); 
				});
			}
			if(jQuery(this).hasClass(mediumClass)) { 
				jQuery(this).fadeTo(0, .70); 
			}
		}
	});
}
// End "News Tag Opacity adjustment"


// ------------------------------------------------------------------------------
// Begin "Custom Chat Link"

function customChat(elm){
  if(jQuery(elm)){
    jQuery('.snippet_btn', $(elm)).find('a:first').click();
	return false;
  }
}

// End "Custom Chat Link"

/* 
End Functions
-------------------------------------------------------------------------------	*/



/* ----------------------------------------------------------------------------	
Begin "safe jQuery onload script"
*/
jQuery(function($) {
	// ------------------------------------------------------------------------------
	// If JavaScript is enabled add "jsOn" to body tag - this is for CSS files.
	$("body").addClass("jsOn");
	
	// ------------------------------------------------------------------------------
    // If a form exists and it has been successfully submitted, hide the form and display a friendly error message.
	jQuery('.form_submit input.button').live('click', function(){
		var noError = true;
		$('.errmessage').each(function(i,e) {
			if($(this).is(':visible')) {
				noError = false;
				return;
			}
		});
		setTimeout(function(){
			if(noError) {
				jQuery('fieldset.Long-list').hide();
				jQuery('#divConfirmationMessage').hide();
				/* contact, support, feedback, optout */
				if($('fieldset.Long-list').hasClass('optout')) {
					jQuery('fieldset.Long-list').next('.form_submit').html('<h2 style="">Thank you.</h2><p>Your preferences will be updated.<br/>Please note that your request may take up to 10 business days to process.</p>').removeClass('form_submit').addClass('form_submit_thankyou');
				} else if($('fieldset.Long-list').hasClass('contact')) {
					jQuery('fieldset.Long-list').next('.form_submit').html('<h2 style="">Thank you.</h2><p>Thank you for your interest in Iron Mountain.<p>You will receive a response to your inquiry within one business day.</p><p>For immediate assistance, please call 1-800-899-IRON<br/>For new service inquiries or customer service support, please call 1-800-FASTFILE.</p>').removeClass('form_submit').addClass('form_submit_thankyou');
				} else if($('fieldset.Long-list').hasClass('support')) {
					jQuery('fieldset.Long-list').next('.form_submit').html('<h2 style="">Thank you.</h2><p>Thank you for your interest in Iron Mountain.<p>You will receive a response to your inquiry within one business day.</p><p>For immediate assistance, please call 1-800-899-IRON<br/>For new service inquiries or customer service support, please call 1-800-FASTFILE.</p>').removeClass('form_submit').addClass('form_submit_thankyou');
				} else if($('fieldset.Long-list').hasClass('feedback')) {
					jQuery('fieldset.Long-list').next('.form_submit').html('<h2 style="">Thank you for your feedback.</h2>').removeClass('form_submit').addClass('form_submit_thankyou');
				} else {
					jQuery('fieldset.Long-list').next('.form_submit').html('<h2 style="">Thank you.</h2><p>Thank you for your interest in Iron Mountain.<p>You will receive a response to your inquiry within one business day.</p><p>For immediate assistance, please call 1-800-899-IRON<br/>For new service inquiries or customer service support, please call 1-800-FASTFILE.</p>').removeClass('form_submit').addClass('form_submit_thankyou');
				}
			} else {
				
			}
		}, 1000);
	});
  
	// ------------------------------------------------------------------------------
	// Begin "initialize primary nav keyboard access"
	var iniPrimaryNavKeyboard = new iniKeyboardAccess();
	iniPrimaryNavKeyboard.menuVars('div.primaryLinkMenu','hover');
	iniPrimaryNavKeyboard.menuObjects('div.primaryLinkMenu .primaryLink > a','.primaryLinkMenu','.primaryMenu');
	
	var iniUtilitiesNavKeyboard = new iniKeyboardAccess();
	iniUtilitiesNavKeyboard.menuVars('div.utilityLinkMenu','hover');
	iniUtilitiesNavKeyboard.menuObjects('div.utilityLinkMenu > a','.utilityLinkMenu','.utilityMenu');
	
	// [!] Method to hide all Visible Dropdown Menus
	$("body").click(function(){
		$("#utilityNav div.utilityLinkMenu").removeClass("hover");
		$("#primaryNav div.primaryLinkMenu").removeClass("hover");
	});
	// End "initialize primary nav keyboard access"
	
	// ------------------------------------------------------------------------------
	// Begin "Primary Nav Rounded Corner Adjustment"
	$(".primaryLinkFirst").prepend('<div class="primaryLinkRounedLeft"><span></span></div>');
	$(".primaryLinkLast").append('<div class="primaryLinkRounedRight"><span></span></div>');
	
	// End "Primary Nav Rounded Corner Adjustment"
	
	// ------------------------------------------------------------------------------
	// Begin "Primary Nav Dropdown Positioning"
	/* Add class name "primaryLinkMenuXXX" to each primary nav link */
	$("#header div.primaryLinkMenu").each(function(i){
		// Add unique class name for each primary link
		// Example: primaryLinkMenu1, primaryLinkMenu2, etc.
		var currentLinkMenu = "primaryLinkMenu"+(i+1);
		$(this).addClass(currentLinkMenu);
		
		// Set Position
		var currentLinkMenuObj = $("."+currentLinkMenu);
		var currentMenuObj = $(currentLinkMenuObj).children(".primaryMenu");
		var currentNumCols = $(currentMenuObj).find(".mc > .table .row .cell").length;
		
		switch (i+1) {
			case 2:
				// primaryLinkMenu2 - Solutions
				if (currentNumCols < 2) {
					$(currentLinkMenuObj).css("position","relative");
					$(currentMenuObj).css("left","-15px");
				}
				break;
			case 3:
				// primaryLinkMenu3 - Knowledge Center
				if (currentNumCols > 1) {
					$(currentMenuObj).css("left","auto").css("right",($("body").hasClass("IE6"))?"5px":"-7px");
				}
				break;
		}
	});
	// End "Primary Nav Dropdown Positioning"
	
	// ------------------------------------------------------------------------------
	// Begin "Initialize clear field"
	var searchBarText = new clearField(".jInputText","jInputTextOff");
	// End "Initialize clear field"
	
	// ------------------------------------------------------------------------------
	// Begin "Printer Friendly Popup"
	var printerFriendlyPopup = new popupWindow(".jsPrinterFriendly","winPrinterFriendlyPage",700,500);
	// End "Printer Friendly Popup"
	
	// ------------------------------------------------------------------------------
	// Begin "Footer Text truncation"
	if($("#footer #footerArea1 .fourCols .columnContent").exists()) {
		// with thumbnail
		$("#footer #footerArea1 .fourCols .columnContent .columnContentPad .thumbList ul li").trunc(50);
		// without thumbnail
		$("#footer #footerArea1 .fourCols .columnContent .columnContentPad > ul li").trunc(60);
	}
	// End "Footer Text truncation"
	
	// ------------------------------------------------------------------------------
	// Begin "New Window Popup"
	//Create an array to hold onto the desired window parameters.
	var windowSizeArray = [ "width=739,height=482",
								 "width=980,height=590" ];
	
	$(document).ready(function(){
	  //Links with the ".newWindow" class will call this script.
	  $('.newWindow').click(function (event){
	
			// Gets the URL from the clicked link.
			var url = $(this).attr("href");
	
			//Gets the name from the clicked link.
			var windowName = $(this).attr("name");
	
			/*Places the string from the array into the windowSize variable.
			  The array slot is determined by the "rel" number on the link.*/
			var windowSize = windowSizeArray[  $(this).attr("rel")  ];
	
			//This method opens a new browser window.
			window.open(url, windowName, windowSize);
	
			/*This prevents the browser from executing the default action and
			  allows us to use the "window.open" within the script.*/
			event.preventDefault();
	
	  });
	});
	// End "New Window Popup"
	
	// ------------------------------------------------------------------------------
	// Begin "Registration, Login, Create Account"
	
	// ------------------------------------------------------------------------------
	// Begin "Initialize Create Account More Questions Dropdown"
	if($("#loginSelector").exists()) {
		iniSearchBarDropdown('#loginSelector','#loginSelectorOptions');
		iniMenuSelectClose('#loginSelector', '#selectLoginService','#loginSelectorOptions ul li');
	}
	// End "Initialize Create Account More Questions Dropdown"
	
	// End "Registration, Login, Create Account"
	
	// ------------------------------------------------------------------------------
	// Begin "Sitemap Empty Field Adjustment"
	if($(".sitemap").exists()) {
		jQuery('.sitemap ul:empty').css('display', 'none');
	}
	// End "Sitemap Empty Field Adjustment"
	
	// ------------------------------------------------------------------------------
	// Begin "initialize Tag Opacity"
	if($("#TagCloud").exists()) {
		iniTagOpacity('.calloutTagCloud .content a','light','medium','heavy');
	}
	// End "initialize Tag Opacity"
	
	// ------------------------------------------------------------------------------
	// Begin "Hero title show (when no hero cycle/carousel)
	if($("#hero").exists()) {
		if(!$("#hero #heroCarousel").exists() && !$("#hero #heroCycle").exists()) {
			$('#hero #heroSectionTitle').show();
		}
	}
	// End "Hero title show (when no hero cycle/carousel)

	// ------------------------------------------------------------------------------
	// Begin "IE6/IE7 threeColsCol2and3Head adjustment"
	if ($(".threeColsCol2and3Head").exists()) {
	    if ($('body').hasClass('IE6')) {
	        if ($('body').hasClass('referenceLibrary')) {
	            $('.threeColsCol2and3Head').css("margin-left", 0).css("padding-left", "40px");
				$('.threeColsCol3').css('padding-right', "0px").css("padding-left", "0px").css("float", "left");
	        }
	    }
	    if ($('body').hasClass('IE6') || $('body').hasClass('IE7')) {

	        if ($('.threeColsCol2and3Head').children().length == 0) {
	            $('.threeColsCol2and3Head').hide();
	        }
	    }
	}
	// End "IE6/IE7 threeColsCol2and3Head adjustment"
	
	// ------------------------------------------------------------------------------
	// Begin "Form input class addition for IE6"
	if ($("fieldset.Long-list").exists() && $('body').hasClass('IE6')) {
		$('input[type=radio]').each(function() { 
			$(this).addClass('input_radio');
			$(this).next('label').addClass("input_radio_lbl");
		});
	}
	// End "Form default option adjustment"
	// ------------------------------------------------------------------------------
	// Begin "Form default option adjustment"
	if ($("fieldset.Long-list").exists()) {
		$j('option', '.Long-list').each(function() { 
			if($j(this).html() == "--Please select one--") {
				$j(this).val(''); 
			}
		});
	}
	// End "Form default option adjustment"
	
	// ------------------------------------------------------------------------------
	// Begin "chat snippet adjustment"
	
	if ($(".chat_snippet_wrap").exists()) {
		$(".chat_snippet_wrap div",".contentBar").each(function() {
			if($(this).attr('id').indexOf('lpButDivID') != -1) {
				$(this).addClass('chat_snippet');	
			}
		});
		
		$(".chat_snippet > div",".contentBar").each(function(i) {
			$(this).addClass('snippet_btn snippet_btn_'+i);
			if($(this).index() == 1) {
				$(this).addClass('snippet_btn_first');
			}
			if($(this).index() == $(".chat_snippet").children('div').length) {
				$(this).addClass('snippet_btn_last');
			}
			
			if($(this).index() > 1) {
				$(this).before('<div class="pipe"></div>');	
			}
			
			if($(this).parents('li.contentBarOneItem').exists()) {
				$(this).find('a').wrapInner('<span />');
			}
		});
		
		if( $('.customFooterChat').exists() ) {
			$('.customFooterChat .contactFooterBg').html($('.snippet_btn').find('a:first').html());
			$('.customFooterChat').click(function(e) {
				e.preventDefault();
				customChat('.snippet_btn');
			});
		}
		//$('.lpStaticButtonTR'
	}
	// End "chat snippet adjustment"
});
/* End "safe jQuery onload script" */


