/* TITLE SHORTENER VERSION 00 */

// Code from http://www.dustindiaz.com/getelementsbyclass
function getElementsByClass(node,searchClass,tag) {
	var classElements = new Array();
	var els = node.getElementsByTagName(tag); // use "*" for all elements
	var elsLen = els.length;
	var pattern = new RegExp("\\b"+searchClass+"\\b");
	for (i = 0, j = 0; i < elsLen; i++) {
 		if ( pattern.test(els[i].className) ) {
 			classElements[j] = els[i];
 			j++;
 		}
	}
	return classElements;
}
// Code from http://refactormycode.com/codes/144-shorten-links
function resizeTitles(titleWidth) {
	var titles = getElementsByClass(document, 'info_title', '*');
	for (var i = 0; i < titles.length; i++) {
		if ( titles[i].title.length >= titleWidth ) 
        	titles[i].innerHTML = titles[i].title.substring(0, titleWidth - 2) + '...';
	}
}
window.onload = function(){
	// Code from http://www.ozzu.com/programming-forum/javascript-getting-div-current-width-t39999.html	
	resizeTitles(parseInt(document.getElementById("page").offsetWidth / 38));
}
window.onresize = function(){
	// Code from http://www.ozzu.com/programming-forum/javascript-getting-div-current-width-t39999.html
	resizeTitles(parseInt(document.getElementById("page").offsetWidth / 38));
}