



//  Force getElementById

if(!document.getElementById) {
	if(document.all) {
		document.getElementById = function() {
			if(typeof document.all[arguments[0]] != "undefined") {
				return document.all[arguments[0]];
			} else { return null; }
		}
	} else if(document.layers) {
		document.getElementById = function() {
			if(typeof document[arguments[0]] != "undefined") {
				return document[arguments[0]];
			} else { return null; }
		}
	}
}




//  Alternative to "voided" links

function Hello() {
	// Empty function
}




//  Show and Hide objects

function objectShow(id) {
	document.getElementById(id).style.visibility = "visible";
}
function objectHide(id) {
	document.getElementById(id).style.visibility = "hidden";
}




//  Popup windows

function windowPop(url, id, width, height) {
	var x = ((screen.width / 2) - ((width) / 2));
	var y = ((screen.height / 2) - ((height) / 2));
	windowNew = window.open(url,id,"width="+ width +",height="+ height +",scrollbars=no,resizable=no,left="+ x +",top="+ y);
	windowNew.focus();
}




//  Base Conversions

function convertDec (dec) {
	this.dec   = dec;
	this.toBin = function() { return this.dec.toString(2); }
	this.toHex = function() { return this.dec.toString(16).toUpperCase(); }
	this.toOct = function() { return this.dec.toString(8); }
}
function convertBin (bin) {
	this.bin   = bin;
	this.toDec = function() { return parseInt(this.bin, 2); }
	this.toHex = function() { return this.toDec().toString(16).toUpperCase(); }
	this.toOct = function() { return this.toDec().toString(8); }
}
function convertHex (hex) {
	this.hex   = hex;
	this.toDec = function() { return parseInt(this.hex, 16); }
	this.toBin = function() { return this.toDec().toString(2); }
	this.toOct = function() { return this.toDec().toString(8); }
}
function convertOct (oct) {
	this.oct   = oct;
	this.toDec = function() { return parseInt(this.oct, 8); }
	this.toBin = function() { return this.toDec().toString(2); }
	this.toHex = function() { return this.toDec().toString(16).toUpperCase(); }
}













var tvInterval = 0;


function tvEngine() {

	var name = new Array("1a", "2a", "2b", "3a", "3b", "4a", "5a", "5b", "5b", "5c", "5d", "6a", "6b", "7a");
	var x 	 = Math.floor(Math.random() *  5);
	var y 	 = Math.floor(Math.random() *  5);
	var tile = Math.floor(Math.random() * 13);
	var id 	 = "x"+ x +"y"+ y;
	document.getElementById(id).src = "MEDIA/TILES/"+ name[tile] +".gif";
}


function tvControl(command) {

	//alert("tvControl: "+ command);
	if (tvInterval) clearInterval(tvInterval);
	if (command == "PlayForward" || command == "Play") { }
	if (command == "PlayBackward") { }
	if (command != "Stop" && command != "Pause") tvInterval = setInterval("tvEngine()", 100);
}

//tvControl("Play");







/*

function tvEngine() {

	var name = new Array("1a", "2a", "2b", "3a", "3b", "4a", "5a", "5b", "5b", "5c", "5d", "6a", "6b", "7a");
	for (y = 0; y < 5; y++) {

		for (x = 0; x < 5; x++) {

			tile = Math.floor(Math.random() * 13);
			id = "x"+ x +"y"+ y;
			document.getElementById(id).src = "MEDIA/TILES/"+ name[tile] +".gif";
		}
	}
}


*/
