    var nhAnimationValue = 10;
    var nhAnimationInterval = 40;

	function nhContainer()
	{
		this.nhCollapseNodeID = 0;		
		this.nhExpandNodeID = 0;
		this.nhModuleMaxRowHeight = 68;
		this.nhModuleMinRowHeight = 24;
		this.nhCollapsedRowHeight = 34;
		this.nhExpandedRowHeight = 58;
		this.tzImageObjbArr = new Array();		
		this.heightAdjustObjbArr = new Array();
		this.containerArr = new Array();
		this.idArr = new Array();
		this.idExpansionStatus = new Array();
		this.numIds = 0;
		this.dataUrl = '';
		this.refreshRate = 30000;
		this.objName = '';
		this.xmlHttpReq = false;
		this.iframeObj = false;
		this.domParserAX = false;
		this.parseHandler = new Function();
	}
	function nhContainer_setObjName(objName)
	{
		this.objName = objName;
	}
	nhContainer.prototype.setObjName = nhContainer_setObjName;
	
	function nhContainer_setParsingFunction(func)
	{
		this.parseHandler = func;
	}
	nhContainer.prototype.setParsingFunction = nhContainer_setParsingFunction;
	
	function nhContainer_refresh()
	{
		if (!this.xmlHttpReq && window.ActiveXObject)
		{
			try
			{
				this.xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e)
			{
				try
				{
					this.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
				} catch(e) {
					// do nothing
				}
			}
			try
			{
				this.domParserAX = new ActiveXObject("Microsoft.XMLDOM");
				xmlDoc.async = false;
			}catch(e) {
			// do nothing
			}			
		} else if (!this.xmlHttpReq && window.XMLHttpRequest && (navigator.userAgent.indexOf('Mozilla/5.0')==-1) && (navigator.userAgent.indexOf('Opera')==-1))
		{
			this.xmlHttpReq = new XMLHttpRequest();
			if(this.xmlHttpReq.overrideMimeType) {
				this.xmlHttpReq.overrideMimeType("text/xml");
			}
		}
		if(this.xmlHttpReq)
		{
			this.xmlHttpReq.open("GET", this.dataUrl+"?cacheID="+(nhModuleCacheBuster%30),false);
			this.xmlHttpReq.send("");
			this.handleResponse();
		}
		else
		{
			this.iframeObj=document.getElementById(this.objName+'Frame');
			window.frames[this.objName+'Frame'].location.replace(this.dataUrl+"?cacheID="+(nhModuleCacheBuster%30));
		}
		window.setTimeout(this.objName+'.refresh()',this.refreshRate);
		nhModuleCacheBuster++;
	}
	nhContainer.prototype.refresh = nhContainer_refresh;
	
	function nhContainer_setDataUrl(url) {
		this.dataUrl = url;
	}
	nhContainer.prototype.setDataUrl = nhContainer_setDataUrl;

	function nhContainer_setRefreshRate(time) { // in seconds
		this.refreshRate = time*1000;		
	}
	nhContainer.prototype.setRefreshRate = nhContainer_setRefreshRate;
	
	function nhContainer_addContainer(id,height) {
		if (document.getElementById(id)) {
			document.getElementById(id).style.height = "24px";
		}
		this.idArr[this.idArr.length] = id;
		this.containerArr[this.containerArr.length] = document.getElementById(id);
		this.heightAdjustObjbArr[this.heightAdjustObjbArr.length] = document.getElementById(id);
		this.tzImageObjbArr[this.tzImageObjbArr.length] = document.getElementById(id +'Image');
		this.idExpansionStatus[this.idExpansionStatus.length] = false;
		this.numIds++;
		if (height) {
			this.nhModuleMaxRowHeight = height;
			this.nhExpandedRowHeight = this.nhModuleMaxRowHeight;				
		}
	}
	nhContainer.prototype.addContainer = nhContainer_addContainer;

	function nhContainer_zipNode(id) {
	    
		for(var i=0;i<this.numIds;i++)
		{
			if(id==this.idArr[i])
			{
				if(this.idExpansionStatus[i])
				{
					this.privateCollapseNode( i );
				}
				else
				{
					this.privateExpandNode( i );
				}
			}else
			{
				if(this.idExpansionStatus[i])
				{
					this.privateCollapseNode( i );
				}
			}
		}
	}
	nhContainer.prototype.zipNode = nhContainer_zipNode;
	
	var nhClassValue = '';

	function nhContainer_nhCollapseNode(which) {
		if (this.nhExpandedRowHeight > this.nhModuleMinRowHeight ) {
			document.getElementById(which.id).style.height = this.nhExpandedRowHeight + "px";
		} else {
			document.getElementById(which.id).style.height = this.nhModuleMinRowHeight + "px";
			window.clearInterval(this.nhCollapseNodeID);
			this.nhCollapseNodeID = 0;
			this.nhExpandedRowHeight = this.nhModuleMaxRowHeight;
			if(document.getElementById(which.id+'Image') && document.getElementById(which.id+'Image').lowsrc) {
				document.getElementById(which.id+'Image').src = 'http://i.cnn.net/cnn/images/1.gif';
			}
		}
		this.nhExpandedRowHeight = this.nhExpandedRowHeight-nhAnimationValue;
	}
	nhContainer.prototype.nhCollapseNode = nhContainer_nhCollapseNode;	
		
	function nhContainer_privateCollapseNode(item) {
	    
		if (this.nhCollapseNodeID == 0) {
			this.nhCollapseNodeID = window.setInterval(this.objName+".nhCollapseNode("+this.objName+".containerArr["+item+"])", nhAnimationInterval);
			this.idExpansionStatus[item]=false;
			nhClassValue = eval(this.objName+".containerArr[ "+item+" ].className.replace(new RegExp(\"nhExpanded\"), \"nhCollapsed\")");
			nhClassValue = nhClassValue.replace(new RegExp(" nhOver"), "");			
			window.setTimeout(this.objName+".containerArr[ "+item+" ].className='"+nhClassValue+"';",500);
		}
	}	
	nhContainer.prototype.privateCollapseNode = nhContainer_privateCollapseNode;			

	function nhContainer_nhExpandNode(which) {
		if (this.nhCollapsedRowHeight <= this.nhModuleMaxRowHeight) {
			which.style.height = this.nhCollapsedRowHeight + "px";
		} else {
			which.style.height = this.nhModuleMaxRowHeight + "px";
			window.clearInterval(this.nhExpandNodeID);
			this.nhExpandNodeID = 0;
			this.nhCollapsedRowHeight = this.nhModuleMinRowHeight;
		}
		this.nhCollapsedRowHeight = this.nhCollapsedRowHeight + nhAnimationValue;
	}
	nhContainer.prototype.nhExpandNode = nhContainer_nhExpandNode;

	function nhContainer_privateExpandNode(item) {
		var realId = this.idArr[item]+'Image';
		if(document.getElementById(realId))
		{
			if (document.getElementById(realId).lowsrc){
				document.getElementById(realId).src = document.getElementById(realId).lowsrc;
			}
		}
		if (this.nhExpandNodeID == 0) {
            this.nhExpandNodeID = window.setInterval(this.objName+".nhExpandNode("+this.objName+".heightAdjustObjbArr["+item+"])", nhAnimationInterval);
			this.idExpansionStatus[item] = true;
			this.containerArr[ item ].className =  this.containerArr[ item ].className.replace(new RegExp(" nhOver"), "");
			this.containerArr[ item ].className =  this.containerArr[ item ].className.replace(new RegExp("nhCollapsed"), "nhExpanded");
		}
	}	
	nhContainer.prototype.privateExpandNode = nhContainer_privateExpandNode;			

	function nhContainer_handleResponse(node) {
		if((this.xmlHttpReq && this.xmlHttpReq.readyState==4) || (this.iframeObj && this.iframeObj.readyState && this.iframeObj.readyState=='complete')|| (this.iframeObj))
		{
			var docObj= '';
			if(this.iframeObj)
			{
				if(this.iframeObj.contentDocument)
				{
					docObj = this.iframeObj.contentDocument;
				}
				else
				{
					docObj = document.frames(this.iframeObj.name).document;
				}
			}
			else
			{
				if(this.domParserAX )
				{
					this.domParserAX.async = false;
					this.domParserAX.loadXML(this.xmlHttpReq.responseText);
					docObj = this.domParserAX.documentElement;			
				}
				else
				{
					docObj = this.xmlHttpReq.responseXML.documentElement;
				}
			}
			var valueNLs = docObj.getElementsByTagName("value");
			var callObjs = new Array();
			for(var i=0;i<valueNLs.length;i++)
			{
				var callObj = new Object();
				var valueNode = valueNLs.item(i);
				callObj.key = valueNode.getAttribute('key');
				callObj.action = valueNode.getAttribute('type');
				callObj.data = valueNode.getAttribute('contents');
			callObjs[callObjs.length] = callObj;
			}
			this.parseHandler(callObjs,this);
		}
	}
	nhContainer.prototype.handleResponse = nhContainer_handleResponse;
	
    function initTopNews() {
	    var nhTopNewsContainers = document.getElementById("topNews").getElementsByTagName("div");
	    for (var i=0; i<nhTopNewsContainers.length; i++){
            var nhTopNewsContainer = nhTopNewsContainers[i];
		    if(nhTopNewsContainer.id.substr(0,7) == "topNews") {
			    nhTopNewsContainer.onmouseover = function () { changeBackground(this,1); return false;}
			    nhTopNewsContainer.onmouseout = function () {changeBackground(this,0); return false;}	
		    }
		    if(nhTopNewsContainer.id.substr(0,13) == "nhHeadlineBar") {
			    nhTopNewsContainer.id = nhTopNewsContainer.id.replace(new RegExp("nhHeadlineBar"), "");
			    nhTopNewsContainer.onclick = function () {topNewsCntr.zipNode("topNews"+this.id); return false;}
		    }	
        }
	}

    function initNewsDetails() {
        initNews("relatedNews");
        initNews("categoryNews");
    }  
    
    function initMainPage() {
        initNews("comments");
        initNews("topNews");
        
    }      
