// JavaScript Document
// MAIN SCRIPTS
// Erik Gorton 2004 for ECOpropertyŽ

// -------------------------------------------------------------------
// -------------------------------------------------------------------
// Edit Variables

// ShowFeatureProperties
var ecoVar_FeatureList = new Array(
new Array("Kilcoy Qld", "qld/kilcoy1", "Lot 51 House Site95.JPG"),
new Array("Troopers Rest", "nsw/2delegatedeveland", "trooper95.jpg"),
new Array("Creswick Vic", "vic/f38", "cres95.JPG"),
new Array("Stanthorpe QLD", "qld/f14", "stan95.JPG"),
new Array("Fabulous Family Living Vic", "vic/f23", "fabfamilyliving95.JPG"),
new Array("Broomfield Vic", "vic/f36", "creswick95.JPG"),
new Array("Organics and Neighbourhood Qld", "qld/f19", "sollfig95.JPG"),
new Array("Oaklands Junction Vic", "vic/f25", "oaklandland95.JPG"),
new Array("Energy Efficiency Plus NSW", "nsw/f2", "Terrahouse95.jpg"),
new Array("Avenel, Vic", "vic/f7", "Avenel95.JPG"),
new Array("Benalla Vic", "vic/4", "benalla95.JPG"),
new Array("Apartments VIC", "vic/f3", "V9MLM95.JPG"),
new Array("Tasmania", "tas/f3", "ABoneofmanyeucs95"),
new Array("Castlemaine VIC", "vic/f16", "FF1071095.JPG"),
new Array("South Coast NSW", "nsw/2", "houselong95.JPG"),
new Array("Dunolly Vic", "vic/f18", "Dunolly house95.JPG"),
new Array("Daylesford", "vic/f16GH", "landandtreesLH95.JPG"),
new Array("Texas Qld", "qld/f13", "texas695.JPG"),
new Array("Wollombi NSW", "nsw/f22", "Wollhouse95.JPG"),
new Array("CoffsHarbour NSW", "nsw/f23", "CHhouse95.JPG"),
new Array("Cowra Region NSW", "nsw/f17", "cowra105.JPG"),
new Array("Hartley NSW", "nsw/4", "Htlyview90.JPG"),
new Array("Coonabarabran NSW", "nsw/f1", "coona_thumb.jpg")

);

// ShowFeatureTEDentries
var ecoVar_TEDFeatureList = new Array(
new Array("Ethical Investor", "books.htm", "ethicalinvestor_thumb.jpg"),																			
new Array("obradovic arkitexture", "architects.htm", "abradovic_thumb.jpg"),
new Array("Brogo River Bakery", "retail.htm", "brogo_thumb.jpg"),
new Array("Sustainable Futures", "education.htm#QLD", "susfutures_thumb.jpg"),
new Array("Alternative Technology Association", "energyconsult.htm", "ata_thumb.jpg")
);

// ShowFeatureBusinesses
var ecoVar_FeatureBusinesses = new Array(
new Array("Organics/BioDynamics Qld", "qld", "OFbizcow95.JPG"),
new Array("E.Gippsland VIC", "vic", "orbost_thumb.jpg"),
new Array("Coonabarabran NSW", "nsw", "coona_thumb.jpg")

);

// ecoMail
ecomail_cj = new ecoNewEmail("Catriona Jane MacDiarmid","cj06");
ecomail_pk = new ecoNewEmail("Patty Kolln","pk06");
ecomail_property = new ecoNewEmail("ECOproperty","property06");
ecomail_admin = new ecoNewEmail("Administration","admin06");

