// JavaScript Document

function prepareRevenez(){
	if(!document.getElementById) return false;
	if(!document.getElementsByTagName) return false;
	
	var elem = document.getElementById("rev_btns");
	if(elem){
		// loop through all webRevenez buttons
		var buttons = elem.getElementsByTagName("a");
		for (var i=0; i<buttons.length; i++){
			// when button is clicked
			buttons[i].onclick = function(){
				// send which button to insert function
				insertRevenez(this);
				return false;
			}
		}
	}
}

function insertRevenez(mylink){
	if(!document.getElementById) return false;
	if(!document.getElementById("webrevenez")) return false;
	
	// "hijack" the href attribute of the selected button
	var module = mylink.getAttribute("href");
	
	// get the webrevenez element (where the iframe will be inserted
	var elem = document.getElementById("webrevenez");
	
	// code for <iframe>
	var flashdata = "<iframe src=\"" + module + "\" scrolling=\"no\" frameborder=\"0\" width=\"690\" height=\"440\"></iframe>";	
	
	// insert iframe element into DOM
	elem.innerHTML = flashdata;
	
	// jump to webrevenez area of page
	location.hash = "wr";
	return false;
}

// on load event, get the button behaviors ready
addLoadEvent(prepareRevenez);