﻿var isIE = (navigator.appName.indexOf("Internet Explorer")>=0);
var isFF = (navigator.appName.indexOf("Netscape")>=0);
var isSafari = (navigator.appVersion.indexOf("Safari")>=0);

function getObject(name) {
	return document.getElementById(name);
}

function advSearch() {
	var frm = getObject('searchForm');
	//frm.action = 'advanced_search.aspx';
	frm.submit();
}

/*
function showPopup(termID) {
	//alert('Get data for term: ' + termID);
	getTerm(termID);
}
function closePopup(termID) {
	var pop = getObject("termPop_"+termID);
	//pop.style.visibility = "hidden";
	pop.style.display = "none";
}


// Check if this National Team entry already exists
function getTerm(termID) {	
	AjaxServices.GetTerm(termID, onGetTerm, onErrGetTerm);
}
function onGetTerm(res){
	//alert(res[0] + "\n" + res[1] + "\n" + res[2]);
	var o = document.getElementById("termLink_" + res[0]);
	var pop = getObject("termPop_"+res[0]);
	pop.style.display = "inline";
	
	getObject("p_"+res[0]).innerHTML = res[1];
	//getObject("btnNext_"+res[]).innerHTML = res[1];
	
	var t = 0;
	var l = 0;
	var t2 = o;

	while(t2.offsetParent != document.body){
		t += t2.offsetTop;
		l += t2.offsetLeft;

		t2 = t2.offsetParent;
	}

	if(t == 0 && l == 0){
		t = o.offsetTop;
		l = o.offsetLeft;
		l = (l + (o.offsetWidth/2) - (pop.offsetWidth/2) - 10);
	} else {
		l = (l + (o.offsetWidth/2) - (pop.offsetWidth/2)-10) + (document.body.offsetWidth-1000)/2;
	}

	pop.style.top = (t - 170) + "px";
	pop.style.left = (l) + "px";
}
function onErrGetTerm(error){
	alert("AJAX Error (GetTerm): " + error.get_message());
}
*/

function openSendTo(url){
	window.open(url, 'sendTo', 'width=340px, height=400px');
}

function newsColor(id){
	var n = getObject("news_"+id);
	if (n == null) {return;}
	if (n.style.color != "#3056a4") {
		n.style.color = "#3056a4";
	} else {
		n.style.color = "#000";
	}
}

function openWin(url) {
	window.open(url, '_blank');
}
function openWin2(url, w, h, options) {
	if (isIE && window.showModalDialog!=null) {
		window.showModalDialog(url,"", "dialogWidth:" + w + "px; dialogHeight:" + h + "px; status:no; center:yes");
	} else {
		window.open(url, '_blank', 'width=' + w + 'px, height=' + h + ', ' + options + '');
	}
}

function alignColumns(){
	var c1 = getObject('rightExpand');
	var c2 = getObject('centerHold');
	var c3 = getObject('leftExpand');
	
	var newH = 0;
	if(c1 != null) {
		newH = Math.max(newH, c1.offsetHeight);
	}
	if(c2 != null) {
		newH = Math.max(newH, c2.offsetHeight);
	}
	if(c3 != null) {
		newH = Math.max(newH, c3.offsetHeight);
	}

	if(c1 != null) {
		c1.style.height = (newH-28) + "px";
		//c1.style.height = newH + "px";
		//alert("c1 " + c1.style.height);
	}
	if(c2 != null) {
		c2.style.height = newH + "px";
		//alert("c2 " + c1.style.height);
	}
	if(c3 != null) {
		c3.style.height = (newH-47) + "px";
		//c3.style.height = newH + "px";
		//alert("c3 " + c1.style.height);
	}
	
}
