window.onresize=setfontsize;
window.onload=setfontsize;

var codecha="";

function setfontsize()
	{
	 if (document.all)
	  {
	  fontindex=Math.round(top.document.body.clientWidth/85);
	  top.document.all['topbody'].style.fontSize = fontindex + "pt";
	  top.mainpanelcontent.document.all['contentbody'].style.fontSize = fontindex + "pt";
	  }
	else if (document.getElementById)
	  {
	  fontindex=Math.round(top.window.innerWidth/85);
	  top.document.getElementById('topbody').style.fontSize = fontindex + "pt";
	  top.mainpanelcontent.document.getElementById('contentbody').style.fontSize = fontindex + "pt";
	  }
	reflowstyle();
	}

function reflowstyle()
	{
	var docstyle=document.body.style;
	var savemode=docstyle.display;
	docstyle.display='none';
	docstyle.display=savemode;
	}
	
function clearSelected()
	{
	menuAnchors = document.getElementsByTagName('li');
	count = menuAnchors.length
	for(var i = 0;i < count;i++)
	  {
	  nodeObj = menuAnchors.item(i);
	  nodeObj.removeAttribute('id');
	  }
	document.getElementById('home').style.visibility='visible';
	}
	
function captcha() {
	var captcharray=[['0','2','4','6','8','U'],['A','E','i','m','q','V'],['b','f','j','n','R','W'],['C','g','k','o','S','x'],['D','H','L','P','t','y'],['1','3','5','7','9','Z']];
	var tally="";
	for (var i = 1;i < 4;i++) {
		var captchabox=document.getElementById('code'+i);
		var	x=Math.floor(Math.random() * 6)*30+"px";
		var	y=Math.floor(Math.random() * 6)*30+"px";
		captchabox.style.backgroundPosition="-"+x+" -"+y;
		tally+=captcharray[x.slice(0,x.length-2)/30][y.slice(0,y.length-2)/30];
	}
	return tally;
}

function testcha() {
	if (document.EmailForm.captcha.value == codecha)
		return true;
	else {
		alert("Failed to match code: try new code!");
		codecha=captcha();
		return false;
	}
}

