/* This notice must be untouched at all times.

cvs_tiptext.js    v. 1.1		13-07-2006

Copyright (c) 2005 Clear Voice Systems Ltd. All rights reserved.

Provides Tiptext classe.

*/

  
function tiptexthandler(e) {

  if (!e) var e = window.event;
    
  var type=e.type;
  var id = this.name;

  if ( type == 'click' ) {
	if ( id.match(/sp\d/i) ) {
	  tiptext.showtiptext(tiptext.stringSearchIndex);
	}		
  }else if ( type == 'mouseover' ) {

    switch(id) {
      case 'bttnseek':
      MM_nbGroup('over','seek','images/sliderbttnnop.gif','',1);
	  tiptext.showtiptext(tiptext.stringSeek);
      break;

	  case 'bttnforward05':
	  case 'bttnforward30':
	  MM_nbGroup('over','forward','images/forwardnop.gif','',1);
	  tiptext.showtiptext(tiptext.stringForward);
	  break;

	  case 'bttnrewind05':
	  case 'bttnrewind30':
	  MM_nbGroup('over','rewind','images/rewindnop.gif','',1);
	  tiptext.showtiptext(tiptext.stringRewind);
	  break;
	
	  case 'bttntsminc':
	  MM_nbGroup('over','tsminc','images/tsmincnop.gif','',1);
	  tiptext.showtiptext(tiptext.stringFastSpeed);
	  break;
	  
	  case 'bttntsmdec':
	  MM_nbGroup('over','tsmdec','images/tsmdecnop.gif','',1);
	  tiptext.showtiptext(tiptext.stringSlowSpeed);
      break;

	  default:
	    ;
    }
  } else {
	MM_nbGroup('out');
    tiptext.removetiptext(); 
  }
  return (false);
}


// CLASS DEFINITION


//
// Class Tiptext

function Tiptext() {
  this.instance = 'tiptext';
  this.w = 130;
  this.h = 50;
  this.threadtiptext = null;
  this.persistence = 1200;		// Delay in mS after which tiptextbox is cancelled
  
  this.stringSeek = "'Seek' slider is available after download progress is complete.";
  this.stringRewind = "'Rewind05' and 'Rewind30' buttons are available after download progress is complete.";
  this.stringForward = "'Forward05' and 'Forward30' buttons are available after download progress is complete.";
  this.stringFastSpeed = "'Fast Speed' button is available after download progress is complete.";
  this.stringSlowSpeed = "'Slow Speed' button is available after download progress is complete.";
  this.stringSearchIndex = "Video Content list is actived after download progress is complete.";
  
  // Function showtiptext()
  this.showtiptext = function showtiptext(tiptext) {
    if ( this.threadtiptext )
      window.clearTimeout(this.threadtiptext);
	
    var id = document.getElementById('tiptextbox');
	id.style.visibility="visible";
	id.style.zIndex="10";
	id.innerHTML = tiptext;
	return (true);
  }

  // Function removetiptext()
  this.removetiptext = function removetiptext() {
    var id = document.getElementById('tiptextbox');
    if ( id.style == null )
	  return(false);

	this.threadtiptext = window.setTimeout('document.getElementById("tiptextbox").style.visibility="hidden";', 1200);
	return (true);
  }
}


//
// Class Tiptext4index

function Tiptext4index() {
  this.instance = 'tiptext4index';  
  this.delay = 15000;				// Delay period in mS before bubble tip is displayed (after movie is playing)
  this.duration = 30000;			// Period is mS for which bubble tip is display
  this.idThreadSentinal = null;			// Stores thread ID
  this.idThreadDelay = null;			// Stores timer thread ID
  this.idThreadDuration = null;			// Stores timer thread ID

  var id = document.getElementById('indexbubblebox');
  
  // Function handler() manages onClick event for closetipbubble
  this.handler = function handler() {
    if (!e)
	  var e = window.event;

	var type=e.type;
	
    switch ( type ) {
      case 'click':
	   // Clear any timer threads
	   if ( this.idThreadDelay )
	     window.clearTimeout(this.idThreadDelay);
		 
	  // Hide the bubble tip
	   removetiptext();
	   break;
	   
	  default:
	    break;
	}
	
  return (false);
  }

  // Function sentinal()
  this.sentinal = function sentinal() {
	 // Check if we are playing or we are finished downloading and that there are parsed index lines
	if ( ( (!_isonline && playstate == "Playing") || loadmovie.downloadstate == 1 ) && index.n > 0 ) {
      // Clear idThreadSentinal
      window.clearTimeout(this.idThreadSentinal);
	  this.idThreadDelay = window.setTimeout(this.instance + ".showtiptext();", this.delay);
	} else {
	   ;		//Do nothing 
	}
	return;
  }

  // Function showtiptext()
  this.showtiptext = function showtiptext() {
    // Clear idThreadDelay
    if ( this.idThreadDelay )
	  window.clearTimeout(this.idThreadDelay);
	
	if ( isIndexOpenedOnce )
	  return;
	  
	id.style.visibility="visible";
	this.idThreadDuration = window.setTimeout(this.instance + ".removetiptext();", this.duration);
	return (true);
  } 

  // Function removetiptext()
  this.removetiptext = function removetiptext() {

	// Clear idThreadDuration
	if ( this.idThreadDuration )
	  window.clearTimeout(this.idThreadDuration);

	id.style.visibility="hidden";
	return (true);
  }

}

