﻿
var alpha=0;
var dirPath="../UploadFile/Product/";
var doc;
var obj1;

var obj2;
var objTitle;
var objBody;
var objImgShow;
var objDownLoadFile;

var objDivMaxImg;
var objImgMax;


function SetObj()
{		
	doc=document.documentElement;
	obj1=document.getElementById("divMax");
	
	obj2=document.getElementById("divShowData");
	objTitle=document.getElementById("title");
	objBody=document.getElementById("body");
	objImgShow=document.getElementById("imgShow");
	objDownLoadFile=document.getElementById("downloadFile");
	
	objDivMaxImg=document.getElementById("divMaxImg");
	objImgMax=document.getElementById("imgMax");	
}

function ShowObj(strTitle,strBody,imgUrl,downloadFile)
{	
	objTitle.innerHTML=strTitle;
	objBody.innerHTML=strBody;	
	objImgShow.src=dirPath+imgUrl;
	
	if(downloadFile=="")
		objDownLoadFile.href="###";
	else
		objDownLoadFile.href=dirPath+downloadFile;
	
	obj1.style.left="0px";
	obj1.style.top="0px";
	obj1.style.width=doc.scrollWidth;
	obj1.style.height=doc.scrollHeight;
	obj1.style.filter="alpha(opacity=60)";
	obj1.style.display='';
		
	obj2.style.display='';		
	obj2.style.top= (doc.clientHeight-obj2.offsetHeight)/2+doc.scrollTop;
	obj2.style.left=(doc.clientWidth-obj2.offsetWidth)/2+doc.scrollLeft;
	
	alpha=0;
	
	ObjAlpha();
}

function HiddObj()
{
	obj1.style.display='none';
	obj2.style.display='none';
}

function ObjAlpha()
{
	obj2.style.filter="alpha(opacity="+alpha+")";

	if(alpha<100)
		setTimeout(ObjAlpha,50);
		
	alpha+=10;
}



function ShowObj2(imgUrl)
{		
	objImgMax.src=dirPath+imgUrl;	
	
	obj1.style.left="0px";
	obj1.style.top="0px";
	obj1.style.width=doc.scrollWidth;
	obj1.style.height=doc.scrollHeight;
	obj1.style.filter="alpha(opacity=60)";
	obj1.style.display='';
	
	objDivMaxImg.style.display='';		
	objDivMaxImg.style.top= (doc.clientHeight-objDivMaxImg.offsetHeight)/2+doc.scrollTop;
	objDivMaxImg.style.left=(doc.clientWidth-objDivMaxImg.offsetWidth)/2+doc.scrollLeft;
	
	alpha=0;
	
	ObjAlpha2();
}

function HiddObj2()
{
	obj1.style.display='none';
	objDivMaxImg.style.display='none';
}

function ObjAlpha2()
{
	objDivMaxImg.style.filter="alpha(opacity="+alpha+")";

	if(alpha<100)
		setTimeout(ObjAlpha2,50);
		
	alpha+=10;
}
