var ScreenHeight = window.screen.availHeight;
var ScreenWidth = window.screen.availWidth;
var scroll_position=0;
var widthb;
var heightb;
var bWidth=0,bHeight=0;
var top=-banner_height1;
var top2=-banner_height2;
var dx=1;
var dx2=1;
var direct_bnr="down";
var direct_bnr2="down";
var bner_timer_1=null;
var bner_timer_2=null;

if(banner_width2=="")
    banner_width2=0;
if(banner_width1=="")
    banner_width1=0;
if(banner_height2=="")
    banner_height2=0;
if(banner_height1=="")
    banner_height1=0;

function time_out_to_removing(){
    window.clearTimeout(bner_timer_1);
    window.clearTimeout(bner_timer_2);
    bner_timer_1=setTimeout('dx=1',3000);
    bner_timer_2=setTimeout('dx2=1',3000);
}

function on_scroll(){
    dx=0;
    dx2=0;
    dwPgDoc.getElementById('onweb_flotbanr').style.top=(top+dwPgDoc.body.scrollTop)+"px";
    dwPgDoc.getElementById('onweb_flotbanr1_big').style.top=(top+dwPgDoc.body.scrollTop)+"px";
    dwPgDoc.getElementById('onweb_flotbanr2').style.top=(top+dwPgDoc.body.scrollTop)+"px";
    dwPgDoc.getElementById('onweb_flotbanr2_big').style.top=(top+dwPgDoc.body.scrollTop)+"px";
    time_out_to_removing();
}

function bner_position(){
	bHeight=dwPgDoc.body.clientHeight;
  bWidth= dwPgDoc.body.clientWidth;
  //offsetX= "dwPgDoc.body.scrollLeft";

	widthb=parseInt(bWidth)-parseInt(banner_width1)-5;
	heightb=parseInt(bHeight)-parseInt(banner_height1);
	dwPgDoc.getElementById('onweb_flotbanr').style.left=(widthb)+"px";
	dwPgDoc.getElementById('onweb_flotbanr').style.top=(heightb)+"px";

  dwPgDoc.getElementById('onweb_flotbanr1_big').style.right=(banner_width1)+"px";
  dwPgDoc.getElementById('onweb_flotbanr1_big').style.top=(heightb)+"px";
  
  dwPgDoc.getElementById('onweb_flotbanr2').style.left=(5)+"px";
  dwPgDoc.getElementById('onweb_flotbanr2').style.top=(heightb)+"px";

  dwPgDoc.getElementById('onweb_flotbanr2_big').style.left=(parseInt(banner_width2)+5)+"px";
  dwPgDoc.getElementById('onweb_flotbanr2_big').style.top=(heightb)+"px";
}

function move_banr_pic(){
	if(top<=(dwPgDoc.body.clientHeight)&&direct_bnr=="down")
	        {
	        dwPgDoc.getElementById('onweb_flotbanr').style.top=(top+dwPgDoc.body.scrollTop)+"px";
	        dwPgDoc.getElementById('onweb_flotbanr1_big').style.top=(top+dwPgDoc.body.scrollTop)+"px";
	        
		      if(top>=(dwPgDoc.body.clientHeight-banner_height_mover1))
		          dwPgDoc.getElementById('onweb_flotbanr1_big').style.top=(dwPgDoc.body.clientHeight+dwPgDoc.body.scrollTop-banner_height_mover1-1)+"px";
		      top+=dx;
	        }
	if(top==(dwPgDoc.body.clientHeight)-banner_height1)
	        {
	        direct_bnr="up";
	        }
	if(top==0)
	        {
	        direct_bnr="down";
	        }
	if(top<=(dwPgDoc.body.clientHeight)&&direct_bnr=="up")
	        {
	        dwPgDoc.getElementById('onweb_flotbanr').style.top=(top+dwPgDoc.body.scrollTop)+"px";
	        dwPgDoc.getElementById('onweb_flotbanr1_big').style.top=(top+dwPgDoc.body.scrollTop)+"px";
		   
		      if(top>=(dwPgDoc.body.clientHeight-banner_height_mover1))
		          dwPgDoc.getElementById('onweb_flotbanr1_big').style.top=(dwPgDoc.body.clientHeight+dwPgDoc.body.scrollTop-banner_height_mover1-1)+"px";
		      top-=dx;
	        }


  if(top2<=(dwPgDoc.body.clientHeight)&&direct_bnr2=="down")
	        {
	        dwPgDoc.getElementById('onweb_flotbanr2').style.top=(top2+dwPgDoc.body.scrollTop)+"px";
	        dwPgDoc.getElementById('onweb_flotbanr2_big').style.top=(top2+dwPgDoc.body.scrollTop)+"px";
		      if(top2>=(dwPgDoc.body.clientHeight-banner_height_mover2))
		          dwPgDoc.getElementById('onweb_flotbanr2_big').style.top=(dwPgDoc.body.clientHeight+dwPgDoc.body.scrollTop-banner_height_mover2-1)+"px";
		      top2+=dx2;
	        }
	if(top2==(dwPgDoc.body.clientHeight)-banner_height2)
	        {
	        direct_bnr2="up";
	        }
	if(top2==0)
	        {
	        direct_bnr2="down";
	        }
       if(top2<=(dwPgDoc.body.clientHeight)&&direct_bnr2=="up")
	        {
	        dwPgDoc.getElementById('onweb_flotbanr2').style.top=(top2+dwPgDoc.body.scrollTop)+"px";
	        dwPgDoc.getElementById('onweb_flotbanr2_big').style.top=(top2+dwPgDoc.body.scrollTop)+"px";

		      if(top2>=(dwPgDoc.body.clientHeight-banner_height_mover2))
		          dwPgDoc.getElementById('onweb_flotbanr2_big').style.top=(dwPgDoc.body.clientHeight+dwPgDoc.body.scrollTop-banner_height_mover2-1)+"px";
		      top2-=dx2;
	        }

	setTimeout('move_banr_pic()',30);
}
function resiz_reposition(){
    bner_position();
}

