// JavaScript Document

function sswitch() {
    var $active = $('#ss a.yactive');
	if ($active.length == 0) $active = $('#ss a:last');
    var $next = $active.next().length ? $active.next()
				: $('#ss a:first'); 
	$active.addClass('last-active');   
    $next.css({opacity: 0.0})
		.addClass('yactive')
		.animate ({opacity:1.0}, 1500, function () {
			$active.removeClass('yactive last-active');		
		});
}
$(function() {
    var playss =  setInterval( "sswitch()", 6000 );
	$('#ss').hover(function() {
		clearInterval(playss);
		var caption = $('#ss a.yactive').find('img').attr('rel');	
		var html = '<div id="tt">';
			html += '<span>' + caption + '</span>';
			html += '</div>';
			$('#ss').append(html).children('#tt').hide().animate({opacity: 0.7},100 );
			$('#ss').children('#tt').animate({height: '40px'},500 ).animate({opacity: 0.7},100 );
	}, function() {
		playss =  setInterval( "sswitch()", 6000 );
		$('#tt').remove();
	});
});


function sswitch2() {
    var $active = $('#ss2 a.yactive2');
	if ($active.length == 0) $active = $('#ss2 a:last');
    var $next = $active.next().length ? $active.next()
				: $('#ss2 a:first'); 
	$active.addClass('last-active');   
    $next.css({opacity: 0.0})
		.addClass('yactive2')
		.animate ({opacity:1.0}, 1500, function () {
			$active.removeClass('yactive2 last-active');		
		});
}
$(function() {
    var playss =  setInterval( "sswitch2()", 7000 );
	$('#ss2').hover(function() {
		clearInterval(playss);
		var caption2 = $('#ss2 a.yactive2').find('img').attr('rel');	
		var html2 = '<div id="tt2">';
			html2 += '<span>' + caption2 + '</span>';
			html2 += '</div>';
			$('#ss2').append(html2).children('#tt2')
			.hide().animate({opacity: 0.7},100 );
			$('#ss2').children('#tt2').animate({height: '40px'},500 ).animate({opacity: 0.7},100 );
	}, function() {
		playss =  setInterval( "sswitch2()", 7000 );
		$('#tt2').remove();
	});
});







function sswitch3() {
    var $active = $('#ss3 a.yactive3');
	if ($active.length == 0) $active = $('#ss3 a:last');
    var $next = $active.next().length ? $active.next()
				: $('#ss3 a:first'); 
	$active.addClass('last-active');   
    $next.css({opacity: 0.0})
		.addClass('yactive3')
		.animate ({opacity:1.0}, 1500, function () {
			$active.removeClass('yactive3 last-active');		
		});
}
$(function() {
	var mySpeed = 5000;
    var playss =  setInterval( "sswitch3()", mySpeed );
	$('#ss3').hover(function() {
		clearInterval(playss);
		var caption3 = $('#ss3 a.yactive3').find('img').attr('rel');	
		var html3 = '<div id="tt3">';
			html3 += '<span>' + caption3 + '</span>';
			html3 += '</div>';
			$('#ss3').append(html3).children('#tt3')
			.hide().animate({opacity: 0.7},100 );
			$('#ss3').children('#tt3').animate({height: '40px'},500 ).animate({opacity: 0.7},100 );
	}, function() {
		playss =  setInterval( "sswitch3()", mySpeed );
		$('#tt3').remove();
		
	});

});






$(function() {
	$('#ss5').hover(function() {
		var caption5 = $('#ss5').find('img').attr('rel');	
		var html5 = '<div id="tt5">';
			html5 += '<span>' + caption5 + '</span>';
			html5 += '</div>';		
			$('#ss5').append(html5).children('#tt5').hide().animate({opacity: 0.7},100 );
			$('#ss5').children('#tt5').animate({height: '40px'},500 ).animate({opacity: 0.7},100 );
	}, function() {
		$('#tt5').remove();
	});
	
	$('#ss6').hover(function() {
		var caption6 = $('#ss6').find('img').attr('rel');	
		var html6 = '<div id="tt6">';
			html6 += '<span>' + caption6 + '</span>';
			html6 += '</div>';		
			$('#ss6').append(html6).children('#tt6').hide().animate({opacity: 0.7},100 );
			$('#ss6').children('#tt6').animate({height: '40px'},500 ).animate({opacity: 0.7},100 );
	}, function() {
		$('#tt6').remove();
	});
			   
	$('#ss7').hover(function() {
		var caption7 = $('#ss7').find('img').attr('rel');	
		var html7 = '<div id="tt7">';
			html7 += '<span>' + caption7 + '</span>';
			html7 += '</div>';		
			$('#ss7').append(html7).children('#tt7').hide().animate({opacity: 0.7},100 );
			$('#ss7').children('#tt7').animate({height: '40px'},500 ).animate({opacity: 0.7},100 );
	}, function() {
		$('#tt7').remove();
	});
	
	
});

