function validacpf(events, args) {

    var cpf = document.getElementById('ctl00_content_txtCPF').value;
      
    if (cpf.length != 11 || cpf == "00000000000" || cpf == "11111111111" ||
	  cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" ||
	  cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" ||
	  cpf == "88888888888" || cpf == "99999999999") {
        return args.IsValid = false;
    }

    soma = 0;
    
    for (i = 0; i < 9; i++)
        soma += parseInt(cpf.charAt(i)) * (10 - i);

    resto = 11 - (soma % 11);
    
    if (resto == 10 || resto == 11)
        resto = 0;

    if (resto != parseInt(cpf.charAt(9))) {
        return args.IsValid = false;
    }

    soma = 0;
    
    for (i = 0; i < 10; i++)
        soma += parseInt(cpf.charAt(i)) * (11 - i);
        
    resto = 11 - (soma % 11);
    
    if (resto == 10 || resto == 11)
        resto = 0;

    if (resto != parseInt(cpf.charAt(10))) {
        return args.IsValid = false;
    }

    return args.IsValid = true;
    
}  
 
 function goToPage(url) {
     if (url != ""){
        document.location.href = url;
     }
 }

function openDiv(altura){
    //alert(altura+'px');
    document.getElementById("menu").style.height = altura+'px';
}
function openFeedback(mensagem, url){
    document.getElementById('msgFeedback').innerHTML = mensagem;
    var urlDestino = url
    if (urlDestino == ''){
        document.getElementById('fecharPop').href = 'javascript:closeFeedback();';
    }
    else{
        document.getElementById('fecharPop').href = urlDestino;
    }
    $('#FeedbackDiv').jqmShow({toTop: true});
}
function closeFeedback(){
    $('#FeedbackDiv').jqmHide({toTop: true});
}
function trim(vString){
	return vString.replace(/^\s+|\s+$/ig, '');
}
function clickInText(obj){
	var valorinicial = trim(obj.getAttribute('valorInicial'));
	if ( trim(obj.value) == valorinicial ) {
		obj.value = '';					
	}
}
function clickOutText(obj){
	var valorinicial = trim(obj.getAttribute('valorInicial'));
	if ( trim(obj.value) == '' ) {
		obj.value = valorinicial;
	}
}
function clickInPass(obj1, obj2){
	var valorinicial = trim(obj1.getAttribute('valorInicial'));
	if ( trim(obj1.value) == valorinicial ) {
		obj1.style.display = 'none';
		obj2.style.display = 'inline';
		obj2.value = '';
		obj2.focus();
	}
}
function clickOutPass(obj1, obj2){
	var valorinicial = trim(obj1.getAttribute('valorInicial'));
	if ( trim(obj2.value) == '' ) {
		obj2.style.display = 'none';
		obj1.value = valorinicial;
		obj1.style.display = 'inline';
	}
}
