
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function get_links(container_id)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
	// Create an object of the container of the links
	var container = document.getElementById(container_id);
	
	// Create an object of the list links
	var link_arr = container.getElementsByTagName('a');

	// Return the link array
	return link_arr;
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function set_clicked_links(clicked_links)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
	// Run through each and do the shit
	for (var i=0; i<clicked_links.length; i++) 
	{ 
		// Mark the viewed ones by keeping the star image in place
		// Gets image filename according to the class name specified in the link
		clicked_links[i].style.background = "url(images/"+clicked_links[i].className+"_red.gif) no-repeat";
	}
}

///////////////////////////////////////////////////////////////////////////////

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
window.onload = function() 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{
	// Make sure that the browser can handle the methods
	if (!document.getElementById || !document.getElementsByTagName) return;

	// Set up the sIFR
	if (typeof sIFR == "function")
	{
		sIFR();
		sIFR.replaceElement("h3", named({sFlashSrc: "squeakychalk.swf", sColor: "#F9EAAA", sWmode: "transparent"}));
		//sIFR.replaceElement(".head_text", named({sFlashSrc: "squeakychalk.swf", sColor: "#FFFFFF", sWmode: "transparent"}));
	};
	
	// Get the slide show image
	var imgObj = document.getElementById('slide_show_img');

	// Get the slide show links
	var link_arr = get_links('chalk_draw');

	// Set up a clicked link array
	var clicked_links = new Array();

	// Run through each link in array
	for (var i=0; i<link_arr.length; i++) 
	{ 
		// Give it a function
		link_arr[i].onclick = function() 
		{
			// Set the slide show image to the current link's href
			imgObj.src = this.getAttribute('href');

			// Add this link to the clicked links
			clicked_links.push(this);

			// Set each clicked link
			set_clicked_links(clicked_links);

			// Mark the viewed ones by keeping the star image in place
			// Gets image filename according to the class name specified in the link
			this.style.background = "url(images/"+this.className+"_yel.gif) no-repeat";

			// Get rid of the "selection" around the link when clicked.
			this.blur();

			// Return false so it doesn't follow link
			return false;
		}
	}
	
}