
function textCounter(id, cant)
{
	if(jQuery("#" + id).val().length > cant)
	{
	   jQuery("#" + id).val( left(jQuery("#" + id).val(),cant) ); 
	}
}

function trim(cad) {
	if(cad)
		return cad.replace(/^\s+|\s+$/g,"");
	else
		return "";
}

function o(cad) {
	return document.getElementById(cad);
}        

function left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

function right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

function refrescapadre()
{
	if (window.opener && !window.opener.closed)
		window.opener.location.reload();
}  


function GMail(para)
{
	popw='';Q='';x=document;y=window;
	if(x.selection) {Q=x.selection.createRange().text;} else if (y.getSelection) {Q=y.getSelection();} 
	else if (x.getSelection) {Q=x.getSelection();}
	popw = y.open (' https://mail.google.com/a/innovar.gov.ar/mail/?view=cm&tf=0&to=' + para  + '&cmid=0&fs=1&tearoff=1' ,'gmailForm','scrollbars=yes,width=680,height=510,top=175,left=75, status=no,resizable=yes');
	if (!document.all) T = setTimeout(' popw.focus()',50);void(0);
}  

function GMailBCC(bcc)
{
	popw='';Q='';x=document;y=window;
	if(x.selection) {Q=x.selection.createRange().text;} else if (y.getSelection) {Q=y.getSelection();} 
	else if (x.getSelection) {Q=x.getSelection();}
	popw = y.open (' https://mail.google.com/a/innovar.gov.ar/mail/?view=cm&tf=0&bcc=' + bcc  + '&cmid=0&fs=1&tearoff=1','gmailForm','scrollbars=yes,width=680,height=510,top=175,left=75, status=no,resizable=yes');
	if (!document.all) T = setTimeout(' popw.focus()',50);void(0);
}
