//<![CDATA[
		   
//Script is Enabled css
window.addEvent('domready', function(){$(document.body).removeClass('NoJavascriptEnabled');});
		   
//Image preloader with standard images to load
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

MM_preloadImages( /*preloading key background images-usually hover images*/
	'/Images/Search/SearchGo.gif',
	'/Images/SideBarNavigation/PccSideBarTabPTSHoverNO.png',
	'/Images/SideBarNavigation/PccSideBarTabPTSHover.png',
	'/Images/InteriorPage/HeaderTabs/PtsInteriorHeaderTab.jpg'
);

// Multi-slide - used to hide information on long pages. User clicks on heading to reveal the information.
function Enable_Multislide() { 	window.addEvent('domready',function() {
		multislide = new multislide('ms_container', 
				{	onExpand: function(el){
						el.addClass('arrow');
					},	
					onCollapse: function(el){
						el.removeClass('arrow');
					}
				});
		var hash = window.location.hash.substr(1); //strip off the leading #
		if (hash) {
			multislide.expand_ifcontains(hash);
			var hashEl = $(hash);
			if (hashEl) {
				var myFx = new Fx.Scroll(window).toElement(hashEl);
			}
		}
		$(document.body).getElements('a[href^=#]').each(function(item){
			href = item.getProperty('href').substr(1);
			item.addEvent('click', function(){
				this.expand_ifcontains(arguments[0]);
				var hashEl = $(arguments[0]);
				if (hashEl) {
					var myFx = new Fx.Scroll(window).toElement(hashEl);
					return false;
				}
				
			}.pass(href, multislide));
		});
	});
}

//Manage search box default text
window.addEvent('domready', function() {
	var searchForm = $('SearchQuery');
	var searchGo = $('SearchSubmit');
	var swapImage = 'SearchGoHover.gif';
	var uri = new URI(searchGo.getProperty('src'));
	

	searchForm.defaultValue = searchForm.getProperty('value');
	searchGo.defaultValue = uri;
	searchGo.hoverValue = uri.get('directory')+swapImage;
	
	searchForm.addEvents({
		'focus': function(){
			if(this.value == this.defaultValue) this.value = ''; 
		},
		'blur': function(){
			if(this.value == '') this.value = this.defaultValue;
		}
	});
	
	searchGo.addEvents({
		'mouseenter': function() {
			this.src = this.hoverValue;
		},
		'mouseleave': function() {
			this.src = this.defaultValue;
		}
	});
});

//Highlight Rotation

