// globals
var gbl_bln_DoScript = false
var gbl_productNav_Id = -1 // stores ID of product nav section when in that section - used to dissable rollover on product nav menu - set in 'processProductNav' function  , used in // used in 'rightMenuSwitch_off' functions


//////////////////////////////////////////////////////////////////
// NETSCAPE fix - calls netscapeFix() function when window is resized
if (document.layers)
{
  window.captureEvents(Event.RESIZE)
  window.onresize=netscapeFix
}

///////////////////////////////////////////////////////////////////
// reload in Netscape if resized
function netscapeFix()
{
  location.reload()
  return false
}

///////////////////////////////////////////////////////////////////
// Innitiated on page load
function setUp()
{
  gbl_bln_DoScript = true
  processProductNav()
}



///////////////////////////////////////////////////////////////////
// Detect current page and change style of right hand product nav accordingly
function processProductNav()
{
  if (document.getElementById)
  {
    // this array holds pages to detect
    var arrProductPages = new Array()
    arrProductPages[0] = "21.0acuvue2"
    arrProductPages[1] = "22.0acuvue"
    arrProductPages[2] = "23.0one-dayacuvue"
    arrProductPages[3] = "24.0bifocal"
    arrProductPages[4] = "25.0toric"
    arrProductPages[5] = "26.0acuvue-2-colours"
    
    var strLocation = self.document.location.href
    var intPosLastSlash = strLocation.lastIndexOf("/")
    var intPosPrevSlash = strLocation.lastIndexOf("/" , intPosLastSlash-1)
    strLocation = strLocation.substring( intPosPrevSlash +1 , intPosLastSlash)
    for (var i=0;i<arrProductPages.length;i++)
    {
      if ((strLocation.indexOf(arrProductPages[i]) != -1) && (document.getElementById("rightMen_arrow_" + i)))
      {
        var strRightMen_imageUrl = "/vistakonsp/images/globals/rightMen_image_" + strMenuID + "_on.gif"
        document.getElementById(strRightMen_imageId).src = strRightMen_imageUrl
        gbl_productNav_Id = i 
      }
    } 
  }
}


///////////////////////////////////////////////////////////////////
// Right hand navigation rollovers - roll on
// strMenuID = id of object that triggered event
function rightMenuSwitch2_on(strMenuID)
{
  if (document.getElementById && gbl_bln_DoScript)
  {
    var strRightMen_imageId = "rightMen_image_" + strMenuID
    var strRightMen_imageUrl = "/vistakonsp/images/globals/rightMen_image_" + strMenuID + "_on.gif"
    var strRightnav_messageUrl = "/vistakonsp/images/globals/right_product_nav_" + strMenuID + ".gif"
    
    document.getElementById(strRightMen_imageId).src = strRightMen_imageUrl
    
    if (document.getElementById("rightnav_message"))
    {
      document.getElementById("rightnav_message").src = strRightnav_messageUrl
    }
  }
}
///////////////////////////////////////////////////////////////////
// Right hand navigation rollovers - roll off
// strMenuID = id of object that triggered event
function rightMenuSwitch2_off(strMenuID)
{
  if (document.getElementById && gbl_bln_DoScript && parseInt(strMenuID) != gbl_productNav_Id)
  {
    var strRightMen_imageId = "rightMen_image_" + strMenuID
    var strRightMen_imageUrl = "/vistakonsp/images/globals/rightMen_image_" + strMenuID + "_off.gif"
    var strRightnav_messageUrl = "/vistakonsp/images/globals/right_product_nav_" + strMenuID + ".gif"
    
    document.getElementById(strRightMen_imageId).src = strRightMen_imageUrl
    
    if (document.getElementById("rightnav_message"))
    {
      document.getElementById("rightnav_message").src = "/vistakonsp/images/globals/right_product_nav_find_lens.gif"
    }
  }
}





///////////////////////////////////////////////////////////////////
// process link
// used by homepage and right hand side product navigation
// obgTr = reference to the TR cell that triggered the onClick event
function doLink(obgTr)
{
    var strHtml = obgTr.innerHTML
    var strLink = strHtml.match(/href=".*"/g)
    strLink = strLink[0].substring(6 , strLink[0].length-1)
    document.location.href = strLink
}

///////////////////////////////////////////////////////////////////
// country selecter
function jumpCountry()
{
  var strCountry = document.select_country.country.options[document.select_country.country.selectedIndex].value
  if (strCountry!= "NON SELL")
  {
    document.location.href = strCountry
  }
}



//////////////////////////////////////////////////////////////////
// NETSCAPE fix - calls netscapeFix() function when window is resized
if (document.layers)
{
  window.captureEvents(Event.RESIZE)
  window.onresize=netscapeFix
}

///////////////////////////////////////////////////////////////////
// reload in Netscape if resized
function netscapeFix()
{
  location.reload()
  return false
}


////////////////////////////////// 
/* Can you please include this javascript function in your library.js files for future consumer sites?
Thanks, 
Greg */
function search(){ 
  window.open("http://www.es.acuvue.com/hygiene/search/search.htm", target="_self"); 
} 

