// JavaScript Document
var active_info = new Array;

//tip up jquery script
$(function(){						   
	$('.boxgrid.captionfull').hover(function(){
		$(".cover", this).animate({top:'120px'},'fast');
	}, function() {
		$(".cover", this).animate({top:'210px'},'nomal');
	});
	
	
	//取得活动商品
	$.ajax({
	   type: "POST",
	   url: "index.php?do=ActiveAjax",
	   data: "",
	   success: function(active){
		   
		  if(!active.status)
		  {
			  return false;  
		  } 
		   
		  var act = active.split('&');
		  //活动商品
		  var id = '';
		  
		  for(var i=0; i<act.length; i++)
		  {
			  var goods = act[i].split('=');
			  active_info[goods[0]] = goods[1];
			  id = '#goods'+goods[0];
			  //设置特惠商品价格
			  $(id).text('');
			  $('<img src="../public/images/load_price.gif" />').appendTo($(id));
			  $(id).text(goods[1]);
		  }
		}
	});	
	
	//默认选中第一个轮播广告
	$('.lyceem_ad_nav_01').click();
	
	//放假通知
	//setTimeout('holiday()' , 20000);
	
	//单击收起通知
	$('#hide_notice').click(function() {
		holiday();
	});
});

/**
 * 切换广告
 */
function changeAd(obj,name,cursel,curse2){
	$('.'+name).css('display','none');
	$('#'+name+'_0'+cursel).css('display','block');

	for(i = 1;i <= 3 ;i++){
		if(curse2 == i){
			$(obj).removeClass(name+'_nav_0'+curse2);
			$(obj).addClass(name+'_nav_0'+cursel);	
		}else{
			var id = i + 3;
			$('#ad_nav_0'+i).removeClass(name+'_nav_0'+ id);
			$('#ad_nav_0'+i).addClass(name+'_nav_0'+ i);
		}	
	}
	
}


//设置div高度
function setDivHeight(height)
{	
	var h = height + 'px';
	$('.goods_list').css('height', h);
}


//放假通知
function holiday()
{
	$('.holiday').animate({height:0 , width:970 , opacity : 0} , 1000);
	$('#top_ad').css('margin-top','-5px');
}
