﻿// JScript File
var ddmenuitem = 0;

function jsddm_open() {
  ddmenuitem = $(this).find('ul').show();
  if($.browser.msie != true){
   ddmenuitem.css('top','-3px');
  }  
  ulid = ddmenuitem.attr("id")
  if (ulid == "ul1")
    document.getElementById("imgAbout").src="/wp-content/themes/itg-white/images/mainnav1-over.png"
  if (ulid == "ul2")
    document.getElementById("imgSolutions").src="/wp-content/themes/itg-white/images/mainnav2-over.png"
  if (ulid == "ul3")
    document.getElementById("imgOfferings").src="/wp-content/themes/itg-white/images/mainnav3-over.png"
  if (ulid == "ul4")
    document.getElementById("imgNews").src="/wp-content/themes/itg-white/images/mainnav4-over.png"
}

function jsddm_close() {
  if(ddmenuitem) {
    ddmenuitem.css('display', 'none');
    ulid = ddmenuitem.attr("id")
    currentlocation = new String(window.location)

    if (ulid == "ul1"){  
      if ((currentlocation.indexOf("/about.htm")>0) || (currentlocation.indexOf("/abt_")>0)){
        document.getElementById("imgAbout").src="/wp-content/themes/itg-white/images/mainnav1-on.png"             
      }
      else {
        document.getElementById("imgAbout").src="/wp-content/themes/itg-white/images/mainnav1.png"      
      }
    }
    if (ulid == "ul2"){
      if ((currentlocation.indexOf("/solutions.htm")>0) || (currentlocation.indexOf("/sol_")>0)){
        document.getElementById("imgSolutions").src="/wp-content/themes/itg-white/images/mainnav2-on.png"
      }
      else {
        document.getElementById("imgSolutions").src="/wp-content/themes/itg-white/images/mainnav2.png"
      }
    }
    if (ulid == "ul3"){
      if ((currentlocation.indexOf("/offerings.htm")>0) || (currentlocation.indexOf("/off_")>0)){
        document.getElementById("imgOfferings").src="/wp-content/themes/itg-white/images/mainnav3-on.png"
      }
      else {
        document.getElementById("imgOfferings").src="/wp-content/themes/itg-white/images/mainnav3.png"
      }
    }
    if (ulid == "ul4"){
      if ((currentlocation.indexOf("/news.htm")>0) || (currentlocation.indexOf("/new_")>0)){
        document.getElementById("imgNews").src="/wp-content/themes/itg-white/images/mainnav4-on.png"
      }
      else {
        document.getElementById("imgNews").src="/wp-content/themes/itg-white/images/mainnav4.png"
      }
    }
  } 
}

$(document).ready(function() {
  $("#jsddm > li").hoverIntent({
    sensitivity: 1, 
    interval: 150, 
    over: jsddm_open, 
    timeout: 250, 
    out: jsddm_close
  });
});

document.onclick = jsddm_close;  