// The following code is by Ken Nguyen (koolken@hotmail.com). Please respect my intellectual property and contact me first before using my code.
function getBrowserVersion(){aName=navigator.appName;aVersion=navigator.appVersion;versionNumber=aVersion.substring(0,1); if(versionNumber>=3){if(aName=="Netscape"||aName=="Microsoft Internet Explorer")return 1} return 0}
function iBlinker(index,iName){if(getBrowserVersion())document[iName].src=image[index].src}
iSource=new Array();var imgbase=IPath+"nav/";iSource[0]=imgbase+"home1_43x12.gif";iSource[1]=imgbase+"home0_43x12.gif";iSource[2]=imgbase+"schedule1_68x12.gif";iSource[3]=imgbase+"schedule0_68x12.gif";iSource[4]=imgbase+"map1_30x15.gif";iSource[5]=imgbase+"map0_30x15.gif";iSource[6]=imgbase+"bbs1_32x12.gif";iSource[7]=imgbase+"bbs0_32x12.gif";iSource[8]=imgbase+"contactus1_78x12.gif";iSource[9]=imgbase+"contactus0_78x12.gif";iSource[10]=imgbase+"otherlinks1_83x12.gif";iSource[11]=imgbase+"otherlinks0_83x12.gif";
if( Xtern){
	iSource[12]=imgbase+"login1_43x16.gif";iSource[13]=imgbase+"login0_43x16.gif";
} else{
	iSource[12]=imgbase+"member1_59x12.gif";iSource[13]=imgbase+"member0_59x12.gif";
}
if(getBrowserVersion()){ image=new Array(); for(i=0;i<14;i++){image[i]=new Image();image[i].src=iSource[i];}}

function showmem( mid) { window.open( PUrl+"?mem_id="+mid,"member","width=750,height=300,scrollbars");}

/**********************************************************************************   
EngrishClock, derived from multiple open-source code snippets. [20060919/koolken@hotmail.com]
*   Browser detection object and animation framework extracted from a javascript 
*   component called NewsSlideFade.
*   Copyright (C) 2001 <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a>
*   This script was released at DHTMLCentral.com
*   Visit for more great scripts!
*   This may be used and changed freely as long as this msg is intact!
*   We will also appreciate any links you could give us.
*
*   Made by <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a> 
*********************************************************************************/

function lib_bwcheck(){ //Browsercheck (needed)
  this.ver=navigator.appVersion
  this.agent=navigator.userAgent
  this.dom=document.getElementById?1:0
  this.opera5=this.agent.indexOf("Opera 5")>-1
  this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
  this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
  this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
  this.ie=this.ie4||this.ie5||this.ie6
  this.mac=this.agent.indexOf("Mac")>-1
  this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
  this.ns4=(document.layers && !this.dom)?1:0;
  this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
  return this
}
var bw=new lib_bwcheck()

function EngrishClock(obj,nest){
  nest=(!nest)?"":'document.'+nest+'.'
  
  this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0;
  this.writeref=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+"document.layers."+obj+".document"):0;

  this.WriteDateTime=b_WriteDateTime; 
  this.slideIn=b_AnimateClock;

  this.obj = obj + "Object"; 
  eval(this.obj + "=this"); 

  return this
}

function pstDaylightAprStart(intFullYear){
	return (2+6*intFullYear-((intFullYear-(intFullYear%4))/4))%7+1
}

function pstDaylightOctEnd(intFullYear){
	return 31-((intFullYear*5-(intFullYear*5)%4)/4+1)%7;
}

function GetDate(intFullYear, intMonth, intDayOrdinal, intDay){ //month, nth, day (all units are base-1 for clarity)
	var b_Direction = (intDayOrdinal>0?1:0)
	if(intDayOrdinal<0)intDayOrdinal*=-1;
	if(b_Direction){ --intMonth;}
	--intDay

	var objDate = new Date(intFullYear,intMonth,1,0,0,0,0)
	if(!b_Direction){ objDate.setDate(objDate.getDate()-1);}

	while(intDayOrdinal>0){
		if(intDay==objDate.getDay()){--intDayOrdinal;}
		if(intDayOrdinal>0){objDate.setDate(objDate.getDate()+(!b_Direction?-1:1));}
	}

	return objDate;
}

