function closemenu(idname,thisframe) {
   var targetElement, targetElement2;
   if (thisframe == 0) {
      targetElement = document.getElementById(idname);
      targetElement2 = document.getElementById(idname + "-active");
   } else {
      targetElement = parent.menu.document.getElementById(idname);
      targetElement2 = parent.menu.document.getElementById(idname + "-active");
   }
   if (targetElement.style.display == "none") {
         targetElement.style.display = "block";
         targetElement2.style.display = "none";
   }
}
function closeAll(thisframe) {
   closemenu('menu-guide', thisframe);
   closemenu('menu-myscreensavers', thisframe);
   closemenu('menu-downloads', thisframe);
   closemenu('menu-cds', thisframe);
   closemenu('menu-helpdesk', thisframe);
   activelink(1, thisframe);
   activelink2(4, thisframe);
   var artargetElement = [];
   for (i=1;i<=6;i++) {
      if (thisframe == 0) {
         artargetElement[i] = document.getElementById('line'+i);
      } else {
         artargetElement[i] = parent.menu.document.getElementById('line'+i);
      }
   }
   for (i=2;i<=5;i++) {
      artargetElement[i].className = 'line-bb';
   }
   artargetElement[1].className = 'line-bb1';
   artargetElement[6].className = 'line-bb6';
}
function openmenu(idname, thisframe) {
   var targetElement, targetElement2;
   closeAll(thisframe);
   if (thisframe == 0) {
      targetElement = document.getElementById(idname);
      targetElement2 = document.getElementById(idname + "-active");
   } else {
      targetElement = parent.menu.document.getElementById(idname);
      targetElement2 = parent.menu.document.getElementById(idname + "-active");
   }
   if (targetElement.style.display == "block") {
      targetElement.style.display = "none";
      targetElement2.style.display = "block";
   }
   var artargetElement = [];
   for (i=1;i<=6;i++) {
      if (thisframe == 0) {
         artargetElement[i] = document.getElementById('line'+i);
      } else {
         artargetElement[i] = parent.menu.document.getElementById('line'+i);
      }
   }
   if (idname == 'menu-guide') {
      artargetElement[1].className = 'line-bw1';
      artargetElement[2].className = 'line-wb';
   }
   if (idname == 'menu-myscreensavers') {
      artargetElement[2].className = 'line-bw';
      artargetElement[3].className = 'line-wb';
   }
   if (idname == 'menu-downloads') {
      artargetElement[3].className = 'line-bw';
      artargetElement[4].className = 'line-wb';
   }
   if (idname == 'menu-cds') {
      artargetElement[4].className = 'line-bw';
      artargetElement[5].className = 'line-wb';
   }
   if (idname == 'menu-helpdesk') {
      artargetElement[5].className = 'line-bw';
      artargetElement[6].className = 'line-wb6';
   }
}
function activelink(num, thisframe) {
   var targetElement, targetElement2, targetElement3, targetElement4;
   if (thisframe == 0) {
      targetElement = document.getElementById('available');
      targetElement2 = document.getElementById('available-active');
      targetElement3 = document.getElementById('current');
      targetElement4 = document.getElementById('current-active');
   } else {
      targetElement = parent.menu.document.getElementById('available');
      targetElement2 = parent.menu.document.getElementById('available-active');
      targetElement3 = parent.menu.document.getElementById('current');
      targetElement4 = parent.menu.document.getElementById('current-active');
   }
   if (num == 1) {
      targetElement.style.display = 'none';
      targetElement2.style.display = 'block';
      targetElement3.style.display = 'block';
      targetElement4.style.display = 'none';
   } else {
      targetElement.style.display = 'block';
      targetElement2.style.display = 'none';
      targetElement3.style.display = 'none';
      targetElement4.style.display = 'block';
   }
   return true;
}
function activelink2(num, thisframe) {
   var targetElement, targetElement2, targetElement3, targetElement4, targetElement5, targetElement6, targetElement7, targetElement8;
   if (thisframe == 0) {
      targetElement = document.getElementById('aboutmanager');
      targetElement2 = document.getElementById('aboutmanager-active');
      targetElement3 = document.getElementById('aboutus');
      targetElement4 = document.getElementById('aboutus-active');
      targetElement5 = document.getElementById('contactus');
      targetElement6 = document.getElementById('contactus-active');
      targetElement7 = document.getElementById('faq');
      targetElement8 = document.getElementById('faq-active');
   } else {
      targetElement = parent.menu.document.getElementById('aboutmanager');
      targetElement2 = parent.menu.document.getElementById('aboutmanager-active');
      targetElement3 = parent.menu.document.getElementById('aboutus');
      targetElement4 = parent.menu.document.getElementById('aboutus-active');
      targetElement5 = parent.menu.document.getElementById('contactus');
      targetElement6 = parent.menu.document.getElementById('contactus-active');
      targetElement7 = parent.menu.document.getElementById('faq');
      targetElement8 = parent.menu.document.getElementById('faq-active');
   }
   if (num == 1) {
      targetElement.style.display = 'none';
      targetElement2.style.display = 'block';
      targetElement3.style.display = 'block';
      targetElement4.style.display = 'none';
      targetElement5.style.display = 'block';
      targetElement6.style.display = 'none';
      targetElement7.style.display = 'block';
      targetElement8.style.display = 'none';
   }
   if (num == 2) {
      targetElement.style.display = 'block';
      targetElement2.style.display = 'none';
      targetElement3.style.display = 'none';
      targetElement4.style.display = 'block';
      targetElement5.style.display = 'block';
      targetElement6.style.display = 'none';
      targetElement7.style.display = 'block';
      targetElement8.style.display = 'none';
   }
   if (num == 3) {
      targetElement.style.display = 'block';
      targetElement2.style.display = 'none';
      targetElement3.style.display = 'block';
      targetElement4.style.display = 'none';
      targetElement5.style.display = 'none';
      targetElement6.style.display = 'block';
      targetElement7.style.display = 'block';
      targetElement8.style.display = 'none';
   }
   if (num == 4) {
      targetElement.style.display = 'block';
      targetElement2.style.display = 'none';
      targetElement3.style.display = 'block';
      targetElement4.style.display = 'none';
      targetElement5.style.display = 'block';
      targetElement6.style.display = 'none';
      targetElement7.style.display = 'none';
      targetElement8.style.display = 'block';
   }
   return true;
}
function updatedownloads() {
   s = eval(external.GetDownloadsInfo());
   num = s.length;
   comp = 0;
   for (i=0; i<num; i++) {
      if (s[i]['state'] == 'completed') {
         comp++;
      }
   }
   if (num == 0) {
      textdownload = 'Downloads';
   } else {
      textdownload = 'Downloads: '+comp+'/'+num;
   }
   if (document.getElementById('menu-downloads').innerHTML != textdownload) {
      document.getElementById('menu-downloads').innerHTML = textdownload;
      document.getElementById('menu-downloads2').innerHTML = textdownload;
   }
}
