//<![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/PccSideBarTab.png',
	'/Images/SideBarNavigation/PccSideBarTabHover.png',
	'/Images/SideBarNavigation/PccSideBarTabNoLink.png',
	'/Images/SideBarNavigation/PccSideBarTabForYou.png',
	'/Images/SideBarNavigation/PccSideBarTabFSHover.png', 
	'/Images/SideBarNavigation/PccSideBarTabPHover.png', 
	'/Images/SideBarNavigation/PccSideBarTabGHover.png', 
	'/Images/SideBarNavigation/PccSideBarTabAHover.png', 
	'/Images/SideBarNavigation/PccSideBarTabGSHover.png',
	'/Images/SideBarNavigation/PccSideBarTabCSHover.png',
	'/Images/SideBarNavigation/PccSideBarTabClinicHover.png',
	'/Images/SideBarNavigation/PccSideBarTabInside.gif',
	'/Images/SideBarNavigation/PccSideBarTabInsideHover.gif',
	'/Images/SideBarNavigation/PccSideBarTabNoToggleHover.png',
	'/Images/SideBarNavigation/PccSideBarTabAboutHover.png'
);

// 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));
		});
	});
}

function SetupSlideShowPro(album, filepath, width, height) {
	height = (typeof height == 'undefined') ? 300 : height;
	width = (typeof width == 'undefined') ? 300 : width;
	var container = new Element('div');
	var sspscript = new Element('script',{
		type: 'text/javascript',
		src: "http://pcc.slideshowpro.com/m/embed.js"
	});
	var el = new Element('div', {id:'album-'+album});
	container.adopt(sspscript,el);
	document.write(container.get('html'));

	window.addEvent('domready', function(album, filepath, width, height) {
		SlideShowPro({
			attributes: {
			src: filepath,
			id: "album-"+album,
				width: width,
				height: height
			},
			mobile: {
				auto: false
			},
			params: {
				bgcolor: "#000000",
				allowfullscreen: true
			},
			flashvars: {
				xmlFilePath: "http://pcc.slideshowpro.com/images.php?album="+album,
				contentScale: "Crop to Fit All"
			}
		});
	}.pass([album, filepath, width, height]));
	
}

//Manage search box default text
window.addEvent('domready', function() {
	var searchForm = $('SearchQuery');
	var searchGo = $('SearchSubmit');
	var swapImage = 'SearchGoHover.gif';
	if (searchGo != null) {
		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;
			}
		});
	};
	
	

	// setup accordions if there are any.
	var lastAccordion;
	var lastAccordionEl;
	
	$$('.accordion h2').each(function(el) {
		el.grab(new Element('div', {'class':'accordionInstructions',html:'click to expand'}),'bottom');
		el.grab(new Element('div', {'class':'accordionInstructions2',html:'click to collapse'}),'bottom');
	});
	$$('.accordion h2 div.accordionInstructions:first-child').fade('hide');
	$$('.accordion').each(function(el) {window.lastAccordion = new Fx.Accordion(el, '.accordion h2', '.accordion .content',
		{display: -1, alwaysHide: true, initialDisplayFx:false,
		 onActive: function(toggler, el) {
		 	window.lastAccordionEl = el;
			var instEl = toggler.getElement('div.accordionInstructions');
			var instEl2 = toggler.getElement('div.accordionInstructions2');
			if (instEl != null) {
				/*instEl.fade('out');*/
				instEl.setStyle('display', 'none');
				/*instEl2.fade('in');*/
				instEl2.setStyle('display', 'block');
			}
		 },
		 onBackground: function(toggler, el) {
			var instEl = toggler.getElement('div.accordionInstructions');
			var instEl2 = toggler.getElement('div.accordionInstructions2');
			if (instEl != null) {
				/*instEl.fade('in');*/
				instEl.setStyle('display', 'block');
				/*instEl2.fade('out');*/
				instEl2.setStyle('display', 'none');
			}
		 },
		 onComplete: function() {
		 	if (window.getScroll().y > window.lastAccordionEl.getCoordinates().top) {
				new Fx.Scroll(window).toElement(window.lastAccordionEl,'y');
			}
		 }
		}
	)});
	
});

//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);
})();




// PCC mailto solution: transforms e-mail addresses in the form noreply*pcci|edu to noreply@pcci.edu
// Taken from \\webservertest\WebSiteFolders\www.abeka.com\Includes\javascript\ABBScripts.js on 1/4/12
window.addEvent('domready', function () {
    var elements, elementIndex, emailAddress, correctedEmailAddress;

    elements = $$('a[href]');
    for (elementIndex = 0; elementIndex < elements.length; elementIndex++) {
        if (elements[elementIndex].href.match(/^mailto:/)) {
            emailAddress = elements[elementIndex].href.replace('mailto:', '');
            correctedEmailAddress = emailAddress.replace(/\*/g, '@').replace(/\|/g, '.');
            elements[elementIndex].set('href', elements[elementIndex].get('href').replace(emailAddress, correctedEmailAddress));
            elements[elementIndex].set('html', elements[elementIndex].get('html').replace(new RegExp(emailAddress.replace(/([*|])/g, '\\$1'), 'i'), correctedEmailAddress));
        }
    }

    elements = $$('.emailTransform');
    for (elementIndex = 0; elementIndex < elements.length; elementIndex++) {
        elements[elementIndex].set('text', elements[elementIndex].get('text').replace(/\*/g, '@').replace(/\|/g, '.'));
    }
});

//]]>



function showHide(shID) {
	if (document.getElementById(shID)) {
		if (document.getElementById(shID+'-show').style.display != 'none') {
			document.getElementById(shID+'-show').style.display = 'none';
			document.getElementById(shID).style.display = 'block';
		}
		else {
			document.getElementById(shID+'-show').style.display = 'inline';
			document.getElementById(shID).style.display = 'none';
		}
	}
}

