/** description:	
*         Generic object storing ticker information and state, 
*         object has animate() method that 
*					animates ticker by one frame
*				 
*	created			M.Szlapa 22 Dec 1999
*	modified	
*/
function Ticker(objTickerItem, boxSize, text, mSeconds) {
  // member variables
  this.tickerItem     = objTickerItem;
  this.boxLength      = boxSize;  
  this.tickerMessage  = new String(text);
  this.interval       = mSeconds;       // time allowed for animating one character
  this.pos            = 0;
  this.tickerLength   = text.length;
  this.speed          = (this.boxLength/this.tickerLength)+1;
  //methods
  this.animate        = animate;
  //alert("ticker created for "+ this.tickerItem.name);
}
// animation method of ticker object
function animate(){
   this.tickerItem.value = this.tickerMessage.substring(this.pos,  this.pos+this.boxLength+1);
   if(this.pos++ >= (this.tickerLength-this.boxLength) ) 
      this.pos=0;
}


/** 
* description:	This function highlight single image
*	              requires that image files named image.gif amd image_s.gif exist
*								called by OnMouseOver	  
*	created			M.Sz 6 Dec 1999
*	modified	  M.Sz 13 Dec 1999 - highlighted images have now "_r" in name 
*/
function turnImageOn(objImg) {

 
  // try to highlight image only if image is not highlighted yet
  if( objImg.src.indexOf("_r.gif") == -1 ) {
    document.imo_highlighted_image = objImg; // store the name of the image
    objImg.src = objImg.src.substring(0, objImg.src.indexOf(".gif",1) ) + "_r.gif";	    
 }
}

/** 
* description:	This function highlight single image
*	              requires that image files named image.gif amd image_s.gif exist
*								called by OnMouseOver	  
*	created			M.Sz 6 Dec 1999
*	modified	  M.Sz 13 Dec 1999 - highlighted images have now "_r" in name 
*/
function turnImageOff(objImg, bAlways) {

 // image will be always unhighlighted if the flag bAlways is on
 // otherwise will be  unhighlighted only if highlighted already

 if (bAlways) 
    objImg.src = objImg.src.substring(0, objImg.src.indexOf("_r.gif",1) ) + ".gif";	
}

/** 
* description:	This function preloads all images spedified in parameter list
*	              requires that image files named image.gif amd image_s.gif exist
*								called by OnMouseOver	  
*	created			M.Sz 7 Jan 2000
*	modified	  
*/
function preloadImages(objImgList) {
  var idx;

  if(preloadImages.arguments.length > 0 ) {

    if( document.imageArray == null) {
      document.imageArray = new Array(preloadImages.arguments.length);
    }
    
    for( idx=0; idx < preloadImages.arguments.length; idx++) {
      if( preloadImages.arguments[idx] != null) {
        document.imageArray[idx] = new Image();
        document.imageArray[idx].src = preloadImages.arguments[idx];
      } // end if
    } // end for
  }//end if imglist.length > 0
}


/** 
* description:	function goes to the section based on the text selected in the drop down list
*               parameter is the name of the dropdown list
*	created			  M.Sz 13 Dec 1999
*	modified	
*/
function goToSection(objSelectField){ 
	
  var index = objSelectField.selectedIndex;
	var fieldValue = objSelectField.options[index].value;
	var URL  = objSelectField.options[index].value;
	
	

  if( URL != "#" )
    parent.location.href = "/imoweb/"+URL;
    
 	
}


/*A function used to cleanUp a special string, usually extracted from a cookie. */
/*WARNING: Potentially Error-Prone										--SZ    */	
function cleanUp (theString)
{	var finalWord = ""
	var oldword = ""
	var aword = theString;
	
	/*The following statement might be the reason of run time error because */
	/*of the non-existant char "+" in the cookie string		-- SZ			*/
	if ((aword.indexOf("+") != -1) && (aword.charAt("+") != aword.length-1))
	{	var bword = aword.split("+"); 				
		for (i=0;i < bword.length;i++)
		{	oldword = oldword + bword[i] + " ";
		}
		finalWord = oldword.substring(0,oldword.length - 1);
	}
	else
	{	finalWord = aword;
	}

	testWord = finalWord;
	count = testWord.length
	for (i=0;i<count;i++)
	{	finalWord = testWord.replace("\"","\'");
		if (finalWord.indexOf("\"") == -1)
		{	break; }
		testWord = finalWord;
	}
	
	testWord2 = finalWord;
	count2 = testWord2.length
	for (i=0;i<count2;i++)
	{	finalWord = testWord2.replace("%$$%","="); 	
		if (finalWord.indexOf("%$$%") == -1)
		{	break; }
		testWord2 = finalWord;
	}
	testWord3 = finalWord;
	if (testWord3 == "&%null")
	{	finalWord = testWord3.replace("&%null",""); 	
	}
	return finalWord;
}





