var msie6 = $.browser.msie && /MSIE 6\.0/i.test(window.navigator.userAgent) && !/MSIE 7\.0/i.test(window.navigator.userAgent);

if (!msie6) {

	$(function(){
	
		//show the page, non js get markup with different css
		$('div#container').show();
		
		//position the smaller logos
		if ($('div.ondemand').length) {
			$('div#tlagay').css('left', '400px');
			$('div#tlaraw').css('left', '200px');
		} else {
			$('div#tlagay').css('left', '400px');
			$('div#tlaraw').css('left', '200px');
			$('div#tlalesbian').css('right', '200px');
			$('div#tlamovies').css('right', '400px');
		}
		
		//animation & interaction timing
		fadeInLogoDelay = setTimeout('fadeInLogo();', 300); //300ms + 1000ms(animation time)
		showLogosDelay = setTimeout('showLogos();', 1500); //1300ms + 200ms(buffer)
		animateLogosDelay = setTimeout('animateLogos();', 1700); //1500ms + 200ms(buffer)
		if ($('div.ondemand').length) {
			showVodDescriptDelay = setTimeout('showVodDescript();', 3200); //1700ms + 1500ms(animation)
		}
		hoverLogosDelay = setTimeout('hoverLogos();', 3200); //1700ms + 1500ms(animation)
	});
	
	function fadeInLogo(){
		$('h1, span.shadow').css({opacity: 0.0,visibility: 'visible'}).animate({opacity: 1.0}, 1000);
	}
	
	function showLogos(){
		$('h2, h2 a').css({visibility: 'visible'});
	}
	
	function animateLogos(){
		if ($('div.ondemand').length) {
			$('div#tlagay').animate({left: '200'}, 1500);
			$('div#tlaraw').animate({left: '400'}, 1500);
		} else {
			$('div#tlagay').animate({left: '0'}, 1500);
			$('div#tlaraw').animate({left: '0'}, 1500);
			$('div#tlalesbian').animate({right: '0'}, 1500);
			$('div#tlamovies').animate({right: '0'}, 1500);
		}
	}
	
	function showVodDescript() {
		$('div.window p').fadeIn('slow');
	}
	
	function hoverLogos(){
		$('div.window').hover(function(){
			parentID = $(this).attr('id');
			$overImage = $('div#tla div.' + parentID);
			if (!$overImage.hasClass('active')) {
				$(this).oneTime(700, "hoverLogo", function(){
					if (!$('div.ondemand').length) {
						$(this).children('p').fadeIn('slow');
					}
					$overImage.css({opacity: 0.0,visibility: 'visible'}).animate({opacity: 1.0}, 700).addClass('active');
				});
			}
		}, function(){
			$(this).stopTime("hoverLogo");
			if (!$('div.ondemand').length) {
				$('div.window p:visible').fadeOut('slow');
			}
			$('div.over').animate({opacity: 0.0}, 700).removeClass('active');
		});
	}
	
} else {
	$('div.noscript').parent('div').show();
}