/*	    var nhTopNewsContainers = document.getElementById("relatedNews").getElementsByTagName("div");

	    for (var i=0; i<nhTopNewsContainers.length; i++){
            var nhTopNewsContainer = nhTopNewsContainers[i];
		    if(nhTopNewsContainer.id.substr(0,11) == "relatedNews") {
			    nhTopNewsContainer.onmouseover = function () { changeBackground(this,1); return false;}
			    nhTopNewsContainer.onmouseout = function () { changeBackground(this,0); return false;}	
		    }
		    if(nhTopNewsContainer.id.substr(0,13) == "nhHeadlineBar") {
			    nhTopNewsContainer.id = nhTopNewsContainer.id.replace(new RegExp("nhHeadlineBar"), "");
			    nhTopNewsContainer.onclick = function () {relatedNewsCntr.zipNode("relatedNews"+this.id); return false;}
		    }	
        }
	}
*/
    function initNews(strId) {
	    var nhTopNewsContainers = document.getElementById(strId).getElementsByTagName("div");
        
	    for (var i=0; i<nhTopNewsContainers.length; i++){
	        
            var nhTopNewsContainer = nhTopNewsContainers[i];
		    if(nhTopNewsContainer.id.substr(0, strId.length) == strId) {
			    nhTopNewsContainer.onmouseover = function () { changeBackground(this,1); return false;}
			    nhTopNewsContainer.onmouseout = function () { changeBackground(this,0); return false;}	
		    }
		    if(nhTopNewsContainer.id.substr(0,13) == "nhHeadlineBar") {
			    nhTopNewsContainer.id = nhTopNewsContainer.id.replace(new RegExp("nhHeadlineBar"), "");
			    nhTopNewsContainer.onclick = function () {eval(strId+"Cntr").zipNode(strId+this.id); return false;}
		    }	
        }
	}
	function changeBackground(which, val) {
	    
	switch (val) {
		case 1:
			which.className += " nhOver";
			break;
		case 0:
			which.className=which.className.replace(new RegExp(" nhOver\\b"), "");
			break;
	    }
    }

	

