// JavaScript Document
var agt = navigator.userAgent.toLowerCase();
is_major = parseInt(navigator.appVersion);
is_minor = parseFloat(navigator.appVersion);
is_ie  = ((agt.indexOf("msie") != -1) && (agt.lastIndexOf(")") == agt.length-1) || window.opera);
is_ie5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
is_ie5up = (is_ie && (is_major == 4) && (agt.indexOf("msie 4.0")==-1) );
is_nav = (navigator.appName.indexOf("Netscape") != -1);
is_win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
is_mac = (agt.indexOf("mac")!=-1);
is_nav4 = (is_nav && is_major == 4);
is_nav6 = (is_nav && (is_major > 4));
is_safari = agt.indexOf("safari") != -1;
function handleResize() { document.location.reload(false); }
if (is_nav4 && (is_minor > 4.08 )) {
window.captureEvents(Event.RESIZE);
window.onResize = handleResize;
}

function preloadImages()
{
  if(document.images)
  {
    if(!document.imageArray) document.imageArray = new Array();
    var i,j = document.imageArray.length, args = preloadImages.arguments;
    
    for(i=0; i<args.length; i++)
    {
      if (args[i].indexOf("#")!=0)
      {
        document.imageArray[j] = new Image;
        document.imageArray[j++].src = args[i];
      }
    }
  }
}

function switchImage(houseNum,imgSrc,imgDesc,num) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
	  document.main_pic.src = imgSrc;
	  document.getElementById("desc").innerText=imgDesc;
	  document.getElementById("medium").href="javascript:openPopup('./images/house_"+houseNum+"/big/"+num+".jpg')";
    }
  }
}

function swapImg(imgName, imgSrc) {
if (typeof document[imgName] != 'undefined') document[imgName].src = imgSrc;
}

var popup=null;
function openPopup(url) {
closeWin(popup);
popup = window.open(url,"pop_win","height=650,width=860,location=no,menubars=no,scrollbars=yes,toolbars=no,resizable=yes");
}

function closeWin(winRef) {
if (winRef)
if (!winRef.closed) winRef.close();
return null;
}

