
// Open Window functions
var SendKeyArray = new Array();
var SendValueArray = new Array();
var ParamCount = 0;

function clearParams() {
	SendKeyArray = new Array();
	SendValueArray = new Array();
	ParamCount = 0;
}

function AddSendParam(Key, Value)
{
    SendKeyArray[ParamCount] = Key;
    SendValueArray[ParamCount] = Value;
    ParamCount++;
}

function OpenWindowWithPost(URL, Caption, WindowOptions)
{
   var NewWindow = window.open("", Caption, WindowOptions);  
   if (!NewWindow)
    {
        return false;
    }

    var html = "";  
    html += "<html><head></head><body><form id='formid' method='post' action='" + URL + "'>";  
    for (var i = 0; i < ParamCount; i++) 
    {       
        html += "<input type='hidden' name='" + SendKeyArray[i] + "' value='" + SendValueArray[i] + "'/>"; 
    }

    html += "</form><script type='text/javascript'>document.getElementById(\"formid\").submit()</script></body></html>";  
    NewWindow.document.write(html);  
    return NewWindow;  
}

function MyAccount(username, password, ul, clienttype)
{
    clearParams();
    var WindowOptions = 'directories=0,left=0,top=0,width=1014' +
                        ',height=651,location=0,menubar=0,resizable=1,' +
                        'scrollbars=0,status=0,titlebar=0,toolbar=0';
    AddSendParam('Clienttype', clienttype);
    AddSendParam('ServerID', '1544');
    AddSendParam('loginname', username); 
    AddSendParam('password', password); 
    AddSendParam('ul', ul);
    AddSendParam('ssologintype', '0');
    OpenWindowWithPost('https://signin2.valueactive.eu/myaccount/default.aspx', 'MyAccount', WindowOptions);
}

function Banking(username, password, ul, clienttype)
{
    clearParams();
    var WindowOptions = 'directories=0,left=0,top=0,width=1014' +
                        ',height=651,location=0,menubar=0,resizable=1,' +
                        'scrollbars=0,status=0,titlebar=0,toolbar=0';
    AddSendParam('Clienttype', clienttype);
    //AddSendParam('ServerID', '1544');
    AddSendParam('loginname', username);
    AddSendParam('password', password);
    AddSendParam('ul', ul);
    OpenWindowWithPost('https://bank2.valueactive.eu/1544/default.asp', 'Banking', WindowOptions);
}


function StartGame(username, password, ul, clienttype)
{
    clearParams();
    var WindowOptions = 'directories=0,left=0,top=0,width=1014' +
                        ',height=651,location=0,menubar=0,resizable=1,' +
                        'scrollbars=0,status=0,titlebar=0,toolbar=0';
    AddSendParam('ClientType', clienttype);
    AddSendParam('ModuleID', '70004');
    AddSendParam('UserType', '0');
    AddSendParam('ProductID', '2');
    AddSendParam('CasinoID', '1545');
    AddSendParam('LoginName', username); 
    AddSendParam('Password', password); 
    AddSendParam('ClientID', '2');
    AddSendParam('UL', ul);
    AddSendParam('VideoQuality', '2');
    AddSendParam('BetProfileID', '0');
    AddSendParam('ActiveCurrency', 'Credits');
    OpenWindowWithPost('https://etiloader3.valueactive.eu/ETILoader/default.aspx', 'Microgaming', WindowOptions);
}
function RecoverPassword()
{
    clearParams();
    var WindowOptions = 'directories=0,left=0,top=0,width=1014' +
                        ',height=651,location=0,menubar=0,resizable=1,' +
                        'scrollbars=0,status=0,titlebar=0,toolbar=0';
    AddSendParam('Clienttype', '1');
    AddSendParam('ServerID', '1545');
    AddSendParam('insideclient', '1');
    OpenWindowWithPost('https://signin2.valueactive.eu/forgotpassword/default.aspx', 'Microgaming', WindowOptions);
}
function Register(url)
{
    window.open(url, 'register', 'width=1014,height=651');    
}

function Popup(name, url)
{
    window.open(url, name, 'width=1014,height=651,status=0, titlebar=0, toolbar=0, menubar=0, location=0, fullscreen=0, resizable=0');    

}

function Chat(name, url)
{
    window.open(url, name, 'width=500,height=320,status=0, titlebar=0, toolbar=0, menubar=0, location=0, fullscreen=0, resizable=0');    

}








