function showDetails(item_id)	{
	var popup_details = document.getElementById(item_id);
	if(popup_details.style.display != 'block')
		popup_details.style.display = 'block';
	else 
		popup_details.style.display = 'none';
}

function findImgPosition(form_id, item_id)	{
	var popupBox = document.getElementById(item_id);
	var el 		 = document.getElementById(form_id);
	var x 		 = findPosX(el);
	var y 		 = findPosY(el);
	
	function findPosX(obj) {
		var curleft = 0;
		var windowWidth = window.innerWidth * 0.93;
		var windowWidthIE = document.body.clientWidth * 0.93;
		if (obj.offsetParent) {
			while (obj.offsetParent) {
				curleft+=obj.offsetLeft;
				if (!obj.offsetParent) {
					break;
				}
				obj=obj.offsetParent;
			}
		} else if (obj.x) {
			curleft+=obj.x;
		}
		
		if((curleft+popupBox.offsetWidth) > windowWidth || (curleft+popupBox.offsetWidth) > windowWidthIE)	{
			popupBox.style.left = curleft + popupBox.offsetWidth*(-1) + 20 + 'px';
		} else	{
			popupBox.style.left = curleft + el.offsetWidth - 20 + 'px';
		}
		return curleft;
	}
	
	function findPosY(obj) {
		var curtop = 0;
		var windowHeight = window.innerHeight;
		var windowHeightIE = document.body.clientHeight;
		if (obj.offsetParent) {
			while (obj.offsetParent) {
				curtop+=obj.offsetTop;
				if (!obj.offsetParent) {
					break;
				}
				obj=obj.offsetParent;
			}
		} else if (obj.y) {
			curtop+=obj.y;
		}
		if((curtop+popupBox.windowHeight) > windowHeight || (curtop+popupBox.offsetHeight) > windowHeightIE)	{
			popupBox.style.top = curtop + popupBox.offsetHeight*(-1) + el.offsetHeight + 'px';
		} else	{
			popupBox.style.top = curtop + 'px';
		}
		return curtop;
	}
}
