function open_buyer_new(){
	var newwin = window.open('','buyer_new','top=150,left=150,topX=150,topY=150,width=400,height=400');

	get_verified_data('C',newwin,vbuyer_title,400);
}

function open_recipient(){
	var newwin = window.open('','recipient_new','top=150,left=150,topX=150,topY=150,width=400,height=400');

	get_verified_data('R',newwin,vrecipient_title,400);
}

function open_orderid_help(){
	var newwin = window.open('','help_new','top=150,left=150,topX=150,topY=150,width=400,height=400');

	get_verified_data('H',newwin,help_title,400);
}

function get_verified_data(t,win,title,winheight){
	var xmlHttp;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
		return;
	}

	win.document.writeln('<?xml version="1.0" encoding="iso-8859-1"?>\n');
	win.document.writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n');
	win.document.writeln('<html xmlns="http://www.w3.org/1999/xhtml">\n<head>\n<title>'+title+'</title>\n<link rel="stylesheet" href="'+cssfile+'" />\n</head>\n<body>\n');

	win.document.writeln('</body>\n</html>');

	win.document.close();

	xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==4){
			var htmlbody = xmlHttp.responseText;

			var maindiv = win.document.createElement('div');
			maindiv.style.width = '100%';
			maindiv.style.height = (winheight - 25) + 'px';
			maindiv.style.position = 'fixed';
			maindiv.style.left = '0px';
			maindiv.style.top = '0px';
			maindiv.innerHTML = htmlbody;

			var newdiv = win.document.createElement('div');
			newdiv.style.position = 'fixed';
			newdiv.style.bottom = '0px';
			newdiv.style.left = '0px';
			newdiv.style.height = '20px';
			newdiv.style.width = '100%';
			newdiv.style.backgroundColor = 'white';
			newdiv.style.textAlign = 'center';

			newanchor = win.document.createElement('a');
			newanchor.appendChild(win.document.createTextNode('Close Window'));
			newanchor.setAttribute('href','#');
			newanchor.onclick = function (){win.window.close();}

			newdiv.appendChild(newanchor);

			win.document.body.appendChild(maindiv);
			win.document.body.appendChild(newdiv);
		}
	}

	var post = 'mode=ajax_get_verified_text&type=' + encodeURIComponent(t);

	xmlHttp.open("POST",xcart_web_dir+'/bcse_prnr_add.php',true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
	xmlHttp.send(post);
}

function GetXmlHttpObject(){
	var xmlHttp
	try{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}catch (e){
		// Internet Explorer
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}catch (e){
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
