// -----------------------------------------------------------------------------
// Generic Javascript Functions
//
// Copyright (C) 2001 - 2002 BeCom S.A. http://www.becom.gr
// Distributed under the terms of the GNU Library General Public License
// -----------------------------------------------------------------------------
// String trimming functions - S.B.
// -----------------------------------------------------------------------------

//Title For All Windows
//document.title='NovaBank - www.novabank.gr';
//window.name='NovaBank';

function bjs_ltrim(str){
	for(var i=0;str.charAt(i)==" ";i++);
	return str.substring(i,str.length);
}
function bjs_rtrim(str){
	for(var i=str.length-1;str.charAt(i)==" ";i--);
	return str.substring(0,i+1);
}
function bjs_alltrim(str){return bjs_ltrim(bjs_rtrim(str));}

//OPEN NEW WINDOW - POP UP
/*function create_window(page,width,height)
{
 if (page)
 { 
  var w = 100;
  var h = 100;
  var rights;
  if (width){ width= width;}else{ width = w;}
  if (height){ height= height;}else{ height = h;}
  rights = "scrollbars=yes,status=no,width="+ width +",height="+ height;
  var win1 = window.open(page, 'win1', rights);
  var win1 = win1.focus();
 } 
}*/
function create_window(page,width,height)
{
    if (document.all)
        var xMax = screen.width, yMax = screen.height;
    else
        if (document.layers)
            var xMax = window.outerWidth, yMax = window.outerHeight;
        else
            var xMax = 640, yMax=480;

    var xOffset = (xMax - width)/2, yOffset = (yMax - height)/2;

var win1 = window.open(page,'win',',scrollbars=yes,toolbar=no,menubar=no,status=no,resizable=yes,directories=no,width='+width+',height='+height+',screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+',resizable=no');
var win1 = win1.focus();
}

function resize_window(width,height)
{
window.resizeTo(width,height);
if (document.all)
        var xMax = screen.width, yMax = screen.height;
    else
        if (document.layers)
            var xMax = window.outerWidth, yMax = window.outerHeight;
        else
			var xMax = window.outerWidth, yMax = window.outerHeight;
            //var xMax = 640, yMax=480;

    var xOffset = (xMax - width)/2, yOffset = (yMax - height)/2;
    window.moveTo(xOffset,yOffset);
}


// -----------------------------------------------------------------------------
//Original:  David Salsinha (david.salsinha@popsi.pt)
// -----------------------------------------------------------------------------
function Encrypt(theText) {
output = new String;
Temp = new Array();
Temp2 = new Array();
TextSize = theText.length;
for (i = 0; i < TextSize; i++) {
rnd = Math.round(Math.random() * 122) + 68;
Temp[i] = theText.charCodeAt(i) + rnd;
Temp2[i] = rnd;
}
for (i = 0; i < TextSize; i++) {
output += String.fromCharCode(Temp[i], Temp2[i]);
}
return output;
}
function unEncrypt(theText) {
output = new String;
Temp = new Array();
Temp2 = new Array();
TextSize = theText.length;
for (i = 0; i < TextSize; i++) {
Temp[i] = theText.charCodeAt(i);
Temp2[i] = theText.charCodeAt(i + 1);
}
for (i = 0; i < TextSize; i = i+2) {
output += String.fromCharCode(Temp[i] - Temp2[i]);
}
return output;
}
// -----------------------------------------------------------------------------
//Cookies
// -----------------------------------------------------------------------------
function Get_Cookie(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}
function Set_Cookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") + 
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}
function Delete_Cookie(name,path,domain) {
    if (Get_Cookie(name)) document.cookie = name + "=" +
       ( (path) ? ";path=" + path : "") +
       ( (domain) ? ";domain=" + domain : "") +
       ";expires=Thu, 01-Jan-70 00:00:01 GMT";
}
// -----------------------------------------------------------------------------
//Correct IE 5.5 Cursor error (SB)
// -----------------------------------------------------------------------------
function GetPointer1 () {
var pointer = 'hand';
if (navigator.appName.toLowerCase().indexOf('microsoft') != -1){pointer = 'hand';} else {pointer = 'pointer';}
return pointer;
}


//SCRIPT FOR WINDOW OPEN FOR e-Banking application - Millennium Bank
function callRetailLogin(){
	document.location.href = 'https://ebanking.millenniumbank.gr/eBankingWeb/login?Lang=el';
}
function callBusLogin(){
	document.location.href = 'https://ebanking.millenniumbank.gr/eBankingWeb/buslogin?Lang=el';
}
function callRetailLoginEN(){
	document.location.href = 'https://ebanking.millenniumbank.gr/eBankingWeb/login?Lang=en';
}
function callBusLoginEN(){
	document.location.href = 'https://ebanking.millenniumbank.gr/eBankingWeb/buslogin?Lang=en';
}
function go2RetailLogin(){
	window.open('http://www.millenniumbank.gr/MillenniumVB/Templates/EBanking.aspx?LANGID=30&TARGET=1','','toolbar = no, menubar = no, status = yes, resizable = yes, location = yes, top = 0, left = 0, width = 790 , height = 550, scrollbars = yes');
}
function go2BusLogin(){
	window.open('http://www.millenniumbank.gr/MillenniumVB/Templates/EBanking.aspx?LANGID=30&TARGET=2','','toolbar = no, menubar = no, status = yes, resizable = yes, location = yes, top = 0, left = 0, width = 790 , height = 550, scrollbars = yes');
}
function go2RetailLoginEN(){
	window.open('http://www.millenniumbank.gr/MillenniumVB/Templates/EBanking.aspx?LANGID=0&TARGET=1','','toolbar = no, menubar = no, status = yes, resizable = yes, location = yes, top = 0, left = 0, width = 790 , height = 550, scrollbars = yes');
}
function go2BusLoginEN(){
	window.open('http://www.millenniumbank.gr/MillenniumVB/Templates/EBanking.aspx?LANGID=0&TARGET=2','','toolbar = no, menubar = no, status = yes, resizable = yes, location = yes, top = 0, left = 0, width = 790 , height = 550, scrollbars = yes');
}

//OLD
 function go2RetailLoginOld() {
         window.open('http://ebanking.millenniumbank.gr/login?Lang=el','','toolbar = no, menubar = no, status = yes, resizable = yes, location = no, top = 0, left = 0, width = 790 , height = 550, scrollbars = yes');
         //window.opener=null;
         //window.close();    
 }

 function go2BusLoginOld() {      
         window.open('http://ebanking.millenniumbank.gr/buslogin?Lang=el','','toolbar = no, menubar = no, status = yes, resizable = yes, location = no, top = 0, left = 0, width = 790 , height = 550, scrollbars = yes');
         //window.opener=null;
         //window.close();         
 }

//SCRIPT FOR WINDOW OPEN FOR e-Banking application - Millennium Bank
 function go2RetailLoginENOld() {
         window.open('http://ebanking.millenniumbank.gr/login?Lang=en','','toolbar = no, menubar = no, status = yes, resizable = yes, location = no, top = 0, left = 0, width = 790 , height = 550, scrollbars = yes');
         //window.opener=null;
         //window.close();    
 }

 function go2BusLoginENOld() {      
         window.open('http://ebanking.millenniumbank.gr/buslogin?Lang=en','','toolbar = no, menubar = no, status = yes, resizable = yes, location = no, top = 0, left = 0, width = 790 , height = 550, scrollbars = yes');
         //window.opener=null;
         //window.close();         
 }