//javascript for shelley miller

//generates e-mail link, hides address from spammers
function mailto(linktext){
 if (!linktext) linktext = 'miller_shelley@hotmail.com';
 document.write('<a href="mailto:miller_shelley@hotmail.com">' + linktext + '</a>');
}

//find object position
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

//writes caption
function writecaption(titletext,datetext,obj) {
 var coors = findPos(obj);
 document.getElementById('caption-title').innerHTML = titletext;
 document.getElementById('caption-date').innerHTML = datetext;
 document.getElementById('caption').style.top = (coors[1] - 108) + 'px';
 document.getElementById('caption').style.display = 'block';
}

//clears caption
function clearcaption() {
 document.getElementById('caption-title').innerHTML = '&nbsp;';
 document.getElementById('caption-date').innerHTML = '&nbsp;';
 document.getElementById('caption').style.display = 'none';
}

function placebookmark(thisid) {
 document.getElementById('bookmark').style.display = 'block';
 document.getElementById('bookmark').style.top = '33px';
 document.getElementById('bookmark').style.right = 7 + ((numberofitems - thisid) * 42) + 'px'; /* 42px */
}

//displays panel and hides other panels
function display(thisid) {
 for (var i=1; i<(numberofitems+1); i++) {
  document.getElementById('panel'+i).style.display = 'none';
 }
 document.getElementById('panel'+thisid).style.display = 'block';
 document.getElementById('bar-caption').innerHTML = document.getElementById('panel-caption'+thisid).innerHTML;
 previd = (parseInt(thisid) - 1); if (previd < 1) previd = 1;
 nextid = (parseInt(thisid) + 1); if (nextid > numberofitems) nextid = numberofitems;
 placebookmark(thisid);
}

function hideloading() {
 document.getElementById('loading').style.display = 'none';
}

//embeds movie object (this fixes having to click to start the movie in IE)
function insertmov() {
 document.write(movobject);
}

