// return a reference to a DOM element by ID
function e(id) {
	return document.getElementById(id);
}

//show or hide an object
function toggle(elementID) {
	e(elementID).style.display = e(elementID).style.display == 'none' ? '' : 'none';
}

$(document).ready(function() {
	jQuery(function( $ ){
		//borrowed from jQuery easing plugin
		//http://gsgd.co.uk/sandbox/jquery.easing.php
		$.easing.backout = function(x, t, b, c, d){
			var s=1.70158;
			return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
		};
		$('#screen').scrollShow({
			view:'#view',
			content:'#images',
			easing:'backout',
			wrappers:'crop',
			navigators:'a[id]',
			navigationMode:'s',
			circular:true,
			start:0,
			setWidth: true
		});
	});
	
	var homepage = e('chooseALoanBalloon');
	if(homepage!=null)
	{
		$("#chooseALoanBalloon").hover(function() {
			$(this).css({cursor: "pointer"});
			$("#chooseALoanBalloon p").animate({backgroundColor: "#F5F09E"}, 500, queue=false);
		}, function () {
			$("#chooseALoanBalloon p").animate({backgroundColor: "#ffffff"}, 500, queue=false);
			$(this).css({cursor: "default"});
		});
		
		$("#chooseALoanBalloon").click(function() {
			location.href = "?choose-a-loan";
		});
		
		$("#getABetterDealBalloon").hover(function() {
			$(this).css({cursor: "pointer"});
			$("#getABetterDealBalloon p").animate({backgroundColor: "#F5F09E"}, 500, queue=false);
		}, function () {
			$("#getABetterDealBalloon p").animate({backgroundColor: "#ffffff"}, 500, queue=false);
			$(this).css({cursor: "default"});
		});
		
		$("#getABetterDealBalloon").click(function() {
			location.href = "?get-a-better-deal";
		});
		
		$("#ourPhilosophyBalloon").hover(function() {
			$(this).css({cursor: "pointer"});
			$("#ourPhilosophyBalloon p").animate({backgroundColor: "#F5F09E"}, 500, queue=false);
		}, function () {
			$("#ourPhilosophyBalloon p").animate({backgroundColor: "#ffffff"}, 500, queue=false);
			$(this).css({cursor: "default"});
		});
		
		$("#ourPhilosophyBalloon").click(function() {
			location.href = "?about-us/our-company";
		});

		$("#investingBalloon").hover(function() {
			$(this).css({cursor: "pointer"});
			$("#investingBalloon p").animate({backgroundColor: "#F5F09E"}, 500, queue=false);
		}, function () {
			$("#investingBalloon p").animate({backgroundColor: "#ffffff"}, 500, queue=false);
			$(this).css({cursor: "default"});
		});
		
		$("#investingBalloon").click(function() {
			location.href = "?choose-a-loan/finance-for-investing";
		});

		$("#financeEducationBallooon").hover(function() {
			$(this).css({cursor: "pointer"});
			$("#financeEducationBallooon p").animate({backgroundColor: "#F5F09E"}, 500, queue=false);
		}, function () {
			$("#financeEducationBallooon p").animate({backgroundColor: "#ffffff"}, 500, queue=false);
			$(this).css({cursor: "default"});
		});
		
		$("#financeEducationBallooon").click(function() {
			location.href = "?recognised-training";
		});

		$("#getInTouchBalloon").hover(function() {
			$(this).css({cursor: "pointer"});
			$("#getInTouchBalloon p").animate({backgroundColor: "#F5F09E"}, 500, queue=false);
		}, function () {
			$("#getInTouchBalloon p").animate({backgroundColor: "#ffffff"}, 500, queue=false);
			$(this).css({cursor: "default"});
		});
		
		$("#getInTouchBalloon").click(function() {
			location.href = "?contact-us";
		});
		
	}
});
