﻿var divLeft = '160px';
var divTop = '212px'; //195
var divWidth = '605px';
var divHeight = '210px';

function _news(id, code, lang)
{
    var url = 'viewNews2.aspx?id=' + id + '&code=' + code + '&lang=' + lang;
   _nw = window.open(url, 'nw', 'width=700,height=500,toolbar=no,resizable=yes,scrollbars=yes');
}


var d = document;
var browser = '';
if(typeof(document.all) == "undefined") {
	if(document.layers != undefined)
		browser='N4';
	else
		browser='N6';
} else
	browser='IE';

window.defaultStatus = 'EFG Eurobank Ergasias';

if(browser=='IE'){
	szs = new Array(6,92,5,90,5,88,4,86,4,84,3,82,3,80,3,78,4,76,4,74,4,72,4,70,4,68,4,66,4,64,4,62,4,60,4,58,4,56,4,54,4,52,4,50,4,48,4,46,4,44,5,42,5,40,5,39,5,38,5,37,5,36,6,35,6,34,5,34,10,34,10,35,15,36,15,37,15,38,15,39,15,40,15,41,15,42,15,43,15,44,15,45,15,46,15,47,15,48,15,49,15,50,14,51,13,52,12,53,11,54,10,55,9,57,9,59,9,61,9,63,9,65,9,67,9,69,9,71,9,73,9,75,9,77,9,77,9,81,9,83,9,85,9,87,8,89);
	
	szs2 = new Array(6,92,6,90,6,88,6,86,6,84,6,82,6,80,6,78,6,76,6,74,6,72,6,70,6,68,6,66,6,64,6,62,6,60,6,58,6,56,6,54,6,53,6,52,6,51,6,50,6,50,6,50,6,50,6,50,6,51,6,52,6,53,6,54,6,55,6,56,6,57,6,58,6,59,6,60,6,61,6,62,6,63,6,64,6,65,6,67,6,69,6,71,6,73,6,75,6,77,6,79,6,81,6,83,6,84,6,85,6,86,6,87,6,88,6,89,6,90,6,91,6,92,6,93,6,94);
}

function ge(e) {
	return (d.getElementById(e));
}

function preload(){
	for (i=0; i<preload.arguments.length; i++)
		loadimg(preload.arguments[i]);
}
function loadimg(name){
	Img = new Image();
	Img.src = name;
	return Img;
}

function imgOver(name, over, out){
	return;
	try {
	var theImg = ge(name);
	if (theImg){
		if (theImg.src.indexOf(over)!=-1){
			theImg.src=out;
		} else {
			theImg.src=over;
		}
	}
	} catch(e) { }
}



function repositionMenus() {
	return;
	var obj = document.getElementById('theMenu').getElementsByTagName('td');

	var large = 0;
	for(var i = 0; i < obj.length; i++) {
		if(obj[i].id.substr(0, 3) == 'poz') {
			if(parseInt(obj[i].offsetHeight) > large)
				large = parseInt(obj[i].offsetHeight);
		}
	}	
	
	for(i = 0; i < obj.length; i++) {
		if(obj[i].id.substr(0, 3) == 'poz') {
			obj[i].style.height = large + 'px'; // attach 'px' for netscape
		}
	}
	
}



function TRA(rowObj, whichAction, overColor, outColor){
	if (whichAction==1){ //mouseOver
		rowObj.style.background=overColor;
	} else if (whichAction==0){ //mouseOut
		rowObj.style.background=outColor;
	}
}

function TRS(rowObj, whichAction, overStyle, outStyle){
	var ob = rowObj.getElementsByTagName('a')[0];
	if (whichAction==1){ //mouseOver		
		ob.style.color = '#D1564E';
	} else if (whichAction==0){ //mouseOver
		ob.style.color = '#686868';
	}
}

function TRSS(rowObj, whichAction, overStyle, outStyle){
	var ob = rowObj.getElementsByTagName('a')[0];
	if (whichAction==1){
		ob.style.color = '#D1564E';
	} else if (whichAction==0){ 
		ob.style.color = '#686868';
	}
}

function resizeParentIFrame(whichFrame){
	try {
		__obj = top.ge(whichFrame);
	} catch(error) { return; }

	bodyheight = ge('mainTable').offsetHeight;
	bodyheight = parseInt(bodyheight) + 1;
	if(bodyheight != top.ge(whichFrame.height))
		top.ge(whichFrame).height=bodyheight;
	setTimeout("resizeParentIFrame('" + whichFrame + "')", 500);
}

