var currSlideCl = 0;
var slideICl;
var lShowCl = Array();

function startSlide( )
{
	slideICl = setInterval( newClient, 2000 );
}

function newClient( )
{
	var dList = document.getElementById( "clients" ).getElementsByTagName( "div" );

	if( dList.length < 2)
	{
		clearInterval( slideICl );
		return;
	}

	clearInterval( slideICl );

	var i = 0;
	var total = 0;
	var swd = false;

	lShowCl = Array();

	while( i < dList.length )
	{
		if( dList[i].style.display == "" )
		{
			lShowCl.push( i );
			var opacityTween = new OpacityTween( dList[i],Tween.regularEaseIn, 100, 0, 1 );
			opacityTween.start();

			if( !swd )
				opacityTween.onMotionFinished = function(){ showClient(); };

			swd = true;
		}

		i++;
	}
}

function showClient( )
{
	var dList = document.getElementById( "clients" ).getElementsByTagName( "div" );
	var total = dList.length;

	var i = 0;


	while( i < lShowCl.length )
	{
		dList[lShowCl[i]].style.display = "none";
		i++;
	}
	i = 0;

	if( total < 7 )
	{
		lShowCl = Array();
	}



	var tmpSTR = "";

	while( i < 1 )
	{
		var rs = getUniqueCL( lShowCl, total );
		lShowCl.push( rs );
		dList[rs].style.display = "";
		
		var opacityTween = new OpacityTween( dList[rs], Tween.regularEaseIn, 0, 100, 1 );
		opacityTween.start();

		i++;
	}
	
	slideICl = setInterval( newClient, 2000 );
}

function getUniqueCL( lShow, total )
{
	var aw = 0;
	var rs = Math.floor( Math.random() * total );

	while( aw < lShow.length )
	{
		if( rs == lShow[aw] )
		{
			rs = getUniqueCL( lShow, total );
		}
		aw++;
	}
	return rs;
}

function show_options(){
	$('#activity_sel').hide('fast');
	$('#service_sel').hide('fast');
	$('#box-tool').hide('fast');
	$('#label_sel').show('slow');
}
function show_activities(){
	$('#label_sel').hide('fast');
	$('#service_sel').hide('fast');
	$('#box-tool').hide('fast');
	$('#activity_sel').show('slow');
}
function show_services(){
	$('#label_sel').hide('fast');
	$('#activity_sel').hide('fast');
	$('#box-tool').hide('fast');
	$('#service_sel').show('slow');
}
function show_tools(){
	$('#label_sel').hide('fast');
	$('#activity_sel').hide('fast');
	$('#service_sel').hide('fast');
	$('#box-tool').show('slow');
}

$('.form-quote').focus(function(){
  $(this).css('border','solid 1pt #97be0d');
  $(this).css('background-color','#ffffff');
});

$('.form-quote').blur(function(){
  $(this).css('border','1px solid #eee');
  $(this).css('background-color','#eeeeee');
});

