
function ImgControls(contianID)
{
    try{
        var Contain = document.getElementById(contianID);
        
        var list=Contain.getElementsByTagName("IMG");

        for(var i = 0;i<list.length;i++){

            AttachEvent('load', list[i], ControlImage);
        }

    }catch(e){}
}


function ControlImage(e){

    try{//salert("ok");
        var Width = 500;
        var Height = 600;
        var src;
        if(window.document.all)
                src=e.srcElement;
        else
                src=e.currentTarget;
               
        if (src.clientWidth >= Width)
                {
                    src.style.width = Width+"px";
                }
                else
                {
                    if (src.clientHeight >= Height)
                        src.style.Height = Height+"px";
                }
    }catch(e){}
    
}



