// JavaScript Document

$(document).ready(function() {	
	
// Fake Parallax Animations
	$('.next').click(function() {
		//if its not animated
		var leftValue = $('#heading , #other , #badge , #heading , #bones').css("left");
		if (leftValue != '-1920px' && (!$('#heading , #other , #badge , #heading , #bones').is(":animated"))) {
        	// do stuff
			$('#dog').animate({"left": "-=960px"}, 1200);
			$('#other').animate({"left": "-=960px"}, 1000);
			$('#badge').animate({"left": "-=960px"}, 800); 
			$('#heading').animate({"left": "-=960px"}, 600);
			$('#bone').animate({"left": "-=960px"}, 1400);
			$('.bone1').animate({"left": "-=960px"}, 1700);
			$('.bone2').animate({"left": "-=960px"}, 1600);
			$('.bone3').animate({"left": "-=960px"}, 1500);
			$('#toFrame1,#toFrame2,#toFrame3,#toFrame4').removeClass('active');
			switch(leftValue)
			{
			//case '0px':
				//$('#toFrame1').addClass('active');
			  //break;
			case '0px':
				$('#toFrame2').addClass('active');
			  break;
			case '-960px':
				$('#toFrame3').addClass('active');
			  break;
			//case '-1920px':
				//$('#toFrame4').addClass('active');
			 // break;
			}
    	}
		else {
			$('#toFrame1').click();
		}
	}); 
	$('.prev').click(function() {
		//if its not animated
		var leftValue = $('#heading , #other , #badge , #heading , #bones').css("left");
		if (leftValue != '0px' && (!$('#heading , #other , #badge , #heading , #bones').is(":animated"))) {
        	// do stuff
			$('#dog').animate({"left": "+=960px"}, 1200);
			$('#other').animate({"left": "+=960px"}, 1000);
			$('#badge').animate({"left": "+=960px"}, 800); 
			$('#heading').animate({"left": "+=960px"}, 600);
			$('#bone').animate({"left": "+=960px"}, 1400);
			$('.bone1').animate({"left": "+=960px"}, 1700);
			$('.bone2').animate({"left": "+=960px"}, 1600);
			$('.bone3').animate({"left": "+=960px"}, 1500);
			$('#toFrame1,#toFrame2,#toFrame3,#toFrame4').removeClass('active');
			switch(leftValue)
			{
			//case '0px':
				//$('#toFrame1').addClass('active');
			  //break;
			case '-2880px':
				$('#toFrame3').addClass('active');
			  break;
			case '-1920px':
				$('#toFrame2').addClass('active');
			  break;
			//case '-960px':
				//$('#toFrame1').addClass('active');
			  //break;
			}
    	}
		else {
			$('#toFrame3').click();
		}
	}); 
	$('#toFrame1').click(function() { 
		//if its not animated
		if (!$('#heading , #other , #badge , #heading , #bones').is(":animated")) {
        	// do stuff 
			$('#dog').animate({"left": "0px"}, 1200);
			$('#other').animate({"left": "0px"}, 1000);
			$('#badge').animate({"left": "0px"}, 800); 
			$('#heading').animate({"left": "0px"}, 600);
			$('#bone').animate({"left": "0px"}, 1400);
			$('.bone1').animate({"left": "0px"}, 1700);
			$('.bone2').animate({"left": "0px"}, 1600);
			$('.bone3').animate({"left": "0px"}, 1500);
			$('#toFrame2,#toFrame3,#toFrame4').removeClass('active');
			$('#toFrame1').addClass('active');
		}
		
	});
	$('#toFrame2').click(function() { 
		//if its not animated
		if (!$('#heading , #other , #badge , #heading , #bones').is(":animated")) {
        	// do stuff 
			$('#dog').animate({"left": "-960px"}, 1200);
			$('#other').animate({"left": "-960px"}, 1000);
			$('#badge').animate({"left": "-960px"}, 800); 
			$('#heading').animate({"left": "-960px"}, 600);
			$('#bone').animate({"left": "-960px"}, 1400);
			$('.bone1').animate({"left": "-960px"}, 1700);
			$('.bone2').animate({"left": "-960px"}, 1600);
			$('.bone3').animate({"left": "-960px"}, 1500);
			$('#toFrame1,#toFrame3,#toFrame4').removeClass('active');
			$('#toFrame2').addClass('active');
		}
		
	});
	$('#toFrame3').click(function() { 
		//if its not animated
		if (!$('#heading , #other , #badge , #heading , #bones').is(":animated")) {
        	// do stuff 
			$('#dog').animate({"left": "-1920px"}, 1200);
			$('#other').animate({"left": "-1920px"}, 1000);
			$('#badge').animate({"left": "-1920px"}, 800); 
			$('#heading').animate({"left": "-1920px"}, 600);
			$('#bone').animate({"left": "-1920px"}, 1400);
			$('.bone1').animate({"left": "-1920px"}, 1700);
			$('.bone2').animate({"left": "-1920px"}, 1600);
			$('.bone3').animate({"left": "-1920px"}, 1500);
			$('#toFrame1,#toFrame2,#toFrame4').removeClass('active');
			$('#toFrame3').addClass('active');
		}
		
	});
	$('#toFrame4').click(function() { 
		//if its not animated
		if (!$('#heading , #other , #badge , #heading , #bones').is(":animated")) {
        	// do stuff 
			$('#dog').animate({"left": "-2880px"}, 1200);
			$('#other').animate({"left": "-2880px"}, 1000);
			$('#badge').animate({"left": "-2880px"}, 800); 
			$('#heading').animate({"left": "-2880px"}, 600);
			$('#bone').animate({"left": "-2880px"}, 1400);
			$('.bone1').animate({"left": "-2880px"}, 1700);
			$('.bone2').animate({"left": "-2880px"}, 1600);
			$('.bone3').animate({"left": "-2880px"}, 1500);
			$('#toFrame1,#toFrame2,#toFrame3').removeClass('active');
			$('#toFrame4').addClass('active');
		}
		
	});
	
	
	$('.arrow-1').live("mouseover",function() {
		if ( $.browser.msie ) {
    		$('.rollover-1').show();
 		} else {
    		$('.rollover-1').fadeIn();
 		}
	});
	$('.rollover-1').live("mouseout",function() {
		if ( $.browser.msie ) {
    		$('.rollover-1').hide();
 		} else {
    		$('.rollover-1').fadeOut();
 		}
	});
	
	$('.arrow-2').live("mouseover",function() {
		if ( $.browser.msie ) {
    		$('.rollover-2').show();
 		} else {
    		$('.rollover-2').fadeIn();
 		}
	});
	$('.rollover-2').live("mouseout",function() {
		if ( $.browser.msie ) {
    		$('.rollover-2').hide();
 		} else {
    		$('.rollover-2').fadeOut();
 		}
	});
	
	$('.arrow-3').live("mouseover",function() {
		if ( $.browser.msie ) {
    		$('.rollover-3').show();
 		} else {
    		$('.rollover-3').fadeIn();
 		}
	});
	$('.rollover-3').live("mouseout",function() {
		if ( $.browser.msie ) {
    		$('.rollover-3').hide();
 		} else {
    		$('.rollover-3').fadeOut();
 		}
	});
	
	$('.arrow-4').live("mouseover",function() {
		if ( $.browser.msie ) {
    		$('.rollover-4').show();
 		} else {
    		$('.rollover-4').fadeIn();
 		}
	});
	$('.rollover-4').live("mouseout",function() {
		if ( $.browser.msie ) {
    		$('.rollover-4').hide();
 		} else {
    		$('.rollover-4').fadeOut();
 		}
	});
	
	$('.arrow-5').live("mouseover",function() {
		if ( $.browser.msie ) {
    		$('.rollover-5').show();
 		} else {
    		$('.rollover-5').fadeIn();
 		}
	});
	$('.rollover-5').live("mouseout",function() {
		if ( $.browser.msie ) {
    		$('.rollover-5').hide();
 		} else {
    		$('.rollover-5').fadeOut();
 		}
	});

positionArrows();

$(window).resize(function () {
    positionArrows();
});

/*----------- FR ------------*/
		$('.arrow-4').live("mouseover",function() {
			if ( $.browser.msie ) {
				$('.rollover-4-fr').show();
			} else {
				$('.rollover-4-fr').fadeIn();
			}
		});
		$('.rollover-4-fr').live("mouseout",function() {
			if ( $.browser.msie ) {
				$('.rollover-4-fr').hide();
			} else {
				$('.rollover-4-fr').fadeOut();
			}
		});
		
		$('.arrow-5').live("mouseover",function() {
			if ( $.browser.msie ) {
				$('.rollover-5-fr').show();
			} else {
				$('.rollover-5-fr').fadeIn();
			}
		});
		$('.rollover-5-fr').live("mouseout",function() {
			if ( $.browser.msie ) {
				$('.rollover-5-fr').hide();
			} else {
				$('.rollover-5-fr').fadeOut();
			}
		});


});
