﻿function Sethomepage(obj)
{
  obj.style.behavior='url(#default#homepage)';
  obj.setHomePage('http://www.ynaan.cn');
  return false;
}

function SaveInBook()
{
 switch(getOs()){
  case 1:
   window.external.addfavorite(location.href,'云南省美术家协会网');
  break;
  case 2:
   window.sidebar.addPanel('云南省美术家协会网', 'http://www.ynaan.cn', "");
  break;
  case 0:
   alert("加入收藏失败，您使用的浏览器不支持这个功能");
  break;
 }
}


function getOs() { 
   if(navigator.userAgent.indexOf("MSIE")>0)return 1; 
   if(navigator.userAgent.indexOf("Firefox")>0)return 2; 
   return 0; 
}

/* --- Time Show --- */
function showtime()
{
	//setInterval("nowtime.innerHTML=new Date().toLocaleString()+'星期'+'日一二三四五六'.charAt(new Date().getDay());",1000);
	//new Date().toLocaleString()+'星期'+'日一二三四五六'.charAt(new Date().getDay()
	var date = new Date(); //日期对
	var now = ""; 
	now = date.getFullYear()+"年"; //读英文就
	now = now + (date.getMonth()+1)+"月"; //取月的时候取的是当前月-1如果想取当前
	now = now + date.getDate()+"日";
	now = now + date.getHours()+"时";
	now = now + date.getMinutes()+"分";
	now = now + date.getSeconds()+"秒";
	document.getElementById("nowDiv").innerHTML = now; //div的html是now这个字
	setTimeout("showtime()",1000); //设置过1000毫秒就是1秒，调用show
}

function showt()
{
       today=new Date();
       function initArray(){
       this.length=initArray.arguments.length
       for(var i=0;i<this.length;i++)
       this[i+1]=initArray.arguments[i] }
       var d=new initArray(
       "星期日",
       "星期一",
       "星期二",
       "星期三",
       "星期四",
       "星期五",
       "星期六");
       document.write(
       "<font style='font-size:9pt;font-family: Times New Roman'> ",
       today.getYear(),"年 ",
       today.getMonth()+1,"月",
       today.getDate(),"日 ",
       d[today.getDay()+1],
       "</font>" );
}

/* ---------------- */
var timerID = null;
var timerRunning = false;

function stopclock (){
        if(timerRunning)
                clearTimeout(timerID);
        timerRunning = false;
}

function showtime () {
        var now = new Date();
        var hours = now.getHours();
        var minutes = now.getMinutes();
        var seconds = now.getSeconds()
        var timeValue = " " + ((hours >12) ? hours -12 :hours)
        timeValue += ((minutes < 10) ? ":0" : ":") + minutes
        timeValue += ((seconds < 10) ? ":0" : ":") + seconds
        timeValue += (hours >= 12) ? " pm" : "am"
        window.status = '现在时间:'+timeValue;
        timerID = setTimeout("showtime()",1000);
        timerRunning = true;
}
function startclock () {
        stopclock();
        showtime();
}
window.onload=startclock
