function frame_change(pound){
/*
	Developed by John Foushee 2/20/07
	For: Documentation of the American South: Southern Oral Histories Project
	for internet explorer compatibility, to change the the iframe's source
	the # can't be url encoded (: -> %3A) FireFox will do both : or %3A when
	we give it a # to go to so we'll just not encode the pound we get

*/
//	var pUrl;
//	pUrl = URLEncode(pound);
//	pUrl = pound;
	//get the iframe object we're going to change
	var ifrm = document.getElementById("transcript_frame");
	if(!ifrm){ //couldn't find the iframe object, output any errors?
		return;
	}

	//from here on out, we have the iframe so we just have to get the
	//current source and manipulate that. Let's get it now:

	var src = ifrm.src || ifrm.getAttribute("src");
	if(!src){ //i don't know why we wouldn't be able to find the source
			  //but just in case, we'll abort
		return;
	}
	//now we'll split everything in src before a # sign
	var domain = new Array();
	domain = src.split('#');
	//what we want to use is in domain[0]
	var url = domain[0]+"#"+pound;

	//we're ready to change the iframe's source
	ifrm.src = url;
	ifrm.setAttribute("src",url);
	var pbdiv = document.getElementById("playback_div"); //playback div
	if(pbdiv && pbdiv.scrollIntoView) //scroll the player into view
		pbdiv.scrollIntoView();

}

function URLEncode(plaintext)
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    alert( "Unicode Character '" 
                        + ch 
                        + "' cannot be encoded using standard URL encoding.\n" +
				          "(URL encoding only supports 8-bit characters.)\n" +
						  "A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

	return encoded;
};
