var xmlHttp
var id
var MyPic
var is_ie = (navigator.userAgent.indexOf('MSIE') >= 0) ? 1 : 0; 
var is_ie5 = (navigator.appVersion.indexOf("MSIE 5.5")!=-1) ? 1 : 0; 
var is_opera = ((navigator.userAgent.indexOf("Opera6")!=-1)||(navigator.userAgent.indexOf("Opera/6")!=-1)) ? 1 : 0; 
//netscape, safari, mozilla behave the same??? 
var is_netscape = (navigator.userAgent.indexOf('Netscape') >= 0) ? 1 : 0; 
	
	function tS(whichLayer)
	{
		if (document.getElementById)
		{
			// this is the way the standards work
			var style2 = document.getElementById(whichLayer).style;
			style2.display = style2.display? "":"block";
		}
		else if (document.all)
		{
			// this is the way old msie versions work
			var style2 = document.all[whichLayer].style;
			style2.display = style2.display? "":"block";
		}
		else if (document.layers)
		{
			// this is the way nn4 works
			var style2 = document.layers[whichLayer].style;
			style2.display = style2.display? "":"block";
		}
	}

	function tL(whichLayer)
	{
		var MyPic = 'im'+whichLayer;
		if (document.getElementById)
		{
			// this is the way the standards work
			var style2 = document.getElementById(whichLayer).style;
			style2.display = style2.display? "":"block";
			// do image swap
			var fullpath = document.getElementById(MyPic).src;
		   if ( fullpath.search('/NewImages/Minus.jpg')>0 ) {
				document.getElementById(MyPic).src = '/NewImages/Plus.jpg';
			}
			else {
				document.getElementById(MyPic).src = '/NewImages/Minus.jpg';
			}
		}
		else if (document.all)
		{
			// this is the way old msie versions work
			var style2 = document.all[whichLayer].style;
			style2.display = style2.display? "":"block";
		}
		else if (document.layers)
		{
			// this is the way nn4 works
			var style2 = document.layers[whichLayer].style;
			style2.display = style2.display? "":"block";
		}
	}
	
function tOpen(whichLayer, type) {
	MyPic      = 'imtci_'+whichLayer;
	whichLayer = 'mc_' + whichLayer;
	if (document.getElementById)
	{
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
	// do image swap
	if (type == 1) {
		var fullpath = document.getElementById(MyPic).src;
	    if ( fullpath.search('/images/tree/ftv2mfirstnode.gif')>0 ) {
			document.getElementById(MyPic).src = '/images/tree/ftv2pfirstnode.gif';
		}
		else {
			document.getElementById(MyPic).src = '/images/tree/ftv2mfirstnode.gif';
		}
	}
	else if (type == 2) {
		var fullpath = document.getElementById(MyPic).src;
	    if ( fullpath.search('/images/tree/ftv2mlastnode.gif')>0 ) {
			document.getElementById(MyPic).src = '/images/tree/ftv2plastnode.gif';
		}
		else {
			document.getElementById(MyPic).src = '/images/tree/ftv2mlastnode.gif';
		}
	}
	else {
		var fullpath = document.getElementById(MyPic).src;
	    if ( fullpath.search('/images/tree/ftv2mnode.gif')>0 ) {
			document.getElementById(MyPic).src = '/images/tree/ftv2pnode.gif';
		}
		else {
			document.getElementById(MyPic).src = '/images/tree/ftv2mnode.gif';
		}
	}
}

  function sSc(div){ 
	var url = '/getSubCats.php?id=' + div;
	MyPic = 'imci_'+div;
	id    = 'ci_' + div
    // test if open
	var mystr  = document.getElementById(id).innerHTML;
	var style2 = document.getElementById(id).style;
	if (mystr.length > 0) {
		document.getElementById(id).innerHTML="" 
		style2.display = 'none';
	}
	else {
		style2.display = 'block';
		xmlHttp=GetXmlHttpObject(stateChanged)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
	    stateChanged()
	}
	// do image swap
	var fullpath = document.getElementById(MyPic).src;
    if ( fullpath.search('/NewImages/Minus.jpg')>0 ) {
		document.getElementById(MyPic).src = '/NewImages/Plus.jpg';
	}
	else {
		document.getElementById(MyPic).src = '/NewImages/Minus.jpg';
	}
} 

function stateChanged() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		document.getElementById(id).innerHTML=xmlHttp.responseText 
	} 
} 

function GetXmlHttpObject(handler) { 
    var objXmlHttp = null;    //Holds the local xmlHTTP object instance 

    //Depending on the browser, try to create the xmlHttp object 
    if (is_ie){ 
        //The object to create depends on version of IE 
        //If it isn't ie5, then default to the Msxml2.XMLHTTP object 
        var strObjName = (is_ie5) ? 'Microsoft.XMLHTTP' : 'Msxml2.XMLHTTP'; 
         
        //Attempt to create the object 
        try{ 
            objXmlHttp = new ActiveXObject(strObjName); 
            objXmlHttp.onreadystatechange = handler; 
        } 
        catch(e){ 
        //Object creation errored 
            alert('IE detected, but object could not be created. Verify that active scripting and activeX controls are enabled'); 
            return; 
        } 
    } 
    else if (is_opera){ 
        //Opera has some issues with xmlHttp object functionality 
        alert('Opera detected. The page may not behave as expected.'); 
        return; 
    } 
    else{ 
        // Mozilla | Netscape | Safari 
        objXmlHttp = new XMLHttpRequest(); 
        objXmlHttp.onload = handler; 
        objXmlHttp.onerror = handler; 
    } 
     
    //Return the instantiated object 
    return objXmlHttp; 
} 
  
  function textCounter(Valfield, CNTfield, maxlimit) {
    if (Valfield.value.length > maxlimit)
      Valfield.value = Valfield.value.substring(0, maxlimit);
    else
      CNTfield.value = maxlimit - Valfield.value.length;
  }
	
function getHeight()
{
	if(typeof(window.innerHeight) == 'number') return window.innerHeight; //Non-IE
	else if(document.documentElement && document.documentElement.clientHeight) return document.documentElement.clientHeight; //IE 6+ in 'standards compliant mode'
	else if(document.body && document.body.clientHeight) return document.body.clientHeight; //IE 4
}
function getWidth()
{
	if(typeof(window.innerWidth) == 'number') return window.innerWidth; //Non-IE
	else if(document.documentElement && document.documentElement.clientWidth) return document.documentElement.clientWidth; //IE 6+ in 'standards compliant mode'
	else if(document.body && document.body.clientWidth) return document.body.clientWidth; //IE 4
}
function pleaseWaitMsg()
{
	var pw=document.getElementById('pwait').style;
	pw.top=(getHeight()/2 - parseInt(pw.height)/2)+'px';
	pw.left=(getWidth()/2 - parseInt(pw.width)/2)+'px';
	pw.display='block';
}

function fixOverLay()
{
	var pw=document.getElementById('lbContent').style;
	pw.top=(getHeight()/2 - parseInt(pw.height)/2)+'px';
	pw.left=(getWidth()/2 - parseInt(pw.width)/2)+'px';
	pw.display='block';
}

function ThumbsWin(cid, type)
{
  leftPos = 0
  topPos = 0
  if (screen) {
    leftPos = (screen.width / 2) - 251
    topPos = (screen.height / 2) - 162
  }
  window.open('/votes.php?cid='+cid+'&type='+type,'commvote','width=400,height=150,left='+leftPos+',top='+topPos+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=yes')
}

<!-- 
function confirmDelete(stext) { 
if (confirm(stext)) {
  return true; 
} else {
  return false;
} 
} 
//--> 
