//last modified 2010-01-21 16:35:36
function getid(d){return document.getElementById(d)}
function gettag(o,t){return o.getElementsByTagName(t)}
function _lowercase(o){return o.toString().toLowerCase()}
function _middle(o,l,r){return (o.split(l)[1])?o.split(l)[1].split(r)[0]:''}
function _leftback(o,n){return o.substr(0,n)}
function _rightback(o,n){return o.substr(o.length-n,n)}
function dw(c){document.write(c)}
var spacer='
';
var _timezones=28800000;
var lastmodified=new Date('2009-08-04 09:54:44'.replace(/-/ig,'/')).getTime();
var mgrlink=false;
var uris=_lowercase(document.URL);
var baseURI=new Array();
baseURI['home']='http://km.nutrition.org.tw/';
baseURI['content']=baseURI['home']+'contentbypermalink';
baseURI['css']=baseURI['home']+'css';
baseURI['js']=baseURI['home']+'js';
baseURI['media']=baseURI['home']+'media';
baseURI['download']=baseURI['home']+'download';
function qsp(p){return _middle(uris+'&','&'+p+'=','&')}
function loadjs(s){
upd=(s.split('comment').length>1)?new Date().getTime():lastmodified;
upd='&upd='+upd
dw('<'+'script src="'+s+upd+'"><'+'/script>')}
function addToFavorite(){
if((navigator.appVersion.indexOf("MSIE")>0) && (parseInt(navigator.appVersion)>=4)){
window.external.AddFavorite(baseURI['home'],this.document.title)}}
function asmt(n,d){location.href='mailto:'+n+'@'+d}
var dbwr=_lowercase(navigator.appName);
var isie=(dbwr=='microsoft internet explorer');
var isff=(dbwr=='netscape');
var isother=(!isie && !isff);
ishome=(typeof ishome=='undefined')?false:ishome
var isview=(uris.split('openview').length>1||ishome);
var isdoc=(uris.split('contentbypermalink').length>1);
var issrch=(uris.split('searchview').length>1);
var ispreview=(uris.split('preview').length>1);
viewtitle=uris.split('/')[uris.split('/').length-1].split('.php')[0]+'.php'
_start=(qsp('start')=='')?1:qsp('start');
_count=(qsp('count')=='')?10:qsp('count');
_catid=qsp('catid');
_category=(_catid=='')? '':'&catid='+_catid;
function status(s,e){s=s.replace(/-/ig,'/');e=e.replace(/-/ig,'/');
var dt=new Date().getTime();
var sd=new Date(s).getTime();
var ed=new Date(e).getTime();
pub=(sd < dt && ed > dt)
return pub}
var archiveBymonth=['2004_02','2004_03','2004_04','2004_05','2004_06','2004_07','2004_08','2004_09','2005_01','2005_02','2006_03','2006_05','2006_06','2007_11','2008_02','2009_05','2010_01'].reverse();
function sharchives(){
o=gettag(getid('Archives'),'select')[0];
o.disabled=false;
o.options[0]=new Option(calendar_mon[today.getMonth()]+', '+thisyear,'')
if(archiveBymonth.length > 0 && archiveBymonth[0].length>6){
for(i=0;i < archiveBymonth.length;i++){
D=archiveBymonth[i].split('_');var yr=D[0];var mn=D[1]
sv=baseURI['home']+'contentbymonth.php?openview&catid=' + archiveBymonth[i];
st=calendar_mon[eval(mn-1)] + ', ' + yr;
o.options[i]=new Option(st,sv,0,(archiveBymonth[i]==_catid))}}}
var _permalink='';var _images=[];var _attachments=[];var _created='';var _modified='';var _pubdate='';var _subject='';var _iscomment='n';
var today=new Date();
var thisyear=(today.getYear() < 1900)? 1900+today.getYear():today.getYear();
var thismon=_rightback('00'+(today.getMonth()+1),2)
var navdate=(_catid.length>10||_catid=='')?thisyear+'_'+thismon:_catid
var calendar_mon=["January","February","March","April","May","June","July","August","September","October","November","December"]
mon_jan='01';mon_feb='02' ;mon_mar='03';mon_apr='04';
mon_may='05';mon_jun='06';mon_jul='07';mon_aug='08';
mon_sep='09';mon_oct='10';mon_nov='11';mon_dec='12';
function shcalendar(){
var dow=new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
var dsow=7;var dsom=31;var cal='
';var tdn=0;var Cal;
var init_date=navdate.split('_');
Cal=new Date(init_date[0]+'/'+init_date[1]+'/01')
var yr=(Cal.getYear()<1900)? 1900+Cal.getYear():Cal.getYear();
var mn=Cal.getMonth(); var wk=Cal.getDay();
Cal.setDate(1); Cal.setMonth(mn);
for(index=0;index< Cal.getDay();index++)
cal+='| | ';
for(index=0;index< dsom;index++){
if(Cal.getDate()>index){
wk=Cal.getDay();
if(wk==0){cal+='
'}
if(wk!=dsow){var dy=Cal.getDate();
cal+='| '+dy+' | ';tdn+=1}
if(wk==dsow){cal+='
'}}
Cal.setDate(Cal.getDate()+1);}
cal+=(7-tdn>0)? ' | ':''
if(getid('Calendar')){
getid('Calendar').innerHTML=''}}
var profilestr=new Array();
var name=new Array();
profilestr['mgrlink']='管理員登入';
profilestr['docempty']='很抱歉!目前沒有相符的文件,請您稍後再來觀看…謝謝。 ';
profilestr['navprev']='
';
profilestr['navnext']='
';
profilestr['commentinner']='發表回應 ?';
profilestr['commenttitle']='Reader Comments';
profilestr['authortitle']='Posted by';
profilestr['updatetitle']='最後更新';
profilestr['more']='More ...';
profilestr['postcommenttitle']='發表您對本文的回應';
profilestr['postcommentname']='您的姓名';
profilestr['postcommentemail']='您的電郵 (已避免垃圾郵件收集)';
profilestr['postcommenturl']='您的網址';
profilestr['postcommentbody']='回應內容';
profilestr['postcommentbodyalert']='請勿使用 HTML 語法, 字數最多 500 字';
profilestr['postcommentbtn']='張貼回應';
profilestr['queryempty']='很抱歉 !您並沒有填入任何的搜尋關鍵字,請重新嘗試一次 !謝謝 !';
profilestr['myphoto']='My Foto';
profilestr['myattachment']='My Files';
profilestr['fullstory']=' .... [ 全文 ]';
name['chironchou']='chiron.chou';
name['marcchou']='台灣營養學會';
name['roylee']='';
name['24714143 ']='';
function timemode(t,m,h){
t=t.toString().replace(/-/ig,'/')
tz =(m=='gmt')? 0:_timezones
ndt=new Date(new Date(t).getTime()+tz).toGMTString().toString();
i=ndt.split(' ')
_wk=_lowercase(i[0]);
_m=_lowercase(i[2])
var wk=_wk.substring(0,1).toUpperCase()+_wk.substring(1,3);
var dy=_rightback('00'+i[1],2);
var mn=_m.substring(0,1).toUpperCase()+_m.substring(1,3);
var yr=i[3]
var _t=i[4].split(':');
var hrs=(_t[0]>12 && m=='num')? _t[0]-12:_t[0];
var ap=(_t[0]>11)? ' PM':' AM'
m_num=yr+'/'+eval("mon_"+_m)+'/'+dy ;m_str=wk+', '+dy+' '+mn+' '+yr;m_gmt=wk+', '+dy+' '+mn+' '+yr
v=eval('m_'+m)+' '+_rightback('00'+hrs,2)+':'+_t[1]
v+=(m=='num')? ap:''
v+=(m=='gmt')? ':'+_t[2]+' GMT':''
if(h==''||typeof h=='undefined'){dw(v)}else{return v}}
function viewisempty(){
if(_totalrec==0)
getid('contenttable').innerHTML=''+profilestr['docempty']+'
'}
_prev=eval(_start)-eval(_count);_next=eval(_start)+eval(_count);
prevUrl=_prev+'&count='+_count+_category;nextUrl=_next+'&count='+_count+_category;
prevlink=''
nextlink=''
function navlink(){if(isview){p=(_prev<1)?'':prevlink;n=(_next>_totalrec)?'':nextlink;
dw(p+n)}}
function shatts(t,d,a){
attns=(a[0]=='')?[]:a.sort();
var pics=new Array();
var atts=new Array();
var _a='';var _p='';p=0;a=0;
tub=(attns.join(',').split('thumb.gif').length>1)
for(i=0;i < attns.length;i++)
{
ext=_rightback(attns[i],4);
if(ext=='.jpg'||ext=='.gif'||ext=='.png'||ext=='jpeg')
{
if(tub)
{
if(isdoc && attns[i]!=='thumb.gif')
{
pics[p++]=attns[i]
}
}
else{
pics[p++]=attns[i]
}
}
else{
atts[a++]=attns[i]
}
}
if((tub && isview) || (tub && issrch)){pics=['thumb.gif']}
if(atts.length!==0)
{
_a+=''
}
if(pics.length!==0)
{
_p+='|
':'>'
for(i=0;i < pics.length;i++)
{
_p+=' '
}
_p+=' |
'
}
if(pics.length+atts.length!==0)
{
if((tub && isview) || (tub && issrch))
{
dw(''+
((atts.length!==0)?''+_a+'
':''))
}
else{
dw(''+_p+_a+'
')
}
}
}
function shft(c,a,m){m=m.replace(/-/ig,'/');
a=(typeof name[a]!='undefined')? profilestr['authortitle']+' '+name[a]+'
':''
c=(typeof catname['cat_'+c]!='undefined')?catname['cat_'+c]+'
':'';
var v=c+a+profilestr['updatetitle']+' '+timemode(m,'num','r')+''
dw(v)}
function chkSearch(f,srchcounts){var regExp1=/\bfield\b/i;var regExp2=/[(,),<,>,\[,\]]/;var s=f.value;
if(trim(s)==''){alert(profilestr['queryempty']);f.focus();return false}else{
if(typeof regExp1.source!='undefined')
if(regExp1.test(s)||regExp2.test(s)){
alert('Sorry!\nKeyword can\'t include [, ], (, ), < ? >');f.focus();return false}
location.href=baseURI['home']+'contentsearch.php?searchview&query='+encodeURIComponent(s)+'&start=1&count='+srchcounts}}
function dl(v,d){dw(''+v+'')}
function trim(s){return s.replace(/^\s{1,}/,"").replace(/\s{1,}$/,"")}
function mgrlogin(){if(mgrlink){
dw(''+profilestr['mgrlink']+'')}}