function openAjax() {
var ajax;
try{
    ajax = new XMLHttpRequest(); // XMLHttpRequest para browsers como: Firefox, Safari entre outros.
	}catch(ee){
		try{
			ajax = new ActiveXObject("Msxml2.XMLHTTP"); // Para o IE da MS
		}catch(e){
			try{
				ajax = new ActiveXObject("Microsoft.XMLHTTP"); // Para o IE da MS
			}catch(E){
				ajax = false;
			}
		}
	}
return ajax;
}


function include(url,destino){
	var ajax= openAjax();
		ajax.open("GET", url, true);
		ajax.send(null);
		ajax.onreadystatechange = function() {
											if (ajax.readyState == 4) {
												if (ajax.status == 200) {
													document.getElementById(destino).innerHTML=ajax.responseText;
												}else{
													alert("Erro:\n" + ajax.statusText);
												}
											 }
											}
}

function OpenObj(serverPage, objID, e){
  var obj = document.getElementById(objID);
  obj.style.visibility = "visible";
  obj.style.height = "200px";
  obj.style.width = "200px";
  var posx = 0;
  var posy = 0;
  posx = e.clientX + document.body.scrollLeft;
  posy = e.clientY + document.body.scrollTop;
  obj.style.left = posx + "px";
  obj.style.top = posy + "px";
	var xmlhttp= openAjax();
		xmlhttp.open("GET", serverPage, true);
		xmlhttp.send(null);
		xmlhttp.onreadystatechange = function() {
											if (xmlhttp.readyState == 4) {
												if (xmlhttp.status == 200) {
													obj.innerHTML=xmlhttp.responseText;
												}else{
													alert("Erro:\n" + xmlhttp.statusText);
												}
											 }
											}
}

function OpenFormObj(serverPage, objID){
  var obj = document.getElementById(objID);
  obj.style.visibility = "visible";
  obj.style.height = "200px";
  obj.style.width = "450px";
  var posx = 0;
  var posy = 0;
  obj.style.left = posx + "px";
  obj.style.top = posy + "px";
	var xmlhttp= openAjax();
		xmlhttp.open("GET", serverPage, true);
		xmlhttp.send(null);
		xmlhttp.onreadystatechange = function() {
											if (xmlhttp.readyState == 4) {
												if (xmlhttp.status == 200) {
													obj.innerHTML=xmlhttp.responseText;
												}else{
													alert("Erro:\n" + xmlhttp.statusText);
												}
											 }
											}
}

function CloseObj (objID)
{
  theObject = document.getElementById(objID);
  if (theObject.style.visibility == "visible")
  {
    theObject.style.visibility = "hidden";
    theObject.style.height = "0px";
    theObject.style.width = "0px";
  }
}

function doThePopUp(url) {
reWin = window.open(url,'determined','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=550,height=580,top=20,left=250');
}

function doThePopUp1(url, w, h, t, l) {
reWin = window.open(url,'determined1','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' + w + ',height=' + h + ',top=' + t + ',left=' + l + '');
}

function win_pagamento(url, w, h, t, l) {
reWin = window.open(url,'pagamento','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=' + w + ',height=' + h + ',top=' + t + ',left=' + l + '');
}

function win_block_name(url, w, h, t, l, win_name)
{
reWin = window.open(url, win_name,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' + w + ',height=' + h + ',top=' + t + ',left=' + l + '');
}

function win_scroll_name(url, w, h, t, l, win_name)
{
reWin = window.open(url, win_name,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=' + w + ',height=' + h + ',top=' + t + ',left=' + l + '');
}