//=============
ypos=-banner_height3;
xpos=200;
degree = 60;
set_x_moth=1;
set_y_moth=2;


function Curve()
    {
    abc=new Array(0,1,1,2,2,3,4,0,6,-1,-1,-2,-2,-3,-4,0,-6)
    for (i=0; i < abc.length; i++)
        {
        var C=Math.round(Math.random()*[i])
        }
    howbend=abc[C];
    setTimeout('Curve()',30);
    return howbend;
    }


function MoveRandom()
    {
    PathBend=degree+=howbend;
    y = set_x_moth*Math.sin(PathBend*Math.PI/180);
    x = set_y_moth*Math.cos(PathBend*Math.PI/180);
    if (document.layers)
        {
        ypos+=y;
        xpos+=x;
        document.onweb_flotbanr3.top=ypos+window.pageYOffset;
        document.onweb_flotbanr3.left=xpos+window.pageXOffset;
        }
    else if (document.all)
        {
        ypos+=y;
        xpos+=x;
        document.all.onweb_flotbanr3.style.top=ypos+document.body.scrollTop;
        document.all.onweb_flotbanr3.style.left=xpos+document.body.scrollLeft;
        document.all.onweb_flotbanr3_big.style.top=ypos+document.body.scrollTop-(-banner_height3);
        document.all.onweb_flotbanr3_big.style.left=xpos+document.body.scrollLeft;
        }
    setTimeout('MoveRandom()',30);
    }

function edges()
    {
    if (document.layers)
        {
        if (document.onweb_flotbanr3.left >= window.innerWidth-40+window.pageXOffset)
            degree=Math.round(Math.random()*45+157.5);
        if (document.onweb_flotbanr3.top >= window.innerHeight-30+window.pageYOffset)
            degree=Math.round(Math.random()*45-112.5);
        if (document.onweb_flotbanr3.top <= 2+window.pageYOffset)
            degree = Math.round(Math.random()*45+67.5);
        if (document.onweb_flotbanr3.left <= 2+window.pageXOffset)
            degree = Math.round(Math.random()*45-22.5);
        }
    else if (document.all)
        {
        if (document.all.onweb_flotbanr3.style.pixelLeft >= document.body.offsetWidth-banner_width3+document.body.scrollLeft)
            degree=Math.round(Math.random()*45+157.5);
        if (document.all.onweb_flotbanr3.style.pixelTop >= document.body.offsetHeight-banner_height3+document.body.scrollTop)
            degree=Math.round(Math.random()*45-112.5);
        if (document.all.onweb_flotbanr3.style.pixelTop <= 2+document.body.scrollTop)
            degree = Math.round(Math.random()*45+67.5);
        if (document.all.onweb_flotbanr3.style.pixelLeft <= 2+document.body.scrollLeft)
            degree = Math.round(Math.random()*45-22.5);
        }
    setTimeout('edges()',30);
    }
function starteffect()
    {
    Curve();
    MoveRandom();
    edges();
    }
/* ================================= */
/* Original Information Co.,LTD.     */
/* http://www.original.com.tw        */
/* email:service@original.com.tw     */
/* ================================= */    