var bizmobiledata = {
	
	init: function() {
		bizmobiledata.general(); // General JS
		bizmobiledata.tooltips(); // Initialise tooltips
		bizmobiledata.facebox(); // Initialise facebox
		bizmobiledata.registerlabel(); // Show hide register Email label
		bizmobiledata.setup(); // Show hide setup listings
	},
	
	general: function() {
		$('.menu li').each(function() {
			$(this).mouseover(function() {
				$(this).addClass('sfhover');
			}).mouseout(function() {
				$(this).removeClass('sfhover');
			});
		});
	},
	
	tooltips: function() {
		$('label#signup').tooltip({
			track: true,
			delay: 0,
			showURL: false,
			showBody: " - ",
			fade: 250
		});
		$('a#myaccount').tooltip({
			track: true,
			delay: 0,
			showURL: false,
			showBody: " - ",
			fade: 250
		});
		$('#see-deal').tooltip({
			track: true,
			delay: 0,
			showURL: false,
			showBody: " - ",
			fade: 250
		});
	},
	
	facebox: function() {
		$('a[rel*=facebox]').facebox();
	},
	
	registerlabel: function() {
		var text = 'enter email address';
		var empty = '';
		var current = '';
		
		if ($('#header-email').length) {
			$('#header-email').focus(function() {
				current = $('#header-email').val();
				if(current == text)
				{
					$('#header-email').val(empty);
				}
			});
			
			$('#header-email').blur(function() {
				current = $('#header-email').val();
				if( current == '' )
				{
					$('#header-email').val(text);
				}
			});
		}
	},
	
	setup: function() {
		if ($('#setup-listing').length) {
			$('.setup-details').hide();
			$('.setup-details:first').show();
			$('.setup-details:first').next('.setup-heading').addClass('active');
			$('.setup-details:first').next('.setup-details').addClass('active');
			$('.setup-details:first').parents('.setup-item').addClass('active');
			
			$('.setup-heading').click(function() {
				var checkElement = $(this).next();
				if((checkElement.is('.setup-details')) && (checkElement.is(':visible'))) {
					return false;
				}
				if((checkElement.is('.setup-details')) && (!checkElement.is(':visible'))) {
					var activeElement = $('#setup-listing .setup-details:visible');
					activeElement.slideUp('normal');
					activeElement.parents('.setup-item').removeClass('active');
					activeElement.next('.setup-details').removeClass('active');
    				activeElement.removeClass('active');
					checkElement.slideDown('normal');
					checkElement.parents('.setup-item').addClass('active');
					checkElement.next('.setup-details').addClass('active');
    				checkElement.addClass('active');
					return false;
				}
			});
			
			$('#setup-viewall').click(function() {
				$('.setup-details').show();
				$('.setup-item').addClass('active');
				$('.setup-details').addClass('active');
				$('.setup-heading').addClass('active');
			}); 
		}
	}
};

$(document).ready(function() {
	bizmobiledata.init();
});

Cufon.replace('h1, h2, .cufon, .register span, .optusdin, .info, .submit, .search-filter, .button, .button-grey, #tooltip h3, .button-yellow-grey, .button-yellow, .step1 h3, .step2 h3, .step3 h3', {
	hover: {
		color: '#000000'
	}
});
Cufon.replace('.cufon-yellowhover, .cufon-normal', {
	hover: true
});
