/* ================================= */
/* Original Information Co.,LTD.     */
/* http://www.original.com.tw        */
/* email:service@original.com.tw     */
/* ================================= */
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;
    document.all['onweb_flotbanr'].style.top=top+document.body.scrollTop;
		document.all['onweb_flotbanr1_big'].style.top=top+document.body.scrollTop;
		document.all['onweb_flotbanr2'].style.top=top+document.body.scrollTop;
		document.all['onweb_flotbanr2_big'].style.top=top+document.body.scrollTop;
    time_out_to_removing();
}

function bner_position(){
	bHeight=document.body.clientHeight;
  bWidth= document.body.clientWidth;
  offsetX= "document.body.scrollLeft";

	widthb=parseInt(bWidth)-parseInt(banner_width1)-5;
	heightb=parseInt(bHeight)-parseInt(banner_height1);
	document.all['onweb_flotbanr'].style.left=widthb;
	document.all['onweb_flotbanr'].style.top=heightb;

	document.all['onweb_flotbanr1_big'].style.right=banner_width1;
	document.all['onweb_flotbanr1_big'].style.top=heightb;

	document.all['onweb_flotbanr2'].style.left=5;
	document.all['onweb_flotbanr2'].style.top=heightb;

	document.all['onweb_flotbanr2_big'].style.left=parseInt(banner_width2)+5;
	document.all['onweb_flotbanr2_big'].style.top=heightb;
}

function move_banr_pic(){
	if(top<=(document.body.clientHeight)&&direct_bnr=="down")
	        {
		      document.all['onweb_flotbanr'].style.top=top+document.body.scrollTop;
		      document.all['onweb_flotbanr1_big'].style.top=top+document.body.scrollTop;
		      if(top>=(document.body.clientHeight-banner_height_mover1))
		          document.all['onweb_flotbanr1_big'].style.top=document.body.clientHeight+document.body.scrollTop-banner_height_mover1-1;
		      top+=dx;
	        }
	if(top==(document.body.clientHeight)-banner_height1)
	        {
	        direct_bnr="up";
	        }
	if(top==0)
	        {
	        direct_bnr="down";
	        }
	if(top<=(document.body.clientHeight)&&direct_bnr=="up")
	        {
		      document.all['onweb_flotbanr'].style.top=top+document.body.scrollTop;
		      document.all['onweb_flotbanr1_big'].style.top=top+document.body.scrollTop;
		      if(top>=(document.body.clientHeight-banner_height_mover1))
		          document.all['onweb_flotbanr1_big'].style.top=document.body.clientHeight+document.body.scrollTop-banner_height_mover1-1;
		      top-=dx;
	        }


  if(top2<=(document.body.clientHeight)&&direct_bnr2=="down")
	        {
		      document.all['onweb_flotbanr2'].style.top=top2+document.body.scrollTop;
		      document.all['onweb_flotbanr2_big'].style.top=top2+document.body.scrollTop;
		      if(top2>=(document.body.clientHeight-banner_height_mover2))
		          document.all['onweb_flotbanr2_big'].style.top=document.body.clientHeight+document.body.scrollTop-banner_height_mover2-1;
		      top2+=dx2;
	        }
	if(top2==(document.body.clientHeight)-banner_height2)
	        {
	        direct_bnr2="up";
	        }
	if(top2==0)
	        {
	        direct_bnr2="down";
	        }
       if(top2<=(document.body.clientHeight)&&direct_bnr2=="up")
	        {
		      document.all['onweb_flotbanr2'].style.top=top2+document.body.scrollTop;
		      document.all['onweb_flotbanr2_big'].style.top=top2+document.body.scrollTop;
		      if(top2>=(document.body.clientHeight-banner_height_mover2))
		          document.all['onweb_flotbanr2_big'].style.top=document.body.clientHeight+document.body.scrollTop-banner_height_mover2-1;
		      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();
    }