

 // new preloads. Just preload the overs.

var about_wre = new Image();			var about_wre_over = new Image();		var contact_wre = new Image();	
var contact_wre_over = new Image();	    var join_wre = new Image();			    var join_wre_over = new Image();
var help_wre = new Image();	            var help_wre_over = new Image();		var login_wre = new Image();
var login_wre_over = new Image();       var home_wre = new Image();			    var home_wre_over = new Image();
    
var imgObj = new Array(about_wre,about_wre_over,contact_wre,contact_wre_over, join_wre,join_wre_over,
                       help_wre,help_wre_over,login_wre,login_wre_over,home_wre,home_wre_over);
var images = new Array('about.gif','aboutover.gif','contact.gif','contactover.gif','join.gif','joinover.gif',
                       'site.gif','siteover.gif','members.gif','membersover.gif','main.gif','mainover.gif');

var imgName;
for (i=0;i<images.length;i++) {
      imgName = '\/images\/' + images[i];
      imgObj[i].src=imgName;
}

function attachRollovers () {
  if (document.getElementById) {
    document.getElementById('about_link').onmouseover = function() { document.getElementById('about_wre').src = '\/images\/aboutover.gif'; }; 
    document.getElementById('about_link').onmouseout  = function() { document.getElementById('about_wre').src = '\/images\/about.gif'; }; 
    document.getElementById('contact_link').onmouseover = function() { document.getElementById('contact_wre').src = '\/images\/contactover.gif'; }; 
    document.getElementById('contact_link').onmouseout  = function() { document.getElementById('contact_wre').src = '\/images\/contact.gif'; }; 
    document.getElementById('signup_link').onmouseover = function() { document.getElementById('signup_wre').src = '\/images\/joinover.gif'; }; 
    document.getElementById('signup_link').onmouseout  = function() { document.getElementById('signup_wre').src = '\/images\/join.gif'; }; 
    document.getElementById('help_link').onmouseover = function() { document.getElementById('help_wre').src = '\/images\/siteover.gif'; }; 
    document.getElementById('help_link').onmouseout  = function() { document.getElementById('help_wre').src = '\/images\/site.gif'; }; 
    document.getElementById('login_link').onmouseover = function() { document.getElementById('login_wre').src = '\/images\/membersover.gif'; }; 
    document.getElementById('login_link').onmouseout  = function() { document.getElementById('login_wre').src = '\/images\/members.gif'; }; 
    document.getElementById('home_link').onmouseover = function() { document.getElementById('home_wre').src = '\/images\/mainover.gif'; }; 
    document.getElementById('home_link').onmouseout  = function() { document.getElementById('home_wre').src = '\/images\/main.gif'; }; 
  }
}
window.onload = function() { attachRollovers(); }; 
	
   
// need to scour scripts and use this.
    function newWin(url,img,title,w,h) {

	   if (! (url) && ! (img)) { return; }
	   var day= new Date();
	   var id = day.getTime();
	   var ww = w+75;
	   var wh = h+125;
	   var params = 'width='+ww+',height='+wh+',scrollbars,resizable';
	   if (url=='') {
	      var msg='<!DOCTYPE HTML PUBLIC "-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN" "http:\/\/www.w3.org/TR\/html4\/loose.dtd">\n'+
		          '<meta http-equiv="Content-Type" content="text\/html; charset=iso-8859-1">\n'+
		          '<html><head><title>'+img+'<\/title><\/head>'+
		          '<style type="text\/css">\n'+
				  ' html,body { font-family: Arial,Helvetica,Sans-Serif; }\n'+
				  'h3 { text-align: center; }\n'+
				  'td { text-align: center; }\n'+
				  '<\/style><body>\n'+
				  '<h3>'+title+'<\/h3>\n <table align="center" border="0"><tr><td><img src="'+img+'" width="'+w+'" height="'+h+'" border="0" alt="'+title+'"></td></tr>\n'+
				  '<tr><td><hr width="100%" size="1"><form><input type="button" onClick="javascript:window.close();" value="Close Window">\n'+
				  '<hr width="100%" size="1"><\/form><\/td><\/tr><\/table><\/body><\/html>\n';
	      var win = open('',id,params);
		  win.document.write(msg);
		  win.document.close();
	   }
	   else { var win = open(url,id,params); } 
	   return false;
}
	

function checkContact(form) {
        var requireds = new Array('Name', 'Email');
        var msg = '';

        for (i=0; i<requireds.length; i++) {
            if (document.getElementById(requireds[i]).value == '') {
                 msg = 'Please provide your ' + requireds[i] + ' before submitting this form.';
                break;
            }
        }
        if ((msg == '') && (form.Email.value != '')) {
            var found = false;
            var emailString = form.Email.value;
            for (j=0; j < emailString.length; j++) {
                if (emailString.charAt(j) == "@") { found = true; }
            }
            if (found == false) {
                msg = 'Is that your true email address?\n' +
                      'Please enter your correct email address.\n' +
                      'We will not place you on any mailing lists!\n';
            }
        }

        if (msg == '') { form.submit(); }
        else {  alert(msg);  }

}
			   
     function checkForm(form) {

        var searchString = '/cgi/search.cgi?function=search_db';
        var type = form.type.options[form.type.selectedIndex].value;

        var DDval   = form.state.options[form.state.selectedIndex].value;
        var cityVal = form.city.value;

        if (DDval == "none") {
            alert('Please select the ' + type + ' state.');
            return false;
        }


        searchString = searchString + '&type=' + type + '&state=' + DDval;
        if ((cityVal != '') && (cityVal != 'City \(Optional\)')) {
           searchString = searchString + '&city=' + cityVal;
        }
        document.location=searchString;

     }

     function checkAdvanced(form) {
        var ind     = form.state.selectedIndex;
        var DDval   = eval('form.state.options[' + ind + '].value');
        if (DDval == "none") {
            alert('The state field is the only required field to \n perform an advanced ' + form.type.value + ' search.');
            return;
        }
        else {  form.submit();  }
     }
	 
     function clearField(fld) {
          if (fld.value == 'City \(Optional\)') { fld.value =''; }
     }

//Listing pages, newWindow is probably now dead.
   function printWindow(){
      bV = parseInt(navigator.appVersion)
      if (bV >= 4) window.print()
   }
   function mailpage(url){
     mail_str = 'mailto:?subject=I found this on web-realestate.net.'+
                '&body=\n\nI thought you might be interested in this listing.\n\n'+
                'You can view it at ' + url; 
     location.href = mail_str;
   }
   
   // DRAT! This will not work on IE. See large_ad.txt
   function getBookmark(url,who) {
       var txt = "Bookmark This Listing";
       var ver = navigator.appName
       var num = parseInt(navigator.appVersion);
	   var msg;
       if ((ver == "Microsoft Internet Explorer")&&(num >= 4)) {
          msg  = '<a class="bold" href="#" onClick="window.external.AddFavorite(url,who);" '+
                 'onMouseOver="window.status=' + txt + '\; return true\;" onMouseOut="window.status=\' \'; return true\;">' + txt + '<\/a>';
       }
	   else { msg = "Press (Ctrl+D) to " + txt; }
       return msg;
   }

   function swapImage(id,wrapid,url,w,h) {
	 var obj  = document.getElementById(id); 
	 var wrap = document.getElementById(wrapid);
	 if (wrap) {
	  wrap.style.width=(w<250)?'290px':parseInt(w+40)+'px'; } // Adjust if you padding and margin change styles!
	 if (obj) {
	  obj.width=w;
	  obj.height=h;
	  obj.src=url;
	 }
   }