// ecoTerms
var ecoTerms = new Array(); //Don't remove or change this line!
ecoterm_biodynamic = new ecoNewTerm("biodynamic","Biodynamic","general","Biodynamic Farming/Products - First suggested by Rudolf Steiner, Biodynamics is a method of agriculture which seeks to actively work with the health-giving forces of nature without pesticides and chemicals, replenishing nutrients in the soil");
ecoterm_bioregion = new ecoNewTerm("bioregion","Bioregion","general","A Bioregion is a method of describing a locality according to it's water catchment area");
ecoterm_buildingbiology = new ecoNewTerm("buildingbiology","Building Biology","general","How  buildings impact upon the health of the people who occupy them");
ecoterm_ecodirectory = new ecoNewTerm("ecodirectory","ECOdirectory","eco","A feature of the eco.com.au website that lists various businesses and products that have sustainable qualities");
ecoterm_ecofind = new ecoNewTerm("ecofind","ECOfind","eco","A feature of the eco.com.au website that allows people to register their property requirements, which ECOproperty&reg; will then attempt to find for them");
ecoterm_ecohomestay = new ecoNewTerm("ecohomestay","ECOhomestay","eco","A feature of the eco.com.au website that assists people to stay with homestay hosts to learn about the local area, the ECO features of their property or just spend time with like-minded people in great locations");
ecoterm_ecoproperty = new ecoNewTerm("ecoproperty","ECOproperty","eco","An ECOproperty is any dwelling or land that utilizes sustainable features or  energy efficient principles in it's design and/or operation.<br>ECOproperty&reg; is the registered trading name for our business.");
ecoterm_ecopropertyupdate = new ecoNewTerm("ecopropertyupdate","ECOproperty Update","eco","A regular newsletter published by ECOproperty&reg; via email and on the web, featuring new properties on the eco.com.au website and other news");
ecoterm_embodiedenergy = new ecoNewTerm("embodiedenergy","Embodied Energy","general","Embodied energy is the energy consumed by all of the processes associated with the production of a building, from the acquisition of natural resources to product delivery");
ecoterm_energyefficient = new ecoNewTerm("energyefficient","Energy Efficient","general","Having qualities that reduces the consumption of non-renewable energy");
ecoterm_ethicalenterprisenetwork = new ecoNewTerm("ethicalenterprisenetwork","Ethical Enterprise Network","general","A national organisation for enterprises that are seeking ethical ways of doing profitable business");
ecoterm_localscan = new ecoNewTerm("localscan","localsCAN","eco","The ECOproperty Local Consultants Network - individuals and organisations  working together to provide specialist expertise or assistance  with local economic and community development");
ecoterm_magandzine = new ecoNewTerm("magandzine","Mag&amp;Zine","eco","Both a printed Magazine and online 'Zine' - A quarterly publication by ECOproperty&reg; with articles about sustainable issues and products");
ecoterm_mudbrick = new ecoNewTerm("mudbrick","Mud Brick","general","A building technique using mud that is sun-dried as a brick, providing an energy efficient (cool in summer, warm in winter) and cost effective building material");
ecoterm_organic = new ecoNewTerm("organic","Organic","general","Organic Farming/Products - Farming methods that don't use pesticides or other chemicals");
ecoterm_permaculture = new ecoNewTerm("permaculture","Permaculture","general","Permanent Agriculture - the conscious design and maintenance of agriculturally productive ecosystems which have the diversity, stability and resilience of natural ecosystems");
ecoterm_solarpassive = new ecoNewTerm("solarpassive","Solar Passive","general","Designing a building's placement and construction materials, of windows, walls, and floors to collect, store, and distribute solar energy in the form of heat in the winter and reject solar heat in the summer");
ecoterm_triplebottomline = new ecoNewTerm("triplebottomline","Triple Bottom Line","general","A system for measuring the environmental performance and impact of a business, as an alternative to traditional financial reporting");
ecoterm_wwoof = new ecoNewTerm("wwoof","WWOOF","general","Willing Workers On Organic Farms (WWOOF) is a form of cultural exchange in which WWOOFers live and work as family with host farms, and learn about the skills of organic growing and the area they are visiting");

// NOTE: There are other variables set below in the individual function definitions

// -------------------------------------------------------------------
// -------------------------------------------------------------------
// Show TED Feature Entries (in Sidebar)


