var img_src="http://blog.hsin.tw/plane/plane.png";
var img2_src="http://blog.hsin.tw/plane/transparent.gif";
var img_w=45;
var img_h=45;
var img_speed=1;
var v1,v2;
function myplane(){
	var img=document.createElement("img");
	if(navigator.appName=="Microsoft Internet Explorer"){
		img.src=img2_src;
		img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+img_src+", sizingmethod=scale);";
	}
	else{
		img.src=img_src;
	}
	img.id="myplane";
	img.style.position="absolute";
	img.style.top="20px";
	img.style.left=(getSize()-img_w)+"px";
	img.width=img_w;
	img.height=img_h;
	document.body.appendChild(img);
	v1=document.getElementById("myplane");
	setTimeout('plane_fly()',img_speed);
}
function plane_fly(){
	v2=v1.style.left;
	v2=v2.substring(0,v2.length-2);
	if(v2>-(img_w)){
		document.getElementById("myplane").style.left=(v2-1)+'px';
		setTimeout('plane_fly()',img_speed);
	}
	else
		document.getElementById("myplane").style.display='none';
}

function getSize(){//可視寬度高度：http://www.howtocreate.co.uk/tutorials/javascript/browserwindow
  var myWidth=0;
  if(typeof(window.innerWidth)=='number'){//Non-IE
    myWidth=window.innerWidth;
  }else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){//IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  }else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){//IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  return myWidth;
}

//if(navigator.appName=="Microsoft Internet Explorer"){window.attachEvent("onload",myplane);}
//else{window.addEventListener("load",myplane,false);}

var oldOnload=window.onload||function(){};
window.onload=function(){
oldOnload();
myplane();
}
