function Vhtml() {    
	Vhtml.init = function() {
			var req;
			
			try {
					req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
					try {
							req = new ActiveXObject("Msxml2.XMLHTTP");
					} catch(ex) {
							try {
									req = new XMLHttpRequest();
							} catch(exc) {
									req = null;
							}
					}
			}
			
			return req;
	}
	
	// o parametro cb e a funcao para onde sera enviado o resultado
	Vhtml.open = function( pag, cb ) {
			var vhtml = Vhtml.init();
			
			if( vhtml ) {
					var sendCont = Vhtml.open.arguments[2] ? Vhtml.open.arguments[2] : null;
					
					if( sendCont ) {
							vhtml.open("POST", pag, true);
							vhtml.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
					} else {
							vhtml.open("GET", pag, true);
					}
					
					vhtml.onreadystatechange = function() {
							if(vhtml.readyState == 4) {
									if( vhtml.status == 200 ) {
											var resp = vhtml.responseText;
											if(!resp) {
													return false;
											}
											
											 if( cb ) {
												 eval( cb + '("' + resp + '")' );
												 
												}
									} else {
											alert('Erro ' + vhtml.status + ': ' + vhtml.statusText);
											return false;
									}
							}
					}
					
					vhtml.send(sendCont);
			}
	}
}
new Vhtml();
