function thumbnailImage(pathImage, idThumbnail, idFrame, idImage)
{
	var arrInfo			= idImage.split("-");
	
	if(arrInfo[1] == "0" && arrInfo[2] =="0"){
		var img_tmp = new Image();
		img_tmp.src = pathImage;
		var height = img_tmp.height;
		var width = img_tmp.width;
		if(height > 650)
		{
			arrInfo[1] = (parseInt(width) * 700)/parseInt(height);
		    arrInfo[2] = 650;
		}
		arrInfo[1] = width;
		arrInfo[2] = height
		//alert(arrInfo[1] + " " + arrInfo[2])
	}
	if(arrInfo[2]>650)
	{
		arrInfo[1] = (parseInt(arrInfo[1]) * 700)/parseInt(arrInfo[2]);
		arrInfo[2] = 650;
	}
	
	var scroll_Y 		= document.body.scrollTop;
	var heightScreen 	= document.body.clientHeight;
	var widthScreen 	= document.body.clientWidth;
	pos_x				= (parseInt(widthScreen) - parseInt(arrInfo[1]))/2  
	pos_y				= ((parseInt(heightScreen) - parseInt(arrInfo[2]))/2) + parseInt(scroll_Y);
	 
	popup = document.getElementById(idThumbnail);
	iframe = document.getElementById(idFrame);
	
	var htmlImage      	= "<div style='text-align:right; padding:5px'>";
	htmlImage      		+="		<a href=\"javascript:closeThumbnail('"+idThumbnail+"', '"+idFrame+"')\">Close</a>";
	htmlImage      		+="</div>";
	htmlImage      		+="<div style='padding-left:10px; padding-right:10px; padding-bottom:10px'>";
	htmlImage      		+="		<img src='"+pathImage+"' height='"+arrInfo[2]+"' style='cursor:pointer' onclick=\"closeThumbnail('"+idThumbnail+"', '"+idFrame+"')\">";
	htmlImage      		+="</div>";		
	popup.innerHTML      = htmlImage;
	popup.style.top      = pos_y;
	popup.style.left     = pos_x;
	popup.style.width    = parseInt(arrInfo[1]);
	popup.style.height   = parseInt(arrInfo[2]);
	//popup.style.display  = "block";	
	$("#"+idThumbnail).show(500);
	
	iframe.style.width   = popup.offsetWidth + "px";
	iframe.style.height  = popup.offsetHeight + "px";
	iframe.style.left    = popup.offsetLeft + "px";
	iframe.style.top     = popup.offsetTop + "px";
	iframe.style.display = 'block';
}

function closeThumbnail(idThumbnail, idFrame)
{
	document.getElementById(idThumbnail).innerHTML = "";
	document.getElementById(idThumbnail).style.display = "none";
	document.getElementById(idFrame).style.display = "none";
}
