function $g(id)
{
   return document.getElementById(id);
}

function set_imgurl(imgurl)
{
  $g('tempIMG').src = imgurl ; 
}

function closeImage()
{
	$g('detail_img').style.visibility = 'hidden' ;
}

function display_detailIMG(top,left,state)
{		
  //(document.documentElement.clientHeight/2)	
  if(state == 1)
  {
    if (navigator.userAgent.indexOf("Firefox")>0)
    {
      $g('detail_img').style.top = top + 50 + 'px';
      $g('detail_img').style.left = '500px'; 
    }
    else
    {
      if(screen.width == 1280)
      { 
    	$g('detail_img').style.top = top + 200 + 'px';
        $g('detail_img').style.left = '500px'; 
      }
      else
      {
      	$g('detail_img').style.top = top + 200 + 'px';
        $g('detail_img').style.left = '500px'; 
      }
    }
    
    $g('detail_img').style.visibility = 'visible' ;
  }
  else $g('detail_img').style.visibility = 'hidden' ;
  //alert(top) ;
}


function DrawImage1(ImgD,width,height)   //limit image size 
{ 
    var image = new Image(); 
    image.src = ImgD.src; 
    if(image.width > 0 && image.height > 0)
    { 
        flag = true; 
        if(image.width/image.height >= width/height)
        { 
            if(image.width > width)
            { 
                ImgD.width = width; 
                ImgD.height = (image.height * width) / image.width; 
            }
            else
            { 
                ImgD.width = image.width; 
                ImgD.height = image.height; 
            } 
                ImgD.alt = image.width + "×" + image.height; 
        } 
        else
        { 
            if(image.height > height)
            { 
                ImgD.height = height; 
                ImgD.width = (image.width * height) / image.height; 
            }
            else
            { 
                ImgD.width = image.width; 
                ImgD.height = image.height; 
            } 
                ImgD.alt = image.width + "×" + image.height; 
        } 
    } 
}