<!-- <![CDATA[

// background image pre-loader
function preLoadImages() {
	var imagecount = 6;
	var imagewidth = 1100;
	var imageheight = 900;
	var imageArray = new Array(imagecount+1);
	for(i = 1 ; i <= imagecount ; i++) {
		imageArray[i] = new Image(imagewidth, imageheight);
		imageArray[i].src = "/images/bkgimage" + i + ".jpg";
	}
}

// display an image
function displayGalleryImage(id, w, h, caption) {
	var imagePanelID = "imageViewer";
	var showClass = "imageShow";
	var halfW = (w/2);

	// compute the image text
	imgText = '<span class="emphasisBold">' + caption + '</span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="fontSmaller">[click image to close]</span><br/><a href="javascript:removeGalleryImage();"><img src="/images/gallery/gallery' + id + '.jpg" width="' + w + '" height="' + h + '" alt="Click to close"/></a>';

	// hide things we don't want to see
	try {
		document.getElementById("dropdown1").className = "visHide";
	}
	catch(e) {
	}

	// write the new image
	document.getElementById(imagePanelID).style.marginLeft = "-" + halfW + "px";
	document.getElementById(imagePanelID).innerHTML = imgText;
	document.getElementById(imagePanelID).className = showClass;

}

// hide an image
function removeGalleryImage() {
	var imagePanelID = "imageViewer";
	var hideClass = "imageHide";

	// show things we had hidden
	// hide things we don't want to see
	try {
		document.getElementById("dropdown1").className = "paypal";
	}
	catch(e) {
	}

	document.getElementById(imagePanelID).innerHTML = "";
	document.getElementById(imagePanelID).className = hideClass;

}

// show the share menu
function openShare(page, headline) {
	var imagePanelID = "shareViewer";
	var showClass = "visShow";
	var URLlink = "http://www.peopleofkibera.com" + page;
	var slash = '/';
	// prep the URL
	URLlink = URLlink.replace(":", "%3A");
	URLlink = URLlink.replace(/\//g, "%2F");
	Headline = headline.replace(/ /g, "%20");


	// array of the share links	(name, icon width, icon height, URL start, URL finish)
	var share = new Array();
	share[1] = new Array("Facebook", 14, 14, "http://www.facebook.com/sharer.php?u=", "");
	share[2] = new Array("Twitter", 13, 14, "http://twitter.com/home?status=Check%20out%20", ""); 
	share[3] = new Array("Digg", 16, 16, "http://digg.com/submit?phase=2&url=", "");
	share[4] = new Array("MySpace", 17, 14, "http://www.myspace.com/Modules/PostTo/Pages/?l=3&u=", "");	
	share[5] = new Array("Stumble", 15, 16, "http://www.stumbleupon.com/submit?url=", ""); 
	share[6] = new Array("del.icio.us", 16, 16, "http://delicious.com/save?url=", "");
	share[7] = new Array("LinkedIn", 16, 16, "http://www.linkedin.com/shareArticle?mini=true&url=", "");
	share[8] = new Array("Reddit", 14, 17, "http://reddit.com/submit?url=", "");
	share[9] = new Array("Google", 16, 16, "http://www.google.com/bookmarks/mark?op=edit&bkmk=", "");
	share[10] = new Array("Yahoo!", 22, 15, "http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&u=", "");
	share[11] = new Array("Buzz", 16, 16, "http://buzz.yahoo.com/buzz?targetUrl=", "&headline=" + Headline);

	// build the table of links
	var shareHTML = '<div class="shareLinks"><table style="width:99%; border-bottom: 1px #800000 dashed;" cellspacing="0"><tr><td style="padding-bottom:0px;"><h2>Share this page</h2></td><td style="padding-bottom:0px; text-align:right; width:17px;"><a href="#" onclick="javascript:hideShare();"><img src="/images/share/shareClose.gif" width="16" height="14" alt="Close this menu" style="margin-bottom:3px;"/></a></td></tr></table><table style="width:99%; margin-top: 3px;" cellspacing="0"><tr>';
	var colcount = 1;
	for(i = 1 ; i < share.length ; i++) {

		if(colcount > 3) {
			colcount = 1;
			shareHTML = shareHTML + "</tr><tr>";
		}
		shareHTML = shareHTML + '<td><a href="' + share[i][3] + URLlink + share[i][4] + '" target="_blank"><img src="/images/share/share' + i + '.gif" width="' + share[i][1] + '" height="' + share[i][2] + '" alt="Share on ' + share[i][0] + '"/> ' + share[i][0] + '</a></td>';
		colcount++;
	}
	shareHTML = shareHTML + '<td style="text-align:right;padding-top:5px;"><a href="#" onclick="javascript:hideShare();">x Close</a></td></tr></table></div>';

	document.getElementById(imagePanelID).innerHTML = shareHTML;
	document.getElementById(imagePanelID).className = showClass;

}


// hide the share menu
function hideShare() {
	var imagePanelID = "shareViewer";
	var hideClass = "shareHide";

	document.getElementById(imagePanelID).innerHTML = "";
	document.getElementById(imagePanelID).className = hideClass;

}



// code that handles opening links in a second window (<a href="..." rel="external">)
function externalLinks() { 
	if (!document.getElementsByTagName) return; 
	var anchors = document.getElementsByTagName("a"); 
	for (var i=0; i<anchors.length; i++) { 
	var anchor = anchors[i]; 
	if (anchor.getAttribute("href") && 
		anchor.getAttribute("rel") == "external") 
		anchor.target = "_blank"; 
	} 
} 
window.onload = externalLinks;

// ]]> -->
