function setPesquisaRapida(inputId, value, criterio, execute) {
    document.getElementById('executapesquisa').value = execute;  
    document.getElementById(inputId).value = value;
	
	if (null != criterio && '' != criterio) {
	    document.getElementById(criterio).value = trim( document.getElementById(criterio).value );
	}
}

function submitAction( formID, path )
{    
    var formAct = document.getElementById(formID);
    formAct.action = path;
    formAct.submit();   
}

function submitPortletAction( formID, action, portletParameter, portelLabel, path )
{    
    var formAction = document.getElementById(formID);
    formAction.portletLabel.value = portelLabel;
    formAction.actionSubmitted.value = action;
    formAction.portletParameter.value = portletParameter;
    formAction.action = path;
    formAction.submit();   
}   

function submitPortletNavAction( formID, action, portletParameter, portelLabel, nav, path )
{    
    var formAction = document.getElementById(formID);
    formAction.portletLabel.value = portelLabel;     
    formAction.actionSubmitted.value = action; 
    formAction.portletParameter.value = portletParameter;
    formAction.portletNav.value = nav; 
    formAction.action = path;
    formAction.submit();   
}

function submitPortletNavIdAction( formID, action, portletParameter, portelLabel, nav, id, path )
{   
    var formAction = document.getElementById(formID); 
    formAction.portletLabel.value = portelLabel;     
    formAction.actionSubmitted.value = action; 
    formAction.portletParameter.value = portletParameter;
    formAction.portletNav.value = nav; 
    formAction.portletId.value = id; 
    formAction.action = path;
    formAction.submit();   
}

function textCounter(field, countfield, maxlimit, message) {
    if (field.value.length > maxlimit) { // if too long...trim it!
        field.value = field.value.substring(0, maxlimit);
        alert(message + '(' + maxlimit + ')');
    }
    // otherwise, update 'characters left' counter
    else 
        countfield.value = maxlimit - field.value.length;
}

   