//------------------------------------------------------------------------------
//  JavaScript Common Unit 3.0
//  Copyright 1999-2005 Imediacom AG. All rights reserved.      www.imediacom.ch
//------------------------------------------------------------------------------

CRY = '2005';	// Copyright Year

//------------------------------------------------------------------------------

LOC = '';

if (location.href.indexOf('de.') != -1) {
  lang = 'de.';
}

else if (location.href.indexOf('en.') != -1) {
  lang = 'en.';
}

else if (location.href.indexOf('fr.') != -1) {
  lang = 'fr.';
}
else {
  lang = 'en.';
}

//------------------------------------------------------------------------------

function createWindow(url, nme, att) {
	windowHandle = '';
	windowHandle = window.open(url,nme,att);
}

//------------------------------------------------------------------------------

function changeLanguage(lng) {
	LOC = replaceString(LOC, lang, lng);
	window.location.href = 'default_' + lng + 'asp?pgn=' + LOC;
}

//------------------------------------------------------------------------------		

function cookieDel(nme) {
	exp = new Date()
	exp.setYear(exp.getYear()-1)
	document.cookie = nme + '=;expires=' + exp.toGMTString()
}

//------------------------------------------------------------------------------	

function cookieGet(nme) {
	cookies = document.cookie.split(";")
	if (cookies == "") return ""
	if (cookies[0] == "") return ""
	for (looper = 0; looper < cookies.length; looper++) {
		thiscookie = cookies[looper].split("=")
		if (thiscookie[0] == nme) return thiscookie[1]
	}
	return ""
}

//------------------------------------------------------------------------------

function cookieSet(nme, val) {
	exp = new Date()
	exp.setYear(exp.getYear() + 1)
	document.cookie = nme + '=' + val + ';expires=' + exp.toGMTString()
}

//------------------------------------------------------------------------------

function getDOC_H(doc) {
	var DOC_H = 0, sh, oh;
	if (DOC_H) {
		DOC_H = doc.height;
	}
	else {
		if (doc.body) {
			if (doc.body.scrollHeight) {
				DOC_H = sh = doc.body.scrollHeight;
			}
			if (doc.body.offsetHeight) {
				DOC_H = oh = doc.body.offsetHeight;
			}
			if (sh && oh) {
				DOC_H = Math.max(sh, oh);
			}
		}
	}
	return DOC_H;
}

//------------------------------------------------------------------------------

function mailto(usr, dom1, dom2, sub, bdy) {
	window.location = 'mailto:' + usr + '@' + dom1 + '.' + dom2 + 
	'?subject=' + sub + '&body=' + bdy;  
}

//------------------------------------------------------------------------------

function popUpImage(src, imgW, imgH) {
	var dimensions = 'width=' + imgW +', height=' + imgH +','
	popwin = window.open("", "", dimensions)
	popwin.document.open()
	popwin.document.write('<title>Details</title>');
	popwin.document.write('<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">');
	popwin.document.write('  <img src="' + src + '">');
	popwin.document.write('</body>');
	popwin.document.close()
}

//------------------------------------------------------------------------------

function redirectIFR() {
	if (parent == window) {
		return;
	}
	else {
		if (location.href.indexOf('?mde=') == -1) {
			parent.setIFR_R('I2', location.href + '?mde=3');
			parent.updateMenuLinks(location.href);
			parent.LOC = location.href;
		}
	}
}

//------------------------------------------------------------------------------

function replaceString(str1, str2, str3) {
	var strLength = str1.length
	var txtLength = str2.length;

	if ((strLength == 0) || (txtLength == 0)) {
		return str1;
	}

	var i = str1.indexOf(str2);

	if ((!i) && (text1 != str1.substring(0, txtLength))) {
		return str1;
	}

	if (i == -1) {
		return str1;
	}

	var newstr = str1.substring(0, i) + str3;

	if (i + txtLength < strLength) {
		newstr += replaceString(str1.substring(i + txtLength, strLength), str2, str3);
	}
	return newstr;
}

//------------------------------------------------------------------------------

function setIFR_H(ifr) {
	IFR_W = window.frames[ifr];
	IFR_E = document.getElementById? document.getElementById(ifr): document.all? document.all[ifr]: null;
	if (IFR_E && IFR_W) {
		IFR_E.style.height = "auto";  
		DOC_H = getDOC_H(IFR_W.document);
		if (DOC_H) {
			if (navigator.appName == "Microsoft Internet Explorer") {
				IFR_E.style.height = DOC_H + 00 + "px";
			}
			else {
				IFR_E.style.height = DOC_H + 40 + "px";
			}			
		}
	}
}

//------------------------------------------------------------------------------

function setIFR_R(ifr, url) {
	IFR_W = window.frames[ifr];
	if (IFR_W) {
		IFR_W.location.replace(url);
	}
}

