<!--
      /**********************************************************************************   

      *   Description: The page comprises of the JavaScript code for the FPI website

      *

      *   Revision History: 

      *   Owner Initials           Date(mm/dd/yy)      Changes 

      * ----------------------------------------------------------

      *   ML                       02/03/05            Created

      *********************************************************************************/ 

var agt = navigator.userAgent.toLowerCase();
var ns6 = (!document.all && document.getElementById);
var ie5 = (agt.indexOf('msie') != -1);
var ie4 = document.all;
var ns4 = (document.layers);
var t;
var submenus = ["aboutus","products","services","cases","resources","pipeappl"];
var currentStory = -1;
var currentLength = 0;
var objTicker;
var characterTimeout = 50;
var storyTimeout = 5000;
var WidgetOne = "_";
var WidgetTwo = "-";
var NoWidget = "";
var headLines = new Array();
var headLineLinks = new Array();
var objTicker;


function jsfnHighlight(obj)
{
      /**********************************************************************************   
      *   Function Name: jsfnHighlight
      *   Parameters: obj
      *   Returns: N/A
      *   Description: The function Highlights the menu link
      *   Revision History:
      *   Initials                 Date              Changes
      * ---------------------------------------------------------- 
      *   ML                       02/03/05          Created
      *********************************************************************************/
  obj.className = "ft_MtextH";
}

function jsfnDimMe(obj)
{
      /**********************************************************************************   
      *   Function Name: jsfnDimMe
      *   Parameters: obj
      *   Returns: N/A
      *   Description: The function dims the highlighted link
      *   Revision History:
      *   Initials                 Date              Changes
      * ---------------------------------------------------------- 
      *   ML                       02/03/05          Created
      *********************************************************************************/
  obj.className = "ft_Mtext";
}
function jsfnHighlightItem(item)
{
      /**********************************************************************************   
      *   Function Name: jsfnHighlight
      *   Parameters: item
      *   Returns: N/A
      *   Description: The function Highlights the menu Cell
      *   Revision History:
      *   Initials                 Date              Changes
      * ---------------------------------------------------------- 
      *   ML                       02/03/05          Created
      *********************************************************************************/
  var obj;
  obj = jsfnfindObj(item);
  obj.className = "td_popmenuH";
}


function jsfnHighlightItem1(item)
{
      /**********************************************************************************   
      *   Function Name: jsfnHighlight1
      *   Parameters: item
      *   Returns: N/A
      *   Description: The function Highlights the menu Cell
      *   Revision History:
      *   Initials                 Date              Changes
      * ---------------------------------------------------------- 
      *   Sreekumar                05/06/05          Created
      *********************************************************************************/
  var obj;
  obj = jsfnfindObj(item);
  obj.className = "td_popmenuH1";
}




function jsfnDimItem(item)
{
      /**********************************************************************************   
      *   Function Name: jsfnDimMe
      *   Parameters: obj
      *   Returns: N/A
      *   Description: The function dims the highlighted Cell
      *   Revision History:
      *   Initials                 Date              Changes
      * ---------------------------------------------------------- 
      *   ML                       02/03/05          Created
      *********************************************************************************/
  var obj;
  obj = jsfnfindObj(item);
  obj.className = "td_popmenu";
}


function jsfnDimItem1(item)
{
      /**********************************************************************************   
      *   Function Name: jsfnDimItem1
      *   Parameters: obj
      *   Returns: N/A
      *   Description: The function dims the highlighted Cell
      *   Revision History:
      *   Initials                 Date              Changes
      * ---------------------------------------------------------- 
      *   Sreekumar                05/06/05          Created
      *********************************************************************************/
  var obj;
  obj = jsfnfindObj(item);
  obj.className = "td_popmenu1";
}

function jsfnPopUp(menuid,action)
{
      /**********************************************************************************   
      *   Function Name: jsfnPopUp(id,action)
      *   Parameters: menuid = identity of the item , action=show/hide
      *   Returns: N/A
      *   Description: The function displays the popupmenu
      *   Revision History:
      *   Initials                 Date              Changes
      * ---------------------------------------------------------- 
      *   ML                       02/03/05          Created
      *********************************************************************************/
var obj,v;

v = action;
if (t) {
      clearTimeout(t);
      t = null;
}
if ((obj=jsfnfindObj(menuid))!=null)  { 
         if (obj.style) {
            obj=obj.style; 
            v=(action=='show')?'block':(action=='hide')?'none':action; 
          }
        obj.display=v; 
	}	
}

function jsfnfitmainpane(xwidth)
{
      /**********************************************************************************   
      *   Function Name: jsfnfitmainpane
      *   Parameters: xwidth - horizontal resolution
      *   Returns:  none
      *   Description: The function fits the hidden pane to the screen width
      *   Revision History:
      *   Initials                 Date              Changes
      * ---------------------------------------------------------- 
      *   ML                       02/03/05          Created
      *********************************************************************************/
var obj;

if (ns6) {
            obj = document.getElementById('mainpane');
}

else if (ie4){
            obj = document.all['mainpane'];
}

else if (ns4) {
            obj = document.layers['mainpane'];
}

 obj.style.width=xwidth;

}

