/*
* hirdetés rotáláshoz
*/
var selectedAd = 0;
var countAdBox = 0;
var adbox_html = '';
var adbox_href = '';

/*
*	jquery document ready
*/
$(document).ready(function () {

	/*
	* hirdetés rotálás
	*/
	countAdBox = $(".advertListRow .advertBox").size();
	if (countAdBox > 0)
	{
		ShowNextAdvert();
	}
		
	/*
	* fancy box
	*/
	if ($("a.picWrap").size() > 0)
	{
		$("a.picWrap").fancybox();
	}
	
});


function check_pics_name() {
	var ret = true;
	$(".gameUserPics .placeholder .text").each(function(){
		if ($(this).val() == '')
		{
			ret = false;
		}
	})

	if (ret)
		return confirm('Biztosan beküldi a fotóit a játékba?');
		
	alert('Minden képet el kell nevezni!');
	return false;
}

function ShowAdvert(adbox_obj)
{
	adbox_html = adbox_obj.html();
	adbox_href = adbox_obj.attr('href');
	$("#advertPlaceholder #adPlace").html(adbox_html);
	$("#advertPlaceholder #adPlace").attr('href', adbox_href);
	$("#advertPlaceholder").show();
}

function ShowNextAdvert()
{
	$(".advertListRow .advertBox").each(function(currentAdBox){
		if (selectedAd == currentAdBox)
		{
			ShowAdvert($(this));
		}
	})
	selectedAd = (selectedAd + 1) % countAdBox;
	setTimeout("ShowNextAdvert()", 3000);
}

