var startZoom = 14;
var map;
var mapshown=0;
function showmap(lat,lng) {
	
	if (GBrowserIsCompatible()) {
		document.getElementById("fullpic").innerHTML="<div id=mymap></div>";
		map = new GMap2(document.getElementById("mymap")); //create the map
		var location = new GLatLng(lat, lng); 
		map.setCenter(location, startZoom, G_HYBRID_MAP);
		map.addControl(new GSmallMapControl());
	  map.addControl(new GMapTypeControl());
	  //addMarkers();
	  var point = new GLatLng(lat,lng);
	  var baseIcon = new GIcon();
	  baseIcon.iconSize = new GSize(32, 32);
	  baseIcon.shadowSize = new GSize(20, 20);
		baseIcon.iconAnchor = new GPoint(15, 32);
		baseIcon.infoWindowAnchor = new GPoint(9, 2);
		baseIcon.infoShadowAnchor = new GPoint(18, 25);
	  var icon = new GIcon(baseIcon);
  	icon.image = "/images/trienaki.png";
	  var marker = new GMarker(point,icon);
	  map.addOverlay(marker);
	  mapshown=1;
    }  

}
function changepic(newfile,sold,rented) {
	if (mapshown==1) {
	GUnload;
	document.getElementById("fullpic").innerHTML="<img id=bigpic>";
	mapshown=0;
  };
	var cursor = 
     document.layers ? document.cursor :
     document.all ? document.all.cursor :
     document.getElementById ? document.getElementById('cursor') : null;
	cursor = 'wait';
	obj=document.getElementById("bigpic");
	obj.src="images/indicator.gif";
	img=new Image;
	if (sold==0 && rented==0) {
	newfile=newfile.replace(".jpg","_WWW.jpg");
	img.src="/photos/"+newfile;
	obj.src="/photos/"+newfile;
	}
	else if (sold==1) {
		newfile=newfile.replace(".jpg","SOLD.jpg");
		img.src="/photos/"+newfile;
		obj.src="/photos/"+newfile;
	}
	else if (rented==1) {
		newfile=newfile.replace(".jpg","RENTED.jpg");
		img.src="/photos/"+newfile;
		obj.src="/photos/"+newfile;
	}
	cursor = 'default';
}
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;
}
function detectexist(obj){
		return (typeof obj !="undefined")
	}
function jkpopimage(imgpath, popwidth, popheight){

function getpos(){
leftpos=(detectexist(window.screenLeft))? screenLeft+document.body.clientWidth/2-popwidth/2 : detectexist(window.screenX)? screenX+innerWidth/2-popwidth/2 : 0
toppos=(detectexist(window.screenTop))? screenTop+document.body.clientHeight/2-popheight/2 : detectexist(window.screenY)? screenY+innerHeight/2-popheight/2 : 0
if (window.opera){
leftpos-=screenLeft
toppos-=screenTop
}
}

getpos()
var winattributes='width='+popwidth+',height='+popheight+',resizable=yes,left='+leftpos+',top='+toppos
//var bodyattribute=(popbackground.indexOf(".")!=-1)? 'background="'+popbackground+'"' : 'bgcolor="'+popbackground+'"'
if (typeof jkpopwin=="undefined" || jkpopwin.closed)
jkpopwin=window.open("","",winattributes)
else{
//getpos() //uncomment these 2 lines if you wish subsequent popups to be centered too
//jkpopwin.moveTo(leftpos, toppos)
jkpopwin.resizeTo(popwidth, popheight)
}
jkpopwin.document.open()

jkpopwin.document.write('<body bgcolor=#8A521F><img src="'+imgpath+'" />')
jkpopwin.document.close()
jkpopwin.focus()
}

function showccmap(lat, lng){

function getpos(){
leftpos=(detectexist(window.screenLeft))? screenLeft+document.body.clientWidth/2-popwidth/2 : detectexist(window.screenX)? screenX+innerWidth/2-popwidth/2 : 0
toppos=(detectexist(window.screenTop))? screenTop+document.body.clientHeight/2-popheight/2 : detectexist(window.screenY)? screenY+innerHeight/2-popheight/2 : 0
if (window.opera){
leftpos-=screenLeft
toppos-=screenTop
}
}

getpos()
var winattributes='width='+popwidth+',height='+popheight+',resizable=yes,left='+leftpos+',top='+toppos
//var bodyattribute=(popbackground.indexOf(".")!=-1)? 'background="'+popbackground+'"' : 'bgcolor="'+popbackground+'"'
if (typeof jkpopwin=="undefined" || jkpopwin.closed)
jkpopwin=window.open("","",winattributes)
else{
//getpos() //uncomment these 2 lines if you wish subsequent popups to be centered too
//jkpopwin.moveTo(leftpos, toppos)
jkpopwin.resizeTo(popwidth, popheight)
}
jkpopwin.document.open()

jkpopwin.document.write('<body bgcolor=#8A521F><img src="'+imgpath+'" />')
jkpopwin.document.close()
jkpopwin.focus()
}


