// JavaScript Document

	loopMe = null;
	rotating = false;
	
	function setPageClassName(e){
		
		//get the source element
		//page = $(event).srcElement;
		
		
		var evt = window.event || e;
		var page = $(evt).srcElement || evt.target;
		
		if(evt.type=='mouseout' && $(page).hasClassName('down')==false){
			$(page).removeClassName('over');
		}
		if(evt.type=='mouseover' && $(page).hasClassName('down')==false){
			$(page).addClassName('over');
		}
		if(evt.type=='click' && rotating==false){
			$$('#HomeRotation .homePage').each(function(item){
				$(item).removeClassName('down');
				$(item).removeClassName('over');
			});
			$(page).addClassName('down');
			
			//get the page we want to show!
			$$('#HomeRotation .homeGroup').each(function(item){
				item.setStyle({display:'none'});
			});
			//set the appropriate group to visible
			index = Number($(page).innerHTML) - 1;
			
			//show the correct image
			$A($$('#HomeRotation .homeGroup'))[index].setStyle({display:'block'});
			
			if(!Object.isUndefined(loopMe)){
				clearTimeout(loopMe);
			}
			
		}
	}
	
	
	function beginRotation(){				
		loopMe = setTimeout('homeRotation()',4000);	
	}
	
	function homeRotation(){
	
		clearTimeout(loopMe);

		current  = 0;
		arrGroup = $A($$('#HomeRotation .homeGroup'));
		arrPage  = $A($$('#HomeRotation .homePage'));
		//get the current group
		arrGroup.each(function(item,index){
			if(item.style.display == 'block'){
				current = index
			}
		});
		
		//check the number of groups we have...
		count = arrGroup.length;
		
		//get the next group to show
		if(current < count-1){
			next = current + 1;
		} else {
			next = 0;
		}
		
		arrGroup = $A($$('#HomeRotation .homeGroup'))
		objCurrent 	= arrGroup[current];
		objNext 	= arrGroup[next];
		
		new Effect.Parallel([
			new Effect.Fade(objCurrent,{}),
			new Effect.Appear(objNext,{
				beforeStart:function(){
					rotating = true;
					arrPage[current].removeClassName('down');
				},
				afterFinish:function(){
					rotating = false;
					objCurrent.style.display='none'
					objNext.style.display='block'
					arrPage[next].addClassName('down');					
					loopMe = setTimeout('homeRotation()',7000);
				}
			})
		]);
	}	
	
	
	
	
	
	
	
	function createBookmarkLink(title,url) { 
	//	title = "Webpage Title";   
		// Blogger - Replace with <$BlogItemTitle$>   
		// MovableType - Replace with <$MTEntryTitle$> 
		
	//	url = "Webpage URL";  
		// Blogger - Replace with <$BlogItemPermalinkURL$>  
		// MovableType - Replace with <$MTEntryPermalink$>  
		// WordPress - <?php bloginfo('url'); ?>	
		if (window.sidebar) { 
			// Mozilla Firefox Bookmark		
			window.sidebar.addPanel(title, url,"");	
		} 
		else if(window.external ) { 
			// IE Favorite		
			window.external.AddFavorite( url, title); 
		}	
		else if(window.opera && window.print) { 
			// Opera Hotlist		
			return true; 
		} 
				
	}	






	function switchTabs(thisTab) {
		
		$('Overview').hide();
		$('Location').hide();
		
		$(thisTab).show();
		
		$('btnOverview').src = '../jpg/btnOverview.jpg';
		$('btnLocation').src = '../jpg/btnLocation.jpg';
		
		$('btn' + thisTab).src = '../jpg/btn' + thisTab + '-over.jpg';
		
	}