function eco_ShowTEDFeatureEntries() {
	var theImage, theTextLink, theURL;
	var theFeatureList, theText, theLink, thePic;
	var theNumPics = ecoVar_TEDFeatureList.length;
	var theIndex = 0;
	while (theIndex <= theNumPics) {
		theURL = 'http://www.eco.com.au';
		theFeatureList = ecoVar_TEDFeatureList[theIndex];
		theText = theFeatureList[0];
		theLink = theFeatureList[1];
		thePic = theFeatureList[2];
		theSpacer = '<img src='+theURL+'"/img/gbl/Spacer.gif" width="1" height="5" border="0"';
		theImage = '<A HREF="'+theURL+'/directory/dir/'+theLink+'"><IMG SRC="'+theURL+'/img/featureTED/'+thePic+'" WIDTH=94 HEIGHT=61 ALT="'+theText+'" BORDER=1  CLASS="sidebar_featureimage"></A>';
		theTextLink = '<A HREF="'+theURL+'/directory/dir/'+theLink+'">'+theText+'</A>';
		if (theIndex <= 4) {
			document.write(theSpacer + '<br>' + theImage + '<br>' + theTextLink+'<br>');
			if (theIndex == 4) {
				document.write(theSpacer + '<br><IMG SRC="'+theURL+'/img/gbl/dot_brown.gif" WIDTH=94 HEIGHT=1 BORDER=0  CLASS="sidebar_featureimage"><br>');
			}
		}
		else {
			document.write(theSpacer + '<br>' + theTextLink + '<br>');
		}
		theIndex++;
	}
}

// -------------------------------------------------------------------
// -------------------------------------------------------------------
// Show Feature Properties (in Sidebar)

// Show first 5 as pics - rest as text

function eco_ShowFeatureProperties() {
	var theImage, theTextLink, theURL;
	var theFeatureList, theText, theLink, thePic;
	var theNumPics = ecoVar_FeatureList.length;
	var theIndex = 0;
	while (theIndex <= theNumPics) {
		theURL = 'http://www.eco.com.au';
		theFeatureList = ecoVar_FeatureList[theIndex];
		theText = theFeatureList[0];
		theLink = theFeatureList[1];
		thePic = theFeatureList[2];
		theSpacer = '<img src='+theURL+'"/img/gbl/Spacer.gif" width="1" height="5" border="0"';
		theImage = '<A HREF="'+theURL+'/r_estate/byState/'+theLink+'.htm"><IMG SRC="'+theURL+'/img/feature/'+thePic+'" WIDTH=94 HEIGHT=61 ALT="'+theText+'" BORDER=1  CLASS="sidebar_featureimage"></A>';
		theTextLink = '<A HREF="'+theURL+'/r_estate/byState/'+theLink+'.htm">'+theText+'</A>';
		if (theIndex <= 4) {
			document.write(theSpacer + '<br>' + theImage + '<br>' + theTextLink+'<br>');
			if (theIndex == 4) {
				document.write(theSpacer + '<br><IMG SRC="'+theURL+'/img/gbl/dot_brown.gif" WIDTH=94 HEIGHT=1 BORDER=0  CLASS="sidebar_featureimage"><br>');
			}
		}
		else {
			document.write(theSpacer + '<br>' + theTextLink + '<br>');
		}
		theIndex++;
	}
}

function eco_ShowFeatureBusinesses() {
	var theImage, theTextLink, theURL;
	var theFeatureList, theText, theLink, thePic;
	var theNumPics = ecoVar_FeatureBusinesses.length;
	var theIndex = 0;
	while (theIndex <= theNumPics) {
		theURL = 'http://www.eco.com.au';
		theFeatureList = ecoVar_FeatureBusinesses[theIndex];
		theText = theFeatureList[0];
		theLink = theFeatureList[1];
		thePic = theFeatureList[2];
		theSpacer = '<img src='+theURL+'"/img/gbl/Spacer.gif" width="1" height="5" border="0"';
		theImage = '<A HREF="'+theURL+'/r_estate/forSale/'+theLink+'.htm"><IMG SRC="'+theURL+'/img/feature/'+thePic+'" WIDTH=94 HEIGHT=61 ALT="'+theText+'" BORDER=1  CLASS="sidebar_featureimage"></A>';
		theTextLink = '<A HREF="'+theURL+'/r_estate/forSale/'+theLink+'.htm">'+theText+'</A>';
		if (theIndex <= 4) {
			document.write(theSpacer + '<br>' + theImage + '<br>' + theTextLink+'<br>');
			if (theIndex == 4) {
				document.write(theSpacer + '<br><IMG SRC="'+theURL+'/img/gbl/dot_brown.gif" WIDTH=94 HEIGHT=1 BORDER=0  CLASS="sidebar_featureimage"><br>');
			}
		}
		else {
			document.write(theSpacer + '<br>' + theTextLink + '<br>');
		}
		theIndex++;
	}
}

