// 呈現當天日期資訊
function writeNowDate()
{
  var today = new Date();
  var week = today.getDay();
  var day = '';
  switch (week) {
    case 0: day = '日'; break;
    case 1: day = '一'; break;
    case 2: day = '二'; break;
    case 3: day = '三'; break;
    case 4: day = '四'; break;
    case 5: day = '五'; break;
    case 6: day = '六'; break;
  }
  var date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate() + '&nbsp;星期' + day + '&nbsp;';
  document.write(date);
}

// 設定 TopMenu MouseOver 效果
function getFocus(obj)
{
  obj.style.background = '#FFC6CC';
}

// 設定 TopMenu MouseOut 效果
function getBlur(obj)
{
  obj.style.background = '#FFE5E6';
}

// 表單輸入欄位 MouseFouse 時，清除預設提示文字
function clearMe(control)
{
  control.value = '';
}

// 表單輸入欄位 MouseBlur 時，回復預設提示文字
function restore(control, str)
{
  if (control.value == '') control.value = str;
}

// 設定 Yam 廣告
function showYamAD(adtype, site)
{
  var ts = Math.random();
  var site = (site === (void 0)) ? '' : ('&site=' + site);
  document.write('<scr' + 'ipt language="JavaScript" type="text/javascript" src="http://ads.yam.com/js?ADTYPE=' + adtype + '&' + ts + site + '"></scr' + 'ipt>');
}

// 設定 Yam 頁面計數器
function setYamLog(id)
{
  var ts = Math.random();
  document.write('<img src="http://tr.yam.com.tw/sp?ts=' + ts + '&t=' + id + '" height="0" width="0" alt="" />');
}

// 設定 POPUP 視窗
var popupWina;
function openWin(url, winName, w, h, pos)
{
  var pos = (pos === (void 0)) ? '0' : (screen.availWidth - w - 10);
  if (!popupWina) {
    popupWina = window.open(url, winName, 'width=' + w + ',height=' + h + ',scrollbars=no,top=0,left=' + pos + ',resizable=1');
  } else if (!popupWina.closed) {
    popupWina.location.href = url;
  } else {
    popupWina = window.open(url, winName, 'width=' + w + ',height=' + h + ',scrollbars=no,top=0,left=' + pos + ',resizable=1');
  }
  popupWina.focus();
}

// 設定可由 cookie 控制的視窗
function openAnnounce(url, winName, w, h, pos)
{
  var pos = (pos === (void 0)) ? '0' : (screen.availWidth - w - 10);
  var favorite = GetCookie('switch');
  if (favorite != 'off') {
    if (!popupWina) {
      popupWina = window.open(url, winName, 'width=' + w + ',height=' + h + ',scrollbars=no,top=0,left=' + pos + ',resizable=1');
    } else if (!popupWina.closed) {
      popupWina.location.href = url;
    } else {
      popupWina = window.open(url, winName, 'width=' + w + ',height=' + h + ',scrollbars=no,top=0,left=' + pos + ',resizable=1');
    }
    popupWina.focus();
  }
}

//預覽範例
function popup(theURL)
{
ww = screen.width;
newleft = ww-510;

window.open(''+theURL+'','','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=500,height=400,top=0,left='+newleft+'');
}


