﻿function SetImageWidth(obj)
{
	obj.style.display = "none";
    setTimeout(function(){SetImageWidthTime(obj);},500);
}

function SetImageWidthTime(obj)
{
	var objParent = obj.parentNode;
	while(objParent && objParent != document.body)
	{
	    if(objParent.offsetWidth)
	        break;
	    objParent = objParent.parentNode;
	}
	if(objParent.offsetWidth)
	{
	    if(objParent.offsetWidth < 500 && objParent.offsetWidth > 32)
	        obj.width = objParent.offsetWidth;
	    else if(objParent.offsetWidth < 32)
	        obj.width = 100;
	    else
	        obj.width = 200;
	}
	else
        obj.width = 200;
	obj.style.display = "block";
}
