 var playStatus = 0;
 var activeFrame = 1;
 var totalFrames = 4;
 var pauseBetweenFrames = 600;
 var scrollingPlayerTimer;
 var FramesContent = [];
 var framesContentCounter = 0;
 var arrData = [];
 var sPath = "";
 
 function ScrollingPlayerAddFrame(arrDataForFrame)
 {
  FramesContent[framesContentCounter] = Array(arrDataForFrame['Title'], arrDataForFrame['Text'], arrDataForFrame['Link'], arrDataForFrame['Photo']);
  framesContentCounter++;
 } //end ScrollingPlayerAddFrame
 
 function refreshFrame(prev_id)
 {
  var index = activeFrame-1;
  document.getElementById('scrollingPlayerButton_'+prev_id).style.color='black';
  document.getElementById('scrollingPlayerButton_'+activeFrame).style.color='white';
	  //deal with Title
  document.getElementById('scrollingPlayerTitle').innerHTML=FramesContent[index][0];
	  //deal with Text
  document.getElementById('scrollingPlayerText').innerHTML=FramesContent[index][1];
	  //deal with Link
  if (FramesContent[index][2].length==0) FramesContent[index][2]='#';
  document.getElementById('scrollingPlayerLink').href=FramesContent[index][2];
  document.getElementById('scrollingPlayerLink').title=FramesContent[index][0];
	  //deal with Photo
  if (FramesContent[index][3].length==0) 
  {
  	FramesContent[index][3]= sPath+'blank.gif';
	document.getElementById('scrollingPlayerPhoto').title='';
  } //end if 
  else 
  {
  	document.getElementById('scrollingPlayerPhoto').title=FramesContent[index][0];
  } //end else 
  document.getElementById('scrollingPlayerPhoto').src=FramesContent[index][3];  
  document.getElementById('scrollingPlayerPhoto').alt=FramesContent[index][0];
 }//end function refreshFrame
 
 function changeFrame(newFrame, fromInit)
 {
  if (fromInit==undefined) fromInit=0;
  if (fromInit==1 && activeFrame>1) activeFrame--;
  var previousFrameButton = activeFrame;
  if (newFrame>0) 
  {
  	activeFrame=newFrame;
	clearTimeout(scrollingPlayerTimer);  
  } //end if 
  else 
  {
	  if (activeFrame==totalFrames || fromInit==1) activeFrame=1; else activeFrame++;
  }//end else 

   refreshFrame(previousFrameButton);
   if (playStatus==1) scrollingPlayerTimer = setTimeout("changeFrame(0)", pauseBetweenFrames);
 } //end function changeFrame
 
 function doPause()
 {
  playStatus=0;
  document.getElementById('pauseButton').src=sPath+'PauseDisabled.png';
  document.getElementById('playButton').src=sPath+'Play1Hot.png';
  clearTimeout(scrollingPlayerTimer);  
 } //end function doPause
 
 function doPlay(fromInit)
 {
	  playStatus=1;
	  document.getElementById('pauseButton').src=sPath+'PauseHot.png';
	  document.getElementById('playButton').src=sPath+'Play1Disabled.png';
	  changeFrame(0, fromInit);
 } //end function doPlay
 
 function ScrollingPlayerInit(init_playStatus, init_activeFrame, init_totalFrames, init_pauseBetweenFrames)
 {
  playStatus = init_playStatus;
  activeFrame = init_activeFrame;
  totalFrames = init_totalFrames;
  pauseBetweenFrames=init_pauseBetweenFrames;
  if (framesContentCounter>totalFrames) totalFrames=framesContentCounter;
  refreshFrame(activeFrame);
  
  if (totalFrames>1)
  {
	  if (playStatus==0) doPause(); else doPlay(1);
  } //end if 
  else 
  {
	 document.getElementById('pauseButton').src=sPath+'PauseDisabled.png';
	 document.getElementById('playButton').src=sPath+'Play1Disabled.png';
  } //end else 
 } //end function ScrollingPlayerInit
