//Check the version of IE and Java Script.
var xmlhttp = false; 
  try {  
   	xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');   
	}catch (e){
      try {   
	   	xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');    
		}catch (e2){
         try {  
    	   	xmlhttp = new XMLHttpRequest();
   			}catch (e3){  
		    	xmlhttp = false;   
 		}
   }
}


//Vtour
var showVtour = true;
function showHideVtour(id,addr,floor) {
//The location we are loading the page into.
var objID = id;
//Change the current image of the minus or plus.
if (showVtour == true){
//document.getElementById(objID).innerHTML = "<center><img src=http://www.bergerrealty.com/loading/loading6.gif></center>";
//document.getElementById("opencloseimg").src = "../images/minus.gif";
//The page we are loading.
var serverPage = "http://www.bergerrealty.com/includes/functions/ajax/vframe.php?file=" + id + "&property=" + addr + "&floor=" + floor;
//Set the open close tracker variable.
showVtour = false;
var obj = document.getElementById(objID);
xmlhttp.open("GET", serverPage);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
} else {
//Hide the calendar.
//document.getElementById("opencloseimg").src = "../images/plus.gif";
showVtour = true;
document.getElementById(objID).innerHTML = "";
}
}

//ImageViewer
var showImageViewer = true;
function showHideImageViewer(mls,id) {
//The location we are loading the page into.
var objID = id;
//Change the current image of the minus or plus.
if (showImageViewer == true){
//document.getElementById("opencloseimg").src = "../images/minus.gif";
//The page we are loading.
var serverPage = "http://www.bergerrealty.com/includes/functions/ajax/imageviewer.php?id=" + id + "&mls=" + mls;
//Set the open close tracker variable.
showImageViewer = false;
var obj = document.getElementById(objID);
xmlhttp.open("GET", serverPage);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
} else {
//Hide the calendar.
//document.getElementById("opencloseimg").src = "../images/plus.gif";
showImageViewer = true;
document.getElementById(objID).innerHTML = "";
}
}

//Rates
var showRates = true;
function showHideRates(id,uokey,ryear) {
//The location we are loading the page into.
var objID = id;
//Change the current image of the minus or plus.
if (showRates == true){
//document.getElementById("opencloseimg").src = "../images/minus.gif";
//The page we are loading.
var serverPage = "http://www.bergerrealty.com/includes/functions/ajax/rates.php?id=" + id + "&uokey=" + uokey + "&ryear=" + ryear;
//Set the open close tracker variable.
showRates = false;
var obj = document.getElementById(objID);
xmlhttp.open("GET", serverPage);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
} else {
//Hide the calendar.
//document.getElementById("opencloseimg").src = "../images/plus.gif";
showRates = true;
document.getElementById(objID).innerHTML = "";
}
}

//GoogleMap
var showMap = true;
function showHideMap(id,addr) {
//The location we are loading the page into.
var objID = id;
//Change the current image of the minus or plus.
if (showMap == true){
//document.getElementById("opencloseimg").src = "../images/minus.gif";
//The page we are loading.
var serverPage = "http://www.bergerrealty.com/includes/functions/ajax/maps.php?id=" + id + "&addr=" + addr;
//Set the open close tracker variable.
showMap = false;
var obj = document.getElementById(objID);
xmlhttp.open("GET", serverPage);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
} else {
//Hide the calendar.
//document.getElementById("opencloseimg").src = "../images/plus.gif";
showMap = true;
document.getElementById(objID).innerHTML = "";
}
}

//Amenities Legend
var showLegend = true;
function showHideLegend(id) {
//The location we are loading the page into.
var objID = id;
//Change the current image of the minus or plus.
if (showLegend == true){
//document.getElementById("opencloseimg").src = "../images/minus.gif";
//The page we are loading.
var serverPage = "http://www.bergerrealty.com/includes/functions/ajax/legend.php";
//Set the open close tracker variable.
showLegend = false;
var obj = document.getElementById(objID);
xmlhttp.open("GET", serverPage);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
} else {
//Hide the calendar.
//document.getElementById("opencloseimg").src = "../images/plus.gif";
showLegend = true;
document.getElementById(objID).innerHTML = "";
}
}

//Customer Reviews
var showReviews = true;
function showHideReviews(id) {
//The location we are loading the page into.
var objID = "review";
//Change the current image of the minus or plus.
if (showReviews == true){
//document.getElementById("opencloseimg").src = "../images/minus.gif";
//The page we are loading.
var serverPage = "http://www.bergerrealty.com/includes/functions/ajax/reviews.php?ucode=" + id;
//Set the open close tracker variable.
showReviews = false;
var obj = document.getElementById(objID);
xmlhttp.open("GET", serverPage);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
} else {
//Hide the calendar.
//document.getElementById("opencloseimg").src = "../images/plus.gif";
showReviews = true;
document.getElementById(objID).innerHTML = "";
}
}

//Image Swap
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

