/* ----------------------------------------------------------------------------------------
File Name: General_Functions.js

	This file handles general functions.
 ----------------------------------------------------------------------------------------*/
var _gGroup = 0;
var first_time2 = true;
var last_item	= "";
//var printObj;
function openLink(url)
{
	popUpWin = open(url, 'popUpWin');
	popUpWin.focus();
}
function popUpWindow(URLStr, left, top, width, height)
{
	var popUpWin=0;
	if(popUpWin)
	{
		if(!popUpWin.closed) popUpWin.close();
	}
	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
	popUpWin.focus();
}

function limit(El)
{
	if(El.value.length >= 40)
		El.value = El.value.substring(0,40);
}

//--------------------------------------------------------------------------------

function GroupIt(El)
{
	if (El.state !== "down")
	{
		if(first_time2)
		{
			last_item = El.id;
			first_time2 = false;
		}
		else
		{
			if(document.getElementById(last_item))
			{
				document.getElementById(last_item).state = "";
				document.getElementById(last_item).style.cursor = "hand";
				document.getElementById(last_item).src =  "../images/" + last_item + "_normal.gif";
			}
			last_item = El.id;
		}
				
		El.style.cursor = "normal";
		El.src = "../images/" + El.id + "_over" + ".gif";
		El.state = "down";
	}
} 
function OverIt(El)
{
	if (El.state !== "down")
	{
		El.src = "../images/" + El.id + "_over" + ".gif";
		El.state = "over";
	}	
}
function OutIt(El)
{
	if (El.state == "over")
	{
		El.state = "";
		El.src = "../images/" + El.id + "_normal" + ".gif";
	}	
	else if (El.state !== "over" && El.state !== "down")
			El.src = "../images/" + El.id+ "_normal" + ".gif";
}

function PrintData(type)
{
	/*switch(type)
	{
		case 1:
			printObj = document.getElementById("content");
			break;
	}*/
	
	printWin = open("includes/printWin.html", 'printWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width=0,height=0,left=2000, top=2000');
}

//------------ CONTACT FUNCS ---------------------------//
function resetForm(frm)//gets frm form object and clears all data in texts areas and inputs
{
	var allFormEl = new Array();
	allFormEl = frm.getElementsByTagName("INPUT");
	//alert(allFormEl.length)
	
	for(var i=0; i<allFormEl.length; i++)
		if(allFormEl[i].type == "text")
			allFormEl[i].value = "";
	
	allFormEl = frm.getElementsByTagName("INPUT");
	//alert(allFormEl.length)
	
	frm.Comments.value = "";
}

// --------- LEFT MENU SELECTED -------------
function selectedMenuItem()
{	
    linkName = document.getElementById("menu_href_news").innerHTML;
    document.getElementById("menu_item_news").innerHTML = "<img src='../images/menu_element.gif'><span class='sideMenu_selected'>" + linkName + "</span>";
}