	// -------------------------------------------------------
	// PopUp Unico Central
	function popupUC(pg,nome,w,h){//popUp Unico Central
		var x; 	var y;
		x = (screen.width-w)/2;	y = (screen.height-h)/2;
		window.open(pg,nome,'scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width='+w+',height='+h+',left='+x+',top='+y+'');
	}

	// -------------------------------------------------------
	// Form validation
	function validaForm(f){
		for (i=0 ; i<f.length ; i++){        
			e = f.elements[i];
			str = e.title.split(";");
			//if (e.title=="Campo Obrigatório" && e.value == ""){
			if (str[1]=="Campo Obrigatório" && e.value == ""){
				alert("O campo "+str[0]+" deve ser preenchido");
				e.focus();
				return (false);
			} 
			e = null;
		}
		return(true);
	}
	
	// E-Mail validation
	function validaMail (email){
		if(email.value!=""){
			if (email.value.indexOf("@") <= 0 || email.value.indexOf(".") <= 0){
				alert("Formato do email inválido.")
				email.focus()
				return (false);
			}
		}
		return (true);
	}

	// -------------------------------------------------------
	// confirm delete
	function delObj(page){
		//confirmation="Do you want to confirm the deletion";
		confirmation="Você deseja realmente excluir?";
		if(confirm(confirmation)){
		window.location=page;
    	}
  	}

	// -------------------------------------------------------
	// clear a input value
  	function clearInput(id){
  		e = document.getElementById(id);
  		e.value = "";
  	}

	// -------------------------------------------------------
	function addElement(reciever, element) {
		var ni = document.getElementById(reciever);
		ni.appendChild(element);
	}
	
	function removeElement(reciever,toRem) {
		var ni = document.getElementById(reciever);
		ni.removeChild(toRem);
	}

	
    // -------------------------------------------------------
    // only numbers
    function checkNumber(evt) {
      var charCode = (evt.which) ? evt.which : evt.keyCode
      if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        //alert("Please make sure entries are numbers only.")
        return false
      }
      return true
    }

	// -------------------------------------------------------
	function validaCep(c,evt){
		if(checkNumber(evt)){
			if(c.value.length==5) c.value=c.value.slice(0,5)+"-"+c.value.slice(5,c.value.length);
			return true;
		}else{return false;}
	}