var geocoder;
var myPano;
var map;


// MAKE AJAX
function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {// code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}




	
function propinfo(getprop){

propjax=GetXmlHttpObject();
if (propjax==null)
  {
  alert("Sorry, your browser is a dinosaur");
  return;
  }
var url="Scripts/propinfo.php";
url=url+"?pid="+getprop;
propjax.onreadystatechange=propback;
propjax.open("GET",url,true);
propjax.send(null);
}

function propback(){ 
if (propjax.readyState==4){
	document.getElementById('listinfo').innerHTML=propjax.responseText;
	document.getElementById('listinfo').className="showme";
	document.getElementById('listings').className="hideme";
	document.getElementById('lnavpropimg').className="lnav";
	document.getElementById('propnav').className="hideme";
	document.getElementById('lnavpropimg').innerHTML=document.getElementById('showimgs').innerHTML;
	document.getElementById('showimgs').innerHTML="";
	document.getElementById('lnavback').className="lnav";
var spry1 = new Spry.Widget.ValidationTextField("spry1", "none", {hint:"Firstname"});
var spry2 = new Spry.Widget.ValidationTextField("spry2", "none", {hint:"Last Name"});
var spry4 = new Spry.Widget.ValidationTextField("spry4", "email", {hint:"Email Address"});
var spry3 = new Spry.Widget.ValidationTextField("spry3", "none", {hint:"Phone Number", isRequired:false});
var spry5 = new Spry.Widget.ValidationTextarea("spry5", {hint:"Message"});
 

    var latlng = new google.maps.LatLng(46.6,-80.9);
    var myOptions = {
      zoom: 15,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.HYBRID
    };
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	
	
	//geocode
	var address = document.getElementById("findplace").value;
 	geocoder = new google.maps.Geocoder();
    if (geocoder) {
      geocoder.geocode( { 'address': address}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
			var proplocation=results[0].geometry.location;
          	map.setCenter(proplocation);
         	var marker = new google.maps.Marker({map: map, position: proplocation});
		 	var panoramaOptions = {position:proplocation,pov:{heading:90,pitch: 0,zoom: 1}};
			var panorama = new  google.maps.StreetViewPanorama(document.getElementById("pano"), panoramaOptions);
			map.setStreetView(panorama);
        } else {
          alert("Geocode was not successful for the following reason: " + status);
        }
      });
    }
	


}
}

	  
	  
function goback(){
	document.getElementById('listinfo').className="hideme";
	document.getElementById('listings').className="showme";
	document.getElementById('lnavpropimg').className="hideme";
	document.getElementById('propnav').className="lnav";
	document.getElementById('lnavback').className="hideme";
}

function showimg(whatimg,event){
	var disimg="propimg"+whatimg;
	document.getElementById(disimg).className="bigimg";
  }
 function hideimg(whatimg){
	var disimg="propimg"+whatimg ;
	document.getElementById(disimg).className="hideme";
 }
 
 
 
 function steppage(pageat){

pageax=GetXmlHttpObject();
if (pageax==null)
  {
  alert("Sorry, your browser is a dinosaur");
  return;
  }
var url="Scripts/listpage.php?pageat="+pageat;
pageax.onreadystatechange=pageback;
pageax.open("GET",url,true);
pageax.send(null);
}
function stepsearch(pageat){
pageax=GetXmlHttpObject();
if (pageax==null)
  {
  alert("Sorry, your browser is a dinosaur");
  return;
  }
var url="Scripts/searchlistpage.php?pageat="+pageat;
pageax.onreadystatechange=pageback;
pageax.open("GET",url,true);
pageax.send(null);
}

function pageback(){ 
if (pageax.readyState==4){
	document.getElementById('listings').innerHTML=pageax.responseText;
	}
}

var ltype="mt_a";
function typemenu(totype){
	document.getElementById(ltype).className='hideme';
document.getElementById(totype).className='showme';

ltype=totype;
}
