/* Extension written by David G. Miles (http://www.z3roadster.net/dreamweaver/) 
based in part on code written by Thomas Brattli (http://www.bratta.com)*/
// Courtesy of SimplytheBest.net (http://simplythebest.net/info/dhtml_scripts.html)
<!--
function verifyCompatibleBrowser(){ 
    this.ver=navigator.appVersion 
    this.dom=document.getElementById?1:0 
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
    this.ie4=(document.all && !this.dom)?1:0; 
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
    this.ns4=(document.layers && !this.dom)?1:0; 
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) 
    return this 
} 
bw=new verifyCompatibleBrowser() 

var startdelay=1000;

var speed01=50;
var dir01=1;
var loop01, timer01;
var initialised01;
var height01;
 
function ConstructObject01(obj,nest){ 
    nest=(!nest) ? '':'document.'+nest+'.' 
    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 
    this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; 
    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight 
    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight 
    this.up=MoveAreaUp01;this.down=MoveAreaDown01; 
    this.MoveArea=MoveArea01; this.x; this.y; 
    this.obj = obj + "Object" 
    eval(this.obj + "=this") 
    return this 
} 

function PerformScroll01(speed){ 
	if(!initialised01) InitialiseScrollableArea01()
	loop01=true; 
	if(speed) objScroller01.down(speed) 
	else objScroller01.up(speed) 
} 
function CeaseScroll01(){ 
    loop01=false; 
    if(timer01) clearTimeout(timer01); 
} 
function ContinueScroll01(){ 
    loop01=true; 
	objScroller01.down(1);
} 
 
function InitialiseScrollableArea01(){ 
    objContainer01=new ConstructObject01('divContainer01') 
    objScroller01=new ConstructObject01('divContent01','divContainer01') 
    objScroller01.MoveArea(0,0) 
    objContainer01.css.visibility='visible' 
    initialised01=true;
    height01 = document.getElementById("divContent01").scrollHeight;
    content01 = document.getElementById("divContent01").innerHTML;
    document.getElementById("divContent01").innerHTML = content01 + content01 + content01;
    setTimeout("PerformScroll01(dir01);",startdelay);
//	PerformScroll01(dir01);
} 

function MoveArea01(x,y){ 
    this.x=x;this.y=y 
    this.css.left=this.x +'px'
    this.css.top=this.y + 'px'
} 

//向上
function MoveAreaDown01(move){ 
        if(timer01) clearTimeout(timer01); 
	if(this.y>-(height01*2)+2){
      this.MoveArea(0,this.y-move) 
	}else{  
	  this.MoveArea(0,0)
	}
    if (loop01){
	if (dir01>0) timer01=setTimeout(this.obj+".down("+move+")",speed01)
	else timer01=setTimeout(this.obj+".up("+move+")",speed01) 
	}
} 

//向下
function MoveAreaUp01(move){ 
        if(timer01) clearTimeout(timer01); 
	if(this.y<0){ 
       this.MoveArea(0,this.y-move) 
	}else{
	   this.MoveArea(0,-height01*2)
	   }
    if (loop01){
	if (dir01>0) setTimeout(this.obj+".down("+dir01+")",speed01)
	else setTimeout(this.obj+".up("+dir01+")",speed01) 
	}
} 


function MoveUp01(){
    dir01=-1; 
    speed01=10;
}

function MoveDown01(){
    dir01=1;
    speed01=10;

//	var test = "";
//
//	for (var element in document.getElementById("divContent01"))
//	{
//		test += element + " : " + document.getElementById("divContent01")[element] + "\n";
//	}
//	//document.all.tatest.value = "HI";
//	document.all.tatest.value = test;
//	//alert(document.all.tblTest.offsetHeight );
//	//alert(document.all.tblTest.offsetTop );
//	alert(document.getElementById("divContent01").style.top);
}

function MoveAuto01(){
    dir01=1;
    speed01=50;
}    

var speed02=50 
var dir02=1
var loop02, timer02
var initialised02
var height02

function ConstructObject02(obj,nest){ 
    nest=(!nest) ? '':'document.'+nest+'.' 
    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 
    this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; 
    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight 
    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight 
    this.up=MoveAreaUp02;this.down=MoveAreaDown02; 
    this.scrolling=PerformScroll02;
    this.MoveArea=MoveArea02; this.x; this.y; 
    this.obj = obj + "Object" 
    eval(this.obj + "=this") 
    return this 
} 
function PerformScroll02(speed){ 
	if(!initialised02) InitialiseScrollableArea02()
	loop02=true;
	if(speed>0) objScroller02.down(speed) 
	else objScroller02.up(speed) 
} 
function CeaseScroll02(){ 
    loop02=false 
    if(timer02) clearTimeout(timer02) 
} 
function ContinueScroll02(){ 
    loop02=true; 
	objScroller02.down(1);
} 
 
function InitialiseScrollableArea02(){ 
    objContainer02=new ConstructObject02('divContainer02') 
    objScroller02=new ConstructObject02('divContent02','divContainer02') 
    objScroller02.MoveArea(0,0) 
    objContainer02.css.visibility='visible' 
    initialised02=true;
    height02 = document.getElementById("divContent02").scrollHeight;
    content02 = document.getElementById("divContent02").innerHTML;
    document.getElementById("divContent02").innerHTML = content02 + content02 + content02;
	   setTimeout("PerformScroll02(dir02);",startdelay);
//    PerformScroll02(dir02); 
} 
function MoveArea02(x,y){ 
    this.x=x;this.y=y 
    this.css.left=this.x  +'px'
    this.css.top=this.y  +'px'

} 
//向上
function MoveAreaDown02(move){ 
       if(timer02) clearTimeout(timer02); 
	if(this.y>-(height02*2)+2){ 
       this.MoveArea(0,this.y-move) 
	}else{
	   this.MoveArea(0,0)
    }
    if(loop02){
	if (dir02>0) timer02=setTimeout(this.obj+".down("+dir02+")",speed02)
	else timer02=setTimeout(this.obj+".up("+dir01+")",speed02) 
	}
} 
//向下
function MoveAreaUp02(move){ 
        if(timer02) clearTimeout(timer02); 
	if(this.y<0){ 
        this.MoveArea(0,this.y-move) 
	}else{
		this.MoveArea(0,-(height02*2))
	}
    if(loop02){
	if (dir02>0) setTimeout(this.obj+".down("+dir02+")",speed02)
	else setTimeout(this.obj+".up("+dir02+")",speed02) 
	}
} 

function MoveUp02(){
    dir02=-1
    speed02=10
}    

function MoveDown02(){
    dir02=1
    speed02=10
}

function MoveAuto02(){
    dir02=1
    speed02=50
}

function displayStatusMsg(msgStr) { 
  status=msgStr;
  document.returnValue = true;
}

function preloadImages() { 
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function swapImgRestore() { 
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function findObj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document); return x;
}

function swapImage() { 
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
reloadPage(true);
// -->

