<!--
// set image path
var imgPath = "/gardening/htbg2/flat/images/";

// set modID
var modID ="";

// Preload
function preLoadImages(imageUrls) {
	if (document.images) {
	var pic = new Array(imageUrls.length);
	for (i=0;i<imageUrls.length;i++) {	
		pic[i] = new Image();
		pic[i].src = imgPath + imageUrls[i];
		}
	}
}
// End Preload

// Image swap for homepage navigation
function topnav_on(img) {
if (document.images) {
	document.images[img].src = imgPath + img + "_on.gif";
	document.images['moduletext'].src = imgPath + img + "text_on.gif";
	}
}
function topnav_off(img) {
if (document.images) {
	document.images[img].src = imgPath + img + ".gif";
	document.images['moduletext'].src = imgPath + "moduletext.gif";
	}
}

// Image swap for content navigation
function smallnav_on(img) {
if (document.images) {
	document.images[img].src = imgPath + img + "_on.gif";
	document.images['nav_text'].src = imgPath + "nav_text-" + img + "_on.gif";
	}
}
function smallnav_off(img) {
if (document.images) {
	document.images[img].src = imgPath + img + ".gif";
	document.images['nav_text'].src = imgPath + "nav_text" + modID + ".gif";
	}
}

// Site wide Image swap functions
function BBC_on(img) {
if (document.images) {
	document.images[img].src = imgPath + img + "_on.gif";
	}
}
function BBC_off(img) {
if (document.images) {
	document.images[img].src = imgPath + img + ".gif";
	}
}

//customizable pop-up
function popwin(URL,tgt,w,h) {
	var x = 10, y = 10; // default position
	if (window.screen) {
		var aw = window.screen.availWidth;
		var ah = window.screen.availHeight;
		x = (aw - w) / 2;
		y = (ah - h) / 2;
	}
	pop_window = window.open(URL,tgt,'width=' + w + ',height=' + h + ',left=' + x + ',screenX=' + x + ',top=' + y + ',screenY=' + y + ',fullscreen=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
	self.name = "main";
	if (window.focus) {
		setTimeout('if (!pop_window.closed) {pop_window.focus();}',1000);
	}
}

//plant list pop-up
function plPopwin(URL,tgt) {
	var x = 10, y = 10; // default position
	var w = 546, h = 424; // window size
	if (navigator.appName == "Netscape") {
		h = h + 18;
	}
	if (window.screen) {
		var aw = window.screen.availWidth;
		var ah = window.screen.availHeight - 80;
		x = (aw - w) / 2;
		y = (ah - h) / 2;
	}
	PLpop_window = window.open(URL,tgt,'width=' + w + ',height=' + h + ',left=' + x + ',screenX=' + x + ',top=' + y + ',screenY=' + y + ',fullscreen=no,toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no');
	if (window.focus) {
		setTimeout('if (!PLpop_window.closed) {PLpop_window.focus();}',1000);
	}
}

//print pop-up
function printPopwin(URL,tgt) {
	var x = 10, y = 10; // default position
	var w = 660, h = 550; // window size
	if (window.screen) {
		var aw = window.screen.availWidth;
		var ah = window.screen.availHeight - 80;
		if (aw < w) { w = aw - 50 }
		if (ah < h) { h = ah - 50 }
		x = (aw - w) / 2;
		y = (ah - h) / 2;
	}
	printPop_window = window.open(URL,tgt,'width=' + w + ',height=' + h + ',left=' + x + ',screenX=' + x + ',top=' + y + ',screenY=' + y + ',fullscreen=no,toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no');
	if (window.focus) {
		setTimeout('if (!printPop_window.closed) {printPop_window.focus();}',1000);
	}
}

//check DOM
var isDHTML = 0;
var isID = 0;
var isAll = 0;
var isLayers = 0;

if (document.getElementById) {isID = 1; isDHTML = 1;}
else {
if (document.all) {isAll = 1; isDHTML = 1;}
else {
browserVersion = parseInt(navigator.appVersion);
if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {isLayers = 1; isDHTML = 1;}
}}
 
function domSel(objectID,withStyle) {
	if (withStyle == 1) {
		if (isID) { return (document.getElementById(objectID).style) ; }
		else { 
			if (isAll) { return (document.all[objectID].style); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
	else {
		if (isID) { return (document.getElementById(objectID)) ; }
		else { 
			if (isAll) { return (document.all[objectID]); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
}

//functions for navigation
function navOver(highlight) {
domSel(highlight,1).backgroundColor = "#003366";
}

function navOut(highlight) {
domSel(highlight,1).backgroundColor = "#889cdd";
}

function subnavOver(highlight) {
domSel(highlight,1).backgroundColor = "#eaeeff";
}

function subnavOut(highlight) {
domSel(highlight,1).backgroundColor = "#a1b3e6";
}

//save page (bookmark)
function addPage(fname) {
	if (username && username != "none") {
		add('gardening_lj','main','pages',fname);
		alert('Page saved to \'My garden\'');
	}
	else {
		alert('You need to register and be logged-in before you can save items to \'My garden\'');
	}
}

//save suggested plantlist
function addSuggested(fname) {
	if (username && username != "none") {
		add('gardening_lj','main','suggested',fname);
		alert('Suggested plant list saved to \'My garden\'');
	}
	else {
		alert('You need to register and be logged-in before you can save items to \'My garden\'');
	}
}

//save plantlist
function addPl(fname) {
	if (username && username != "none") {
		add('gardening_lj','main','pl',fname);
		alert('Plantlist saved to \'My garden\'');
	}
	else {
		alert('You need to register and be logged-in before you can save items to \'My garden\'');
	}
}

//save plantlists from a form
function addPlFromForm(fname,type,dtext) {
	var ch = 0;
	if (username && username != "none") {
		for (i=0; i<fname.plSel.length; i++) {
			if (fname.plSel[i].selected || fname.plSel[i].checked) {
				add('gardening_lj','main',type,fname.plSel[i].value);
				ch++;
			}
		}
		if (ch != 0) {
			if (ch == 1) {
				if (dtext) {
					alert(dtext + ' saved to \'My garden\'');
				}
				else {
					alert('Plantlist saved to \'My garden\'');
				}
			}
			else {
				if (dtext) {
					alert(dtext + ' saved to \'My garden\'');
				}
				else {
					alert('Plantlists saved to \'My garden\'');
				}
			}
		}
		else {
			alert('You need to selected at least one option');
		}
	}
	else {
		alert('You need to register and be logged-in before you can save items to \'My garden\'');
	}
}

//-->