//- - -  - --- - -
function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function show_hide(adiv,state){

	if(state==''){
		var status=document.getElementById(adiv).style.display;
		if(status=='block'){
			document.getElementById(adiv).style.display='none';
		}
		if(status=='none'){
			document.getElementById(adiv).style.display='block';
		}
	}
	else{

		document.getElementById(adiv).style.display=state;

	}
}
function cancela_2(val,val2){
	if(confirm('Deseja sair sem salvar ? '))
		{

			levaetraz(val,val2);
		}
}

function formatar(src, mask,evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode
	//alert(charCode);
	if(charCode==8){
		//alert(charCode);
		return true;
	}
	else{
		 if ( ((charCode > 31) && (charCode < 48 || charCode > 57)) ) {
		   return false;
		 }
		 else {

		 var i = src.value.length;
		  var saida = mask.substring(0,1);
		  var texto = mask.substring(i)
			if (texto.substring(0,1) != saida)
			  {
				src.value += texto.substring(0,1);
			  }
			 return true;
		 }

	}


}
