function addFlashObj(node, swf) {
	var tobject = document.createElement('object');
	var param1 = document.createElement('param');
	var param2 = document.createElement('param');
	var param3 = document.createElement('param');
	var tembed = document.createElement('embed');
	var flash_DIV = document.getElementById(node);
	tobject.setAttribute('classid','clsid:27CDB6E-AE6D-11cf-96B8-444553540000'); 
	tobject.setAttribute('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0'); 
	tobject.setAttribute ('id', 'blessingCon');
	param1.setAttribute('movie',swf); 
	param2.setAttribute('quality','high'); 
	param3.setAttribute('wmode','transparent');
	tembed.setAttribute('src',swf); 
	tembed.setAttribute('width','710'); 
	tembed.setAttribute('height','170'); 
	tembed.setAttribute('quality','high'); 
	tembed.setAttribute('pluginspage','http://www.macromedia.com/go/getflashplayer/'); 
	tembed.setAttribute('type','application/x-shockwave-flash'); 
	tembed.setAttribute('wmode','transparent');
	tembed.setAttribute('name', 'blessingCon');
	
	//var tembed = document.createElement("<embed src='"+swf+"' width='710' height='170' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer/' type='application/x-shockwave-flash' wmode='transparent' name='blessingCon' />");
	//var tobject = document.createElement("<object classid='clsid:27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' id='blessingCon' />");
	//onload = function() 
	//{ 
		//tobject.appendChild(param1); 
		//tobject.appendChild(param2); 
		//tobject.appendChild(param3); 
		//tobject.appendChild(tembed); 
		//flash_DIV.appendChild(tobject);
	//最後只用這行(傻眼)
	flash_DIV.innerHTML='<object id="flashSnow" width="710" height="170"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="movie" value="'+swf+'"><param name="wmode" value="transparent"><param name="quality" value="high" /></object>';
		
	//} 
}

function rolling(){
  var blessCon = document.getElementById('BLESS_CON');
  var blessDiv = document.getElementById('BLESS_DIV');
  var left = blessCon.style.left;
  var width = blessCon.style.width;
  var clientWidth = blessDiv.clientWidth;
  left = parseInt( left.replace('px','') );
  width = parseInt( width.replace('px','') );
  //blessCon.style.left = (left-1)+'px';
  if( (left*-1) >= (width-clientWidth+100) )
	blessCon.style.left = '0px';
  else
    blessCon.style.left = (left-1)+'px';  
  setTimeout('rolling()',60);
}
function startDrag(total){
  if(document.getElementById('BLESS_DIV')){
	  clearInterval(blessStart);
	  //載入雪花flash
	  //addFlashObj('BLESS_FLASH','../event/blessing/BLESSING_xmas_snow.swf');
	  var blessDiv = document.getElementById('BLESS_DIV');
	  var blessCon = document.getElementById('BLESS_CON');
	  var blessTable = document.getElementsByName('BLESS_TABLE');
	  var totalWidth = 0;
	  //取得總數量並算出總寬度,再將值塞給DIV
	  for(i=0;i<blessTable.length;i++){
		  totalWidth += blessTable[i].offsetWidth;
	  }
	  blessCon.style.width = totalWidth+'px';
	  var maxWidth = blessDiv.clientWidth-totalWidth;
	  blessCon.style.left = '50px';
	  Drag.init(blessCon,null,maxWidth,0,0,0);
	  //如果超過六則祈福則讓畫面開始自行滑動
	  if(total > 6)
		setTimeout('rolling()',60);
		//rollingGo = setInterval('rolling()',60);
  }
}



