
	
		$(document).ready(function(){
								   
		$(".menu li").hover(
            function(){
                if($(this).find("ul").css('display')=='none')
                    $(this).find("ul").show();
            },
            function(){
                $(this).find("ul").hide();
            }
        );
		
		 $(".menu li ul li").hover(
            function(){
                if($(this).find("li a").css('background')=='transparent url(/img/hover.png) repeat-x center');
            },
			
            function(){
                if($(this).find("li a").css('background')=='none');
            }
        );

	
		
			
			  var currentPosition = 0;
			  var slideHeight = 80;
			  var slides = $('.slide');
			  var numberOfSlides = 5;
			
			  // Remove scrollbar in JS
			  $('#slidesContainer').css('overflow', 'hidden');
			
			  // Wrap all .slides with #slideInner div
			  slides
			  .wrapAll('<div id="slideInner"></div>')
			  // Float left to display horizontally, readjust .slides width
			  .css({
				'clear' : 'both',
				'height' : slideHeight
			  });
			
			  // Set #slideInner width equal to total width of all slides
			  $('#slideInner').css('height', slideHeight * numberOfSlides);
			
			  // Insert left and right arrow controls in the DOM
			  $('#show')
				.prepend('<span class="control" id="upControl">Move Up</span>')
				.append('<span class="control" id="downControl">Move Down</span>');
			
			//   Hide left arrow control on first load
			  manageControls(currentPosition);
			
			  // Create event listeners for .controls clicks
			  $('.control')
				.bind('click', function(){
				// Determine new position
				  currentPosition = ($(this).attr('id')=='downControl')
				? currentPosition+1 : currentPosition-1;
			
				  // Hide / show controls
				  manageControls(currentPosition);
				  // Move slideInner using margin-left
				  $('#slideInner').animate({
					'marginTop' : slideHeight*(-currentPosition)
				  });
				});
				
			function manageControls(position){
			// Hide left arrow if position is first slide
			if(position==0){ $('#upControl').css('left','-99999px') }
			else{ $('#upControl').css('left','auto') }
			// Hide right arrow if position is last slide
			if(position==numberOfSlides-2){ $('#downControl').hide() }
			else{ $('#downControl').show() }
			}


		
		

		});
		
	function flyerFlip (p, id) {
		
		var oldSrc = $("#" + id).attr("src");
		
		$("#" + id).attr("src", p);
		
		setTimeout("flyerFlip('" + oldSrc + "', '" + id + "');", 3000);
		
	}
	
	function flyerFlipMain (p) {
		
		var oldSrc = $(".eventFlyer img").attr("src");
		
		$(".eventFlyer img").attr("src", p);
		
		setTimeout("flyerFlipMain('" + oldSrc + "');", 3000);
		
	}
	
	function gallery() {
		$('ul.gallery').galleria({
				history   : true, // activates the history object for bookmarking, back-button etc.
				clickNext : true, // helper for making the image clickable
				insert    : '#main_image', // the containing selector for our main image
				onImage   : function(image,caption,thumb) { // let's add some image effects for demonstration purposes
				
					var href = window.location.toString();
					var str = window.location.hash;
					var exploded = str.split('/');
						
					if (window.location.hash=='') {
						href = (href+"image/"+exploded[2]+"/");
					} else {
						href = (href.substr(0,href.indexOf("#"))+"image/"+exploded[2]+"/");
					}
					
					href = href+window.location.hash;				
						
														
					$('#addthis_toolbox').empty();	
					var a = document.createElement('a');
					a.setAttribute('class', 'addthis_button_compact');
					a.setAttribute('addthis:url', href);
					a.setAttribute("onmouseover", "return addthis_open(this, '', '"+href+"', '')");
					a.setAttribute("onclick", "return addthis_sendto()");
					a.setAttribute("onmouseout", "addthis_close()");
					a.innerHTML = '<img src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" />';
					document.getElementById('addthis_toolbox').appendChild(a);						
		
					
					// fade in the image & caption
					if(! ($.browser.mozilla && navigator.appVersion.indexOf("Win")!=-1) ) { // FF/Win fades large images terribly slow
						image.css('display','none').fadeIn(1000);
					}
					caption.css('display','none').fadeIn(1000);
					
					// fetch the thumbnail container
					var _li = thumb.parents('li');
					
					// fade out inactive thumbnail
					_li.siblings().children('img.selected').fadeTo(500,0.3);
					
					// fade in active thumbnail
					thumb.fadeTo('fast',1).addClass('selected');
					
					// add a title for the clickable image
					image.attr('title','Next image >>');
				},
				onThumb : function(thumb) { // thumbnail effects goes here
					
					// fetch the thumbnail container
					var _li = thumb.parents('li');
					
					// if thumbnail is active, fade all the way.
					var _fadeTo = _li.is('.active') ? '1' : '0.3';
					
					// fade in the thumbnail when finnished loading
					thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);
					
					// hover effects
					thumb.hover(
						function() { thumb.fadeTo('fast',1); },
						function() { _li.not('.active').children('img').fadeTo('fast',0.3); } // don't fade out if the parent is active
					)
				}
			});	
	}
	
				
	var tickerPos = 0;
	var tickerCount = 0;
	var tickerTotal = 2;
	
	function tickerScroll() {
		if (tickerPos==1) {
			$(".newsContent").scrollTo( $(".newsStart:eq(" + tickerCount + ")"), 2000, {axis:'x'});
			tickerPos=0;
		}
		else
		{
			$(".newsContent").scrollTo( $(".newsEnd:eq(" + tickerCount + ")"), 2000, {axis:'x'});
			tickerPos=1;
		}
		
	}
	
	

