/* 
Budweiser.com Game Commercials JavaScript file 
*/
$(document).ready(function(){
	return;
	var videoTemplate;
	var thumbnailTemplate;

	if (videos.commercials.length <= 0) {
		$('#no-videos').css('display', 'block');
	} else {
		$('#no-videos').remove();
	
		for (var i = 0, j = videos.commercials.length; i < j; i++) {
			videoTemplate = $('#video-template').clone().get(0);
			videoTemplate.id = 'video' + i;

			$('#flash-parent-videoContainer', videoTemplate).get(0).id += i;
			$('#flash-videoContainer', videoTemplate).get(0).id += i;
			$('#videoContainer', videoTemplate).get(0).id += i;
			$('img.video-preview-image', videoTemplate).attr('src', videos.commercials[i].imgpath + '_preview.jpg');
			$('#downloads-container').append(videoTemplate);

			if (Flash.isWorking()) {
				if ($('li.content-view img').length > 0) {
					$('li.content-view img').hide();
				}
			}

			swfobject.embedSWF("/media/swf/budweiser/videoplayer.swf", "videoContainer" + i, "540", "304", Flash.minVersion, "", {
				playerWidth: '540', 
				playerHeight:  '304', 
				lang: 'en', 
				videoFile:videos.commercials[i].videopathstream,
				imageFile: videos.commercials[i].imgpath + '_preview.jpg', 
				highresFile: videos.commercials[i].videopathdownload + '-hi.mp4',
				lowresFile: videos.commercials[i].videopathdownload + '-lo.mp4'
				}, { allowscriptaccess: 'always', bgcolor: '#000000', menu: 'false', allowFullScreen:'true', scale:'noscale', salign:'tl', wmode:'transparent' }, {});

			thumbnailTemplate = $('#thumbnail-template').clone().get(0);
			thumbnailTemplate.id = 'sectionThumbstrip_thumbLink' + i;

			if (i === 0) {
				$(videoTemplate).addClass('current');
				$(thumbnailTemplate).addClass('selected');
				$('img', thumbnailTemplate).addClass('first');
			} else {
				$(thumbnailTemplate).addClass('inactive');
			}
			$('img', thumbnailTemplate).attr('src', videos.commercials[i].imgpath + '_thumb.jpg');
			$(thumbnailTemplate).css('display', 'inline');
			$('#thumbnail-container').append(thumbnailTemplate);

		}

		$('#video-template').remove();
		$('#thumbnail-template').remove();
	}

	// Reproduce downloads.js functionality
	$('#section-thumbstrip li a').each(function(i){
		urlValues[i] = $(this).attr('href');
		$(this).parent().html($(this).html());
	});
	$('#section-thumbstrip li').bind('mouseover',function (e){
		$(this).addClass('active');
		$(this).removeClass('inactive');
	});
	$('#section-thumbstrip li').bind('mouseout',function (e) {
		$(this).addClass('inactive');
		$(this).removeClass('active');
	});
	$('#section-thumbstrip li').bind('click',function (e){
		Player.stopVideo();
		
		var pos = $('#section-thumbstrip li').index(this);
		$('#downloads-container li.content-view.current').fadeOut('fast', function(){
			$('li.content-view .screensaver-platform-container').hide();
			$('li.content-view .desktop-wallpaper-resolution-container').hide();
			$('li.content-view .video-platform-container').hide();
		    $('li.content-view .mobile-wallpaper-form').hide();
			$(this).removeClass('current');
			$('#downloads-container li.content-view:eq('+pos+')').fadeIn('fast', function(){
				$(this).addClass('current');
			});
		});
		$('#section-thumbstrip li.selected').removeClass('selected').addClass('inactive');
		$(this).addClass('selected');
	});

	$('#video0').css('display', 'block');
});