function dig2(intValue){
	var strValue=(intValue+100)+''
	return strValue.substr(strValue.length-2)
}

var dtDlsStart = null
var dtDlsEnd = null

function b_WriteDateTime(){
	var strDay=new Array('SU','MO','TU','WE','TH','FR','SA')
	var dtNow = new Date();
	var dtUS = new Date(dtNow.getUTCFullYear(),dtNow.getUTCMonth(),dtNow.getUTCDate(),dtNow.getUTCHours(),dtNow.getUTCMinutes(),dtNow.getUTCSeconds(),dtNow.getUTCMilliseconds())
	var dtJPN = new Date(dtNow.getUTCFullYear(),dtNow.getUTCMonth(),dtNow.getUTCDate(),dtNow.getUTCHours(),dtNow.getUTCMinutes(),dtNow.getUTCSeconds(),dtNow.getUTCMilliseconds())

	dtUS.setHours(dtUS.getHours()-8)	
	if(dtUS.getFullYear()>=2007)
		dtDlsStart  = GetDate(dtUS.getFullYear(),3,2,1);
	else
		dtDlsStart = new Date(dtUS.getFullYear(),3,pstDaylightAprStart(dtUS.getFullYear()),0,0,0,0)

	if(dtUS.getFullYear()>=2007)
		dtDlsEnd = GetDate(dtUS.getFullYear(),11,1,1);
	else
		dtDlsEnd = new Date(dtUS.getFullYear(),9,pstDaylightOctEnd(dtUS.getFullYear()),0,0,0,0)
	
	if(dtUS>=dtDlsStart&&dtUS<dtDlsEnd)dtUS.setHours(dtUS.getHours()+1)
	dtJPN.setHours(dtJPN.getHours()+9)
	
	//var strNow= dtNow.getUTCFullYear()+'/'+dig2(dtNow.getUTCMonth()+1)+'/'+dig2(dtNow.getUTCDate())+' '+dig2(dtNow.getUTCHours())+':'+dig2(dtNow.getUTCMinutes())+'.'+dig2(dtNow.getUTCSeconds())+' '+dtNow.getUTCDay()+' '+pstDaylightAprStart(dtNow.getUTCFullYear())+'/'+pstDaylightOctEnd(dtNow.getUTCFullYear()) + "<br>" +
	var strSpacer = '&nbsp;&nbsp;&nbsp;&nbsp;'
	var strNow = strSpacer+'LA: '+dtUS.getFullYear()+'/'+dig2(dtUS.getMonth()+1)+'/'+dig2(dtUS.getDate())+' '+dig2(dtUS.getHours())+':'+dig2(dtUS.getMinutes())+'.'+dig2(dtUS.getSeconds())+' ('+strDay[dtUS.getDay()]+")<br>" +
							 strSpacer+'TYO: '+dtJPN.getFullYear()+'/'+dig2(dtJPN.getMonth()+1)+'/'+dig2(dtJPN.getDate())+' '+dig2(dtJPN.getHours())+':'+dig2(dtJPN.getMinutes())+'.'+dig2(dtJPN.getSeconds())+' ('+strDay[dtJPN.getDay()]+")"
							 
	
	var strTimeString="<span style=\"font-family:arial,sans-serif;font-size:12px;\">"+strNow+"</span>";
	
  if (bw.ns4){
    this.writeref.write(strTimeString)
    this.writeref.close()
  } else{
  	this.writeref.innerHTML = strTimeString
  }
}

function b_AnimateClock(){
	this.WriteDateTime()
  setTimeout(this.obj+".slideIn();",500)
}

function clockInit(){
  oNews = new EngrishClock('divClock','divClockCont')
  oNewsCont = new EngrishClock('divClockCont')
  oNews.slideIn(0)
  oNewsCont.css.visibility = "visible"
}

if(bw.bw) onload = clockInit

