﻿function Output(){
	
	this.popUpWin = 0;
	
	this.printdiv = function(fieldsrc, fielddest){
		fielddest.innerHTML = fieldsrc.value + " ";
	}
	
	this.goLocation = function(url){
		window.location = url;
	}
	
	this.changeHidVal = function(hid, value){
		document.getElementById(hid).value = value;
	}
	
	this.openup = function(nome, path, width, height){
		var left = (window.screen.width/2) - (width/2);
		var top = (window.screen.height/2) - (height/2);
		if(this.popUpWin) { 
			if(!this.popUpWin.closed) 
				this.popUpWin.close();
		}
		this.popUpWin = window.open(path, nome, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
	}
	
	this.confirmDialog = function(path){
		
		var c;
		c = window.confirm("Tem certeza que você deseja realizar essa ação?");
		if(c == true){
			this.goLocation(path);
		}
	}
	
	this.changeValue = function(div, value){
		document.getElementById(div).innerHTML = value;
	}
	
	this.hiddenCheckVal = function(id, valor1, valor2){
		var hi = document.getElementById(id);
		var ch = document.getElementById(id + "_checkbox");
		if(ch.checked) hi.value = valor1;
		else hi.value = valor2;
	}
	
	this.checkEnablePainel = function(id, ch){
		if(ch.checked) styl.styleDisplay(id, '');
		else styl.styleDisplay(id, 'none');
	}
	
	this.counterUpdate = function(ref, divcount, carac) {
		t = document.getElementById(divcount);
		t.innerHTML = ref.value.length;
		if(ref.value.length >= carac)
			ref.value = ref.value.substring(0, carac);
	}
	
	this.gid = function(v){
		return document.getElementById(v);
	}
}

var outp = new Output();