
// 이미지 뷰어
function FuncAjaxExpPlugin_Photoview_Func_DivOpen(imgSrc,date,make){
   if(imgSrc){
      $("select").hide();
      $("#DivAjaxExpPlugin_PhotoView_Info").css({"border":"0px solid #000000"});
      $("#DivAjaxExpPlugin_PhotoView_BodyDumy").show();
      $("#DivAjaxExpPlugin_PhotoView_Body").show();
      $("#ImgAjaxExpPlugin_PhotoView_Img").attr({"src":""+imgSrc+""});
      $("#DivAjaxExpPlugin_PhotoView_Mark").hide().fadeIn("300");
      // 리사이즈 처리
      var pagesize = FuncAjaxExpPlugin_Photoview_Func_getPageSize();

      var x = pagesize[0] - 150;
      var y = pagesize[1] - 150;

      var imageWidth = document.getElementById("ImgAjaxExpPlugin_PhotoView_Img").width;
      var imageHeight = document.getElementById("ImgAjaxExpPlugin_PhotoView_Img").height;

      if (imageWidth > x){
         imageHeight = imageHeight * (x / imageWidth); 
         imageWidth = x;
         if (imageHeight > y){
            imageWidth = imageWidth * (y / imageHeight); 
            imageHeight = y;
         }
      } else if (imageHeight > y){
         imageWidth = imageWidth * (y / imageHeight); 
         imageHeight = y;
         if (imageWidth > x){
            imageHeight = imageHeight * (x / imageWidth);
            imageWidth = x;
         }
      }

      $("#ImgAjaxExpPlugin_PhotoView_Img").css({"Width":""+imageWidth+""});
      $("#ImgAjaxExpPlugin_PhotoView_Img").css({"Height":""+imageHeight+""});

      if(imageWidth < 400){
         imageWidth = 400;
         var string = "<img src='"+imgSrc+"' width='400' align='absmiddle'>";
      }else{
         var string = "<img src='"+imgSrc+"' width='"+imageWidth+"' height='"+imageHeight+"' align='absmiddle'>";
      }
      if(imageHeight < 400){
         imageHeight = 400;
      }

      $("#SpanAjaxExpPlugin_PhotoView_Img").html(string);
      $("#DivAjaxExpPlugin_PhotoView_BodyDumy").hide();

      var NowW = Number(Math.round(document.body.clientWidth/2)) - Number(Math.round(imageWidth/2));
      var NowH = Number(Math.round(document.body.clientHeight/2)) - Number(Math.round(imageHeight/2));

      $("#DivAjaxExpPlugin_PhotoView_Info").css({"left":NowW});
      $("#DivAjaxExpPlugin_PhotoView_Info").css({"top":NowH});

      if(SETT_ICARUSX_brower == "Ie"){
         $("#DivAjaxExpPlugin_PhotoView_Info").css({"pixelTop":""+(document.body.scrollTop+NowH)+"","border":"2px solid #000000"});
         $("#DivAjaxExpPlugin_PhotoView_Info").hide().fadeIn(300);
      }else{
         $("#DivAjaxExpPlugin_PhotoView_Info").css({"top":""+(document.body.scrollTop+NowH)+""});
         $("#DivAjaxExpPlugin_PhotoView_Info").hide().fadeIn(300);
         $("#DivAjaxExpPlugin_PhotoView_Info").animate({"border":"10px solid #000000","opacity":"slow"});
      }
      $("select").hide();
      if(date){
         $("#DivAjaxExpPlugin_PhotoView_Info_Date").html(date);
         $("#DivAjaxExpPlugin_PhotoView_TblDate").show();
      }
      if(make){
         $("#DivAjaxExpPlugin_PhotoView_Info_Make").html(make);
         $("#DivAjaxExpPlugin_PhotoView_Info_TblMake").show();
         $("#DivAjaxExpPlugin_PhotoView_MsgMake").show();
      }

      $.blockUI({
         message:""
      });
   }
}

// 뷰어닫기
function FuncAjaxExpPlugin_Photoview_Func_DivClose(){
   $("#DivAjaxExpPlugin_PhotoView_Info").css({"border":"0px solid #000000"});
   $("#ImgAjaxExpPlugin_PhotoView_Img").attr({"src":""});
   $("#SpanAjaxExpPlugin_PhotoView_Img").html("");
   $("#DivAjaxExpPlugin_PhotoView_BodyDumy").hide();
   $("#DivAjaxExpPlugin_PhotoView_Body").hide();
   $.unblockUI();
   $("select").show();
}

function FuncAjaxExpPlugin_Photoview_Func_getPageSize(){
   var de = document.documentElement;
   var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
   var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
   arrayPageSize = [w,h];
   return arrayPageSize;
}

