var motion = 0;
var speedIn = 1000;
var speedOut = 500;
var maxInfoWidth = 410;
jQuery(function($) {

	$.supersized( {

		// Functionality
		slide_interval : 5000, // Length between transitions
		transition : 1, // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide
						// Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel
						// Left
		transition_speed : 2000, // Speed of transition
		performance : 3,
		// Components
		slides : [ {
			image : 'homepage/BGD_1.jpg'
		}, {
			image : 'homepage/BGD_2.jpg'
		}, {
			image : 'homepage/BGD_3.jpg'
		} ]

	});
});
$(document).ready(function() {
	// var FullscreenrOptions = { width: 770, height: 550, bgID: '#bgimg' };
		// jQuery.fn.fullscreenr(FullscreenrOptions);
		
		var vicHeight = $('#infoContainerVic').height();
		//alert(vicHeight);
		$('#infoContainerVic').css('top', '-' + (vicHeight - 70) + 'px');

		$('#menuItemVic').bind('click', function() {

			toggleVic();
		});

		$('#menuItemVic').bind('mouseenter', function() {

			$(this).addClass('hover');
			$('#vicClicker').attr('src', 'homepage/victoriaF2.png');
		});

		$('#menuItemVic').bind('mouseleave', function() {

			$(this).removeClass('hover');
			$('#vicClicker').attr('src', 'homepage/victoria.png');
		});

		$('#menuItemQld').bind('click', function() {

			toggleQld();
		});

		$('#menuItemQld').bind('mouseenter', function() {

			$(this).addClass('hover');
			$('#qldClicker').attr('src', 'homepage/qldF2.png');
		});

		$('#menuItemQld').bind('mouseleave', function() {

			$(this).removeClass('hover');
			$('#qldClicker').attr('src', 'homepage/qld.png');
		});
/*
		$('#vicClicker').bind('mouseenter', function() {
			$(this).attr('src', 'homepage/victoriaF2.png');
		});

		$('#vicClicker').bind('mouseleave', function() {
			$(this).attr('src', 'homepage/victoria.png');
		});
		
		$('#qldClicker').bind('mouseenter', function() {
			$(this).attr('src', 'homepage/qldF2.png');
		});

		$('#qldClicker').bind('mouseleave', function() {
			$(this).attr('src', 'homepage/qld.png');
		});
		*/
		

	});

function toggleVic() {
	// alert($('#infoContainerVic').data('open'));
	if ($('#infoContainerVic').data('open') == 0 && motion == 0) {
		motion = 1;

		// see if QLD is open'
		if ($('#infoContainerQld').data('open') == 1) {

			$('#infoContainerQld').animate( {

				width : '-=' + maxInfoWidth
			}, speedOut, '', function() {
				$('#infoContainerQld').data('open', 0);
			});

		}

		$('#infoContainerVic').animate( {

			width : '+=' + maxInfoWidth
		}, speedIn, 'easeOutBounce', function() {

			motion = 0;
			$('#infoContainerVic').data('open', 1);

		});

	} else {

		$('#infoContainerVic').animate( {

			width : '-=' + maxInfoWidth
		}, speedOut, '', function() {

			motion = 0;
			$('#infoContainerVic').data('open', 0);

		});

	}
}

function toggleQld() {

	if ($('#infoContainerQld').data('open') == 0 && motion == 0) {
		motion = 1;

		// see if Vic is open'
		if ($('#infoContainerVic').data('open') == 1) {

			$('#infoContainerVic').animate( {

				width : '-=' + maxInfoWidth
			}, speedOut, '', function() {

				$('#infoContainerVic').data('open', 0);
			});

		}

		$('#infoContainerQld').animate( {

			width : '+=' + maxInfoWidth
		}, speedIn, 'easeOutBounce', function() {

			motion = 0;
			$('#infoContainerQld').data('open', 1);

		});

	} else {

		$('#infoContainerQld').animate( {

			width : '-=' + maxInfoWidth
		}, speedOut, '', function() {

			motion = 0;
			$('#infoContainerQld').data('open', 0);

		});

	}
}
