

calSWidth=function(){ 

     var divs,contDivs,maxWidth,divWidth,d; 
	
     // get all <div> elements in the document 

     divs=document.getElementsByTagName('div'); 

     contDivs=[]; 

     // initialize maximum width value 

     maxWidth=0;
	 
	 divCount = 0;

     // iterate over all <div> elements in the document 

     for(var i=0;i<divs.length;i++){ 

          // make collection with <div> elements with class attribute 'newsBox' 

          if(/\bnewsBox\b/.test(divs[i].className)){ 

                d=divs[i]; 

				divCount++;

          } 

     } 

	 maxWidth=divCount*178; 

     // assign maximum height value to all of container <div> elements 
	
	document.getElementById("newsContainer").style.width = maxWidth +"px";
     

} 


// Remove title tags from news links as they contain html.
function removeTitles() {
	var links = document.getElementsByTagName('div');

	for ( var i = 0; i<links.length; i++ ) {
		
	links[i].removeAttribute('title');
	}

}
// Runs the script when page loads 

window.onload=function(){ 


     if(document.getElementsByTagName){ 

          calSWidth();
		  removeTitles();

     } 

}








