function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
    // The index() method calculates the index from a
    // given index who is out of the actual item range.
    var idx = carousel.index(i, mycarousel_itemList.length);
    carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1]));
	
	Cufon.replace('.carouselItem .title', {fontFamily: 'Avenir 85 Heavy Oblique TR'});
};
$(document).ready(function(){
	/*$("#carousel").css('visibility', 'hidden');
	
	function showCarousel(){
		
		var agent=navigator.userAgent.toLowerCase();
		var is_iphone = (agent.indexOf('iphone')!=-1);
		
		
		if (is_iphone) {
			$("#carousel").css('visibility', 'visible');
			
		}
		else{
			if($(".carouselItem").height() == null){
				setTimeout(showCarousel,250);
			}
			else{
				$("#carousel").css('visibility', 'visible');
				$(".carouselItem").css('height', '27px');
				$(".carouselItem").css('marginTop', '138px');

				$(".jcarousel-prev-horizontal").css('top', '132px');
				$(".jcarousel-next-horizontal").css('top', '132px');

				$("#carousel").hover(
					function() {
						$(".carouselItem").stop();
						$(".jcarousel-prev-horizontal").stop();
						$(".jcarousel-next-horizontal").stop();

						$(".carouselItem").animate({
							height: '165px',
							marginTop: '0px'
							}, 200);

						$(".jcarousel-prev-horizontal").animate({
							top: '63px'
						}, 200);
						$(".jcarousel-next-horizontal").animate({
							top: '63px'
						}, 200);
					},
					function() {
						$(".carouselItem").stop();
						$(".jcarousel-prev-horizontal").stop();
						$(".jcarousel-next-horizontal").stop();

						$(".carouselItem").animate({
							height: '27px',
							marginTop: '138px'
						}, 200);

						$(".jcarousel-prev-horizontal").animate({
							top: '132px'
						}, 200);
						$(".jcarousel-next-horizontal").animate({
							top: '132px'
						}, 200);
					}
				);
			}
			
			
		}
		
		
		
	}
	
	setTimeout(showCarousel,250);*/
	
});

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
    carousel.remove(i);
};

/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(item)
{
	var output = '<a href="' + item.link + '" target="' + item.window + '"><div class="carouselItem';
	if ((item.title == "Hava Durumu") || (item.title == "Weather Report")){
		output += ' havaDurumu';
	}
	output += '"><div class="title">' + item.title + '</div><div class="content">' + item.content + '</div><div class="footer ' + item.footerAlign + '"><a href="' + item.link + '">' + item.footer + '</a></div></div><a/>';
    return output;
};
