/*
var count = 0;
var tabs = '';

var mouseX = 0;
var mouseY = 0;

var left_off = 0;
var cycle_on = 'true';
*/

$(document).ready( function()
{
	/*
	tabs = $( 'div.tab, div.tab-last' );
	toolTips();
	*/
	
	drawQuotes();
	
	$( 'div#landing-img' ).cycle
	({ 
		fx:	'fade',
		speed: 500,
		timeout: 6000,
		before: flashCall
	});
});

function flashCall()
{
	var flashMovie = document.getElementById( "flashquotes" );
	if( typeof( flashMovie.cycleQuote ) == 'function' ) { flashMovie.cycleQuote() }
}

function drawQuotes()
{
	var so = new SWFObject( "/PrimaryTemplateFiles/images/quotes.swf", "flashquotes", "210", "240", "9", "#FFFFFFF" );
	so.write( "flash-quotes" );
}

/*
function startCycle()
{
	$().unbind( 'mousemove' );
	
	count = left_off;
	cycle_on = 'true';
	
	$( 'div#landing-img' ).cycle( 'resume' );
}

function showHideIMG( obj )
{
	var curr = $( obj ).contents( 'a' ).attr( 'rel' );
	var cycle_images = $( 'div#landing-img div' );
	
	cycle_images.each
	(
		function( index )
		{
			this.style.display = 'none';
			this.style.zIndex = eval( index + 1 );
		}
	);
	
	var image_to_show = cycle_images[ eval( curr - 1 ) ];
	
	image_to_show.style.display = 'block';
	image_to_show.style.opacity = '1';
	
	image_to_show.style.filter = 'alpha( opacity=100 )';
}

function trackOnMouseMove()
{	
	$().mousemove( function( e )
	{
		mouseX = e.pageX;
		mouseY = e.pageY;
		
		var	tooltip = $( 'div#tooltip' );
		var mouseoffset = 40;
		
		if( eval( mouseX - tooltip[ 0 ].offsetLeft ) < 0 - mouseoffset || eval( mouseX - tooltip[ 0 ].offsetLeft ) > 510 || mouseY < 140 || mouseY > 372 )
		{
			startCycle();
		}
	});
}

function toolTips()
{	
	$( 'div.tab, div.tab-last' ).each
	(
		function( index )
		{
			$( this ).hover
			(
			
				function()
				{
					if( cycle_on == 'true' ) { cycle_on = 'false'; left_off = count; }
					$( '#landing-img' ).cycle( 'pause' );
					count = index;
					showToolTip();
					
					showHideIMG( this );
				},
		
				function()
				{
					trackOnMouseMove();
				}
			);
		}
	);
};

function getX( obj )
{
	var x = 0;
	while( obj )
	{
		x += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	
	return x;
};

function showToolTip()
{	
	var xoffset = 16;
	var yoffset = 10;
	
	var x = getX( tabs[ count ] );
	
	var out = $( 'div#tooltip div#tooltip-' + eval( count + 1 ) ).html();
	
	$( 'div#tooltip' ).removeClass().addClass( 'tooltip-' + eval( count + 1 ) )
	.css( { 'top' : 143 + yoffset, 'left' : x - 280 - xoffset } )
	.show();
	
	$( 'div#tooltip div#hello' ).html( out );
	
	count++;
	
	if( count == tabs.length ) { count = 0; }
}

function hideToolTip()
{
	$( 'div#tooltip' ).hide();
}
*/

