function SearchCheck(){
  if(document.search.query_string.value==' search')
    document.search.query_string.value='';
  else if(document.search.query_string.value=='')
    document.search.query_string.value=' search';
}

function CheckSearchSubmit(){
  if(document.search.query_string.value==' search'){
    alert('Enter search term(s) first!');document.search.query_string.focus();return false;}
  else return true;
}


function openWindow(url, width, height) {

    var newWidth = width + 50;
    var newHeight = height + 50;

    var leftPos = window.screenLeft + (window.document.body.clientWidth - newWidth) / 2;
    var topPos = window.screenTop + (window.document.body.clientHeight - newHeight) / 2;

    var newWindow = window.open(url, 'popup_window', 'toolbar=no,location=no,directories=no,status=no,menubar=no, scrollbars=yes,resizable=yes,width=' + newWidth + ',height=' + newHeight + ',left=' + leftPos + ',top=' + topPos);
    newWindow.focus();

}

function confirm_delete(itemName){
	if (confirm('Are you sure you want to delete this ' + itemName + '?'))
		return true;
	else
		return false;
}

function getElementsByClass(searchClass, node, tag) {
	var classElements = new Array();
	if (node == null) {
		node = document;
	}
	if (tag == null) {
		tag = '*';
	}
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var  pattern = new RegExp("(^|\\s)" + searchClass + "(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if (pattern.test(els[i].className)) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function addEvent(elm, evType, fn, useCapture) {
	if (elm.addEventListener) {
		elm.addEventListener(evType, fn, useCapture);
		return true;
	} else if (elm.attachEvent) {
		var r = elm.attachEvent('on' + evType, fn);
		EventCache.add(elm, evType, fn);
		return r;
	} else {
		elm['on' + evType] = fn;
	}
}

function open_window(url) { 
	window.open(url,"win",'toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=640,height=510');
}

function externalSite(url){
	agree=confirm(
	"You are about to leave Animas Credit Union's Web site.\n\n" +
	"Any external site listed here is not under the control of Animas Credit Union, and The Credit Union makes no representation concerning the content of this site, nor does a link serve as an endorsement by Animas Credit Union of any site. Animas CU does not represent either the third party or the member if the two enter into a transaction.\n\n" +
	"Please note that when you exit our site, our Privacy Policy is no longer in effect.  Privacy and security policies may differ from those practiced by the Credit Union.\n\n" +
	"Thank you for visiting.  Please return when you need information about Animas CU's products and services."
	);
	if (agree)
		x=window.open(url);
}

