﻿function init()
{
	createTitleTips();
	splashRotator();
	newsFader();
	$('.home .main div div:not(#b6)').click(locationClickHandler);
}

function createTitleTips()
{
	$('.main h3').each(
		function()
		{
			$(this).parent().attr('title', $(this).text().toString() );
		}
	);
}

function splashRotator()
{
	setTimeout("swapfade(document.getElementById('splash'), 'images/splash/splash_00.jpg', '10', 'BayAreaDivorce.com')",20000);
	setTimeout("swapfade(document.getElementById('splash'), 'images/splash/splash_02.jpg', '10', 'BayAreaDivorce.com')",40000);
	setTimeout("swapfade(document.getElementById('splash'), 'images/splash/splash_04.jpg', '10', 'BayAreaDivorce.com')",60000);
	setTimeout("swapfade(document.getElementById('splash'), 'images/splash/splash_05.jpg', '10', 'BayAreaDivorce.com')",80000);
}

function newsFader()
{
	$('#fader').innerfade({
		animationtype: 'fade',
		speed: 'slow',
		timeout: 30000,
		type: 'random'
	})
}

function locationClickHandler()
{
	var url = '/';
	switch(this.id)
	{
		case 'b1':
			url = '/about.php';
			break;    
		case 'b2':
			url = '/new.php?landing=t2';
			break;    
		case 'b3':
			url = '/about.php?landing=testimonials';
			break;    
		case 'b4':
			url = '/new.php';
			break;    
		case 'b5':
			url = '/new.php?landing=t4';
			break;    
		case 'b6':
			url = '/';
			break;    
		default:
			url = '/';
			break;    
	}
    location.href = url;
}
$(document).ready(init);