/**
 * jQuery.slidAR
 * Copyright (c) 2010-2011 Artistokrats.com - info(at)artistokrats(dot)com | http://artistokrats.com
 * Dual licensed under MIT and GPL.
 * Date: 5/16/2011
 *
 * @projectDescription Heavy element scrolling using jQuery.
 *
 * @author Artistokrats.com
 * @version 1.0a
**/



var topNews = 1;
var c = 0;



// topNewsAutoPlayStart
function topNewsAutoPlayStart(topNewsCurrent, id) {
	t = setTimeout(function() {topNewsAutoPlayCount(topNewsCurrent, id)}, 10000);
}



// topNewsAutoPlayStart
function topNewsSlidePlay(topNewsCurrent, id) {
	t = setTimeout(function() {topNewsAutoPlayCount(topNewsCurrent, id)}, 0);
	
	$(".top-news-counter li.pause").css("z-index", "999");
	$(".top-news-counter li.play").css("z-index", "998");
}






// topNewsAutoPlayCount
function topNewsAutoPlayCount(topNewsCurrent, id) {
	var autoScrollSpeed = 500; // 500
	var topNewsContents = $(".top-news-content").length;
	
	
	if (topNewsCurrent > topNewsContents) { topNewsCurrent = 1; }
	
	
	
	var dateCurrent = "#top-news-date-" + topNewsCurrent;
	var imageCurrent = "#top-news-image-" + topNewsCurrent;
	var textCurrent = "#top-news-text-" + topNewsCurrent;
	var smallImageCurrent = "#top-news-small-image-" + topNewsCurrent;
	
	
	
	var date = "#top-news-date-" + id;
	var image = "#top-news-image-" + id;
	var text = "#top-news-text-" + id;
	var smallImage = "#top-news-small-image-" + id;
	
	
	
	// ha nagyobbra kattint
	$(date).delay(0).animate({left: "2380px"}, 0);
	$(image).delay(0).animate({left: "2433px"}, 0);
	$(text).delay(0).animate({left: "3040px"}, 0);
	$(smallImage).delay(0).animate({left: "3200px"}, 0);
	
	
	$(dateCurrent).delay(0).animate({left: "-980px", opacity: "0"}, 400);
	$(imageCurrent).delay(0).animate({left: "-927px", opacity: "0"}, 400);
	$(textCurrent).delay(0).animate({left: "-320px", opacity: "0"}, 400);
	$(smallImageCurrent).delay(0).animate({left: "-160px", opacity: "0"}, 400);
			
	
	
	// scroll
	var content = "#top-news-content-" + id;
	$("#top-news-mask").delay(200).scrollTo(content, 0, "swing");
	
	
	
	// elemek beanimalasa
	// ha nagyobbra kattint
	$(date).delay(0).animate({left: "510px", opacity: "1"}, 1000, "easeOutCubic");
	$(image).delay(200).animate({left: "563px", opacity: "1"}, 800, "easeOutCubic");
	$(text).delay(400).animate({left: "1170px", opacity: "1"}, 600, "easeOutCubic");
	$(smallImage).delay(600).animate({left: "1330px", opacity: "1"}, 400, "easeOutCubic");
	
	
	
	
	
	if (id < topNewsContents) {
		topNewsCurrent++;
		id++;
	}
	

	
	else {
		topNewsCurrent = topNewsContents;
		id = 1;
	}
		
	
	
	t = setTimeout(function() {topNewsAutoPlayCount(topNewsCurrent, id)}, 10000);
}



// autoPlayPause
function topNewsSlidePause() {
	clearTimeout(t);
	
	$(".top-news-counter li.pause").css("z-index", "998");
	$(".top-news-counter li.play").css("z-index", "999");
}



