$(function(){
	$("#news_slider").cycle({
		fx:'scrollDown', 
		speed:  450, 
		timeout: 4000, 
		sync: 1
	});
	$("#phone1").hover(
		function()
		{
			$(this).animate(
			{
				'left':'398px',
				'top':'185px'
			}, 300);
		},
		function()
		{
			$(this).animate(
			{
				'left':'413px',
				'top':'200px'
			}, 300);
		}
	);
	$("#phone2").hover(
		function()
		{
			$(this).animate(
			{
				'left':'540px',
				'top':'166px'
			}, 300);
		},
		function()
		{
			$(this).animate(
			{
				'left':'555px',
				'top':'181px'
			}, 300);
		}
	);
	$("#phone3").hover(
		function()
		{
			$(this).animate(
			{
				'left':'692px',
				'top':'130px'
			}, 300);
		},
		function()
		{
			$(this).animate(
			{
				'left':'707px',
				'top':'145px'
			}, 300);
		}
	);
	$('#phone-spread > div').click(function() {
		var href = $(this).attr("data-url");
  		document.location.href = href;
  		return false;
	});
	
	$('.slide-inner-wrapper').click(function() {
		var href = $(this).attr("data-url");
  		document.location.href = href;
  		return false;
	});
	$("#slideshow").cycle({
		speed:  750,
		timeout: 15000,
		before: onBefore,
		pause:  1,
		pager:  '#slide_nav_pagination',
		prev:    '#prev',
		next:    '#next'
	});
	function onBefore(data)
	{
		var current_slide = $(this).attr('id');
	}
	$("#slideCrossover .slideOverlay").hover(
		function()
		{
			$('#coSecPhone').animate({
				'left':'0px'
			}, 250);
			$("#slideCrossover a").addClass('active');
		}, 
		function()
		{
			$('#coSecPhone').animate({
				'left':'-200px'
			}, 250);
			$("#slideCrossover a").removeClass('active');
		}
	);	
	$("#slideCrossover .slideOverlay").click(function()
	{
		$("#slideCrossover a").click();
		return true;
	});	

	on = 0;
	$("#slide_pocket .slide-copy").hover(function(){
		$("#phone-overlay").fadeIn(100);
		$("#pocket_learn_more a").addClass('active');
	}, function(){
		$("#phone-overlay").fadeOut(100);
		$("#pocket_learn_more a").removeClass('active');
	});
	
	$("#slideBreakout .slideOverlay").hover(
		function()
		{
			$('#bPhone').animate(
			{
				'rotate': 4
			}, 20);
			$("#slideBreakout a").addClass('active');
		},
		function()
		{
			$('#bPhone').animate(
			{
				'rotate': 0
			}, 20);
			$("#slideBreakout a").removeClass('active');
		}
	);
	
	$("#slideElement .slideOverlay").hover(
		function()
		{
			$('h4#burst').animate(
			{
				'rotate': -2
			}, 20);
			$("#slideElement a").addClass('active');
		},
		function()
		{
			$('h4#burst').animate(
			{
				'rotate': 0
			}, 20);
			$("#slideElement a").removeClass('active');
		}
	);
	
	$("#slideBurst .slideOverlay").hover(
		function()
		{
			$('#burstPhoneFront').animate(
			{
				'rotate': -1
			}, 20);
			$('#burstPhoneBack').animate(
			{
				'rotate': 2
			}, 20);
			$("#slideBurst a").addClass('active');
		},
		function()
		{
			$('#burstPhoneFront').animate(
			{
				'rotate': 0
			}, 20);
			$('#burstPhoneBack').animate(
			{
				'rotate': 0
			}, 20);
			$("#slideBurst a").removeClass('active');
		}
	);
	
	$("#slideElementBurst .slideOverlay").hover(
		function()
		{
			$('#burstPhone').animate(
			{
				'rotate': -3
			}, 20);
			$('#elementTablet').animate(
			{
				'rotate': 2
			}, 20);
			$("#slideElementBurst a").addClass('active');
		},
		function()
		{
			$('#burstPhone').animate(
			{
				'rotate': 0
			}, 20);
			$('#elementTablet').animate(
			{
				'rotate': 0
			}, 20);
			$("#slideElementBurst a").removeClass('active');

		}
	);
	$("#slideTorin .slideOverlay").hover(
		function()
		{
			$("#torin").addClass('active');
			
			
			$('#winners-row').animate(
			{
				'rotate': -3
			}, 20);
		},
		function()
		{
			$("#torin").removeClass('active');
			
			$('#winners-row').animate(
			{
				'rotate': 3
			}, 20);
		}
	);


});