// Shows ALL properties in the array as pics - randomly chooses position *CURRENTLY UNSUSED
function eco_ShowFeaturePropertiesALL() {
	var theImage, theTextLink, i, iTest, theRandomNum, theTest, theURL;
	var theFeatureList, theText, theLink, thePic;
	var theTestArray = new Array();
	var theNumPics = ecoVar_FeatureList.length;
	for(i=0;i<theNumPics;i++) {
		theTest = 1;
		while (theTest == 1) {
			theTest = 0;
			theRandomNum = randomNumber(ecoVar_FeatureList.length);
			//alert("i:"+i+" Random:"+ theRandomNum+" TestArrayLength:"+theTestArray.length);
			for(iTest=0;iTest<theTestArray.length;iTest++) {
				//alert("iTest: "+iTest+" theTestArray["+iTest+"]:"+theTestArray[iTest]+ "theRandomNum:"+theRandomNum);
				if (theRandomNum == theTestArray[iTest]) {
			 	 theTest = 1;
					break;
				}
			}
		}
		theURL = 'http://www.eco.com.au';
		theTestArray[theTestArray.length] = theRandomNum;
		theFeatureList = ecoVar_FeatureList[theRandomNum];
		theText = theFeatureList[0];
		theLink = theFeatureList[1];
		thePic = theFeatureList[2];
		theSpacer = '<img src='+theURL+'"/img/gbl/Spacer.gif" width="1" height="5" border="0"';
		theImage = '<A HREF="'+theURL+'/r_estate/byState/'+theLink+'.htm"><IMG SRC="'+theURL+'/img/feature/'+thePic+'" WIDTH=94 HEIGHT=61 ALT="'+theText+'" BORDER=1  CLASS="sidebar_featureimage"></A>';
		theTextLink = '<A HREF="'+theURL+'/r_estate/byState/'+theLink+'.htm">'+theText+'</A>';
		document.write(theSpacer + '<br>' + theImage + '<br>' + theTextLink + '<br>');
	}
}

function randomNumber(limit){
  return Math.floor(Math.random()*limit);
}



// -------------------------------------------------------------------
// -------------------------------------------------------------------
// ecoMail scripts

// ---------------------------------------------------------------------
// Begin function ecoNewEmail
function ecoNewEmail(name, address) {
	this.name = name;
	this.address = address;
}

// ---------------------------------------------------------------------
// Begin function ecoMail
function ecoMail(theEmail,theSubject,thePosition,theSentence) {
	if (!theSubject) theSubject = "";
	if (!thePosition) thePosition = "right";
	if (theSentence) {
		theLink = '<img src="http://www.eco.com.au/img/gbl/email.gif" width="16" height="11"> ';
		theLink = theLink + '<a href="mail'+'to:' +theEmail.address +'&#064;' +'eco.com.au' +'?Subject=' +theSubject+ '" ';
		thePopUpLink = theEmail.address +'&#064;' +'eco.com.au';
		theLink = theLink + 'onClick="PopUp()" onMouseOver="PopUp(&quot;hint&quot;,&quot;Click Here to Send an Email to '+thePopUpLink+'&quot;,&quot;&quot;,&quot;'+thePosition+'&quot;)" onMouseOut="PopUp()">';
		theLink = theLink + theSentence + '</a>';
	}
	else {
		theLink = '<img src="http://www.eco.com.au/img/gbl/email.gif" width="16" height="11"> '
		theLink = theLink +'<a href="mail'+'to:' +theEmail.address +'&#064;' +'eco.com.au' +'?Subject=' +theSubject+ '" ';
		thePopUpLink = theEmail.address +'&#064;' +'eco.com.au';
		theLink = theLink + 'onClick="PopUp()" onMouseOver="PopUp(&quot;hint&quot;,&quot;Click Here to Send an Email to '+thePopUpLink+'&quot;,&quot;&quot;,&quot;'+thePosition+'&quot;)" onMouseOut="PopUp()">';
		theLink = theLink + theEmail.name + '</a>';
	}
	document.write(theLink);
}

