function init() {

	//if there are at least two news boxes (first one is newsBox0) then
	//kick off the fadein/out news timer

	if (document.getElementById('txtQ')) {
		addHandlers(document.getElementById('txtQ'));
		addHandlers(document.getElementById('btnQ'));
	}
	if (document.getElementById('txtQ2')) {
		addHandlers(document.getElementById('txtQ2'));
		addHandlers(document.getElementById('btnQ2'));
	}
	if (document.getElementById('txtQNews')) {
		addHandlers(document.getElementById('txtQNews'));
		addHandlers(document.getElementById('btnQNews'));
	}
	/*
	if (document.getElementById("newsBox1")) 
		fadeNews();
	*/

	function right(e) {
		var msg = "Sorry, you don't have permission to right-click.";
		if (navigator.appName == 'Netscape' && e.which == 3) {
			//alert(msg);
			return false;
		}
		if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
			//alert(msg);
			return false;
		}
		return true;
	}

	function trap() {
		if(document.images) {
			for(i=0;i<document.images.length;i++){
				document.images[i].onmousedown = right;
				document.images[i].onmouseup = right;
			}
		}
	  }
	trap();
}

function enterHandler(e) {

	if (navigator.appName.indexOf("Internet Explorer") < 0) {
		if (e.target.name)
			whichField = e.target.name;
		Key = e.which;
	}
	else {
		e = window.event;
		
		if (e.srcElement && e.srcElement.name)
			whichField = e.srcElement.name;
			
		Key = e.keyCode;
		e.cancelBubble = true;
	}

	if (Key == 13) {
		if (whichField == 'txtQ' || whichField == 'btnQ') {
			checkSearch();
			return false;
		}
		if (whichField == 'txtQ2' || whichField == 'btnQ2') {
			checkSearch2();
			return false;
		}
		if (whichField == 'txtQNews' || whichField == 'btnQNews') {
			checkSearchNews();
			return false;
		}
	}
	
	return true;
}

function addHandlers(o) {

	if (navigator.appName.indexOf("Internet Explorer") < 0) 
		window.captureEvents(Event.KEYPRESS);
	o.onkeypress = enterHandler;

}

///////////////////////////////
//pop windows...
///////////////////////////////

function popWin(url, width, height) 
{
	pop = window.open(url,'popWin','toolbar=no, location=no, status=no, menubar=no, top=140, left=325, scrollbars=no, width=' + width + ', height=' + height + ', resizable=yes');
	pop.focus();
}

function zoomThumb(img) {

	window.open('/content/zoom.aspx?img=' + img, 'popZoom','screenx=150,screeny=75,left=150,top=75,width=660,height=500,menubar=no,toolbar=no,location=no,status=no,directories=no,copyhistory=no,scrollbars=auto,resizable=yes');

}

///////////////////////////////
//misc DOM functions...
///////////////////////////////
/*
    Copyright Robert Nyman, http://www.robertnyman.com
    Free to use if this text is included
*/
function getElementsByAttribute(oElm, strTagName, strAttributeName, strAttributeValue){
    var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    var oAttributeValue = (typeof strAttributeValue != "undefined")? new RegExp("(^|\\s)" + strAttributeValue + "(\\s|$)") : null;
    var oCurrent;
    var oAttribute;
    for(var i=0; i<arrElements.length; i++){
        oCurrent = arrElements[i];
        oAttribute = oCurrent.getAttribute(strAttributeName);
        if(typeof oAttribute == "string" && oAttribute.length > 0){
            if(typeof strAttributeValue == "undefined" || (oAttributeValue && oAttributeValue.test(oAttribute))){
                arrReturnElements.push(oCurrent);
            }
        }
    }
    return arrReturnElements;
}


///////////////////////////////
//toggler...
///////////////////////////////
	
	var btnX = '+';	 //the collapse character is alt+0150 (on numeric keypad) not a regular dash.
	
	function toggleSelector() {
		
		if (btnX == '–') {
			document.getElementById("selectPdf").style.display = "none";
			btnX = '+';
		}
		else {
			document.getElementById("selectPdf").style.display = "block";
			btnX = '–';
		}
			
	}
