function swapImage(newimage) {
  document.getElementById('mainimage').src = mainimages[newimage];
  return true;
}

if (typeof google != 'undefined') {
  google.load('maps','2.x');
  var d_location;
}else {
  function initialize() {
    return true;
  }
  function GUnload() {
    return true;
  }
}
  function initialize() {
    map         = new google.maps.Map2(document.getElementById('gmap_holder'));
    d_location  = new GLatLng(mapref[0],mapref[1]);
    map.setCenter(d_location,d_zoom);
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    map.setMapType(G_HYBRID_MAP);

    var marker  = new GMarker(d_location, { title: gmarker_title});
    map.addOverlay(marker);
  }


var emailafriend_w  = 435;
var emailafriend_h  = 400;
function show_emailafriend() {
  setscreendimensions();
  document.getElementById('formOverlay').style.height   = docHeight + 'px';
  document.getElementById('formOverlay').style.width    = docWidth + 'px';
  document.getElementById('formOverlay').style.display  = "inline";

  if (viewportwidth <   emailafriend_w) emailafriend_w  = viewportwidth - 10;
  if (viewportheight <  emailafriend_h) emailafriend_h  = viewportheight- 10;

  document.getElementById('emailafriend').style.width   = emailafriend_w + 'px';
  document.getElementById('emailafriend').style.height  = emailafriend_h + 'px';
  document.getElementById('emailafriend').style.top     = ((viewportheight/2)-(emailafriend_h/2)+dsoctop) + 'px';
  document.getElementById('emailafriend').style.left    = ((viewportwidth/2) -(emailafriend_w/2)+dsocleft) + 'px';
  document.getElementById('emailafriend').style.display = "inline";

}
function hide_emailafriend() {
  document.getElementById('formOverlay').style.display  = "none";
  document.getElementById('emailafriend').style.display = "none";
}
var ajax;
function send_email() {
  ajax          = new sack();
  var sendform  = document.getElementById('emailafriend_form');
  ajax.setVar('FORM_NAME',sendform.FORM_NAME.value);
  ajax.setVar('sendername',sendform.sendername.value);
  ajax.setVar('senderemail',sendform.senderemail.value);
  ajax.setVar('toname',sendform.toname.value);
  ajax.setVar('toemail',sendform.toemail.value);
  ajax.setVar('comments',sendform.comments.value);
  ajax.setVar('propertyid',sendform.propertyid.value);
  ajax.setVar('spam',document.getElementById('spam').value);
  ajax.requestFile = 'inc/sendemail.php';
  ajax.onCompletion = function() {
    if (ajax.responseStatus) eval(ajax.response);
  };
  ajax.runAJAX();
  return false;
}
