$(function(){
	
	$("#logos").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
        visible: 8,
        auto: 1000,
    	speed: 1000
    });
    
    $('a[href$=".jpg"], a[href$=".jpeg"], a[href$=".png"], a[href$=".gif"], a[href$=".JPG"], a[href$=".JPEG"], a[href$=".PNG"], a[href$=".GIF"]').fancybox();
	
	testshow = {
		list : [],
		loaded : [],
		makelist : function(a) {
			var i = $(a);
			i.each(function() {
				var b = $(this);
				testshow.list.push(b);
				b.remove();
			});
			testshow.list.reverse()
			$("#slogan").html("<div></div>");
			testshow.run();
		},
		run : function() {
			var src = testshow.takeone();

			if (typeof (src) == "object") {

				src.show();

				var s = $("#slogan");

				src.children("h3").css("margin-left", "-960px")
				src.children("h3").css("opacity", 0)
				src.children("h4").css("margin-left", "960px")
				src.children("h4").css("opacity", 0)
				src.children(":last").addClass("btm");

				d = s.children("div");
				src.appendTo(s);

				d.fadeOut(800, function() {
					d.remove();

				});
				
				src.children("h4,h3").show();
				src.children("h4,h3").css("width", "100%").animate({
					"margin-right" : 0,
					"margin-left" : 0,
					"opacity": 1
				}, 3000, function() {

				})
				setTimeout("testshow.run()", 15000);
				;

			}

		},
		takeone : function() {
			if (testshow.list.length > 0) {
				var t = testshow.list.shift()
				testshow.loaded.push(t);
				return t;
			} else if (testshow.loaded.length > 0) {
				testshow.list = testshow.loaded;
				testshow.loaded = [];
				return testshow.takeone();
			}
			return false;

		}
	}
	
	
	testshow.makelist("#slogan div");
});
