$(document).ready(function(){
	var TargetObj = $('#bgFlash');
	//swfobject.embedSWF('/bg01.swf', '#bgFlash', '100%', '1005', '9.0.0', '/js/expressinstall.swf',{}, {wmode: 'transparent', menu: 'false'}, {id: 'bg01'});   

	TargetObj.html('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="100%" height="100%" id="bg01"><param name="id" value="bg01"><param name="wmode" value="transparent"><param name="movie" value="/bg01"><param name="quality" value="high"><embed src="/bg01.swf" wmode="opaque" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="100%"></embed></object>');

//    $().mousemove( function (e){
//        var x = e.clientX;
//        var y = e.clientY;
//        $( '#xy' ).html( x + ', ' + y );
//        if (document.all){ // Internet Explorer
//            window[ 'bg01' ].callFlash( x, y );
//        }else{
//            document[ 'bg01' ].callFlash( x, y );
//        }
//    });

	//check browser and its version
	TargetObj.css({
		position : 'fixed',
		top: '0px',
		left: '0px',
		zIndex: '2',
		width: '100%',
		height: '100%'
		});
		
	if($.browser.msie){
		var version = parseInt($.browser.version);
		if(version <= 9){
			TargetObj.css({
				position : 'absolute',
				top: '0px',
				left: '0px',
				zIndex: '2',
				width: '100%',
				height: '100%'
				});
			window.setInterval(fixedPosition,500);
			$(window).resize(fixedPosition);
			$(window).scroll(fixedPosition);
			
		}
	}
});

function fixedPosition(){
	var TargetObj = $('#bgFlash');
	var height = TargetObj.innerHeight();
	var docHeight = document.body.scrollHeight  || document.documentElement.scrollHeight;
	var t = document.body.scrollTop  || document.documentElement.scrollTop;
  if((t + height) >= docHeight){
  	t = (docHeight - height);
		TargetObj.css({top:t+'px'});
  	return;
  }
	TargetObj.css({top:t+'px'});
  return;
}