
function ConvertFromHTMLref(text){

   text=text.replace(/&aacute;/gi,"á")
   text=text.replace(/&agrave;/gi,"à")
   text=text.replace(/&acirc;/gi,"â")
   text=text.replace(/&atilde;/gi,"ã")
   text=text.replace(/&auml;/gi,"ä")
   text=text.replace(/&aring;/gi,"å")
   text=text.replace(/&aelig;/gi,"æ")
   text=text.replace(/&ccedil;/gi,"ç")
   text=text.replace(/&eacute;/gi,"é")
   text=text.replace(/&egrave;/gi,"è")
   text=text.replace(/&ecirc;/gi,"ê")
   text=text.replace(/&euml;/gi,"ë")
   text=text.replace(/&igrave;/gi,"ì")
   text=text.replace(/&iacute;/gi,"í")
   text=text.replace(/&icirc;/gi,"î")
   text=text.replace(/&iuml;/gi,"ï")
   text=text.replace(/&ntilde;/gi,"ñ")
   text=text.replace(/&oacute;/gi,"ó")
   text=text.replace(/&ograve;/gi,"ò")
   text=text.replace(/&ocirc;/gi,"ô")
   text=text.replace(/&otilde;/gi,"õ")
   text=text.replace(/&#339;/gi,"œ")
   text=text.replace(/&ouml;/gi,"ö")
   text=text.replace(/&uacute;/gi,"ú")
   text=text.replace(/&ugrave;/gi,"ù")
   text=text.replace(/&ucirc;/gi,"û")
   text=text.replace(/&uuml;/gi,"ü")
   text=text.replace(/&Ucirc;/gi,"Û")
   text=text.replace(/&yacute;/gi,"ý")
   text=text.replace(/&deg;/gi,"°")
   text=text.replace(/&lt;/gi,"<")
   text=text.replace(/&gt;/gi,">")
   text=text.replace(/&#40;/gi,"(")
   text=text.replace(/&#41;/gi,")")
   text=text.replace(/&#39;/gi,"'")
   text=text.replace(/&#96;/gi,"`")
   text=text.replace(/&#x22;/gi,"\"")

   return text;

}


   function help_open(url,width,height,name){
      if (typeof(width) == "undefined"){var width=600;}
      if (typeof(height) == "undefined"){var height=400;}
      if (width == ""){var width=600;}
      if (height == ""){var height=400;}
      if (typeof(name) == "undefined"){name = "helpconsole";}
      window.open(url,name,'width='+width+',height='+height+',menubar=0,toolbar=0,status=0,scrollbars=1,resizable=1')
   }

   function roll(img_name, img_src){
      document[img_name].src = img_src;
   }


  function MM_preloadImages() {
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
  }


  function ShowMenu(init){
    if (init == "yes"){
      if (window.init()){
        init();
      }
    }
    document.getElementById("floating_menu").style.display = "block";
    document.getElementById("left_corner").style.background = "#E7EFF7";
  }




function pull(){
     if (window.drawit){
       clearInterval(drawit);
     } 
     pullit=setInterval("pullengine()",10);
   }

   function draw1(){
     clearTimeout(moving);
     moving = setTimeout('draw1()', waitTime);
   }
   function draw(){
     clearInterval(pullit)
     drawit = setInterval("drawengine()",10)
   }

   function pullengine(){
     if ((ie4||ns6) && parseInt(themenu.marginLeft) > (leftmarginboundary)){
       themenu.marginLeft=parseInt(themenu.marginLeft)-10+"px"
     }
     else if (window.pullit){
       themenu.marginLeft=leftmarginboundary
       clearInterval(pullit)
     }
   }

   function drawengine(){
     if ((ie4||ns6) && parseInt(themenu.marginLeft) < (rightmarginboundary)){
       themenu.marginLeft = parseInt(themenu.marginLeft)+10+"px"
     }
     else if (window.drawit){
       themenu.marginLeft = rightmarginboundary
       clearInterval(drawit)
     }
   }

   function truebody(){
     return (document.compatMode!="BackCompat")? document.documentElement : document.body
   }

   function makeStatic() {
     if (ns6) {winY = window.pageYOffset;}
     if (ie4) {winY = truebody().scrollTop;}
     if (ie4||ns6) {
     if (winY!=lastY&&winY>YOffset-staticYOffset) {
     smooth = .2 * (winY - lastY - YOffset + staticYOffset);}
     else if (YOffset-staticYOffset+lastY>YOffset-staticYOffset) {
     smooth = .2 * (winY - lastY - (YOffset-(YOffset-winY)));}
     else {smooth=0}
     if(smooth > 0) smooth = Math.ceil(smooth);
     else smooth = Math.floor(smooth);
     if (ie4) themenu.pixelTop+=smooth;
     else if (ns6) themenu.top=parseInt(themenu.top)+smooth+"px"
     lastY = lastY+smooth;
     setTimeout('makeStatic()', 1)}
   }



 function chgColor(row_id,color,original_color){

     var current_color = document.getElementById(row_id).style.background;
     current_color = current_color.toUpperCase();

     // re-color everything
     var row_color = '#FFFFFF';
     var table = document.all ? document.all['mainTable'] :
     document.getElementById ?
     document.getElementById('mainTable') : null;
     if (table){
        for (var r = 0; r < table.rows.length; r++){
           if (row_color == '#E9E9FF'){
             row_color = "#FFFFFF";
           }
           else {
             row_color = "#E9E9FF";
           }
           table.rows[r].style.background = row_color;
        }
     }

     // set the color for the row
     if (current_color != color){
        document.getElementById(row_id).style.background=color;
     }
     else {
         document.getElementById(row_id).style.background=original_color;
     }
   }

   function checkBrowser(fullagent) {
      var wts_browser="";
      var wts_browser_version="";

      var agent = fullagent.toLowerCase();
      if (agent.indexOf('opera/') != -1){
         wts_browser = "Opera "+agent.substr(agent.indexOf('opera')+6,4);
      return wts_browser;
      }
      if (agent.indexOf('opera') != -1){
         wts_browser = "Opera "+agent.substr(agent.indexOf('opera')+5,4);
         return wts_browser;
      }
      if (agent.indexOf('googlewirelesstranscoder') != -1){
         wts_browser = "Google Wireless Transcoder";
         return wts_browser;
      }
      if (agent.indexOf('msie') != -1){
         if (agent.indexOf('trident/4.0') != -1){
            wts_browser = "MSIE 8.0"
            return wts_browser;
         }
         wts_browser = "MSIE "+agent.substr(agent.indexOf('msie')+4,3);
         return wts_browser;
      }
      if (agent.indexOf('chrome') != -1){
         wts_browser = "Chrome "+agent.substr(agent.indexOf('chrome')+7,3);
         return wts_browser;
      }
      if (agent.indexOf('safari')!= -1){
         wts_browser = "Safari "+agent.substr(agent.indexOf('version')+8,3);
         return wts_browser;
      }
      if (agent.indexOf('netscape/')!= -1){
         wts_browser = "Netscape "+agent.substr(agent.indexOf('netscape')+9,3);
         return wts_browser;
      }
      if (agent.indexOf('netscape6')!= -1){
         wts_browser = "Netscape "+agent.substr(agent.indexOf('netscape6')+10,3);
         return wts_browser;
      }
      if (agent.indexOf('netscape')!= -1){
         wts_browser = "Netscape "+agent.substr(agent.indexOf('netscape')+8,3);  
         return wts_browser; 
      }
      if (agent.indexOf('aol')!= -1){
         wts_browser = "AOL "+agent.substr(agent.indexOf('aol')+4,4);
         return wts_browser;
      }
      if (agent.indexOf('firebird')!= -1){
         wts_browser = "Firebird "+agent.substr(agent.indexOf('firebird')+9); 
         return wts_browser;
      }
      if (agent.indexOf('firefox')!= -1){
         wts_browser = "Firefox "+agent.substr(agent.indexOf('firefox')+8,3); 
         return wts_browser;
      }
      if (agent.indexOf('avantgo')!= -1){
         wts_browser = "AvantGo "+agent.substr(agent.indexOf('avantgo')+7,3);  
         return wts_browser;
      }
      if (agent.indexOf('thunderbird')!= -1){
         wts_browser = "Thunderbird "+agent.substr(agent.indexOf('thunderbird')+12,3);  
         return wts_browser;
      }
      if (agent.indexOf('camino')!= -1){
         wts_browser = "Camino "+agent.substr(agent.indexOf('camino')+7,3);  
         return wts_browser;
      }
      if (agent.indexOf('nokia')!= -1){
         wts_browser = "Nokia" 
         return wts_browser;
      }
      if (agent.indexOf('blackberry')!= -1){
         wts_browser = "BlackBerry";  
         return wts_browser;
      }
      if (agent.indexOf('mozilla')!= -1){
         wts_browser_version = agent.substr(agent.indexOf('mozilla')+8,3); 
//         if (wts_browser_version > 2){
//            wts_browser = "Netscape "+wts_browser_version
//         }
//         else {
            wts_browser = "Mozilla "+wts_browser_version
//         }
         return wts_browser;
      }

      wts_browser = "other";
      return wts_browser;   
   }

   function checkOS(fullagent) {
      var wts_os="";

      var agent = fullagent.toLowerCase();
      if (agent.indexOf('winnt6.0') != -1){
         wts_os = "Win Vista";
         return wts_os;
      }
      if (agent.indexOf('windowsnt6.1') != -1){
         wts_os = "Win 7";
         return wts_os;
      }
      if (agent.indexOf('windowsnt6.0') != -1){
         wts_os = "Win Vista";
         return wts_os;
      }
      if (agent.indexOf('winnt5.1') != -1){
         wts_os = "Win XP";
         return wts_os;
      }
      if (agent.indexOf('windowsnt5.1') != -1){
         wts_os = "Win XP";
         return wts_os;
      }
      if (agent.indexOf('winxp') != -1){
         wts_os = "Win XP";
         return wts_os;
      }
      if (agent.indexOf('windowsxp') != -1){
         wts_os = "Win XP";
         return wts_os;
      }
      if (agent.indexOf('winnt5.0') != -1){
         wts_os = "Win 2000";
         return wts_os;
      }
      if (agent.indexOf('windowsnt5.0') != -1){
         wts_os = "Win 2000";
         return wts_os;
      }
      if (agent.indexOf('winnt') != -1){
         wts_os = "Win NT";
         return wts_os;
      }
      if (agent.indexOf('windowsnt') != -1){
         wts_os = "Win XP";
         return wts_os;
      }
      if (agent.indexOf('win9x4.90') != -1){
         wts_os = "Win Me";
         return wts_os;
      }
      if (agent.indexOf('windowsme') != -1){
         wts_os = "Win Me";
         return wts_os;
      }
      if (agent.indexOf('win98') != -1){
         wts_os = "Win 98";
         return wts_os;
      }
      if (agent.indexOf('windows98') != -1){
         wts_os = "Win 98";
         return wts_os;
      }
      if (agent.indexOf('win95') != -1){
         wts_os = "Win 95";
         return wts_os;
      }
      if (agent.indexOf('windows95') != -1){
         wts_os = "Win 95";
         return wts_os;
      }
      if (agent.indexOf('windows3.1') != -1){
         wts_os = "Win 3.1";
         return wts_os;
      }
      if (agent.indexOf('win3.1') != -1){
         wts_os = "Win 3.1";
         return wts_os;
      }
      if (agent.indexOf('win16') != -1){
         wts_os = "Win 3.1";
         return wts_os;
      }
      if (agent.indexOf('macintosh') != -1){
         wts_os = "Mac";
         return wts_os;
      }     
      if (agent.indexOf('mac_powerpc') != -1){
         wts_os = "Mac";
         return wts_os;
      }      
      if (agent.indexOf('mac_ppc') != -1){
         wts_os = "Mac";
         return wts_os;
      }
      if (agent.indexOf('linux') != -1){
         wts_os = "Linux";
         return wts_os;
      }
      if (agent.indexOf('lynx') != -1){
         wts_os = "UNIX";
         return wts_os;
      }
      if (agent.indexOf('x11') != -1){
         wts_os = "UNIX";
         return wts_os;
      }
      if (agent.indexOf('bsd') != -1){
         wts_os = "UNIX";
         return wts_os;
      }
      if (agent.indexOf('sunos') != -1){
         wts_os = "UNIX";
         return wts_os;
      }
      if (agent.indexOf('webtv') != -1){
         wts_os = "WebTV";
         return wts_os;
      }
      if (agent.indexOf('symbianos')!= -1){
         wts_os = "Symbian OS";  
         return wts_os;
      }
      if (agent.indexOf('j2me')!= -1){
         wts_os = "Java";  
         return wts_os;
      }
      if (agent.indexOf('iemobile')!= -1){
         wts_os = "IE Mobile";  
         return wts_os;
      }
      if (agent.indexOf('iphone') != -1){
         wts_os = "IPhone";
         return wts_os;
      }
      if (agent.indexOf('blackberry') != -1){
         wts_os = "Blackberry";
         return wts_os;
      }
      if (agent.indexOf('nokia')!= -1){
         wts_os = "Nokia";  
         return wts_os;
      }

      wts_os = "other";
      return wts_os;   

   }


   function roll(img_name, img_src){
      document[img_name].src = img_src;
   }

  function MM_preloadImages() {
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
  }

//  MM_preloadImages("tab1_img0.gif","tab1_img1.gif","tab1_img2.gif","tab2_img0.gif","tab2_img1.gif","tab2_img2.gif","tab3_img0.gif","tab3_img1.gif","tab3_img2.gif","tab1.gif","tab2.gif","tab3.gif","corner_tl.gif","corner_tr.gif","card_backgnd.jpg","card_bottom.jpg");

  MM_preloadImages("corner_tl.gif","tab1_img2.gif","tab2_img2.gif","tab3_img2.gif");

  function ChangePic(id,type){
    if (id == "tab'.$PRINT->{'tab_number'}.'"){
       return;
    }
    if (type == "show"){
      document.getElementById(id).src = id+"_img2.gif";
      document.getElementById(id+'_text').style.color = "#CC3333";
    }
    else {
      document.getElementById(id).src = id+"_img0.gif";
      document.getElementById(id+'_text').style.color = "#827BAE";
    }
  }


