
//檢查各單元Banner是否存在。有，才顯示；無，不顯示
var x_pos = 690;	
var y_pos = 0;	
var KMTPRE_step = 1;	
var KMTPRE_delay = 70;	
var height = 0;	
var offset = 0;	
var y_up = 0;	
var navi = navigator.appName;	
var imgsrc = '/image/btn_top.gif';
var imgurl = '#top';
if(imgsrc != ""){
	if (imgurl !=""){
		document.write('<DIV id=KMTPRE style="POSITION:absolute; VISIBILITY:visible">');
		document.write('<A href='+imgurl+' onmouseout=MM_swapImgRestore() onmouseover=MM_swapImage("Image_top","","/image/btn_top_r.gif",1)><IMG id="image_top" border=0 src='+imgsrc+' width="44" height="22"> </A></DIV>');
	}else{
		document.write('<DIV id=KMTPRE style="POSITION:absolute; VISIBILITY:visible">');
		document.write('<IMG border=0 src='+imgsrc+'></DIV>');
		
	}

	if (navi == "Microsoft Internet Explorer"){
		y_pos = 0;
		KMTPRE.style.top = y_pos;
	}
	else{
		y_pos = 0;
		document.KMTPRE.pageY = window.innerHeight;
		document.KMTPRE.visibility = "hidden";
	}
	isLoading();
}

function positionChange(){
	if (y_up == 0){
		y_pos = window.screen.availHeight - 220;		
	}
	else{
		y_pos = 320;
	}
	if (navi == "Microsoft Internet Explorer"){
		height = document.body.clientHeight;
		offset = KMTPRE.offsetHeight;
	}
	else{
		height = window.innerHeight;
		offset = document.KMTPRE.clip.height;
	}
	if (navi == "Microsoft Internet Explorer"){
		KMTPRE.style.left = x_pos;
		KMTPRE.style.top = y_pos + document.body.scrollTop;
	}
	else{
		document.KMTPRE.pageX = x_pos;
		document.KMTPRE.pageY = y_pos + window.pageYOffset;
	}
	if (y_pos < 0){
		y_up = 1;	
		y_pos = 0;
	}
	if (y_pos >= (height - offset)){
		y_up = 0;
		y_pos = (height - offset);
	}
}

function isLoading(){
   if (navi != "Microsoft Internet Explorer"){
      document.KMTPRE.visibility = "visible";
   }
   isLooping();
}

function isLooping(){
   positionChange();
   wm_move = setTimeout("isLooping()",KMTPRE_delay);
}


ns4=  (document.layers) ? true : false;
ie4 = (document.all) ? true : false;


function onMouseOver(){
	clearTimeout(wm_move);
}

function onMouseOut(){
   wm_move = setTimeout("isLooping()",KMTPRE_delay);
}
