function put_pic(pic_id,pic_new_url,no_pic_url,maxwidth,maxheigth,thisturn)
{
    if(!thisturn)
    {
        thisturn=1;
    }
    else
    {
        thisturn++;
    }
    var thepiconmypage = document.getElementById(pic_id);
    var redostring = "put_pic('" + pic_id + "','" + pic_new_url + "','" + no_pic_url + "'," + maxwidth + "," + maxheigth + "," + thisturn + ")";
    if(thepiconmypage!=null)
    {
        var oImg = new Image();
        oImg.src = pic_new_url;
        
        if(oImg.complete && (oImg.naturalWidth != 0 || typeof oImg.naturalWidth == "undefined"))
        //if(oImg.complete)
        {
            thepiconmypage.style.display = "inline";
            
            var width_of_this_pic_is_what_pr1_of_max = oImg.width / maxwidth;
            var height_of_this_pic_is_what_pr1_of_max = oImg.height / maxheigth;
            if(width_of_this_pic_is_what_pr1_of_max >= height_of_this_pic_is_what_pr1_of_max && width_of_this_pic_is_what_pr1_of_max > 1)
            {
                var newwidth = Math.floor(oImg.width / width_of_this_pic_is_what_pr1_of_max);
                var newheigth = Math.floor(oImg.height / width_of_this_pic_is_what_pr1_of_max);
                thepiconmypage.style.width = newwidth + 'px';
                thepiconmypage.style.height = newheigth + 'px';
            }
            else if(height_of_this_pic_is_what_pr1_of_max > 1)
            {
                var newwidth = Math.floor(oImg.width / height_of_this_pic_is_what_pr1_of_max);
                var newheigth = Math.floor(oImg.height / height_of_this_pic_is_what_pr1_of_max);
                thepiconmypage.style.width = newwidth + 'px';
                thepiconmypage.style.height = newheigth + 'px';
            }

            thepiconmypage.src = pic_new_url;
        }
        else if(thisturn < 10)
        {            
            var t=setTimeout(redostring,100);
        }
        else
        {
            if(no_pic_url != '')
            {
                thepiconmypage.style.display = "inline";
                thepiconmypage.src = no_pic_url;
            }
            if(thisturn < 100)
            {
                var t=setTimeout(redostring,100);
            }
        }
    }
}
