﻿var NewWin = null;
function OpenWindow(path,title,height,width,left,top,resizable,scrollbars)
{
   var arg = "height="+height+",width="+width+",left="+left+",top="+top+",resizable="+resizable+",scrollbars="+scrollbars+",status=no,toolbar=no,menubar=no,location=no";
   NewWin = window.open(path,title,arg);
   NewWin.focus();
}
function rePicSize(imgObject,iwidth,iheight)
{
  var image=new Image();
  image.src=imgObject.src;
  var FitWidth = iwidth;
  var FitHeight = iheight;
  imgObject.style.marginTop = 0 +'px';
  if(image.width>0 && image.height>0)
  {
    if(image.width/image.height >= FitWidth/FitHeight)
    {
     if(image.width>FitWidth)
     {
      imgObject.width=FitWidth;
      imgObject.height=(image.height*FitWidth)/image.width;
     }
     else
     {
      imgObject.width=image.width;
      imgObject.height=image.height;
     }
    }
    else
    {
     if(image.height>FitHeight)
     {
      imgObject.height=FitHeight;
      imgObject.width=(image.width*FitHeight)/image.height;
     }
     else
     {
      imgObject.width=image.width;
      imgObject.height=image.height;
     }
   }
   if(imgObject.height < FitHeight)
   {
      var mInt =  Math.round((FitHeight-imgObject.height)/2) +'px';
      imgObject.style.marginTop = mInt;
      imgObject.style.marginBottom = mInt;
   }
  }
}
function getId(aID)
{
  return (document.getElementById) ? document.getElementById(aID): document.all[aID];
}
function stopEvent(evt)
{
   if (evt.preventDefault)
   {
     evt.preventDefault();
     evt.stopPropagation();
   }
   else
   {
      evt.cancelBubble = true;
      evt.returnValue = false;
   }
}
function isempty(strtext)
{
   aa=strtext;
   bb=aa.length;
   for(i=1;i<bb+1;i++)
   {
     cc=aa.substring(i-1,i);
     if(cc!=" ")
     {
       return false;
     }
   }
  return true;
}
 function getOs() 
{ 
   var OsObject = ""; 
   if(navigator.userAgent.indexOf("MSIE")>0) { 
        return "MSIE"; 
   } 
   if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){ 
        return "Firefox"; 
   } 
   if(isSafari=navigator.userAgent.indexOf("Safari")>0) { 
        return "Safari"; 
   }  
   if(isCamino=navigator.userAgent.indexOf("Camino")>0){ 
        return "Camino"; 
   } 
   if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){ 
        return "Gecko"; 
   } 
} 
function dozoom(objcontrol,fontsize)
{
	getId(objcontrol).style.fontSize=fontsize+'em';
}
var isIe=getOs(); 
function high(which)
{ 
     theobject=which;
     highlighting=setInterval("highlightit(theobject)",60);
} 
function low(obj)
{ 
    clearInterval(highlighting);
    if(isIe=="MSIE")
      obj.filters.alpha.opacity=100;
    else
      obj.style.opacity=1;
} 
function highlightit(cur)
{ 
    if(isIe=="MSIE")
    {
       if (cur.filters.alpha.opacity > 50) 
          cur.filters.alpha.opacity -= 10; 
       else if (window.highlighting) 
          clearInterval(highlighting);
    }
    else
    {
       if (cur.style.opacity > 0.5) 
          cur.style.opacity -= 0.1; 
       else if (window.highlighting) 
          clearInterval(highlighting);
    }
}
//屏蔽js错误 
function ResumeError() { 
      return true; 
}
window.onerror = ResumeError;