function loadList(page)
{
	//$("#list_item").html("<div style='text-align:center;margin:50px;'><image src='" + base_url() + "/images/news/loading.gif'></div>");
	$.ajax({
		url: base_url() + "news_list.php",
		type: "GET",
		data: "home=true&page="+ page +"&offset=3&_="+ Math.random(),
		success: function(data){
			$("#fetch-news").html(data);
		}
	});
}

function changeHot(step)
{
	var current = parseInt($('.dish-item.active').attr('rel'));
	var currentObj = $('.dish-item[rel='+current+']');
	var next = current + parseInt(step);
	var nextObj = $('.dish-item[rel='+next+']');
	
	// remove current
	/* if($.browser.msie) currentObj.removeClass('active');
	else currentObj.animate({opacity: 0}, function(){ $(this).removeClass('active'); });
	
	if(nextObj.length){
		if($.browser.msie) nextObj.addClass('active');
		else nextObj.addClass('active').animate({opacity: 1});
	}else{
		if(step=='-1')
			nextObj = $('.dish-item').eq($('.dish-item').length-1);
		else
			nextObj = $('.dish-item').eq(0);
		
		if($.browser.msie) nextObj.removeClass('active');
		else nextObj.addClass('active').animate({opacity: 1});
	} */
	
	// remove current
	if($.browser.msie){ currentObj.removeClass('active'); }
	else{ currentObj.animate({opacity: 0}, function(){ $(this).removeClass('active'); }); }
	
	if(nextObj.length){
		if($.browser.msie){ nextObj.addClass('active'); }
		else{ nextObj.addClass('active').animate({opacity: 1}); }
	}else{
		if(step=='-1')
			nextObj = $('.dish-item').eq($('.dish-item').length-1);
		else
			nextObj = $('.dish-item').eq(0);
		
		if($.browser.msie){ nextObj.addClass('active'); }
		else{ nextObj.addClass('active').animate({opacity: 1}); }
	}
}

$(document).ready(function(){
	/* $("#slider").jcarousel({
		btnNext: ".next",
		btnPrev: ".prev",
		visible: 7,
		auto:2,
		wrap: 'last',
		initCallback: mycarousel_initCallback

	}); */

	// hot dish
	// $('.dish-item').eq(0).addClass('active');
	// if(!$.browser.msie) $('.dish-item').not(':first-child').css({opacity: 0});
	
	//$("#slider").easySlider({
	//	continuous: true,
	//	auto: true,
	//	speed: 1500,
	//	pause: 5000
	//});
	
	// fetch news
	// ------------------------------------------------
	loadList(1);
	
	// highlight banner 
	// ------------------------------------------------
	$('#embed-flash').embedSWF({
		src: base_url() + 'swf/main_loading.swf', 
		width: "948", 
		height: "388",
		flashvars: {
			swffile: base_url() + 'swf/index_banner_home.swf',
			swf_w: '948',
			swf_h: '388',
			path: base_url(),
			lang: getLang(),
			xmlfile: 'http://'+ window.location.hostname +'/xml/xml.php?cmd=banner&lang='+getLang()
		}
	});
	
	$('#flv_recommended').embedSWF({
		src: base_url() + 'swf/recommended.swf', 
		width: "312", 
		height: "430",
		wmode:"transparent",
		flashvars: {
			xmlfile: 'http://'+ window.location.hostname +'/xml/xml.php?cmd=hot_dish&lang='+getLang(),
			lang: getLang()
		}
	});

});