/************************************************************
 ** Clears a field
 ** By: 	Joshua Sowin (fireandknowledge.org)
 ** HTML: <input type="text" value="Search" name="search"
 **			id="search" size="25" 
 ** 		onFocus="clearInput('search', 'Search')" 
 ** 		onBlur="clearInput('search', 'Search')" />
 ***********************************************************/
function clearInput(field_id, term_to_clear) {
	
	// Clear input if it matches default value
	if (document.getElementById(field_id).value == term_to_clear ) {
		document.getElementById(field_id).value = '';
	}
	
	// If the value is blank, then put back term
	else if (document.getElementById(field_id).value == '' ) {
		document.getElementById(field_id).value = term_to_clear;
	}
} // end clearSearch()

$(document).ready(function(){
	var limiteTexto = 140;
	var limiteTextoMaior = 200;
	var limiteTextoHome = 45;
	var limiteTextoHomeLateral = 120;
	
	$('.textwidget .last p').each(function(){
		var texto = $(this).text();
		if(texto.length > limiteTexto){
			$(this).text(texto.substr(0,limiteTexto)+' [...]');
		}
	});
	
	$('#feature ul li h4 a').each(function(){
		var texto = $(this).text();
		if(texto.length > limiteTextoHome){
			$(this).text(texto.substr(0,limiteTextoHome)+' [...]');
		}
	});
	/*
	$('.post .entry p').each(function(){
		var texto = $(this).text();
		if(texto.length > limiteTexto){
			$(this).text(texto.substr(0,limiteTexto)+' [...]');
		}
	});
	*/
	
	$('#home_right .news-block p').each(function(){
		var texto = $(this).text();
		if(texto.length > limiteTextoHomeLateral){
			$(this).text(texto.substr(0,limiteTextoHomeLateral)+' [...]');
		}
	});
	
	$('.news-block hr:last, .textwidget hr:last').remove();

});
