// TabRotator Version:1.1 ;Author:linss<linss@ms1.url.com.tw> ;Release:2007/3/9
var Msg_Timer;
var onPause=false;
var currentMsg=0;
//var Msg_Obj=(document.all)?Tag_IE_1:document.all.Tag_NN_1;
var tmp_obj = document.getElementById('Tag_IE_1');
var Msg_Obj = tmp_obj !== null ? tmp_obj.getElementsByTagName('a') : null;

function Rot_Msg(m){
  if(!onPause||m){
  	if (document.Tag_COMM[currentMsg] == 'undefined'){
  		Msg_Obj = null;
  	}
  	if (Msg_Obj !== null) {
      var len = Msg_Obj.length;
      for(var i=0; i < len; i++){
      	if (document.Tag_COMM[i]){
          document.Tag_COMM[i].src="img/product/common/new_prd/home_new_prd_"+(i+1)+".png";
          Msg_Obj[i].style.display="none";
      	} else {
      		Msg_Obj = null;
      	}
      }
      if(m){
        currentMsg=m-1;
        clearTimeout(Msg_Timer);
      }else{Msg_Timer=setTimeout("Rot_Msg()",8000);}

      if (document.Tag_COMM[currentMsg]){
        document.Tag_COMM[currentMsg].src="img/product/common/new_prd/home_new_prd_"+(currentMsg+1)+"_grey.png";
        Msg_Obj[currentMsg].style.display="block";
        currentMsg = currentMsg+1 == len ? 0 : currentMsg+1;
      } else {
      	Msg_Obj = null;
      }
  	}
  }
}

function Pause_Msg(){
onPause=onPause?false:true
}
Rot_Msg()