﻿//显示星
function showweek()
{
    now = new Date();
    if (now.getDay() == 0) return ("星期日");
    if (now.getDay() == 1) return ("星期一");
    if (now.getDay() == 2) return ("星期二");
    if (now.getDay() == 3) return ("星期三");
    if (now.getDay() == 4) return ("星期四");
    if (now.getDay() == 5) return ("星期五");
    if (now.getDay() == 6) return ("星期六");
} 
//显示日期
function showdate()
{ 
    var now = new Date();
    var year = now.getYear();
    var month = now.getMonth() + 1;
    var day = now.getDate();
    return year + "年" + month + "月" + day + "日";
} 

//隐藏脚本错误时状态栏的提
function killErrors() {return true;}
window.onerror = killErrors;

//加入收藏
function bookmark(){
    var title=document.title
    var url=document.location.href
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if( window.opera && window.print ){
    var mbm = document.createElement('a');
    mbm.setAttribute('rel','sidebar');
    mbm.setAttribute('href',url);
    mbm.setAttribute('title',title);
    mbm.click();}
    else if( document.all ) window.external.AddFavorite( url, title);
}

//图片按比例缩放 
var flag=false; 
function DrawImage(ImgD,iwidth,iheight){ 
 var image=new Image(); 
// var iwidth = 200;  //定义允许图片宽度 
// var iheight =200;  //定义允许图片高度 
 image.src=ImgD.src; 
 if(image.width>0 && image.height>0){ 
 flag=true; 
 if(image.width/image.height>= iwidth/iheight){ 
  if(image.width>iwidth){   
  ImgD.width=iwidth; 
  ImgD.height=(image.height*iwidth)/image.width; 
  }else{ 
  ImgD.width=image.width;   
  ImgD.height=image.height; 
  } 
  } 
 else{ 
  if(image.height>iheight){   
  ImgD.height=iheight; 
  ImgD.width=(image.width*iheight)/image.height;   
  }else{ 
  ImgD.width=image.width;   
  ImgD.height=image.height; 
  } 
  } 
 } 
} 

//高亮效果
suckerfish(sfHover, "p");
suckerfish(sfActive, "p");
suckerfish(sfHover, "INPUT");
suckerfish(sfActive, "TEXTAREA");
suckerfish(sfFocus, "INPUT");
suckerfish(sfFocus, "TEXTAREA");
suckerfish(sfTarget, "H5");
suckerfish(sfHover, "pre");
suckerfish(sfActive, "pre");