//------------------------------
//	1. OPEN POP UP WINDOW FUNCTION
function openPops(theURL,i){
	window.open(theURL,"mPopUp","toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=650, height=675");
	document.imgVar = i;
	//document.write(imgVar);
}
//
//------------------------------
//	2. WRITE POP UP WINDOW CODE FUNCTION
function writeDocStr(){
	var imgVar = window.opener.document.imgVar;
	document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">');
	document.write('<html>');
	document.write('<head>');
	document.write('<title>Millea Bros Ltd.</title>');
	document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
	document.write('<link href="milleaMain.css" rel="stylesheet" type="text/css">');
	document.write('<script src="millea.js" language="JavaScript"></script>');
	document.write('</head>');
	document.write('<body>');
	document.write('<p align="center"><a href="javascript:window.close()" class="navLink">Close this window</a></p>');
	document.write('<div align="center"><img id="largeImg" src="images/viewer/0408/image');
	document.write(imgVar + 'lg.jpg" /></div>');
	document.write('</body>');
	document.write('</html>');
	document.write('');
	document.write('');
	document.write('');
	self.window.focus()
	function sizer(){
		myImage = this.document.getElementById("largeImg")
		var w = myImage.width + 50;
		var h = myImage.height + 150;
//		var w = 600;
//		var h = 600;
		self.window.resizeTo(w,h);
		self.moveTo(10,10)
	}
//	sizer();
}
//
//-----------------------------------------|
//	3. WRITE PDF WINDOW CODE FUNCTION	   |
//-----------------------------------------|
function writeDocStr2(){
	var pass = window.opener.document.webviewName.name.value;
	document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">');
	document.write('<html>');
	document.write('<head>');
	document.write('<title>Millea Bros Ltd.</title>');
	document.write('<META HTTP-EQUIV=Refresh CONTENT="1"; URL="http://');
	document.write('appraisals/'+ pass + '.pdf">');
//	document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">');
	document.write('<link href="milleaMain.css" rel="stylesheet" type="text/css">');
	document.write('<script src="millea.js" language="JavaScript"></script>');
	document.write('</head>');
	document.write('<body>');
	document.write('<p align="center"><a href="javascript:window.close()" class="navLink">Close this window</a></p>');
	document.write('<EMBED src=appraisals/'+pass);
	document.write('.pdf"></EMBED>');
	document.write('</body>');
	document.write('</html>');
	document.write('');
	document.write('');
	document.write('');
	self.window.focus()
	function sizer(){
		myImage = this.document.getElementById("largeImg")
		var w = myImage.width + 50;
		var h = myImage.height + 50;
		self.window.resizeTo(600,600);
	}
	sizer();
}
//
//-----------------------------------------|
//		  4. WEBVIEW LOGIN FUNCTION		   |
//-----------------------------------------|
function login()
{
    var pass = document.webviewName.name.value;
	var pdfStr = "appraisals/" + pass + ".pdf";

    if(pass!="")
      {
	window.open(pdfStr);
      }
    else
      {
      alert('Please type in a name, or verify that you have spelled it correctly.')
      }
};