// Javascript functions for helping with special scripting
// These scripts can be combined with other custom javascripting to
// produce special effects when items or elements are completed or items are selected

// Wrapper for the Axel SetWebParam function
function SetWebParam(param, value) {
	window.top.document.embeds['axel'].SetWebParam(param, value);
}

// Wrapper for the Axel GetWebParam function
function GetWebParam(param) {
	return window.top.document.embeds['axel'].GetWebParam(param);
}

// Move the camera if it is movable
function MoveCamera(pos, orientation) {
	s_pos = window.top.camera+"_Position";
	s_or = window.top.camera+"_Orientation";
	SetWebParam(s_pos, pos);
	SetWebParam(s_or, orientation);
}

// Switch Cameras
// Wrapper for javascript on element page
function SetCamera(name) {
	window.top.setcamera(name);
}

// Create Text button
function createTextButton(text, onclick) {
	var btn = document.createElement("button");
	//btn.type = "button";
	btn.name = text;
	//alert(btn.type);
	//btn.onclick = unescape(onclick);
	btn.onclick = onclick;
	btn.appendChild(document.createTextNode(text));
	return btn;
}
// Create Image button
function createImageButton(src, onclick) {
	var btn = document.createElement("button");
	//btn.type = "button";
	btn.onclick = onclick;
	var img = document.createElement("img");
	img.src = src;
	btn.appendChild(img);
	return btn;
}
// The install axel object
function draw_object() {
	var installdiv = document.getElementById('installdiv');
	var html = '<object id="install" classid="CLSID:68A2C3BD-7809-11D3-8ACF-0050046F2F9A" codebase="http://www.mindavenue.com/downloads/AXELPlayerAX_Win32.cab#version=1,5,109,0" width="200" height="100">';
	html += '<param name="Src" value="mod/axel/install.axs">';
	html += '<param name="Windowless" value="0">';
	html += '<embed src="mod/axel/install.axs" name="install" pluginspage="http://www.mindavenue.com/Downloads/AXELPlayerNPInstall.htm" type="application/x-MindAvenueAXELStream" width=200 height=100 Windowless=false>';
	html += '</embed></object>';
	installdiv.innerHTML = html;
}