var current_index = 1;
var dd_length;

$(function(){

	/* Slide In the Registration Form */
		var reg_close = function(hash){
			hash.w.animate({
				top: '-600px'
				}, {
				duration: 250,
				specialEasing: {
					top: 'linear',
					"easing": "easein"
				},
				complete: function() {
					hash.o.remove();
				}
			});
		}; 
	
		$('.login_form').jqm({onHide:reg_close});
		$('.login_form').css("top","-600px");
	
		$(".sign_in").live("click",function(){
			$(".login_form").jqmShow();
			$(".login_form").animate({
				top: '75px'
				}, {
				duration: 250,
				specialEasing: {
					top: 'linear',
					"easing": "easein"
				},
				complete: function() {
					//nothing
				}
			});
			return false;
		});
	
	/* Quote Rotator */
		$(".quotes dd").hide();
		
		dd_length = $(".quotes dd").length;
		
		$(".quotes dd:nth-child(1)").fadeIn('slow',function(){
			$(this).addClass("active");
			int = setTimeout ( "fade_titles()", 5000 );
		});	
	
});

function fade_titles()
{
	clearTimeout(int);

	if(current_index+1 > dd_length)
	{
		current_index = 1;
	}
	else
	{
		current_index++;
	}

	$(".quotes dd.active").fadeOut('slow',function(){
		$(this).removeClass("active");
		$(".quotes dd:nth-child(" + current_index + ")").fadeIn('slow',function(){
			$(this).addClass("active");
			int = setTimeout ( "fade_titles()", 4000 );
		});
	});
}