// ---------------------------------------------------------------------
// Begin function E-Mail-This-Page
// (C) 2000 www.CodeLifter.com
// http://www.codelifter.com

var mailThisUrl_good;

function mailThisUrl(){
	u = window.location;
	p = document.title;
	
	// Edit the following variables. NOTE %0A = Carraige Return character
	m = "Thought you might find this interesting...";
	b = "Here's an interesting page at eco.com.au I thought you might like to see:%0A%0A";
	b2 = "%0A%0AIf your email program does not display the above address as a link then";
	b2 = b2 +"%0Ajust copy the link and paste it into your web browser";
	b2 = b2+"%0A%0A------------------------------------------------------------ ";
	b2 = b2+"%0A%0AYou have received this email because a friend has referred this page to you.";
	b2 = b2+"%0AECOproperty has a policy of never sending unsolicited email and so has made this service";
	b2 = b2+"%0Aavailable between people.";
	b2 = b2+"%0ATherefore, eco.com.au and ECOproperty Pty Ltd have not received any details about you.";
	b2 = b2+"%0AIf you have an interest in our activities please visit this link to request more information:";
	b2 = b2+"%0A%0Ahttp://www.eco.com.au/aboutus/contactform.htm%0A";
	// End of variables to edit
	
	 theMessage = b+u+b2;
   mailThisUrl_good = false
   checkEmailAddress(document.eMailer.address)
   if (mailThisUrl_good){
      // the following expression must be all on one line...
      window.location = "mailto:"+document.eMailer.address.value+"?subject="+m+"&body="+theMessage;
   }
}

function checkEmailAddress(field) {
// the following expression must be all on one line...
var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
if (goodEmail){
   mailThisUrl_good = true
} else {
   alert('Please enter a valid e-mail address.')
   field.focus()
   field.select()
   mailThisUrl_good = false
   }
}

// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// ECO Terms

function ecoNewTerm(name, term, type, description) {
	this.term = term;
  this.type = type;
	this.description = description;
	var theIndex = ecoTerms.length++;
	ecoTerms[theIndex] = name.toLowerCase();
	//alert(ecoTerms[theIndex]);
}

// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// PopUp Message Window

// *************************************************************************************
// Example:
// onMouseOver="toolTip('TheType','The Heading','The Message','left OR right')";
// Can exclude 'left OR right' - will default to right
// onMouseOut="toolTip()";
// you can include any html formatting, including images in the Heading and Message;

var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
popupOffSetX = 15; // Do not use - (negative) numbers for x
popupOffSetY = 15;
popupWindowWidth = 150;
popupPositionX = 1;
var popupSTYLE="";

function PopUpInit()
{
  if(ns4||ns6||ie4)
  {
    if(ns4) popupSTYLE = document.popupLAYER;
    else if(ns6) popupSTYLE = document.getElementById("popupLAYER").style;
    else if(ie4) popupSTYLE = document.all.popupLAYER.style;
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else
    {
      popupSTYLE.visibility = "visible";
      popupSTYLE.display = "none";
    }
    document.onmousemove = PopUpMoveToMouseLoc;
  }
}