var HighlightingRotation = new Class({
    Implements: Options,
	
    options: {
		containerId: null,
        hoverSpeed: 500,
        fadeSpeed: 1000,
		rotateSpeed: 3000,
		textClass: 'text',
		hoverClass: 'hoverEffect',
		highlightClass: 'highlight',
		interActiveClass: 'interactive',
		fadeText: 1,
		showText: 1,
		baseTagType: 'a',
		limitInclusion: {  //may be set on page with global variable 'HR_limitInclusion'
			action: '', //valid values are 'include', or 'exclude'
			files: [],
			start: 0 //zero means do random rotation
		},
		/*number of pictures or less that causes rotateSpeed to increase by increaseFactor:
		  useful to have longer time with extremely small number of pictures
		*/
		increaseRotateOn: 3,
		increaseFactor: 2000
    },
	
    initialize: function(options){
        this.setOptions(options);
		if(!this.options.containerId) return;

		var container = $(this.options.containerId);
		if(!container) return;
		var elements = container.getChildren(this.options.baseTagType);
		if(elements.length == 1) return; //no need to rotate 
		if(elements.length < 1) container.destroy(); //eliminate unnecessary container
		
		//check for page specific limitations
		if($defined(window.HR_limitInclusion)) {
			var defaultStart = this.options.limitInclusion.start;
			if($defined(HR_limitInclusion.action)) {this.options.limitInclusion.action = HR_limitInclusion.action.toLowerCase()}
			if($defined(HR_limitInclusion.files)) {this.options.limitInclusion.files = HR_limitInclusion.files}
			if($defined(HR_limitInclusion.start)) {this.options.limitInclusion.start = HR_limitInclusion.start};
		}

		//limit elements
		var limits = this.options.limitInclusion.action;
		if(limits == 'include') {
			limits = this.options.limitInclusion.files;

			elements = elements.filter(function(item, index){
				var uri = new URI (item.getProperty('src'));
				uri = uri.get('file');
				if(limits.indexOf(uri) == -1) {
					item.destroy();
				}
				else {
					return true;
				}
					
			});
		}
		else if(limits == 'exclude') {
			limits = this.options.limitInclusion.files;
			limits.each(function(item, index){
				var p = elements[0].getParent();
				var limitEl = p.getElement('img[src$='+item+']');
				if(limitEl) {
					elements.erase(limitEl);
					limitEl.destroy();
				}
			});
		}	
	
		if(elements.length <= 1) return; //recheck modified elements for rotation 
		
		var highClass = '.'+this.options.highlightClass;
		var hoverClass = '.'+this.options.hoverClass;
		var textClass = '.'+this.options.textClass;
		var interActClass = this.options.interActiveClass;
		var startNum = this.options.limitInclusion.start;
		
		//determine start number
		if(startNum) {
			if($type(startNum) != 'number' && $type(startNum) != 'string') {
				startNum = 0; //default to first picture if unexpected type
			}
			else if($type(startNum.toInt()) == 'number') {
				startNum = startNum.toInt().limit(1, elements.length+1) - 1;
			}
			else {
				startNum = elements.indexOf(container.getElement('img[src$='+startNum+']'));
				if(startNum == -1) { startNum = 0 } 
			}
		}
		else {
			startNum = Math.floor(Math.random()*elements.length);
		}
		
		//start showing first image right away
		elements[startNum].setStyle('z-Index',100);
		
		container.removeClass('noScript');
		container.elTags = elements;
		container.currentActive = 0;
		container.hoverSpeed = this.options.hoverSpeed; 
		container.fadeSpeed = this.options.fadeSpeed;

		container.rotateSpeed = (elements.length  <= this.options.increaseRotateOn) ? this.options.rotateSpeed+this.options.increaseFactor : this.options.rotateSpeed ;
		container.fadeText = this.options.fadeText;
		container.showText = this.options.showText;
		container.hasAnchors = 0;
		container.needsInteraction = 0;
		
		container.currentSpeed = container.fadeSpeed;
		
		container.setSpeed = function(item) {
			if(item.parent.hasAnchors) {
				item.hover.set('tween', {duration: item.parent.currentSpeed});
				item.txt.set('tween', {duration: item.parent.currentSpeed});
			    item.hl.set('tween', {duration: item.parent.currentSpeed});
			}
			else {
				item.set('tween', {duration: item.parent.currentSpeed});
			}
		}

		container.fadeGroup = function(item, action) {
			if(item.parent.hasAnchors) {
				item.hover.fade(action);
				item.hl.fade(action);
				if(action == 'in') {
					item.txt.fade(item.parent.showText);
				}
				else {
					item.txt.fade(item.parent.fadeText);
				}
			}
			else {
				item.fade(action);
			}
		}
				
		if(this.options.baseTagType == 'a') {
			container.hasAnchors = 1;
			elements.each(function(item, index){
				//initilize
				item.parent = container;
				item.hl = item.getElement(highClass);
				item.hover = item.getElement(hoverClass);
				item.txt = item.getElement(textClass);
				item.index = index;
				
				if(index == startNum) {
					item.addClass('active');
					item.hover.fade('show');
					item.hl.fade('show');
					item.txt.fade(item.parent.showText);
				}
				else {
					item.hl.fade('hide');
					item.hover.fade('hide');
					item.txt.fade(item.parent.fadeText);
				}	
			
				//actions
				item.hide = function() {
						this.parent.setSpeed(this);
						this.removeClass('active');
						this.parent.fadeGroup(this, 'out');
					}.bind(item);
				item.show = function() {
						this.parent.setSpeed(this);
						this.parent.getElement('*.active').hide();
						this.parent.fadeGroup(this, 'in');
						this.addClass('active');
						this.parent.currentActive = this.index;
					}.bind(item);
				item.addEvent('mouseenter', function() {
					this.parent.currentSpeed = this.parent.hoverSpeed;
					if(!this.hasClass('active')) this.show();
				});
			
			});
			
			container.addEvents({
				'mouseenter': function(){
					this.go = $clear(this.go);
				},
				'mouseleave': function(){
					this.currentSpeed = this.fadeSpeed;
					this.go = function(){
						(this.currentActive >= this.elTags.length - 1) ? this.currentActive = 0 : this.currentActive++;
						this.elTags[this.currentActive].show();
					}.periodical(this.rotateSpeed, container);
				}
			});
			
			container.fireEvent('mouseleave');
		}//end if anchor association	
		else { //just a picture rotation
			elements.each(function(item, index){
				//initilize
				item.parent = container;
				item.index = index;
				if(index == startNum) {
					item.addClass('active');
					item.fade('show');
				}
				else {
					item.fade('hide');
				}	
				
				//actions
				item.hide = function() {
						this.parent.setSpeed(this);
						this.removeClass('active');
						this.parent.fadeGroup(this, 'out');
					}.bind(item);
				item.show = function() {
						this.parent.setSpeed(this);
						this.parent.getElement('*.active').hide();
						this.parent.fadeGroup(this, 'in');
						this.addClass('active');
						this.parent.currentActive = this.index;
					}.bind(item);
					
				if(item.hasClass(interActClass)) container.needsInteraction = 1;
				

			});
							

			if(container.needsInteraction) {
				container.addEvents({
				'mouseenter': function(){
					this.go = $clear(this.go);
				},
				'mouseleave': function(){
					this.currentSpeed = this.fadeSpeed;
					this.go = function(){
						(this.currentActive >= this.elTags.length - 1) ? this.currentActive = 0 : this.currentActive++;
						this.elTags[this.currentActive].show();
					}.periodical(this.rotateSpeed, container);
				}
			});
			}
			else {
				container.go = function(){
					(this.currentActive >= this.elTags.length - 1) ? this.currentActive = 0 : this.currentActive++;
					this.elTags[this.currentActive].show();
				}.periodical(container.rotateSpeed, container);
			}
			
	
				
		}//end else
		elements[startNum].setStyle('z-Index', null);
    } //end initilize
});//end Class Definition

// Google Analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-15752844-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

//]]>