function toggleLongDesc() {
	var b = document.getElementById('smallbanner_longdesc');
	if(b.style.display != "none") {
		document.getElementById('smallbanner_longdesc').style.display = "none";
	} else {
		document.getElementById('smallbanner_longdesc').style.display = "block";
	}
}
if(document.getElementById("js_highlight") != null) {//if pulling a random highlight banner..
	var h = document.getElementById("highlight");
	var hpics = document.getElementById("js_highlight").getElementsByTagName("p");
	var m = Math.floor(Math.random()*hpics.length);
	if(hpics[m].innerHTML != "") {
		document.getElementById("highlight_caption").innerHTML = '<a href="'+hpics[m].getAttribute("url")+'">'+hpics[m].innerHTML+'</a>';
	} else {
		document.getElementById("highlight_caption").style.display = "none";
	}
	if(hpics[m].getAttribute("url") == "") { //if no external link for highlight photo
		h.innerHTML = '<img src="'+hpics[m].getAttribute("path")+'">';
	} else { //there is an external link
		h.innerHTML = '<a href="'+hpics[m].getAttribute("url")+'"><img src="'+hpics[m].getAttribute("path")+'"></a>';
	}
}

if(document.getElementById("js_smallbanners") != null) {// if pulling a random small banner..
	var b = document.getElementById('js_smallbanners').getElementsByTagName('p');
	var r = Math.floor(Math.random()*b.length);
	document.getElementById("banner").innerHTML = '<img src="'+b[r].getAttribute("path")+'">';

	var a = document.getElementById('smallbanner_caption');
	var c = document.getElementById('js_smallbanners').getElementsByTagName('i');
	if(c[r].getAttribute("photourl")!="" && c[r].innerHTML=="") { // if external link and no long description
		var d = ' <a href="'+c[r].getAttribute("photourl")+'"> ... more</a>';
	} else if(c[r].innerHTML!="") { // if long description
		var d = ' <a style="cursor:pointer;" onClick="toggleLongDesc()"> ... more</a>';
	} else {
		var d = '';
	}
	if(b[r].innerHTML == "") {
		a.style.display = "none";
	} else {
		a.innerHTML = b[r].innerHTML+d;
		var g = document.getElementById('smallbanner_longdesc');
		if(c[r].getAttribute("photourl")!="") {
			g.innerHTML = c[r].innerHTML+'<a style="float:right; color:#a37b2c;" href="'+c[r].getAttribute("photourl")+'">'+c[r].getAttribute("linktext")+'</a>';
		} else {
			g.innerHTML = c[r].innerHTML;
		}
		g.style.display = "none";
		a.style.display = "block";
	}
}
