﻿/*****************************
	Atrox Animation
	Animations for atrox.se - Start page
	Author: Bjorn Hall & Robert Hedman
*****************************/

$(function() {
	

	// WEEBBSTRATEGI HOVER
	/*
	$(".webbstrategi").mouseover(function() {
		$('.webbstrategi img').fadeOut(150);
	});
	
	$(".webbstrategi").mouseleave(function() {
		$('.webbstrategi img').fadeIn(500);
	});
	*/
	
	/*
	// WEBBKREATIVITET HOVER
	$("#magic-ball").mouseover(function(){
		$('#imgHolder').fadeIn(150);
	});
	
	$("#magic-ball").mouseleave(function(){
		$('#imgHolder').fadeOut(500);
	});
	*/
		
		
	// RUMBLE
	
	$('.mb-bg-1').jrumble({
		opacity: true,
		x: 4,
		y: 4,
		rotation: 3,
		speed: 5,
		opacityMin: .1
	});
	
	$('.mb-bg-2').jrumble({
		opacity: true,
		x: 4,
		y: 4,
		rotation: 4,
		speed: 5,
		opacityMin: .1
	});
	
	$('.mb-bg-3').jrumble({
		opacity: true,
		x: 4,
		y: 4,
		rotation: 4,
		speed: 5,
		opacityMin: .1
	});
	
	$('div.fourZeroFour').jrumble({
		opacity: true,
		x: 10,
		y: 10,
		rotation: 10,
		speed: 5,
		opacityMin: .1
	});
	
	

	
	var rumbleStart = function(){
	$('.mb-bg-1').trigger('startRumble');
	setTimeout(rumbleStop, 700);
	};
	
	var rumbleStop = function(){
	$('.mb-bg-1').trigger('stopRumble');
	setTimeout(rumbleStart, 3000);
	};
	
	var rumbleStart2 = function(){
	$('.mb-bg-2').trigger('startRumble');
	setTimeout(rumbleStop2, 900);
	};
	
	var rumbleStop2 = function(){
	$('.mb-bg-2').trigger('stopRumble');
	setTimeout(rumbleStart2, 2800);
	};
	
	var rumbleStart3 = function(){
	$('.mb-bg-3').trigger('startRumble');
	setTimeout(rumbleStop3, 1100);
	};
	
	var rumbleStop3 = function(){
	$('.mb-bg-3').trigger('stopRumble');
	setTimeout(rumbleStart3, 2600);
	};
	
	
	rumbleStart();
	rumbleStart2();
	rumbleStart3();

	
});

