/* copyright 2006 Houston Chronicle
   ChronMenu2.0.js - author: John StG
  to force a section add window.CurrentSection=[0..11] before this script
*/
var dom=document.getElementById&&!document.all;var mousex,mousey;var agt=navigator.userAgent.toLowerCase();var _ISIE = document.all && window.ActiveXObject && (agt.indexOf("msie") > -1);var cMenus = new Array(12);var cFocusedMenu = null;var YFudge = _ISIE?1:0;var XFudge=(_ISIE)?0:-8;
function setupMenus() {
  var cmenu = getObject(targetmenu);
  if (!cmenu) {return false;}
  var currSection = getCurrentSection();
  var sectionClass = currSection[2];
  var SectionStyle = currSection[4];
  var CurrentPos = currSection[1];
  var i=0;
  var subm;
//  if (CurrentPos==0) {
//    subm = getObject('cSub2')
//  } else {
    subm = getObject('cSub'+(CurrentPos+1))
//  }
  if (subm) {cShow(subm);}
  for (i=0;i<sections.length;i++) {
   var submenuOvr = '';var highlight = '';
   var cmClass=(sections[i][2]+SectionStyle);
   var ele = getObject('cm'+(i+1));
   if (ele) {
    ele.className += SectionStyle;
    if(CurrentPos==i){
      submenuOvr = sections[i][5];
      cmClass=sections[i][3]||cmClass;
      ele.className = 'high';
    }
   }
  }
  return false;
}

function getCurrentSection() {
	var loc = document.location.toString();
        loc = loc.substr(0,(loc.indexOf('?')>0?loc.indexOf('?'):loc.length));
	if (!window.CurrentSection) {
                foundsection:
		for (var i=0;i<sections.length;i++) {
			var sectionMatch = sections[i][0];
			for (x in sectionMatch) {
				if (loc.indexOf(sectionMatch[x])>-1) {window.CurrentSection=i;/*break foundsection;*/}
			}
		}
	}
	if(!window.CurrentSection){
            if (loc.match('chron.com\/$') || loc.match('chron.com\/index.html')) {
		window.CurrentSection=0;
            } else {
		window.CurrentSection=1;
            }
	} else if (window.CurrentSection ==-1) {
      var sect = [['home'],0,'cmblue','','',''];
      return sect;
   }
	return sections[window.CurrentSection];
}
function cAttachEvent(obj,evt,func) {
  if (obj.addEventListener) {
    obj.removeEventListener(evt,func, false);
    obj.addEventListener(evt,func, false);
  } else if (obj.attachEvent){
   obj.detachEvent("on"+evt,func); // Bug fix line
   obj.attachEvent("on"+evt,func);
  }
}
function cShow(obj) {
   var theObj = getObject(obj);
   if (theObj) {
      if (!_ISIE && theObj.tagName.toUpperCase()=='TR') {
         theObj.style.display = "table-row";
      } else if (theObj.getAttribute('displaytype')) {
         theObj.style.display = theObj.getAttribute('displaytype');
      } else {
         theObj.style.display = 'block';
      }
      theObj.style.visibility = "visible";
	}
}
// Set the visibility of an object to hidden
function cHide(obj) {
   var theObj = getObject(obj);
   if (theObj) {
      theObj.style.display = "none";
      theObj.style.visibility = "hidden";
   }
}
function searchTravel() {
  var sel = getObject('globalsearch');
  if (!sel) {alert('No global Search');return false;}
//  var opt = new Option("Travel","Travel");
  sel.options[4].selected = true;

}