function jsfnsetTimer(menuid)
{ 
      /**********************************************************************************   
      *   Function Name: jsfnsetTimer
      *
      *   Parameters: menuid = identity of the item
      *               
      *   Returns: N/A
      *   Description: The function sets a timer to call the function to hide the item 
      *        represened by the id.
      *   Revision History:
      *   Initials                 Date              Changes
      * ---------------------------------------------------------- 
      *   ML                       02/03/05          Created
      *********************************************************************************/

 t = setTimeout("jsfnPopUp('" + menuid + "','hide')",1000);

}
function jsfnlayersCloseAll(){
      /**********************************************************************************   
      *   Function Name: jsfnlayersCloseAll
      *   Parameters: None
      *   Returns: N/A
      *   Description: The function forcibly hides all the popup submenus 
      *   Revision History:
      *   Initials                 Date              Changes
      * ---------------------------------------------------------- 
      *   ML                       02/05/05          Created
      *********************************************************************************/
for (var i=0;i < submenus.length;i++)
         jsfnPopUp(submenus[i],'hide');
}
function jsfnSubPopUp(menuid,parentid){
      /**********************************************************************************   
      *   Function Name: jsfnSubPopUp
      *   Parameters: menuid,parentid
      *   Returns: N/A
      *   Description: The function displays submenus 
      *   Revision History:
      *   Initials                 Date              Changes
      * ---------------------------------------------------------- 
      *   ML                       02/05/05          Created
      *********************************************************************************/
	if ((obj=jsfnfindObj(menuid))!=null)  { 
         if (obj.style) {
		 obj=obj.style;
		
           (obj.display=='none') ? (obj.display='block'):((obj.display=='block') ? (obj.display='none') : obj.display='block');
	}
	}
}

function jsfnfindObj(n,d) { //v4.01
      /**********************************************************************************   
      *   Function Name: jsfnfindObj
      *   Parameters: n = id, d=document object
      *   Returns:  an object 
      *   Description: The function parses thorugh all the components in the page to locate 
      * 	the object corresponding to the id given and returns it
      *   Revision History:
      *   Initials                 Date              Changes
      * ---------------------------------------------------------- 
      *   ML                       02/03/05          Created
      *********************************************************************************/
  var p,i,x;  
  if(!d) d=document; 
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; 
    n=n.substring(0,p);
  }
  if(!(x=d[n])&&d.all) x=d.all[n]; 
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
    x=jsfnfindObj(n,d.layers[i].document);
  if(!x && d.getElementById) 
	x=d.getElementById(n); 
  return x;
}


function jsfnBeginTick() {
      /**********************************************************************************   
      *   Function Name: jsfnBeginTick
      *   Parameters: none
      *   Returns:  none
      *   Description: The function initializes the ticker 
      *   Revision History:
      *   Initials                 Date              Changes
      * ---------------------------------------------------------- 
      *   ML                       02/20/05          Created
      *********************************************************************************/
	
	currentStory = -1;
	currentLength = 0;

	//locate base objects
	if (document.getElementById) {
		objTicker = jsfnfindObj("tickbar");
		jsfnRunTicker();
	}
	else
	{
		document.write("<style>.tickerbar{display:none;}</style>");
            return true;
	}

}

function jsfnRunTicker()
{
      /**********************************************************************************   
      *   Function Name: jsfnRunTicker
      *   Parameters: none
      *   Returns:  none
      *   Description: The function displays the ticker on the ticker bar 
      *   Revision History:
      *   Initials                 Date              Changes
      * ---------------------------------------------------------- 
      *   ML                       02/20/05          Created
      *********************************************************************************/
	
	var myTimeout;

	if (currentLength==0) {
		currentStory++;
		currentStory = currentStory % theItemCount;
		currentHeadline = headLines[currentStory].replace(/&quot;/g,'"');
		targetLink = headLineLinks[currentStory];
		objTicker.href = targetLink;
	}

	objTicker.innerHTML = currentHeadline.substring(0,currentLength) + jsfnWhatWidget();
	// Modify the length for the substring and define the timer

	if(currentLength != currentHeadline.length)
	{
		currentLength++;
		myTimeout = characterTimeout;
	}
	else
	{
		currentLength = 0;
		myTimeout = storyTimeout;
	}
	// Call up the next cycle of the ticker
	setTimeout("jsfnRunTicker()", myTimeout);	
}

function jsfnWhatWidget() {
      /**********************************************************************************   
      *   Function Name: jsfnWhatWidget
      *   Parameters: none
      *   Returns:  widgets
      *   Description: widget generator
      *   Revision History:
      *   Initials                 Date              Changes
      * ---------------------------------------------------------- 
      *   ML                       02/20/05          Created
      *********************************************************************************/

	if (currentLength == currentHeadline.length)
	{
		return NoWidget;
	}
	if ((currentLength % 2) == 1) 
	{
		return WidgetOne;
	}
	else
	{
		return WidgetTwo;
	}
}


 /**********************************************************************************   
      *   Function Name: pickRandom
      *   Parameters: range
      *   Returns:  image links
      *   Description: To get random images
      *   Revision History:
      *   Initials                 Date              Changes
      * ---------------------------------------------------------- 
      *   Sreekumar               04/06/2005          Created
      *********************************************************************************/



    // JavaScript to interpolate random images into a page.
    var ic = 10;     // Number of alternative images
    var xoxo = new Array(ic);  // Array to hold filenames
        
xoxo[0] = "../images/usa/home/image1.jpg";
xoxo[1] = "../images/usa/home/image2.jpg";
xoxo[2] = "../images/usa/home/image3.jpg";
xoxo[3] = "../images/usa/home/image4.jpg";
xoxo[4] = "../images/usa/home/image5.jpg";
xoxo[5] = "../images/usa/home/image6.jpg";
xoxo[6] = "../images/usa/home/image7.jpg";
xoxo[7] = "../images/usa/home/image8.jpg";
xoxo[8] = "../images/usa/home/image9.jpg";
xoxo[9] = "../images/usa/home/image10.jpg";

function pickRandom(range) {
if (Math.random)
return Math.round(Math.random() * (range-1));
else {
var now = new Date();
return (now.getTime() / 1000) % range;
}
}
// Write out an IMG tag, using a randomly-chosen image name.
var choice = pickRandom(ic);
// -->