﻿/// CRIA MASCARA DOS CAMPOS /////////////////
	function mascara(src, mask){
		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);
		}
	}
	
	
/// VERIFICA SE É NÚMERO ////////////////////
		function somente_numero(campo){  
			var digits="0123456789\/-"  
			var campo_temp   
			 for (var i=0;i<campo.value.length;i++){  
				 campo_temp=campo.value.substring(i,i+1)   
				 if (digits.indexOf(campo_temp)==-1){  
					 campo.value = campo.value.substring(0,i);  
				 }  
			 }  
		} 
		function CheckNumeric(e) {
	
			var key //= (window.event) ? event.keyCode : e.which;
			if (window.event){
				key = event.keyCode
			}else{
				key = e.which   // Was key that was pressed a numeric character (0-9) or backspace (8)?
				if ( key > 47 && key < 58 || key == 8 ){
					return; // if so, do nothing 
				}else{ // otherwise, discard character
					if (window.event){ //IE
						//window.event.returnValue = null;
						e.preventDefault();
					}else{ //Firefox
						e.preventDefault();
					}
				}
			}
		}
	
	
/// FUNÇÃO DE COPIAR E COLAR ////////////////////
	function criaClipBoard(elemento) {
		var clip = null;
		// setup single ZeroClipboard object for all our elements
		clip = new ZeroClipboard.Client();
		clip.setHandCursor( true );

			// set the clip text to our innerHTML
			clip.setText( Encoder.htmlDecode(elemento.innerHTML) );
			
			// reposition the movie over our element
			// or create it if this is the first time
			if (clip.div) {
				clip.receiveEvent('mouseout', null);
				clip.reposition(elemento);
			}
			else clip.glue(elemento);
			
			// gotta force these events due to the Flash movie
			// moving all around.  This insures the CSS effects
			// are properly updated.
			clip.receiveEvent('mouseover', null);
			
		//alert('Código copiado com sucesso!')
	}


