function DrawImage(ImgD,FitWidth,FitHeight){
	var image=new Image();
     image.src=ImgD.src;
     if(image.width>0 && image.height>0){
         if(image.width/image.height>= FitWidth/FitHeight){
             if(image.width>FitWidth){
                 ImgD.width=FitWidth;
                 ImgD.height=(image.height*FitWidth)/image.width;
             }else{
                 ImgD.width=image.width;
                 ImgD.height=image.height;
             }
         } else{
             if(image.height>FitHeight){
                 ImgD.height=FitHeight;
                 ImgD.width=(image.width*FitHeight)/image.height;
             }else{
                 ImgD.width=image.width;
                 ImgD.height=image.height;
             }
         }
     }
 }
 

function openem(fieldid){
	//var s;
	var a; 
	a=window.showModalDialog("/other/Up.asp?action=add","","dialogWidth:300px;dialogHeight:150px;scroll:no;status:no");
	if(a!=undefined){
		//	s
		//document.all.pic.value=a;
		$(fieldid).value=a;
		}
}

function $(eid){
	return document.getElementById(eid);
}

function $() 
{
    var elements = new Array();
  
    for (var i = 0; i < arguments.length; i++) 
    {
        var element = arguments[i];
        try
        {
		    if (typeof element == 'string')
		    {
		        element = document.getElementById(element) || document.all(element) || document.forms(0).all(element);
		    }
        }
        catch(ex)
        {
		    element = null;
        }

        if (arguments.length == 1) 
        {
            return element;
        }
      
        elements.push(element);
    }
  
    return elements;
}

function ShowHiden(objid){
  xobj=$(objid);
  //alert(xobj.style.display);
  if(xobj.style.display=="none") {
    xobj.style.display="";
  }else{
    xobj.style.display="none";
  }
}
