jQuery.noConflict();
(function($){

$(document).ready(function(){

	if ($.fn.jCarouselLite)
	{
		(function(){
			
			$('#slideshow1 .slider').jCarouselLite({
				btnPrev: '#slideshow1 a.prev',
				btnNext: '#slideshow1 a.next',
				visible: 1,
				scroll: 1,
				speed: 400,
				auto: false,
				circular: true
			});


//			var slides2 = $('#slideshow2 .slider > ul > li').length;
			$('#slideshow2 .slider').jCarouselLite({
				btnPrev: '#slideshow2 a.prev',
				btnNext: '#slideshow2 a.next',
				visible: 1,
				scroll: 1,
				speed: 400,
				auto: false,
				circular: true
			});
//			$('#slideshow2 a.prev').addClass('disabled');


			var slides3 = $('#slideshow3 .slider > ul > li').length, btns = [], s = '', index = 1;
			$('#slideshow3 .slider > ul > li').each(function(){
				s += '<a href="#" id="slide3-' + index + '">Slide ' + index + '</a>';
				btns[btns.length] = '#slide3-' + index;
				index++;
			});
			$('#slideshow3 .nav').html(s);
			$('#slideshow3 .slider').jCarouselLite({
				btnGo: btns,
				visible: 1,
				scroll: 1,
				speed: 5000,
				auto: true,
				circular: true,
				afterEnd: function(li){
					var i = parseInt(li[0].className.split('-')[1]);
					$('#slideshow3 .nav a').removeClass('active');
					$('#slide3-' + i).addClass('active');
				}
			});
			$('#slide3-1').addClass('active');

			var slides3 = $('#slideshow-home.slider > ul > li').length, btns = [], s = '', index = 1;
                        $('#slideshow-home .slider > ul > li').each(function(){
                                s += '<a href="#" id="slide3-' + index + '">Slide ' + index + '</a>';
                                btns[btns.length] = '#slide3-' + index;
                                index++;
                        });
                        $('#slideshow-home .nav').html(s);
                        $('#slideshow-home .slider').jCarouselLite({
                                btnGo: btns,
                                visible: 1,
                                scroll: 1,
                                speed: 5000,
                                auto: true,
                                circular: true,
                                afterEnd: function(li){
                                        var i = parseInt(li[0].className.split('-')[1]);
                                        $('#slideshow-home .nav a').removeClass('active');
                                        $('#slide3-' + i).addClass('active');
                                }
                        });
                        $('#slide3-1').addClass('active');


			var stories = $('#stories .slider > ul > li').length, btns = [], index = 1;
			$('#stories .slider > ul > li').each(function(){
				btns[btns.length] = '#story-' + (index++);
			});

			$('#stories .slider').jCarouselLite({
				btnPrev: '#stories .nav a.prev',
				btnNext: '#stories .nav a.next',
				btnGo: btns,
				visible: 1,
				scroll: 1,
				speed: 500,
				auto: false,
				circular: true
			});


			var slides3 = $('#news2 .slider > ul > li').length;
			$('#news2 .slider').jCarouselLite({
				btnPrev: '#news2 a.prev',
				btnNext: '#news2 a.next',
				visible: 1,
				scroll: 1,
				speed: 400,
				auto: false,
				circular: true
			});

                        $('#scrolling_videos .slider').jCarouselLite({
                                btnPrev: '#scrolling_videos a.prev',
                                btnNext: '#scrolling_videos a.next',
                                visible: 5,
                                scroll: 1,
                                speed: 400,
                                auto: false,
                                circular: false
                        });

		})();
	}

	$('.list2 a').each(function() {
		$(this).click( function() {
			var status = this.title;
			$(this).parents('.slide-item').find('.img-ba img').hide();
			$(this).parents('.slide-item').find('.img-ba .img-'+status).show();
			$(this).parents('.list2').find('a').removeClass('active');
			$(this).addClass('active');
			return false;
		});
	});

	
	$('.text, textarea').each(function(){
		this._value = this.value;
		$(this).focus(function(){
			if (this.value == this._value)
				this.value = '';
		}).blur(function(){
			if (this.value == '')
				this.value = this._value;
		});
	});


	if ($.browser.msie) {
		try {document.execCommand("BackgroundImageCache", false, true);} catch(err){};
		if (typeof(DD_belatedPNG) != 'undefined')
		{
			DD_belatedPNG.fix('img, #topLinks .links2 a span, .btn-store span, #logo a, #menu div, #menu div ul, #mainstage-top, .submit, .button, .nav a');
		}
	}

});

})(jQuery);

