var blink_rate = 100;

function init(){
	blink();

	fade();
}

function setFontColor(e){
	if(e==null)
		return;

	if(document.location.href.toLowerCase() == e.href.toLowerCase())
	{
		e.className =  'topnav_link_on';
	}
	else
		e.className =  'topnav_link_off';
}

function search(){
	var terms = document.getElementById('ctl00_terms');
	if(terms.style.display == 'none')
	{
		terms.style.display = '';
		terms.focus();
	}
	
}

//network resources javascript
//start javascript for left-hand navigation menu
var last = new Array();
var tbl_menu = null;

function get_Items(tbl_menu, parent, n){
	if(last.length > 0)
		close_MenuItems(tbl_menu);
		
	//find parent row by looping through table
	for(r=0;r<tbl_menu.rows.length;r++)
	{
		if(tbl_menu.rows[r].cells[1].innerHTML.toLowerCase() == parent.toLowerCase())
		{
			last.push(parent);
			last.push(n);
			
			tbl_menu.rows[r].cells[0].innerHTML = "-";

		//open the folling n rows
			for(i=1;i<n+1;i++)
			{
				tbl_menu.rows[r+i].style.display = '';
			}
			break;
		}
	}
}

function close_MenuItems(tbl_menu){
	//find last
	var nlast = last.pop();
	var tlast = last.pop();
	
	for(r=0;r<tbl_menu.rows.length;r++)
	{
		if(tbl_menu.rows[r].cells[1].innerHTML.toLowerCase() == tlast.toLowerCase())
		{
			tbl_menu.rows[r].cells[0].innerHTML = "+";
			
			//close the following n rows
			for(i=1;i<nlast+1;i++)
			{
				tbl_menu.rows[r+i].style.display = 'none';
			}
			break;
		}
	}
}

function set_Menu(){
	//using the title of the page open the sub menu items so the item clicked is visible
	if(document.title.toLowerCase().indexOf("articles") > -1)
	{
		//open the administrtion sub items
		get_Items(document.getElementById('template_tbl_menu'), 1,1);
	}
}

function blink()
{
	//window.status = document.getElementById("bag").style.color;

	if(document.getElementById("bag").style.color.toUpperCase() == "#FFFFFF" || document.getElementById("bag").style.color.toUpperCase() == "RGB(255,255,255)")
		document.getElementById("bag").style.color = "#1C1515";
	else
		document.getElementById("bag").style.color = "#FFFFFF";
	
	setTimeout("blink()",1000);
}

function setOpacity(obj, opacity)
{
	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}

function fade()
{
	switch(document.getElementById("buynow").className)
	{
		case "bright":
			document.getElementById("buynow").className = "dim";
			break;
		case "dim":
			document.getElementById("buynow").className = "bright";
			break;
	}

	setTimeout('fade()',500);
}

function print_Item()
{
	var wind = window.open('print.htm','wind','toolbars=non,history=no');	
	wind = null;	
}

function resize()
{
	var obj = document.getElementById("divContent");
	var cp = document.getElementById("checkpoint");
	window.status = new Date();
	
	switch(navigator.appName.toLowerCase())
	{
		
		case "microsoft internet explorer":
			obj.style.width = ((cp.offsetLeft - cp.offsetWidth) - 275) + 'px';
			obj.style.height = ((cp.offsetTop - cp.offsetHeight) - 65) + 'px';

			break;
		default:		
			obj.style.height = window.innerHeight-window.pageYOffset - 100 +  'px';
			obj.style.width = window.innerWidth-275 + 'px';

			break;
	}


		
}
