//字符截断

var cmsTruncate = function (obj, limit){
	$("#"+obj+" a:not(':has(font,strong)')").each(function(){//无样式的链接
		$(this).text(strLimit($(this).text(),limit));
		});
	$("#"+obj+" a font:not(':has(strong)')").each(function(){//加红的链接
		$(this).text(strLimit($(this).text(),limit));
		});
	$("#"+obj+" a font strong").each(function(){//加红加粗的链接
		$(this).text(strLimit($(this).text(),limit));
		});
	$("#"+obj+" a strong").each(function(){//加粗的链接
		$(this).text(strLimit($(this).text(),limit));
		});
	
	};
var strLimit = function (str, limit) {
	var temp, i;
	temp = str.split('');
	if (temp.length > limit) {
		for (i = temp.length - 1; i > -1; --i) {
			if (i > limit) {
				temp.length = i;
			}
			else if (' ' === temp[i]) {
				temp.length = i;
				break;
			}
		}
		temp.push('...');
	}
	return temp.join('');//组合起来，不然被切成一块块的- -!
};
$(function(){
	cmsTruncate("con_limit1",45);
	cmsTruncate("con_limit2",41);
	cmsTruncate("tab_main01",46);
	cmsTruncate("tab_main02",44);
	cmsTruncate("tab_main11",46);
	cmsTruncate("tab_main12",40);
	cmsTruncate("show_list",24);
	
	
})

