var req;
var pos;
function loadXMLDoc(url){
	req = null;
	if (window.XMLHttpRequest) {
 		req = new XMLHttpRequest();
 		req.onreadystatechange = processReqChange;
 		req.open("GET", url, true); 
 		req.send(null);
	} else if (window.ActiveXObject) {
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP.4.0");
		} catch(e) {
			try {
				req = new ActiveXObject("Msxml2.XMLHTTP.3.0");
			} catch(e) {
				try {
					req = new ActiveXObject("Msxml2.XMLHTTP");
				} catch(e) {
					try {
						req = new ActiveXObject("Microsoft.XMLHTTP");
					} catch(e) {
						req = false;
					}
				}
			}
		}
		if (req) {
 			req.onreadystatechange = processReqChange;
 			req.open("GET", url, true);
 			req.send();
		}
	}
}


function processReqChange(){
	if (req.readyState == 4) {
		if (req.status == 200) {
			document.getElementById(pos).innerHTML = req.responseText;

			parent.document.body.style.cursor='default';
		} else {
			alert("Houve um problema ao obter os dados:\n" + req.statusText);
		}
	}
}

function fotosp(foto,id, num){

if(document.preview.complete){
parent.document.body.style.cursor='wait';
pos = "preview";
loadXMLDoc("/novovenda2/exibirfoto.php?foto="+foto+"&num="+num);
}}


function abrir(URL,width, height) {
var width = width;
var height = height;
var left = 99;
var top = 99;
window.open(URL,'foto', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}


