
/* *******************************************************************************************
 *         Popup - Centered on the screen                                                    *
 ******************************************************************************************* */

function popWinOpen(winW,winH,sUrl,sName,iResize,iScroll,iStatus) {
	var winX, winY ;
	if (screen) {
		if ((screen.height - winH) < 150) {
			winX = (screen.width - winW) / 2;
			winY = 0;
		} else {
			winX = (screen.width - winW) / 2;
			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 addEvent() {
	popWinOpen(420,570,"/jsp/calendar/","addEventWin",1,1,1) ;
}

function tipFriend(path, isEng) {
	popWinOpen(360,500,"/jsp/tip_friend.jsp?path=" + path + (isEng ? "&lang=eng" : ""),"tipFriendWin",1,0,1) ;
}

function openTour(isEng) {
	if (isEng) {
		popWinOpen(800,600,"http://www.wec360.se/public_server/wisbystrand/engelska/start/Pano_cube.swf","",1,0,0) ;
	} else {
		popWinOpen(800,600,"http://www.wec360.se/public_server/wisbystrand/rundtur/pano_11/Pano_cube.swf","",1,0,0) ;
	}
}

function openStats(id) {
	if (/^\d+$/.test(id)) {
		popWinOpen(800,570,"/jsp/view_stats.jsp?view=" + id,"",1,1,1) ;
	}
}

function contactUser(href){
	return !popupWindowRef(440,580,href,"contact",1,0,1);
}

function popupWindowRef(winW, winH, sUrl, sName, iResize, iScroll) {
	var winX, winY ;
	var popWindow;
	if (screen) {
		if ((screen.height - winH) < 150) {
			winX = (screen.width - winW) / 2;
			winY = 0;
		} else {
			winX = (screen.width - winW) / 2;
			winY = (screen.height - winH) / 2;
		}
		popWindow = window.open(sUrl, sName, "resizable=" + iResize + ",menubar=0,scrollbars=" + iScroll + ",width=" + winW + ",height=" + winH + ",top=" + winY + ",left=" + winX + "");
		if (popWindow) popWindow.focus();
	} else {
		popWindow = window.open(sUrl, sName, "resizable=" + iResize + ",menubar=0,scrollbars=" + iScroll + ",width=" + winW + ",height=" + winH);
	}
	return popWindow;
}

