﻿
// This sets a css class to the control specified in me.
function HandleAction(me,CssClass) {
	me.className= CssClass;
} // end function

function MatchColumns(d,isDivision) {
  var menu= document.getElementById("rightMenu");
  var news= document.getElementById("news");
  var divHeight= 0;  
  var menuHeight= 0;  
  news.style.height= "0px";
  if(d.offsetHeight){     
    divHeight= d.offsetHeight; 
    menuHeight= menu.offsetHeight;    
  } //end if
  else if(d.style.pixelHeight){
    divHeight= d.style.pixelHeight; 
    menuHeight= menu.style.pixelHeight;     
  } // end else if
  if(!isDivision) {
    document.getElementById("masterRight").style.height= (divHeight - 10) + 'px';
    news.style.height= (divHeight - menuHeight - 22) + 'px';    
  } // end if
  else {
    document.getElementById("masterRight").style.height= (divHeight + 68 + 12) + 'px';
    news.style.height= (divHeight - menuHeight + 68) + 'px';    
  } // end else 
  news.style.visibility= "visible";
} // end function

function ResizeListBox(id,width) {
  var listBox= document.getElementById(id);
  if(listBox !== null) {
    if(listBox.style.width > width) {
      listBox.style.width = 'auto';
    } // end if  
    else {
      listBox.style.width= width;
    } // end else
  } // end if
} // end function

function SetClipboard(copyText) {    
      if (window.clipboardData) { // IE send-to-clipboard method.
            window.clipboardData.setData('Text', copyText);            
      } // end if
      else if (window.netscape) {
            // You have to sign the code to enable this or allow the action in about:config by changing user_pref("signed.applets.codebase_principal_support", true);
            netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
            
            // Store support string in an object.
            var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
            if (!str) return false;
            str.data=copyText;
            
            // Make transferable.
            var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
            if (!trans) return false;
            
            // Specify what datatypes we want to obtain, which is text in this case.
            trans.addDataFlavor("text/unicode");
            trans.setTransferData("text/unicode",str,copyText.length*2);
            
            var clipid=Components.interfaces.nsIClipboard;
            var clip = Components.classes["@mozilla.org/widget/clipboard;1"].getService(clipid);
            if (!clip) return false;
                        
            clip.setData(trans,null,clipid.kGlobalClipboard);
            
      } // end else
} // end function

var clickedThumb= 0;

function ThumbClick(i) {
  if(clickedThumb > 0) {
    document.getElementById('tab' + clickedThumb).className= 'tabBlock';
  } // end if       
  document.getElementById('division' + clickedThumb).className= 'divisionHidden';    
  document.getElementById('division' + i).className= 'division';
  clickedThumb= i;
  MatchColumns(document.getElementById('division' + i),true);  
} // end function

function ThumbOver(i) {   
  document.getElementById('tab' + i).className= 'tabBlockOver';
} // end function

function ThumbOut(i) {  
  if(clickedThumb != i) {
    document.getElementById('tab' + i).className= 'tabBlock';
  } // end if   
} // end function

