var ie=0;
try {
if (navigator.appName == 'Microsoft Internet Explorer') { ie=parseFloat(navigator.appVersion) }
} catch(e) {}
	
function update_frame(myoptions) {
destination = myoptions[myoptions.selectedIndex].value;
if (destination == "null") { return true; }
window.open(destination, '_top');
myoptions[0].text="Loading "+myoptions[myoptions.selectedIndex].text+"...";
myoptions.selectedIndex = 0;
//myoptions[myoptions.selectedIndex].text+="...";
return true;
}

function selectedCountry(opts,save) {
if (save) {
  var country=opts[opts.selectedIndex].value.match(/\/\/[^\/]+\/([^\/]+)\//)[1];
  if (country) {
    var expdate = new Date();
    expdate.setTime(expdate.getTime()+(1000*60*60*24*360));
    SetCookie('selectedCountry',country,expdate,'/','.verizonbusiness.com');
  }
}
update_frame(opts);
}

function vzbPopup(link) {
 var pop=window.open(link.href,'','width=562,height=600,scrollbars=1,resizable=1');
 if (pop) { pop.focus(); return false; }
}

function sizeRight() {
 var right=document.getElementById('right');
 var height=document.getElementById('content').offsetHeight - document.getElementById('below').offsetHeight - 20;
 if (right && height > right.offsetHeight) { right.style.height=height+"px"; }
}

function sizeLeft() {
 var left=document.getElementById('left');
 var height=document.getElementById('content').offsetHeight;
 if (left && height > left.offsetHeight) { left.style.height=height+"px"; }
}

var flashon;

function vzDD(item) {
  try {
  ul=item.getElementsByTagName('ul')[0];
  if (ie && ie<7) {
   ul.style.visibility="visible";
   if (item.tagName=='LI') {
   li=ul.getElementsByTagName('li');
   for (var i=0;i<li.length;i++) {
    li[i].style.display="block";
   }
  }
 }
 var f=document.getElementById('flashflash1');
 if (f && f.style.display=="block") {
  if (navigator.userAgent.indexOf('Safari')>0 || navigator.userAgent.indexOf('Linux')>0 ) {
    document.getElementById('flashcontent1').style.display="block";
    f.style.height="0px";
    f.style.visibility="hidden";
    flashon=f;
   }
 }
 } catch(e) {}
}
function vzDO(item) {
 try { if (ie && ie<7) {
 item.getElementsByTagName('ul')[0].style.visibility="hidden";
 }
 if (flashon) { 
  flashon.style.visibility="visible";
  flashon.style.height="auto";
  document.getElementById('flashcontent1').style.display="none"; flashon=0;
 }
 } catch(e) {}
}

function displayTopNav(req) {
 if (req.readyState==4) {
  var topnav;
  try {
   topnav=document.getElementById('topnav');
   if (req.responseText.substring(0,20).indexOf('table')>0) {
    topnav.innerHTML = req.responseText;
   }

   if (1 || document.getElementById('fly-voip')) {
   var tds=topnav.getElementsByTagName('td');
   for (var td=0;td<3;td++) {
    var p=tds[td].getElementsByTagName('ul')[0].childNodes;
    for (var n=0; n<p.length; n++) {
     var f=p[n].getElementsByTagName('a')[0].name;
     if (f) { var t=document.getElementById("fly-"+f);
     if (t) { var c=p[n].getElementsByTagName('ul')[0].cloneNode(true);
     if (c) { t.appendChild(c); c.style.marginTop="-10px"; } } }
    }
   }
   }
  } catch (e) {  }
  sizeTopNav();
 }
}

function sizeTopNav() {
  var topnav=document.getElementById('topnav');
  var tds=topnav.getElementsByTagName('td');
  for (var td=0; td<tds.length; td++) {
    var m=tds[td].getElementsByTagName('ul')[0];
    if (m) {
     var w=tds[td].offsetWidth; if (w>200) { w=200; }
     if (m.offsetWidth < w) { m.style.width=w+"px"; }
     else { w=m.offsetWidth; }
     w-=2;
     var ul=m.getElementsByTagName('ul');
     for (var i=0;i<ul.length;i++) { ul[i].style.left=w+"px"; }
     w-=14;
     var c=m.childNodes;
     for (var i=0;i<c.length;i++) {
      if (c[i].tagName == 'LI') { c[i].style.width=w+"px"; }
     }
    }
  }
}
function loadTopNav(url) {
 var navreq=false;
 if (url) {
 if (window.XMLHttpRequest) {
    navreq = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    try { navreq = new ActiveXObject("Msxml2.XMLHTTP"); }
    catch (e) {
      try { navreq = new ActiveXObject("Microsoft.XMLHTTP"); }
      catch (e) {}
    }
  }
  if (!navreq) {
    return true;
  }
  navreq.onreadystatechange = function() { displayTopNav(navreq); };
  navreq.open('GET', url, true);
  navreq.send(null);
  }
  return false;
}
