Namespace.register("PaiPai.Images ");
PaiPai.Images = function(){
	this.ProductName = "";
	this.Data = 
	[
		{"path":"/Public/Products/imglarge/20101120114056.jpg","Small":"/Public/Products/imglarge/20101120114056.jpg","title":""},
		{"path":"/Public/Products/imglarge/20101120114114.jpg","Small":"/Public/Products/imglarge/20101120114114.jpg","title":""}
	];
	this.oDiv_LargePicList = null;
	this.oDiv_SmallPicList = null;
	this.IsAccectClick = true;//是否允许点击（如果动画显示未完成前，不能进行再次点击。）
	this.oTime = null;

	this.Init = function(TagDivLarge,TagDivSmall){
		var _this = this;
		this.oDiv_LargePicList = jQuery("#" + TagDivLarge);
		this.oDiv_SmallPicList = jQuery("#" + TagDivSmall);
	};
	this.DataSource = function(_data){
		this.Data = _data;
	}

	this.DataBind = function()
	{
		var _this = this;
		var html = '';//<h3 class="n_hn n_hh">' + _this.ProductName + ' - 图片</h3>';
		var html_Small = "";
		if(_this.Data!=null){
			try
			{
				var i=0;
				for(i=0;i<_this.Data.length && i<4;i++){
					html += '<a id="DivPicLargeHref_'+ i +'" onclick="Common.ShowBigPic(\''+ _this.Data[i].Path +'\')" target="_blank" style="display:none;">'
						+ '<img id="DivPicLarge_'+ i +'" src="'+ _this.Data[i].Path +'" alt="'+ _this.ProductName +'" />'
						+ '</a>';
					html_Small += '<a id="DivPicSmallHref_'+ i +'" href="#" value="'+ i +'">'
						+ '<img id="DivPicSmall_'+ i +'" src="'+ _this.Data[i].Small +'" alt="'+ _this.ProductName +'" />'
						+ '</a>\r\n';		
				}
			}
			catch(e)
			{
				alert(e.message);
				_this.Data = null;
			}
		}
		_this.oDiv_SmallPicList.html(html_Small);
		_this.oDiv_LargePicList.html(html+"&nbsp;");
	};
	this.Click = function(n){
		
		var _this = this;
		if(_this.IsAccectClick==false){
		 	return false;
		}
		if(this.Data!=null)
		{
			if(this.Data.length>n)
			{
					_this.IsAccectClick=false;
				jQuery("a[id^='DivPicLargeHref_']").hide();
				jQuery("#DivPicLargeHref_"+n).show(1,function(){_this.IsAccectClick=true;});//显示
				
				jQuery("a[id^='DivPicSmallHref_']").css("background-color","#DDDDDD");
				jQuery("#DivPicSmallHref_"+n).css("background-color","#ff0000");
			}
		}
		return false;
	};
	this.AddEvent = function(){
		var _this = this;
		jQuery("a[id^='DivPicSmallHref_']").click(function(){
			var n = jQuery(this).attr("value");
			_this.Click(n);
			return false;
		});
	};
	/*
	this.Delay = function(_second){
		var _this = this;
		this.oTime = setTimeout(_this.CallBackFunc(),_second*1000);
		return false;
		
	};
	this.CallBackFunc = function(){
		var _this = this;
		_this.IsAccectClick==true;
		clearInterval(_this.oTime);
	}*/
	
};

/*
var oImage = new PaiPai.Images();
oImage.Init("div_LargePicList","div_SmallPicList");
oImage.DataSource(d);
oImage.DataBind();
oImage.AddEvent();
oImage.Click(0);

*/
