

function popWinOpen(winW,winH,sUrl,sName,iResize,iScroll,iStatus) {
	if (screen) {
		if ((screen.height - winH) < 150) {
			var winX = (screen.width - winW) / 2;
			var winY = 0;
		} else {
			var winX = (screen.width - winW) / 2;
			var winY = (screen.height - winH) / 2;
		}
		var popWindow = window.open(sUrl,sName,"resizable=" + iResize + ",menubar=0,scrollbars=" + iScroll + ",status=" + iStatus + ",width=" + winW + ",height=" + winH + ",top=" + winY + ",left=" + winX + "");
		if (popWindow) popWindow.focus();
	} else {
		window.open(sUrl,sName,"resizable=" + iResize + ",menubar=0,scrollbars=" + iScroll + ",status=" + iStatus + ",width=" + winW + ",height=" + winH);
	}
}

function openSendToFriend(metaId) {
	popWinOpen(379,530,"/jsp/sendtoafriend.jsp?meta_id=" + metaId,"sendToFriendWin",1,0,1) ;
}
function openAddEvent(sectId) {
	popWinOpen(390,710,"/jsp/events/" + (sectId > 0 ? "?section=" + sectId : ""),"addEventWin",1,0,1) ;
}
function applyToRace(metaId, mainId) {
	popWinOpen(395,600,"/jsp/competition/apply_form.jsp?meta_id=" + metaId + "&main_id=" + mainId,"competitionWin",1,1,1) ;
}

function setFocusByID(elementID){
document.getElementById(elementID).focus();
}

function openFlashFromDocumentMenu(documentId, menuIndex) {
	var sUrl = "/user/movie_flash/run_flash.jsp?documentId=" + documentId + "&menuIndex=" + menuIndex;
	popWinOpen(760,600,sUrl,"FlushWin",1,0,1) ;
}

function showInputImage() {
    document.getElementById("inputImage").style.display = "inline";
    document.getElementById("imageLabel").style.display = "none";
}

function showInputDocument() {
    document.getElementById("inputDocument").style.display = "inline";
    document.getElementById("documentLabel").style.display = "none";
}