function getCookie(CookieName) {
	var start = document.cookie.indexOf(CookieName + '=');
	var len = start + CookieName.length + 1;
		if ((!start) && (CookieName != document.cookie.substring(0,CookieName.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 setCookie(CookieName,value,expires,path,domain,secure) {
	var theDom;
	if(document.location.href.indexOf('realize.gr') > -1)
		theDom = 'realize.gr';
	else
		theDom = 'eurobank.gr';

	Write2Cookie(CookieName, value, theDom);
}

function __setCookie(name, value) 
{	 	
	var secure = 1;
	var cook = '';
	var path = '/';
	var domain = 'realize.gr';
	var Zukunft = new Date();
	var expires =  new Date(d.getTime()+(168*60*60*1000));
	expires = expires.toGMTString();
			
	if (name)
		cook = cook + escape(name) + "=";
	
	if (value)
		cook = cook + escape(value);
	
	if (domain)
		cook = cook + "; domain=" + domain;
	
	if (path)
		cook = cook + "; path=" + path;	
		
	if (expires)
		cook = cook + "; expires=" + expires;
	
	document.cookie=cook;
}


function Write2Cookie(name, value, theDom) {
        if(document.location.href.indexOf('insurance') > -1)
		name = name + '-insurance';
	var CookieVal, CookError;
	var domain = theDom;
	var path = '/';
	var Zukunft = new Date();
	var expires =  new Date(Zukunft.getTime()+(168*60*60*1000));
	expires = expires.toGMTString();
	var secure = 1;
	CookieVal = '';
	if (name){
		CookieVal=CookieVal+escape(name)+"=";
	}
	if (value) {
		CookieVal=CookieVal+escape(value);
	}
	if (domain) {
		CookieVal=CookieVal+"; domain="+domain;
	}
	if (path) {
		CookieVal=CookieVal+"; path="+path;
	}
	if (expires) {
		CookieVal=CookieVal+"; expires="+expires; //.toGMTString();
	}
	document.cookie=CookieVal;        //  sets the cookie
}

function setImage(imgSrc) {
	try {
		var td = document.getElementsByTagName('td');
		for(var i = 0; i < td.length; i++)
			if(td[i].id == 'mainArea') {																			
				var tmp = "url(" + imgSrc + ")";
				td[i].style.backgroundImage = tmp				
				break;
			}
		} catch(e) { }
}


// Create position and fix objects
function writeTable() {
	document.write('<table id="lr" width="100%" cellpadding="0" border="0" cellspacing="0" height="');	
	if(navigator.appName.toLowerCase().indexOf('explorer') < 0) {
		if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1 
				|| navigator.userAgent.toLowerCase().indexOf('firebird') > -1)
			document.write(document.body.clientHeight);
		else
			document.write(document.body.clientHeight - 60);
	}
	else
		document.write('100%');
	document.write('">');
}

function writeSpacer() {
	if(navigator.appName.toLowerCase().indexOf('explorer') < 0)
		document.write('<img id="spacer" src="images/empty.gif" width="1" height="120">');
}

function fix() {
	var heg = document.getElementById('cont').offsetHeight;
	var obj = document.getElementById('mainTable');
	var obj2 = document.getElementById('lr');
	try {		
		if(document.getElementById('photo'))
			document.getElementById('spacer').style.display = '';
		else
			document.getElementById('spacer').style.display = 'none';
		document.getElementById('spacer').setAttribute('height', 120);
	} catch(e) { }
	if(heg < document.body.clientHeight && navigator.appName.toLowerCase().indexOf('explorer') == -1) {			
			return;
	} else
		return;
	if(navigator.appName.toLowerCase().indexOf('explorer') > -1)
		obj.style.height = parseInt(heg) + 200;
	else
		obj2.setAttribute('height', parseInt(heg));	
}


function rep() {
	return;
	var val = document.body.clientHeight - 210;

	cnt.style.height = document.body.clientHeight;
	return;
	var obj = document.getElementById('lr');
	if(navigator.appName.toLowerCase().indexOf('explorer') > -1)
		obj.style.height = parseInt(cnt.offsetHeight) + 117;
	else {
		obj.setAttribute("height", parseInt(cnt.offsetHeight) + 200);		
	}	
}


function _reposition() {
	var ob = document.getElementById('phototop');	
	var obj = document.getElementById('cont');
	obj.style.top = divTop;
	var scr = screen.availHeight - 330;
	if(scr > obj.offsetHeight) {
		var o2 = document.getElementById('tb2');
		o2.style.height = screen.availHeight - 450;		
	}
	try {
		if(obj = document.getElementById('phototop')) {
			var cell = document.getElementById('rCell');
			if(obj.getElementsByTagName('object').length > 0)
				cell.style.paddingTop = '180px';
			else
				cell.style.paddingTop = '0px';

			if(navigator.userAgent.toLowerCase().indexOf('linux') > -1 
				|| navigator.userAgent.toLowerCase().indexOf('opera') > -1
					|| document.getElementById('phototop').innerHTML.toLowerCase().indexOf('.jpg') > -1
						|| document.getElementById('phototop').innerHTML.toLowerCase().indexOf('.gif') > -1) {
				cell.style.paddingTop = '180px';
				o3 = document.getElementById('phototop');
				if(o3.innerHTML.toLowerCase().indexOf('.jpg') == -1
						&& o3.innerHTML.toLowerCase().indexOf('.gif') == -1) {
					o3.innerHTML = '<img src="images/foto2.jpg">';
				}
			}
		} 
		if(document.getElementById('phototop').innerHTML.toLowerCase().indexOf('.gif') > -1) {
			document.getElementById('rCell').style.paddingTop = '180px';
		}
	} catch(e) { }
	try {
		var content = document.getElementById('theContent');
		var li = content.getElementsByTagName('li');
		for(var i = 0; i < li.length; i++) {
			li[i].style.color = '#D1564E';
			li[i].innerHTML = '<span class="txtGrey">' + li[i].innerHTML + '</span>';
		}	
	} catch(e) { }
}

function _reposition2() {
	var isIE = (navigator.appName.toLowerCase().indexOf('explorer') > -1 ? 1 : 0);
	var obj = document.getElementById('cont');
	if(isIE)
		obj.style.top = 212
	else {
		obj.style.top = '200px';
		obj.style.height = document.body.clientHeight + 'px'
	}
	
	try {
		if(obj = document.getElementById('phototop')) {
			var cell = document.getElementById('rCell');
			if(obj.getElementsByTagName('object').length > 0)
				cell.style.paddingTop = '180px';
			else
				cell.style.paddingTop = '0px';

			if(navigator.userAgent.toLowerCase().indexOf('linux') > -1 
				|| navigator.userAgent.toLowerCase().indexOf('opera') > -1
					|| document.getElementById('phototop').innerHTML.toLowerCase().indexOf('.jpg') > -1) {
				cell.style.paddingTop = '180px';
				o3 = document.getElementById('phototop');
				o3.innerHTML = '<img src="images/foto2.jpg">';
			}
		} 
	} catch(e) {  }
	return;	
}

function swap() {
	try {
		var obj = document.getElementById('tab');
		var cell1 = obj.rows[0].cells[0].innerHTML;
		var cell2 = obj.rows[0].cells[1].innerHTML;
	
		var cell3 = obj.rows[1].cells[0].innerHTML;
		var cell4 = obj.rows[1].cells[1].innerHTML;
	
		var text = document.getElementById('submitLink').innerHTML;
		document.getElementById('submitLink').innerHTML = '';
		obj.rows[0].cells[0].innerHTML = cell3;
		obj.rows[0].cells[1].innerHTML = cell4;
		obj.rows[1].cells[0].innerHTML = cell1;
		obj.rows[1].cells[1].innerHTML = cell2 + text;										
		document.getElementById('theCode').style.display = 'none';																						
	} catch(e) { }
}

var requiredVersion = 6;
var flash2Installed = false;
var flash3Installed = false;
var flash4Installed = false;
var flash5Installed = false;
var flash6Installed = false;
var maxVersion = 6;
var actualVersion = 0;
var hasRightVersion = false;
var jsVersion = 1.0;

var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true if we're on ie
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // true if we're on windows

jsVersion = 1.1;

if(isIE && isWin){
  document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
  document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
  document.write('</SCR' + 'IPT\> \n');
}


function detectFlash() {  
  if (navigator.plugins) {
    if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
      //var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
      var flashVersion = flashDescription.split(".")[0].split(" ")[flashDescription.split(".")[0].split(" ").length-1];
      flash2Installed = flashVersion == 2;    
      flash3Installed = flashVersion == 3;
      flash4Installed = flashVersion == 4;
      flash5Installed = flashVersion == 5;
      flash6Installed = flashVersion >= 6;
    }
  }
  for (var i = 2; i <= maxVersion; i++) {  
    if (eval("flash" + i + "Installed") == true) actualVersion = i;
  }
  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 3;
  if (actualVersion >= requiredVersion)
    return true;  
  else
    return false;
}