
		// Logo hit - called by flash
		function logoImpact() {
			jQuery(function( $ ){	
				if (!$.browser.msie) {
					$('#bodywrap').removeClass('notdone').effect("shake", { times:3 }, 40);
				}
				
			});
		}

jQuery(function( $ ){	

// Begin Homepage Rotator 
	
	// Initial Variables
	var activeSlide = 0;
	var animating = false;
	var hovering = false;
	var clicked = true;
	if ($.browser.msie) {
		$(".scroll-two, .scroll-three, .scroll-four").fadeOut(1);
	}else{
		$('#bodywrap').addClass('notdone');
		$('#rotator div div').css('background','url(/wp-content/themes/boxing/lib/img/homepagerotators.png) top left no-repeat');
		$(".scroll-two, .scroll-three, .scroll-four").css('display','block').animate({opacity: 0}, 1);
	}
	slideCycle();

	function changeSlide(next){
		if (next!=activeSlide&&animating!=true&&hovering!=true){
			animating = true;
			hideSlide(activeSlide);
			
			if (!next) {
				activeSlide++;
				if (activeSlide==5){ 
					activeSlide=1;
				}
				next = activeSlide;
			}	
			activeSlide = next;
			showSlide(next);
		}
	}
	
	function hideSlide(slide){
		slide = numWord(slide);	
		if ($.browser.msie) {
			$(".scroll-"+slide).fadeOut(500);
			$(".scroll-"+slide+" img").fadeOut(500);
		}else{
			$(".scroll-"+slide).animate({opacity: 0}, 500);
		}
	}
	
	function showSlide(slide){
		startWiggle(slide);
		slide = numWord(slide);	
		if ($.browser.msie) {
			$(".scroll-"+slide).fadeIn(500);
			$(".scroll-"+slide+" img").fadeIn(500, function(){ animating=false; });
		}else{
			$(".scroll-"+slide).animate({opacity: 1}, 500, function(){ animating=false; });
		}
	}
		
	
	function startWiggle(slide){
		if (slide%2){ direction="left"; } else { direction="right"; }
		slide = numWord(slide);
		randDistOne = Math.floor(Math.random()*51)+20;
		randDistTwo = Math.floor(Math.random()*35)+20;
		randDistThree = Math.floor(Math.random()*51)+20;
		randDistFour = Math.floor(Math.random()*31)+20;
		$(".scroll-"+slide+" div.text").effect("shake", { direction: direction, times: 1, distance: randDistOne}, 5300);
		$(".scroll-"+slide+" div.text2").effect("shake", { direction: direction, times: 1, distance: randDistTwo }, 5300);
		$(".scroll-"+slide+" div.text3").effect("shake", { direction: direction, times: 1, distance: randDistThree }, 5300);
		$(".scroll-"+slide+" div.text4").effect("shake", { direction: direction, times: 1, distance: randDistFour }, 5300);
	}
	
	function numWord(slide){
		if (slide==1){ return "one"; }
		else if (slide==2){ return "two"; }
		else if (slide==3){ return "three"; }
		else if (slide==4){ return "four"; }
		else{ return "five"; }
	}
	
	// Cycle Slide
	function slideCycle(){
		changeSlide();	
		setTimeout(function(){ slideCycle(); }, 6000);
	}


// End Homepage Rotator

	// How is flicker formed?
	var glowLeft = $('div.leftglow');
	var glowRight = $('div.rightglow');
	var fSpeed = 300;
	var altO = 0;
	var flickerCount = 0;
	var flickerMax = 40;
	
	function ghettoFlicker(){
		if (flickerCount<=flickerMax){
			var rand = Math.floor(Math.random()*51);
			var tRand = fSpeed* (Math.abs(Math.sin((rand/100)*Math.PI)));
			var flickerMod = flickerCount/flickerMax;
			if (altO==0){ altO=1;  }else{ altO=0; }			
			if (rand>=35){ altO=1; }
			if (flickerCount==flickerMax){ altO = 1; }
			// Organic opacity
			animO = Math.abs(altO-((Math.random()*5)*0.05));
			$('div.leftglow').animate({
				opacity: animO
			}, tRand);
			$('div.rightglow').animate({
				opacity: animO
			}, tRand, function(){ ghettoFlicker(); });
			flickerCount = flickerCount + 1; 
		}
	}	
	
	// Fire flickering sequence
	if (!$.browser.msie) {
		ghettoFlicker();
	}

});