/* 

Author: 			August
Author URI: 		http://www.august.com.au/
Description:		FSW Mini

*/

// PrettyPhoto Lightbox
$(document).ready(function(){
	$("a[rel^='prettyPhoto']").prettyPhoto({
		animationSpeed: 'normal', /* fast/slow/normal */
		opacity: 0.80, /* Value between 0 and 1 */
		showTitle: false, /* true/false */
		allowresize: false, /* true/false */
		theme: 'facebook', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
		iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no" scrolling="no"></iframe>'
	});
	
});


// Enables preset text in textfields to be cleared.
$(document).ready(function() {
	$('.newsletter-email, .newsletter-firstname').clearField();
});


// Countdown Timer
$(document).ready(function() {
	$('#countdown_dashboard').countDown({
	// targetDate = 1 September 2010 @ 12:00:00
		targetDate: {
			'day': 		1,
			'month': 	9,
			'year': 	2010,
			'hour': 	12,
			'min': 		0,
			'sec': 		0
		}	
	});
});



// Style the File Upload button on the Careers page
$(document).ready(function(){
	$("input[type=file]").filestyle({ 
		 image: "assets/img/choose-file.gif",
		 imageheight : 25,
		 imagewidth : 70,
		 width : 158
	 });
});


// Footer
$(document).ready(function(){
	
	$(".toggle-footer").click(function(){
		
		if ($(this).hasClass('active')) {
			$('#footer-close').fadeOut(400);
			$("#footer-wrap").animate({bottom: '-205px'}, 500, 'easeOutExpo');
			$("#footer-wrap").removeClass('open');
		} else {
			$('#footer-close').fadeIn(400);
			$("#footer-wrap").animate({bottom: '0px'}, 500, 'easeOutExpo');
			$("#footer-wrap").addClass('open');
		}
	
		$(this).toggleClass("active"); 
		return false;
	}); 
	
	$('#footer-close a').click(function() {
		$(".toggle-footer").click();
		return false;
	});

	$("#locations-right").click(function(){
		if (!$("#location-slide:animated").length) {
			if ($("#location-slide").position().left > (425*16 - (3 * 425))*-1) {
				$("#location-slide").animate({'left': $("#location-slide").position().left - 425}, 500, 'easeOutExpo');
			}
		}
	}); 
	$("#locations-left").click(function(){
		if (!$("#location-slide:animated").length) {
			if ($("#location-slide").position().left < 0) {
				$("#location-slide").animate({'left': $("#location-slide").position().left + 425}, 500, 'easeOutExpo');
			}
		}
	});

	$('#locations-wrap li').hover(function() {
		$(this).addClass('hover');
		$('img', this).each(function() {
			this.src = this.src.replace('-grey.png', '.png');
		});
	}, function() {
		$(this).removeClass('hover');
		$('img', this).each(function() {
			this.src = this.src.replace('.png', '-grey.png');
		});
	});
});