//------------------------------------------------------------------------------

function setIFR_U(ifr, url) {
	if (document.getElementById) {
		document.getElementById(ifr).src = url;
	}
}

//------------------------------------------------------------------------------

function showCopyrightNote(lng) {
	if (lng == 'de.') {
		str = '<font color="#0977B9">© ' + CRY + ' Verband Zürcherischer Kreditinstitute</font>';
	}
	else if (lng == 'en.') {
		str = '<font color="#0977B9">© ' + CRY + ' Association of Zurich Credit Institutes</font>';
	}
	else if (lng == 'fr.') {
		str = '<font color="#0977B9">© ' + CRY + ' Association des instituts de crédit de Zurich</font>';
	}
	else {
		str = '<font color="#0977B9">© ' + CRY + ' Association of Zurich Credit Institutes</font>';
	}
	document.write(str);
}

//------------------------------------------------------------------------------


function showCopyrightLink() {
	if (lang == 'de.') {
		str = '<a target="I1" href="content/files/00_001de.asp">© ' + CRY + ' Verband Zürcherischer Kreditinstitute</a>';
	}
	else if (lang == 'en.') {
		str = '<a target="I1" href="content/files/00_001en.asp">© ' + CRY + ' Association of Zurich Credit Institutes</a>';
	}
	else if (lang == 'fr.') {
		str = '<a target="I1" href="content/files/00_001fr.asp">© ' + CRY + ' Association des instituts de crédit de Zurich</a>';
	}
	else {
		str = '<a target="I1" href="content/files/00_001en.asp">© ' + CRY + ' Association of Zurich Credit Institutes</a>';
	}
	document.write(str);
}

//------------------------------------------------------------------------------

function showPageTitle() {
	document.write('<font color="#0977B9">' + document.title + '</font>');
}

//------------------------------------------------------------------------------

function updateMenuLinks(url) {
	document.getElementById('mnu01lnk01').style.color = '';

	document.getElementById('mnu01lnk02').style.color = '';
	document.getElementById('mnu01lnk03').style.color = '';
	document.getElementById('mnu01lnk04').style.color = '';

	document.getElementById('mnu02lnk02').style.color = '';
	document.getElementById('mnu02lnk03').style.color = '';
	document.getElementById('mnu02lnk04').style.color = '';
	document.getElementById('mnu02lnk05').style.color = '';
	document.getElementById('mnu02lnk06').style.color = '';
	document.getElementById('mnu02lnk07').style.color = '';
	document.getElementById('mnu02lnk08').style.color = '';
	document.getElementById('mnu02lnk09').style.color = '';

	if (url.indexOf('01_001') != -1) document.getElementById('mnu01lnk01').style.color='#FFFFFF';

	if (url.indexOf('de.') != -1) document.getElementById('mnu01lnk02').style.color='#FFFFFF';
	if (url.indexOf('en.') != -1) document.getElementById('mnu01lnk03').style.color='#FFFFFF';
	if (url.indexOf('fr.') != -1) document.getElementById('mnu01lnk04').style.color='#FFFFFF';

	if (url.indexOf('02_') != -1) document.getElementById('mnu02lnk02').style.color='#FFFFFF';
	if (url.indexOf('03_') != -1) document.getElementById('mnu02lnk03').style.color='#FFFFFF';
	if (url.indexOf('04_') != -1) document.getElementById('mnu02lnk04').style.color='#FFFFFF';
	if (url.indexOf('05_') != -1) document.getElementById('mnu02lnk05').style.color='#FFFFFF';
	if (url.indexOf('06_') != -1) document.getElementById('mnu02lnk06').style.color='#FFFFFF';
	if (url.indexOf('07_') != -1) document.getElementById('mnu02lnk07').style.color='#FFFFFF';
	if (url.indexOf('08_') != -1) document.getElementById('mnu02lnk08').style.color='#FFFFFF';
	if (url.indexOf('09_') != -1) document.getElementById('mnu02lnk09').style.color='#FFFFFF';
}

//------------------------------------------------------------------------------

function validateLEN(str) {
	if (str.length == 0) {
		return false;
	}
	return true;
}

//------------------------------------------------------------------------------

function validateINT1(str) {
	chars = "0123456789";
	for (var i = 0; i < str.length; i++) {
		if (chars.indexOf(str.charAt(i)) == -1) {
			return false;
		}
	}
	return true;
}

//------------------------------------------------------------------------------

function validateINT2(str) {
	chars = ".-+0123456789";
	for (var i = 0; i < str.length; i++) {
		if (chars.indexOf(str.charAt(i)) == -1) {
			return false;
		}
	}
	return true;
}

//------------------------------------------------------------------------------