window.onerror=function()
{
	//return true;
}

var iDivHeight = 420;
var iDivWidth = 420;   
var big_img_width, big_img_height;
var sels = document.getElementsByTagName('select');
document.write('<div id="big_img_div" style="overflow:hidden; z-index:1001; position:absolute; top:0px; left:0px; display:none; background-color:#ffffff" class="table_border"></div>');
   
function getSize(img)
{
    if(typeof(img)!='object')
        img=document.getElementById(img);
    if(img==null)
        return;
    var image=document.createElement("img");
    image.onload=function()
	{
        big_img_width=this.width;
        big_img_height=this.height;
    }
    image.src=img.src;
}

function show(src, sFileName)   
{
	var iPosX, iPosY;       
	var iMouseX = event.offsetX;
	var iMouseY = event.offsetY;
	
	var iBigImgWidth = big_img_width;
	var iBigImgHeight = big_img_height;
	color_div.style.display='';
	
	var iMultiple = iBigImgWidth/document.getElementById('pro_img').width;
	
	if (iBigImgWidth <= iDivWidth)
	{
		iPosX = (iDivWidth - iBigImgWidth) / 2;   
	}   
	else
	{   
		if ((iMouseX * iMultiple) <= (iDivWidth / 2))   
		{   
			iPosX = 0;   
		}   
		else   
		{   
			if (((src.clientWidth - iMouseX) * iMultiple) <= (iDivWidth / 2))   
			{   
				iPosX = -(iBigImgWidth - iDivWidth);   
			}   
			else   
			{   
				iPosX = -(iMouseX * iMultiple - iDivWidth / 2);   
			}   
		}   
	} 
	
	if (iBigImgHeight <= iDivHeight)   
	{
		iPosY = (iDivHeight - iBigImgHeight) / 2;   
	}   
	else   
	{   
		if ((iMouseY * iMultiple) <= (iDivHeight / 2))   
		{   
			iPosY = 0;   
		}   
		else   
		{   
			if (((src.clientHeight - iMouseY) * iMultiple) <= (iDivHeight / 2))   
			{   
			 	iPosY = -(iBigImgHeight - iDivHeight);   
			}   
			else   
			{   
			 	iPosY = -(iMouseY * iMultiple - iDivHeight / 2);   
			}   
		}   
	}
	
	big_img_div.style.left=document.getElementById('big_img_table').getBoundingClientRect().left+document.body.scrollLeft+350+'px';
	big_img_div.style.top=document.getElementById('big_img_table').getBoundingClientRect().top+document.body.scrollTop-2+'px';
	
	big_img_div.style.height = iDivHeight;
	big_img_div.style.display = ''; 
	big_img_div.style.width = iDivWidth;
	
	big_img_div.innerHTML = "<img id='BigImg' style='position:relative'>";  
	BigImg.src = sFileName;
	
	BigImg.width = iBigImgWidth;   
	BigImg.height = iBigImgHeight;
	BigImg.style.top = iPosY;   
	BigImg.style.left = iPosX;
	
	hidden_select();
}

function out()
{
	big_img_div.style.display='none';
	color_div.style.display='none';
	
	show_select();
}

function hidden_select()
{
	for(var i = 0; i < sels.length; i++)
	{
		sels[i].style.visibility = 'hidden';
	}
}

function show_select()
{
	for(var i = 0; i < sels.length; i++)
	{
		sels[i].style.visibility = '';
	}
}
