$(document).ready(function() {
	var imageSet = false;
	
	if (imageSet == false) {
		var thumbArray = ($('.rssThumbs a'));
		if (thumbArray[0]) {
 			// alert(thumbArray[0]);
			showPic(thumbArray[0]);
		}
	}
	

});

function updateContentHeight() {
	var placeholderHeight = $('img#placeholder').height();
	var placeholderWidth = $('img#placeholder').width();
	if (placeholderHeight > $('#content').height()) {
		document.getElementById('content').style.height = (placeholderHeight + 60) + 'px';
	}
	if (placeholderWidth != $('#jpopaltcaption').width()) {
		document.getElementById('jpopaltcaption').style.width = (placeholderWidth) + 'px';
	}

}



// Javascript Image Gallery by Jeremy Keith
// http://adactio.com/articles/display.php/javascript_image_gallery
function showPic(whichpic) {
	if (document.getElementById) {
		document.getElementById('placeholder').src = whichpic.href;
		setTimeout('updateContentHeight()', 200);
		if (whichpic.title) {
				var rssText = whichpic.title;
				
				txtt = rssText.substring(rssText.indexOf('|') + 1, rssText.length);
				altt = rssText.substring(0,rssText.indexOf('|'));
				if (document.getElementById('jpopcap')) document.getElementById('jpopcap').childNodes[0].nodeValue = txtt;
				if (document.getElementById('jpopalt')) document.getElementById('jpopalt').childNodes[0].nodeValue = altt;
		} else {
				if (document.getElementById('jpopcap')) document.getElementById('jpopcap').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
				if (document.getElementById('jpopalt')) document.getElementById('jpopalt').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
		}
		return false;
	} else {
		return true;
	}
}
