var oNewsTimeout; // news timeout for automatically iterating news articles on homepage

$(function() {
	$("ul.home_listing").each(function() {
		$("ul.home_listing li").get(0).className = "active";
	});
});

/* opens a popup window */
function popScreen(sRoot, sURI, sExtra, sCategory, sSubCategory, sImgID) {
	var sPopScriptPath = sRoot + "popup.asp?file=" + sURI + "&extra=" + sExtra + "&category=" + sCategory + "&subcategory=" + sSubCategory + "&imgid=" + sImgID;
	var newWin = window.open(sPopScriptPath, "popwin", "width=500,height=500,status=yes")
}

/* used to make the height of the 3 columns on the homepage equal */
function EqualizeColumnHeight() {
	var lHeight = 0;
	$("#footer_columns div.column").each(function() {
		if($(this).height() > lHeight) {
			lHeight = $(this).height();
		}
	});
	$("#footer_columns div.column").each(function() {
		if($(this).height() < lHeight) {
			var tempHeight = (lHeight - $(this).height());
			$(this).height(lHeight);
			$("a.btn_more", this).css("top", tempHeight + "px");
		}
	});
}

/* switch focus from one news article to another */
function switchNews(strLanguage, strNewsID) {
	$("ul.home_listing li").each(function() { this.className = ""; });
	var oLi = document.getElementById(strNewsID);
	var oImage = document.getElementById("current_news_image");
	var oLink = document.getElementById("current_news_link");
	oLi.className = "active";
	oImage.src = "/upload/"+ strLanguage +"/news/tblNews_"+ strNewsID +"/1_overview.jpg";
}

/* get the next slogan from a random starting point */
function nextSlogan() {
	if(iSlogan >= slogans.length) { iSlogan = 0; }
	$("#slogan").animate({height: 'toggle', opacity: 'toggle'}, "slow", function() {
		this.innerHTML = slogans[iSlogan];
		$("#slogan").animate({height: 'toggle', opacity: 'toggle'}, "slow", function() {
			iSlogan += 1;
		});
	});
}
/*
function nextSlogan() {
	if(iSlogan >= slogans.length) { iSlogan = 0; }
	$("#slogan").fadeOut(1000, function() {
		this.innerHTML = slogans[iSlogan];
		$("#slogan").fadeIn(1000);
		iSlogan += 1;
	});
}
*/