﻿function imgBox()
{
	this.cm_num=0;
	this.div=document.getElementById('show_img');
	this.img=document.getElementById('img_on_show');
	this.filter=document.getElementById('img_filter');
	this.cm=document.getElementById('img_cm');
	this.cm_top=document.getElementById('img_cm_top');
	this.cm_content=document.getElementById('img_cm_content');
	
	this.showImg=function(bg_color,border_color,pos)
	{
		document.getElementById('img_loading').style.display='block';
		this.div.style.display='none';
		this.phid=dataSet.phid[pos];
		this.div.style.borderColor=border_color;
		this.div.style.backgroundColor=bg_color;
		this.img.src=photoPage.src[pos];
		this.filter.style.display="block";
		this.img.onload=function(){
				var div = document.getElementById('show_img');
				var img = document.getElementById('img_on_show');
				var cm = document.getElementById('img_cm');
				document.getElementById('img_loading').style.display='none';
				div.style.marginLeft=(-1*Math.round(img.width/2))+'px';
				cm.style.marginLeft=(-1*img.width/2)-150+'px';
				cm.style.display='block';
				div.style.display='block';
			};
			
		document.getElementById('pcauthor').value='網名';
		document.getElementById('small_pccontent').value='留言內容';
		document.getElementById('pccontent').value='';
	}
	
	this.closeImg=function()
	{
		this.div.style.display='none';
		this.filter.style.display='none';
		this.cm.style.display='none';
		document.getElementById('img_cm_content').style.height='0px';
		document.getElementById('enlarge_text_content').style.display='none';
	}
	
	this.startLoaingImgBox=function(bg_color,border_color,pos)
	{
		document.getElementById('img_loading').style.display='block';
		this.showImg(bg_color,border_color,pos);
		AjaxUpdater.Update('GET','./photo_commend.php?command=select&phid='+dataSet.phid[0],imgCMOnXMLResponse)
	}
	
}