var got = 0;



// cbGetElementByID: Cross-browser version of "document.getElementById()"
function cbGetElementById(element)
{
	if (document.getElementById) element = document.getElementById(element);
	else if (document.all) element = document.all[element];
	else element = null;
	return element;
}

// cbLeft: Cross-browser version of "element.style.left"
function cbLeft(elmnt, pos, value)
{
	
	//alert(elmnt + ":" + pos + ":" + value);
	if (!(elmnt = cbGetElementById(elmnt))) return 0;
	if (elmnt.style && (typeof(elmnt.style.left) == 'string')) {
		if (typeof(pos) == 'number'){
			//elmnt.style.position = 'relative';
			elmnt.style.left = pos + 'px';
			elmnt.firstChild.nodeValue = slide_array[identify][2] + value + slide_array[identify][3];
			slide_array[identify][4] = value;
			//elmnt.style.position = 'inherit';
		}else {
			pos = parseInt(elmnt.style.left);
			if (isNaN(pos)) pos = 0;
		}
	}
	else if (elmnt.style && elmnt.style.pixelLeft) {
		if (typeof(pos) == 'number') elmnt.style.pixelLeft = pos;
		else pos = elmnt.style.pixelLeft;
	}
	return pos;
}

// cbTop: Cross-browser version of "element.style.top"
function cbTop(elmnt, pos)
{
	if (!(elmnt = cbGetElementById(elmnt))) return 0;
	if (elmnt.style && (typeof(elmnt.style.top) == 'string')) {
		if (typeof(pos) == 'number') elmnt.style.top = pos + 'px';
		else {
			pos = parseInt(elmnt.style.top);
			if (isNaN(pos)) pos = 0;
		}
	}
	else if (elmnt.style && elmnt.style.pixelTop) {
		if (typeof(pos) == 'number') elmnt.style.pixelTop = pos;
		else pos = elmnt.style.pixelTop;
	}
	return pos;
}

function noNumbers(e)
{
	var keynum;
	var keychar;
	var numcheck;
	
	if(window.event) // IE
	{
		keynum = e.keyCode;
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
		keynum = e.which;
	}
	keychar = String.fromCharCode(keynum);
	numcheck = /\d/;
	return numcheck.test(keychar);
}

function change()
{
	cbGetElementById('splash').style.display = "none";
	cbGetElementById('accordion').style.display = "block";
	abstractAcc(1);
	abstractAcc(0);
}

function change_two(div1, div2)
{
	cbGetElementById(div1).style.display = "none";
	cbGetElementById(div2).style.display = "block";
}

function go_back(div1, div2)
{
	cbGetElementById(div1).style.display = "none";
	cbGetElementById(div2).style.display = "block";
}

function show_ans(id)
{
	cbGetElementById(id).style.display = "block";
}

function show_ans_r(id, right)
{
	got++;
	cbGetElementById(right).src = "images/rq_ans_y.gif";
	cbGetElementById(id).style.display = "block";
}

function show_ans_w(id, right, wrong)
{
	cbGetElementById(right).src = "images/rq_ans_y.gif";
	cbGetElementById(wrong).src = "images/rq_ans_n.gif";
	cbGetElementById(id).style.display = "block";
}

function update_res()
{
	cbGetElementById('result').firstChild.nodeValue = "You got " + got + " out of 5 questions correct";
}