// JavaScript Document

function showMenuCenter() {
	document.getElementById('myCenter_menu').style.display = '';
	document.getElementById('myCenter').className = 'sl';
}

function hideMenuCenter() {
	document.getElementById('myCenter_menu').style.display = 'none';
	document.getElementById('myCenter').className = '';
}

function showFilterPopup(id1) {
	document.getElementById(id1).style.display = '';
}

function showFilterPopup2(id1,id2) {
	document.getElementById(id1).style.display = '';
	setTimeout(function(){document.getElementById(id2).focus();},0);
}

function showNewsTitleAndDetail(titleLocId, newsTitleId, detailLocId,
		newsDetailId,newsDate) {
	document.getElementById(titleLocId).innerHTML = document
			.getElementById(newsTitleId).value;

	document.getElementById(detailLocId).innerHTML = document
			.getElementById(newsDetailId).value;
	document.getElementById('newsDate').innerHTML = newsDate;

}

function formatNews(divId, titleLocId, titleId, detailIdLoc, detailId,newsDate) {
	// hide the iframe div
	//
	// document.getElementById('videoFrame').style.visibility = 'hidden';
	showFilterPopup2(divId,'newsPopUpOk');
	showNewsTitleAndDetail(titleLocId, titleId, detailIdLoc, detailId,newsDate);

}

function hideFilterPopup(id1) {
	document.getElementById(id1).style.display = 'none';
	setFocusOnCheck();
}

function hideFilterPopup2(id1, showQuestion) {
	document.getElementById(id1).style.display = 'none';
	if( showQuestion )
		setFocusOnCheck();
	else
		setFocusonNextQuestion();	
}

function hideNewsPopup(id1, id2) {
	document.getElementById(id1).style.display = 'none';
	// document.getElementById(id2).style.visibility = 'visible';
}

function showLoadPopup(id1, id2) {
	document.getElementById(id1).style.display = '';
	document.getElementById(id2).style.display = '';
}

function hideLoadPopup(id1, id2) {
	document.getElementById(id1).style.display = 'none';
	document.getElementById(id2).style.display = 'none';
}

function hideConfirmPopUp(id1, id2, result, showQuestion) {
	document.getElementById(id1).style.display = 'none';
	if (result) {
		if (document.getElementById(id2).type == 'submit') {
			document.getElementById(id2).setAttribute("onclick", '');
			document.getElementById(id2).click();
		} else
			window.location.href = document.getElementById(id2).href;
	}
	else{
		if( showQuestion )
			setFocusOnCheck();
		else
			setFocusonNextQuestion();
	}
}

function showConfirmPopup(id1) {
	setTimeout(function(){document.getElementById("confirmOk").focus();},0);
	document.getElementById(id1).style.display = '';
	
}

function setFocusOnCheck(){
	setTimeout(function(){document.getElementById("checkanswerId").focus();},0);
}

function setFocusonNextQuestion(){
	setTimeout(function(){document.getElementById("nextQuestion").focus();},0);
}

