//Pop up enlarge image

PositionX = (screen.width/2) - 250;
PositionY = (screen.height/2) - 150;

defaultWidth  = 600;
defaultHeight = 600;

var AutoClose = true;

if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;

function popImage(imageURL,imageTitle){
	if (isNN){imgWin=window.open('about:blank','',optNN);}
	if (isIE){imgWin=window.open('about:blank','',optIE);}
	with (imgWin.document){
	writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
	writeln('<sc'+'ript>');
	writeln('var isIE7;');
	writeln('isIE7 = 1;');
	writeln('</sc'+'ript>');
	writeln('<!--'+'[if lt'+' IE 7]>');
	writeln('<sc'+'ript>');
	writeln('isIE7 = 0;');
	writeln('</sc'+'ript>');
	writeln('<![end'+'if]-->');
	writeln('<sc'+'ript>');
	writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
	writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
	writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
	writeln('width=100-(document.body.clientWidth-document.images[0].width);');
	writeln('height=100-(document.body.clientHeight-document.images[0].height);');
	writeln('if (isIE7){');
	writeln('width=width+150;');
	writeln('height=height+80;');
	writeln('}');
	writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
	writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
	writeln('function doTitle(){document.title="View Image";}');writeln('</sc'+'ript>');
	if (!AutoClose) writeln('</head><body scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
	else writeln('</head><body scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
	writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
	close();
	}
}

//Loan calculator
function Morgcal() { 
			form = document.myform 
LoanAmount= form.LoanAmount.value 
DownPayment= "0" 
AnnualInterestRate = form.InterestRate.value/100 
Years= form.NumberOfYears.value 
MonthRate=AnnualInterestRate/12 
NumPayments=Years*12 
Prin=LoanAmount-DownPayment 
MonthPayment=Math.floor((Prin*MonthRate)/(1-Math.pow((1+MonthRate),(-1*NumPayments)))*100)/100 
form.NumberOfPayments.value=NumPayments 
form.MonthlyPayment.value=MonthPayment 
} 

//Pop up a new window
function popup(aUrl,width,height) 
 { var w;
   var u;
   var s = 'scrollbars=no,menubar=no,status=no,toolbar=no,left=10,top=10,width=' + width + ',height=' + height;
   u = aUrl;w = window.open(u,'',s);
 }

function antispam(name,domain) {
    	document.location = "mailto:" + name + "@" + domain;
	}
	
function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}

function radioVal(btn) {
var cnt = -1;
for (var i=btn.length-1; i > -1; i--) {
   if (btn[i].checked) {cnt = i; i = -1;}
   }
if (cnt > -1) return btn[cnt].value;
else return "";
}

function filterFileType(fieldvalue, ext) {
fieldvalue = fieldvalue.toLowerCase();
if (fieldvalue.indexOf('.' + ext) == -1) {
return false;
}
return true;
} 
