var a=new Array();
a[0]=new Image(); a[0].src='/i/menu/active/home.png';
a[1]=new Image(); a[1].src='/i/menu/active/forum.png';
a[2]=new Image(); a[2].src='/i/menu/active/articles.png';
a[3]=new Image(); a[3].src='/i/menu/active/tutorial.png';
a[4]=new Image(); a[4].src='/i/menu/active/books.png';
a[5]=new Image(); a[5].src='/i/menu/active/diction.png';
a[6]=new Image(); a[6].src='/i/menu/active/direct.png';
a[7]=new Image(); a[7].src='/i/menu/active/share.png';

var opera=gecko=ie=false;
var browser=navigator.userAgent.toLowerCase();
var version = parseFloat(navigator.appVersion);
if(browser.match('opera'))opera=true;
if(browser.match('gecko'))gecko=true;
if(browser.match('msie'))
{
  if(!opera)ie=true;
  if(browser.match('msie 6'))version=6;
  else if(browser.match('msie 7'))version=7;
}



function png(element)
{if(ie){
var src,method='scale';
var classname=element.className;
//if(element.tagName=='H1')classname='crop';
if(classname.match('png'))
{
  src=element.getAttribute('src');
  element.setAttribute('src','/i/1.gif');
}
else if(classname.match('scale')||classname.match('crop'))
{
	src=element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i)[1];
  element.style.backgroundImage='none';
  if(classname.match('crop'))method='crop';
}
element.style.filter="progid:dximagetransform.microsoft.alphaimageloader(src='"+src+"',sizingmethod="+method+")";
}}


function win_pop(url, id, width, height)
{
	var id = (id != null) ? id : '_rwin';
	var width = (width == null) ? 600 : width;
	var height = (height == null) ? 500 : height;

	if (url != null)
	{
		window.open(url, id, 'status=yes,toolbar=no,menubar=yes,location=no,scrollbars=yes,status=no,resizable=yes,width=' + width + ',height=' + height);
	}
}

function switch_menu(switchid)
{
	var curr_id = document.getElementById(switchid);
	curr_id.style.display = 'block';

	switch (switchid)
	{
		case 'custom':
			document.getElementById('sitewide').style.display = 'none';
		break;

		case 'sitewide':
			document.getElementById('custom').style.display = 'none';
		break;
	}
}

/**
 * Toggle the visibility of the qr box
 */
function toggle(id)
{
	if (document.getElementById(id))
	{
		if (document.getElementById(id).style.display == 'none')
		{
			document.getElementById(id).style.display = 'block';
		}
		else
		{
			document.getElementById(id).style.display = 'none';
		}
	}
}