
thisDate = new Date();

function setCurrentDate() {
  document.getElementById('beginday').value  = thisDate.getDate();
  document.getElementById('beginmonth').selectedIndex =  thisDate.getMonth();
  document.getElementById('beginyear').value  = thisDate.getFullYear();

  document.getElementById('endday').value  = thisDate.getDate();
  document.getElementById('endmonth').selectedIndex = thisDate.getMonth();
  document.getElementById('endyear').value  = thisDate.getFullYear();
  }
  
function contact(mailtoID,rhs,lhs,innerhtml) {
  document.getElementById(mailtoID).href = 'mailto://' + rhs + '@' + lhs;
  document.getElementById(mailtoID).innerHTML = innerhtml;
  }

function startAds() {
  document.getElementById('loadingImage').style.display = 'none';
  bannerAdShow();
  }
    
function bannerAdShow() {  
  initImage('pano',7000);
  setTimeout("initImage('bannerAd1',7000)",8000);
  setTimeout("initImage('bannerAd2',7000)",17000);
  setTimeout("initImage('bannerAd3',7000)",26000);	
/*  setTimeout("initImage('bannerAd4',7000)",35000);	 */
  setTimeout("bannerAdShow()", 35000);
 }

function initImage(imageId,interval) { 
  image = document.getElementById(imageId);
  setOpacity(image, 0);
  image.style.display = 'inline';
  fadeIn(imageId,0); 
  window.setTimeout("fadeOut('"+imageId+"'," + "100" + ")",interval);  /* number of ms for the pic */
  }

function setOpacity(obj, opacity) {
    opacity = (opacity == 100)?99.999:opacity;
  // IE/Win
    obj.style.filter = "alpha(opacity:"+opacity+")";
  // Safari<1.2, Konqueror
    obj.style.KHTMLOpacity = opacity/100;
  // Older Mozilla and Firefox
    obj.style.MozOpacity = opacity/100;
  // Safari 1.2, newer Firefox and Mozilla, CSS3
    obj.style.opacity = opacity/100;
  }

function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 10;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);  /* fade-in is 1 sec */
    }
  }
}

function fadeOut(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity >= 0) {
      opacity = opacity - 10;
      setOpacity(obj, opacity);
      window.setTimeout("fadeOut('"+objId+"',"+opacity+")", 100);  /* fade-out is 1 sec */
      }
    else {
      obj.style.display = "none";
      }
   }
}

preload_image_object1 = new Image();
preload_image_object1.src = "images/SanFranciscoRealEstate2.gif";
preload_image_object2 = new Image();
preload_image_object2.src = "images/MarketYourProperty2.gif";


function mouseOver(fileName) {
  image.src  = "file"
  }
function mouseOut(image) {
  image.src  = "images/SanFranciscoRealEstate.gif"
  }

function neighborhoodLookup() {

    var xmlHttp;

    try {xmlHttp=new XMLHttpRequest();}
    catch (e){
      try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
      catch (e){
        try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
        catch (e) {alert("Your browser does not support AJAX!");return false;}
        }
      }
    
    query = "/cgi-bin/getnbds?Search=Global&&City=San Francisco&V=SFCHN";
 
    try {xmlHttp.open("GET",query,true);}
    catch (e) {alert(e)};

    xmlHttp.onreadystatechange=function() {

      if(xmlHttp.readyState == 4) {

        var tmpArr  = new Array();
        tmpArr = xmlHttp.responseText.split("\n");

        var lines = new Array();

        for(i=0;i<tmpArr.length-1;i++) { 

          if(tmpArr[i].match(/HTML/i)) {continue;}
          if(tmpArr[i].match(/NAME/i)) {continue;}
          if(tmpArr[i].match(/ALL STATES/i)) {continue;}
          if(tmpArr[i].match(/SELECT/i)) {tmpArr[i] = tmpArr[i].replace(/..SELECT./i,"");}

          lines = tmpArr[i].split('\"');
          var value = lines[1];
          value = value.replace(/^ */, "");
          var label = lines[2].replace(/\>/,"");

          document.getElementById('neighborhood').options[i-3] = new Option(label, value, true, false);
          
          } 
        }
      }
      xmlHttp.send(null);
    }

