bannerw=400;
bannerh=50;
banmidt=2;
logow=100;

els=new Array('mhome','mabout','mlist','mherbs','mbasics','mpricing','mbuy', 'mcontact');
shipx=new Array(3,3,3,3,3,3,3,3);
shipy=new Array(72,92,112,132,152,172,192,212);

lnabase=125;
lna=lnabase;		// left nav anchor

lnitems=8;
lnheight=25;
lnwidth=150;
lnleft=25;
ln_velocity=300;

tplace=0;	// slider thumb place

var e_list;

function cbeOff(x) {
	var e1;
	e1=document.getElementById(x).cbe;
	e1.hide(); e1.moveTo(0,0); return;
}

function loadDet() {
	window.location.replace(det);
}

// ONLOAD
function windowOnload() {

var e1,e2; //general element holder

// set up the left menu
if (p!=99) {
	cbeSetImage(els[p]+'1', els[p]+'1a');					//set left nav current location (red txt)
}
for (i=0; i<lnitems; i++) {								//position, show, and add event listeners
	e1=document.getElementById(els[i]).cbe; 
	e1.resizeTo(150,lnheight);
	e1.moveTo(lnleft,(lnheight*i)+lna); e1.show();
	e1.addEventListener('mouseOver', mouseOverListener, false); 
	e1.addEventListener('mouseOut', mouseOutListener, false); 
	e1.addEventListener('click', clickListener, false); 
}

window.cbe.addEventListener('scroll', scrollListener, false);
Resize();
return;
}

function DrawBanner() {
document.write("<table border=0 bgcolor='ffffff' width='100%'><tr><td width='200' align='center'><img title='logo' alt='The Vagary - Perrenials, Natives and Herbs' src='logo.gif'></td><td align='center'><img title='banner' alt='The Vagary - Perrenials, Natives and Herbs' src='banner.gif'></td><td align='right' width='70'><img src='bright.gif' alt='The Vagary - Perrenials, Natives and Herbs' ></td><td width='2%'></td></tr></table>");
return;
}

function writeEmail() {
document.write("<a alt='eMail us' title='Send us email' href=mail");
document.write("to");
document.write(":nancy@");
document.write("thevagary.com?subject=Web-Inquiry>nancy");
document.write("@thevagary.com</a>");
}

function writePhone() { document.write(""); }

function DrawPageHeader() {
document.write("<center><span class='pghead'>Amherst Web Design <font color='#000000'>&bull;</font> PO Box 232 <font color='#000000'>&bull;</font> Amherst, VA 24521 <font color='#000000'>&bull;</font> ");
writePhone();document.write (" <font color='#000000'>&bull;</font> ");
writeEmail();document.write("</span></center><br>");
}


function DrawFooter() {
document.write("<tr><td colspan=4><center><h2><font face='verdana' size='2'>thevagary.com copyright &copy; 2000-2010 </font>the Vagary.</h2></center></td></tr>");
//<!-- AWD LOGO -->
document.write("<tr><td colspan=4 bgcolor='#ffffff'><center><a href='http://www.amherstwebdesign.com' target='_blank'><img src='awd_link.gif'></a></center></tr></td></table>");
}

function mouseOverListener(e) {
var e1;

//alert(e.cbeCurrentTarget.id+'img'+" :"+ e.cbeCurrentTarget.id);
geto=false;
for (i=0; i<lnitems; i++) {
	if (els[i]==e.cbeCurrentTarget.id)	page=i;
	if (els[p]==e.cbeCurrentTarget.id) geto=true;
}
if (geto) return;
cbeSetImage(e.cbeCurrentTarget.id+"1", e.cbeCurrentTarget.id+'1h');	
}

function mouseOutListener(e) {
//alert(e.cbeCurrentTarget.id+'img'+" :"+ e.cbeCurrentTarget.id);
cbeSetImage(e.cbeCurrentTarget.id+'1', e.cbeCurrentTarget.id+'1x');
if (p!=99) cbeSetImage(els[p]+'1', els[p]+'1a');			//set left nav current location 
}

function clickListener(e) {
//alert(e.cbeCurrentTarget.id+'img'+" :"+ e.cbeCurrentTarget.id);
if (e.cbeCurrentTarget.id==els[p]) window.scroll(0);	// LN click on current page, scroll to top
if (e.cbeCurrentTarget.id=='mhome') location='index.html';
if (e.cbeCurrentTarget.id=='mlist') location='list.php?a=common';
if (e.cbeCurrentTarget.id=='mabout') location='about.html';
if (e.cbeCurrentTarget.id=='mbasics') location='basics.html';
if (e.cbeCurrentTarget.id=='mpricing') location='pricing.html';
if (e.cbeCurrentTarget.id=='mbuy') location='buy.html';
if (e.cbeCurrentTarget.id=='mcontact') location='contact.html';
if (e.cbeCurrentTarget.id=='mherbs') location='herbs.html';
}

function scrollListener(e) {
if (document.cbe.height() < (lnheight*(lnitems+1))+bannerh) {
//	lna=5;
	SlideLN();
	return; //don't scroll if not enough vertical space
}
lna=document.cbe.scrollTop()+10;
if ((lna<lnabase)&&(document.cbe.height() >= lnheight*(lnitems+1))) lna=lnabase;
SlideLN();
}

function Resize() {
var e;
scrollListener(this);
}

function SlideLN() {
for (i=0; i<lnitems; i++) {								//position
	e1=document.getElementById(els[i]).cbe; 
	e1.slideTo(lnleft,(lnheight*i)+lna,ln_velocity);
}
//e1=document.getElementById('ship').cbe; 
//e1.slideTo(shipx[p], shipy[p]+lna-75,ln_velocity); 
}

function DrawLN() {
for (i=0; i<lnitems; i++) {
	document.write("<div id='"+els[i]+"' class='clsCBEch'><img name='"+els[i]+"1' src='"+els[i]+"1.gif' ></div>");
	cbeNewImage(els[i]+'1h', els[i]+'1h.gif');
	cbeNewImage(els[i]+'1x', els[i]+'1.gif');
	if (i==p) cbeNewImage(els[i]+'1a', els[i]+'1a.gif');
}
//cbeNewImage('shipp', 'shipp.gif');
//cbeNewImage('ship', 'ship.gif');
}

