﻿
jQuery.noConflict();

var SBGame = new function() {
    this.Free = true;
    this.Url;
    this.UrlParams;
    this.Features = "toolbar=no,location=no,directories=0,status=1,menubar=0,scrollbars=no,top=0,resizable=no,left=0,width=800,height=660";

    this.Host = "www.svenbertil.com"; 
    this.GameHost = "www.svenbertil.com"; 

    this.Version = 1;
    this.Url = this.Host + "/Client/";
    this.Reload = false; 
    
    var _gameId = -1;
    var _cmd;
    var _name = "";
    var _flash = "";    

    this.Commands = {
        FreePlay: function() {
            SBGame.UrlParams = SBGame.GameHost + "/nyxclient/casino/lounge_slim.swf%3Fclient=..%2Fcasino%2F" + _flash + "%26language=SV%26loaderimage=..%2FSvenBertil%2Floaderimage.swf%26version=" + SBGame.Version;
        
            var url = "http://" + SBGame.Url + "?url=http://" + SBGame.UrlParams + "%26secure=no%26operatorname=SvenBertilFP%26partnername=SvenBertilFP%26freePlay=Yes%26freePlayCurrency=SEK%26freePlayAmount=1000%26gameid=" + _gameId + "%26namet=" + _name + "%26prot=http"; 
        
            if(!SBGame.Reload){
                var w = window.open(url, "SvenBertil", SBGame.Features)
                if(w.focus)w.focus(); 
            }else{
                window.location = url; 
            }
        },
        FullGame: function() {
            SBGame.UrlParams = SBGame.GameHost + "/nyxclient/casino/lounge_slim.swf%3Fclient=..%2Fcasino%2F" + _flash + "%26language=SV%26loaderimage=..%2FSvenBertil%2Floaderimage.swf%26version=" + SBGame.Version;
            
            var url = "https://" + SBGame.Url + "?url=https://" + SBGame.UrlParams + "%26secure=yes%26operatorname=SvenBertil%26partnername=SvenBertil%26session=" + SBGame.Session + "%26gameid=" + _gameId + "%26namet=" + _name + "%26prot=https"; 
            
            if(!SBGame.Reload){
                var w = window.open(url, "SvenBertil", SBGame.Features)
                if(w.focus)w.focus(); 
            }else{
                window.location = url; 
            }
        }
    };

    this.loadClient = function() {                             
        var arr = typeof(arguments[0]) === "object"; 
        
        _gameId = arr ? arguments[0][0]: arguments[0]; 
        _name = arr ? arguments[0][1]: arguments[1];
        _flash = arr ? arguments[0][2]: arguments[2];     
                        
        _load(); 
    };

    var _load = function(){                  
        if (SBGame.Free) {
            _cmd = SBGame.Commands.FreePlay;
        } else {
            _cmd = SBGame.Commands.FullGame;            
        }

        _cmd();
    }

    this.init = function() {

    }
}

jQuery(document).ready(function() {
   	SBGame.init();
});