// theType = type of pop window:
// 'message' (green heading,text) - takes definition from predefined variable
// 'term' (green heading,text)
// 'alert' (red heading,text)
// 'hint' (green just heading no text)
// theHeading = heading text (if 'message' then this is the term object eg. ecoterm_biodynamic)
// theText = message text
// thePositionX = pop window either left or right of cursor ('left' OR 'right')
function PopUp(theType, theHeading, theText, thePositionX)
{
  if(PopUp.arguments.length < 1) // hide
  {
    if(ns4) popupSTYLE.visibility = "hidden";
    else popupSTYLE.display = "none";
  }
  else // show
  {
		if(!theHeading) theHeading = '';
		if(!theText) theText = '';
	  if(!thePositionX) thePositionX = 'right';
	  if(thePositionX == 'left') popupPositionX = (popupWindowWidth + popupOffSetX) *-1;
		else popupPositionX = 1;
	  // No need to specify for thePosition == 'right' as that is the default
		if(theType == 'term') {
		theTopBckGndColor = '#003333';
		theBottomBckGndColor = '#658D72';
		theTopFontPre = '<font color="#FFFFFF" size="1" face="Arial, Helvetica, sans-serif"><strong>';
		theTopFontPost= '</strong></font>';
		theBottomFontPre = '<font color="#FFFFFF" size="1" face="Arial, Helvetica, sans-serif">';
		theBottomFontPost= '</font>';
		theTerm = theHeading;
		theHeading = theTerm.term;
		if (theTerm.type == 'eco') theText = '<font color="#000000">(EcoProperty Term)<br></font>' +theTerm.description;
		else theText = theTerm.description;
		}
		else if (theType == 'message') {
		theTopBckGndColor = '#603501';
		theBottomBckGndColor = '#A15800';
		theTopFontPre = '<font color="#FFFFFF" size="1" face="Arial, Helvetica, sans-serif"><strong>';
		theTopFontPost= '</strong></font>';
		theBottomFontPre = '<font color="#FFFFFF" size="1" face="Arial, Helvetica, sans-serif">';
		theBottomFontPost= '</font>';
		}
		else if (theType == 'alert') {
		theTopBckGndColor = '#390000';
		theBottomBckGndColor = '#880101';
		theTopFontPre = '<font color="#FFFFFF" size="1" face="Arial, Helvetica, sans-serif"><strong>';
		theTopFontPost= '</strong></font>';
		theBottomFontPre = '<font color="#FFFFFF" size="1" face="Arial, Helvetica, sans-serif">';
		theBottomFontPost= '</font>';
		}
		else if (theType == 'hint') {
		theTopBckGndColor = '#003333';
		theTopFontPre = '<font color="#FFFFFF" size="1" face="Arial, Helvetica, sans-serif"><strong>';
		theTopFontPost= '</strong></font>';
		}
		if ( (theType == 'term') || (theType == 'message') || (theType == 'alert') ) {
		// Square Shape With Heading and Text:
		//  ____________________________________________________________________________
    var content =		
		'<table width="'+popupWindowWidth+'" border="0" cellspacing="0" cellpadding="2">'+
    '  <tr>'+
    '    <td align="center" valign="middle" bgcolor="'+theTopBckGndColor+'">'+theTopFontPre+theHeading+theTopFontPost+'</td>'+
    '  </tr>'+
    '  <tr>'+
    '    <td align="center" valign="middle" bgcolor="'+theBottomBckGndColor+'">'+theBottomFontPre+theText+theBottomFontPost+'</td>'+
    '  </tr>'+
    '</table>';
		}
		else if (theType = 'hint') {
		// Square Shape With Heading NO Text:
		//  ____________________________________________________________________________
		var content =
		'<table width="'+popupWindowWidth+'" border="0" cellspacing="0" cellpadding="2">'+
    '  <tr>'+
    '    <td align="center" valign="middle" bgcolor="'+theTopBckGndColor+'">'+theTopFontPre+theHeading+theTopFontPost+'</td>'+
    '  </tr>'+
    '</table>';
		}
	//____________________________________________________________
    if(ns4)
    {
      popupSTYLE.document.write(content);
      popupSTYLE.document.close();
      popupSTYLE.visibility = "visible";
    }
    if(ns6)
    {
      document.getElementById("popupLAYER").innerHTML = content;
      popupSTYLE.display='block'
    }
    if(ie4)
    {
      document.all("popupLAYER").innerHTML=content;
      popupSTYLE.display='block'
    }
  }
}

function PopUpMoveToMouseLoc(e)
{
  if(ns4||ns6)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else
  {
    x = event.x + document.body.scrollLeft;
    y = event.y + document.body.scrollTop;
  }
  popupSTYLE.left = x + popupOffSetX + popupPositionX + 'px';
  popupSTYLE.top = y + popupOffSetY +'px';
  return true;
}

// *************************************************************************************

// -------------------------------------------------------------------
// -------------------------------------------------------------------
// Macromedia Functions

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}