/****
 * IFrame 'watch' script
 * watches an iFrame and looks for hash
 ****/
 
function watch_iframe(id, src) {
	// console.log(id);
	// console.log($(id));
	hash = get_hash();
	if(hash.length > 0 && hash.indexOf("http") == -1) {
		// console.log("loaded: ", hash);
		frames[id].location.href = hash;
	} else
		frames[id].location.href = src;
}

function get_hash() {
	if((hashLoc = window.location.href.indexOf("#")) == -1) return "";
	return window.location.href.substr(hashLoc + 1);
}

function delay_watch_iframe(id, src) {
	Event.observe(window, 'load', function(e) {
		watch_iframe(id, src);
	});
}
