var minJavaVer = "1.5";
var minJavaVersion = minJavaVer+"+"; //the minimum Java version a user must have
function turboInstallJava(){
if(deployJava.installLatestJRE()){
alert("Ok great, Java is updated. Press enter to join the fun");
}else{
alert("Java update was canceled. No problem, it will install automatically later when you enter the rooms, make sure you click accept when prompted");
}
}
/*
* Something went wrong with the applet, give up trying to connect.
*/
function giveUp() {
window.onbeforeunload = null;
var sURL = unescape("givenUp.jsp");
window.location.replace( sURL );
}
function refreshPage() {
window.onbeforeunload = null;
// This version of the refresh function will cause a new
// entry in the visitor's history. It is provided for
// those browsers that only support JavaScript 1.0.
var sURL = unescape(window.location.pathname);
window.location.href = sURL;
//window.location.reload();
}
function refreshPage() {
window.onbeforeunload = null;
// This version does NOT cause an entry in the browser's
// page view history. Most browsers will always retrieve
// the document from the web-server whether it is already
// in the browsers page-cache or not.
var sURL = unescape(window.location.pathname);
window.location.replace( sURL );
}
function refreshPage() {
window.onbeforeunload = null;
// If we needed to pull the document from
// the web-server again (such as where the document contents
// change dynamically) we would pass the argument as 'true'.
window.location.reload( true );
}
function refresh() {
window.scroll(0,0);
}
function openGame(tUrl) {
myOpenWindow(tUrl);
}
function goToGamemoviePage(tGamename, tMoviename){
var sURL = unescape(window.location.pathname);
sURL+="?quick=true&gamename="+tGamename+"&moviename="+tMoviename;
window.location.replace( sURL );
}
function openLobbyHelp() {
tUrl = "help.jsp";
myOpenWindow(tUrl);
}
function openGameHelp(tGame) {
//TODO
myOpenWindow(tUrl);
}
function openGetPoints() {
tUrl = "../../games/user/u?page=deposit";
myOpenWindow(tUrl);
}
//--Opens a players profile
function openUserProfile(tUser) {
tUrl = "../../games/user/u?page=xxx";
myOpenWindow(tUrl);
}
//--Opens a page that contains this players game statistics
function openUsersGameStats(tUser, tGame) {
tUrl = "../../games/user/u?page=xxx";
myOpenWindow(tUrl);
}
function openMyResources(){
openInMainWindow("/games/user/myresources");
}
function openMyAccountPage(){
openInMainWindow("/games/user/u?page=myaccount");
}
function openInvitePage(){
openInMainWindow("/games/user/u?page=refer");
}
function goToSubscribePage(){
openInMainWindow("/games/user/subscribe_page");
}
function openInMainWindow(tUrl) {
//we use window.parent since the applet will always be hosted in some frameset
var mainWindow = window.parent.opener;
mainWindow.location.href = tUrl;
mainWindow.focus();
if (isFirefox) {
//otherwise focus will not be given to the firefox window...very annoying
mainWindow.alert('Press OK to continue');
}
}
function openMyProfile() {
openMyAccountPage();
//tUrl = "../../games/user/u?page=myprofile";
//tOptions = "dialogWidth: 800px; dialogHeighth: 700px; resizable:yes; scroll:no";
}
function myOpenWindow(tUrl){
var args='width=840,height=700,left=25,top=20,toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0';
openURLAndDisplayDivIfBlocked(tUrl,"",args);
}
//window.onResize = refresh;
//window.onLoad = refresh;
var browserName
var isFirefox = false
version = navigator.appVersion
browserName = navigator.appName
if(navigator.userAgent.indexOf("Firefox") != -1){
browserName = "Firefox"
isFirefox = true
}else if(navigator.userAgent.indexOf("MSIE") != -1){
browserName = "Explorer"
}
function writeBrowser(){
document.write("
Browser: "+browserName)
}
function isFirefoxBrowser(){
browserName = navigator.appName
if(navigator.userAgent.indexOf("Firefox") != -1){
return true;
}
return false;
}
function checkVersion(version) {
var javaID="application/x-java-applet;version="
// Mozilla may not recognize new plugins without this refresh
//navigator.plugins.refresh(true);
for (var i = 0; i < navigator.mimeTypes.length; ++i) {
pluginType = navigator.mimeTypes[i].type;
if (pluginType.indexOf(javaID) > -1){
if(pluginType.indexOf(javaID+""+version) > -1){
return true;
}
}
}
return false;
}
//usage:
// var desiredJavaVersion = "1.6"
// detectBrowser()
// if(isFirefox){
// if(checkVersion(desiredJavaVersion)){
// document.write("
OK")
// }else{
// window.location.href = " http://jdl.sun.com/webapps/getjava/BrowserRedirect?locale=en&host=java.com "
// }
// }else{
// document.write("
JRE detection for "+browserName+" not coded yet")
// }
//Used for detecting a popup being blocked. Use target "_blank" to open a popup.
//@ return true if popup was successfully opened
function openURL( url, target, args ) {
try {
var popup = window.open(url, target, args);
if (popup == null)
return false;
if (window.opera)
if (!popup.opera)
return false;
}catch(err) {
return false;
}
return true;
}
var urlBackup;
function openURLAndDisplayDivIfBlocked( url, target, args) {
if (openURL(url, target, args) == false) {
//the popup was blocked
//save the url
urlBackup = url;
//show the div
document.getElementById('popupBlockedDiv').style.display='block';
document.getElementById('appletComponent').style.width='1px';
document.getElementById('appletComponent').style.height='1px';
}
}
function hidePopupBlockedDiv() {
document.getElementById('popupBlockedDiv').style.display='none';
document.getElementById('appletComponent').style.width='100%';
document.getElementById('appletComponent').style.height='100%';
}
/*Just opens a dummy page that will close immediately. If successful it will return true.*/
function arePopupsAllowed(context) {
return (getUrlParameter("continue") != "") || openURL(context+"/popupCheck.jsp","_blank", 'width=50,height=50,left=25,top=20,toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0')
}
/*Tries to open url. Returns true if it manages to open the popup */
function openPopup(url) {
return openPopup(url,'popup');
}
function openPopup(url, target) {
return openURL(url, target, 'width=900,height=680,resizable=yes,scrollbars=no,toolbar=no,menubar=no,location=no,status=no,directories=no');
}
/*Just opens the URL... doesn't return anything. Useful for using it in href="javascript:justOpenPopup(..." */
function justOpenPopup(url) {
openPopup(url);
}
function justOpenPopup(url, target) {
openPopup(url, target);
}
function getUrlParameter( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
function copyToClipboard(s)
{
if( window.clipboardData && clipboardData.setData )
{
clipboardData.setData("Text", s);
}
}
function goToSignUpPage() {
window.onbeforeunload = null;
//i'm accessing the parent just in case it is in a frame set (guest). It won't effect if we're not in a frameset
window.parent.location.href = "/signup_page";
}
function openfortunecity(url){
var screenW = 800, screenH = 800;
if (parseInt(navigator.appVersion)>3) {
screenW = screen.width;
screenH = screen.height;
}
else if (navigator.appName == "Netscape"
&& parseInt(navigator.appVersion)==3
&& navigator.javaEnabled()
)
{
var jToolkit = java.awt.Toolkit.getDefaultToolkit();
var jScreenSize = jToolkit.getScreenSize();
screenW = jScreenSize.width;
screenH = jScreenSize.height;
}
var args='width='+(screenW-40)+',height='+(screenH-70)+',left=10,top=10,toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=1';
//if(window.parent.opener==null){
// openURL(url,'fortunecity',args);
//}else{
window.location.href = url;
//}
}
function writeAppletForSafari(attributes, parameters) {
var html = getObjectTag(attributes, parameters);
document.write(html);
}
function getObjectTag(attributes, parameters) {
//var s = '<' + 'object classid="clsid:CAFEEFAC-DEC7-0000-0000-ABCDEFFEDCBA"';
var s = '<' + 'object type="application/x-java-applet;version=1.5+"';
for (var attribute in attributes) {
if(attribute=="style"){
//TODO parse the string - "width:1000px;height:601px"
var tWidth = "1000";
var tHeight = "601";
s += ' width="'+tWidth+'"';
s += ' height="'+tHeight+'"';
}else{
s += ' ' + attribute + '="' + attributes[attribute] + '"';
}
}
s += '>';
for (var parameter in parameters) {
s += '';
}
s += '';
return s;
}
function getAsEmbedTag(attributes, parameters) {
var s = '<' + 'embed ';
for (var attribute in attributes) {
s += (' ' + attribute + '="' + attributes[attribute] + '"');
}
for (var parameter in parameters) {
s += (' ' + parameter + '="' + parameters[parameter] + '"');
}
s += '>';
return s;
}