// include1.js



//---Popup Window---
//
// Usage:
// in <head>: <script type="text/javascript" src="include1.js"></script>
// in <a>: <a href="example.html" type="popup">Your text</a>

var popup = null;
function thepopup(url) {
if (popup && !popup.closed) { popup.close() }
popup = window.open(url,"popup","width=730,height=600,menubar,scrollbars,resizable");
popup.focus();
return false;
}

function get_anchors() {
var anchors = document.getElementsByTagName('a');
for (var i=0; i<anchors.length; i++) {
if (anchors[i].getAttribute('type') == 'popup') {
anchors[i].onclick = function(){ return thepopup(this.href) }
}
}
}
window.onload = get_anchors;

//----------------------------------------------------------


//---Trim leading and trailing whitespace---
// Removes leading whitespaces
function LTrim( value ) {
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
}
// Removes ending whitespaces
function RTrim( value ) {
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
}

// Removes leading and ending whitespaces
function trim( value ) {
	return LTrim(RTrim(value));
}
//----------------------------------------------------------

//---My custom command processor---

function ask_command() {

homeurl='http://www.realtysaltspringisland.com/';

cmd=prompt("Hi, what can I do for you?","");
cmd=trim(cmd).toLowerCase(); // all my commands will be case insensitive

if (cmd == 'database') {
  url=homeurl + 'database';
  //ret=window.open(url,'database').focus(); // this popup gets blocked by Yahoo toolbar etc.
  document.write('<html><body>');
  document.write('<h1>Welcome to Private Data</h1><p>Please choose:</p>');
  document.write('<li><a href="'+url+'">Database</a> - listed by category and price</li>');
  document.write('<li><a href="'+homeurl+'">Home</a></li>');
  document.write('</body></html>');
  document.close();
  }
else if (cmd == 'datelist') {
  url=homeurl + 'database/datelist.htm';
  //ret=window.open(url,'database').focus(); // this popup gets blocked by Yahoo toolbar etc.
  document.write('<html><body>');
  document.write('<h1>Welcome to Private Data</h1><p>Please choose:</p>');
  document.write('<li><a href="'+url+'">Database</a> - listed by category and list date</li>');
  document.write('<li><a href="'+homeurl+'">Home</a></li>');
  document.write('</body></html>');
  document.close();
  }
else if (cmd=="") {
  // do nothing
  }
else {
  ret=alert("Sorry, I don't understand "+cmd);
  }

}
//----------------------------------------------------------
  // Hide Email Addresses from Harvesters
  function MakeEmail(em1, em2) {
    if (em1 && em2) {
      email=em1 + '@' + em2
      document.write('<a href=\"mailto:' + email +'\">' + email + '</a>');
    }
    else {
      document.write(' -- No email address supplied -- ');
    }
  }
//----------------------------------------------------------