// ShowGoods
function downLoadImage()
{
	var tImgs = new Array(bigImages.length);
	for(var i = 0;i < tImgs.length;i++)
	{
		tImgs[i] = document.createElement("img");
		tImgs[i].src = bigImages[i];
	}
}
function showBigImage(index)
{
	//bigImages
	if(!window.bigImages)return;
	var showImgUrl = null;
	if(window.showImagePage)showImgUrl = showImagePage.replace("$ID$",goodsID).replace("$Index$",index);
	var GoodsImg = null;
	if(window.con)GoodsImg = document.getElementById(con["GoodsImg"]);
	if(GoodsImg)
	{
		GoodsImg.onload = reSize;
		GoodsImg.src = bigImages[index];
		var LargeImageLink = document.getElementById(con["LargeImage"]);
		LargeImageLink.href = showImgUrl;
		GoodsImg.parentElement.href = showImgUrl;
	}
}
function reSize()
{
	
	var GoodsImg = document.getElementById(con["GoodsImg"]);
	var temp = document.createElement("img");
	temp.src = GoodsImg.src;
	var s = new Size(temp.width,temp.height);
	if(!window.goodsImageMaxWidth)
	{
		window.goodsImageMaxWidth = 100;
	}
	if(!window.goodsImageMaxHeight)
	{
		window.goodsImageMaxHeight = 100;
	}
	s = GetSizeForMax(s,goodsImageMaxWidth,goodsImageMaxHeight);
	GoodsImg.width = s.Width;
	GoodsImg.height = s.Height;
	GoodsImg.onload = null;
	GoodsImg.src = temp.src;
}
//showBigImageForGoodsImagePage
function reSizeShowBigImage(img)
{
	img.style.display = '';
	bigImg.document.body.style.margin = 0;
	//bigImg.document.body.style.textAlign = "center";
	var s = new Size(img.width,img.height);
	if(!window.iframeWidth)iframeWidth = 500;
	var bigImg0 = document.getElementById("bigImg");
	var w = parseInt(bigImg0.style.width);
	var h = parseInt(bigImg0.style.height);
	s = GetSizeForMax(s,w,h);
	//img.rWidth = img.width;
	//img.rHeight = img.height;
	cW = img.width;
	cH = img.height;
	img.width = s.Width;
	img.height = s.Height;
}
function showBigImageForGoodsImagePage(index,noResize)
{
	//if(window.moveLayer)return;
	if(bigImages.length >= 1)
	{
		if(index == -1)
		{
			index = bigImages.length - 1;
		}
		else
		{
			if(index == bigImages.length)
			{
				index = 0;
			}
		}
		if(index >=0 && index < bigImages.length)
		{
			var imageCount = document.getElementById("imageCount");
			var currentIndex = document.getElementById("currentIndex");
			currentIndex.innerHTML = index + 1;
			imageCount.innerHTML = bigImages.length;
			//var currentImage = document.getElementById("currentImage");
			//alert(currentImage.document.body.innerHTML);
			//var reSize = "onload='parent.reSizeShowBigImage(this);'";
			//alert(bigImg.document.body);
			bigImg.document.body.innerHTML = "<img id='cuImg' style='display:none' onload='parent.reSizeShowBigImage(this);' onmousemove='parent.move(window)' onmousedown='parent.down(this,window)' onmouseup='parent.up(this,window)' style='position:absolute;' src='" + bigImages[index] + "'/>";
			bigImg.document.body.oncontextmenu = function()
			{
				return false;
			}
			cImg = null;
			//cImg.index = index;
			cuIndex = index;
			//currentImage.src = bigImages[index];
			//currentImage.style.display = "";
		}
	}
}
function preImage()
{
	var currentIndex = document.getElementById("currentIndex");
	index = parseInt(currentIndex.innerHTML);
	index -= 2;
	showBigImageForGoodsImagePage(index);
}
function nextImage()
{
	var currentIndex = document.getElementById("currentIndex");
	
	index = parseInt(currentIndex.innerHTML);
	showBigImageForGoodsImagePage(index);
}