var IP_TO_COUNTRY_SERVLET_LOCATION = "/ip-to-country/ip";var LOGO_AREA_HOME  = "home";var DEFAULT_LANGUAGE = "en";var LOGO_FILENAME = "logo";var LOGO_EXTENSION = ".png";var LOGO_TYPE_PRIVATE_BANKERS = "pb";var LOGO_TYPE_WEALTH_MANAGERS = "wm";var LOGO_TYPE_ACTIF_MANAGERS  = "am";var country, preferredSupportedLanguage;var logoDef = {"AE": LOGO_TYPE_PRIVATE_BANKERS,"BE":LOGO_TYPE_PRIVATE_BANKERS,"BM":LOGO_TYPE_PRIVATE_BANKERS,"BS":LOGO_TYPE_PRIVATE_BANKERS,"CZ":LOGO_TYPE_PRIVATE_BANKERS,"CH":LOGO_TYPE_PRIVATE_BANKERS,"ES":LOGO_TYPE_PRIVATE_BANKERS,"GB":LOGO_TYPE_PRIVATE_BANKERS,"NL":LOGO_TYPE_PRIVATE_BANKERS,"PO":LOGO_TYPE_PRIVATE_BANKERS,"TR":LOGO_TYPE_PRIVATE_BANKERS,"others":LOGO_TYPE_PRIVATE_BANKERS,"CA":LOGO_TYPE_WEALTH_MANAGERS,"CN":LOGO_TYPE_WEALTH_MANAGERS,"JP":LOGO_TYPE_WEALTH_MANAGERS,"SG":LOGO_TYPE_WEALTH_MANAGERS,"FR":'-',"DE":LOGO_TYPE_PRIVATE_BANKERS}var arrayType = {"fr":logoDef,"en":$.extend({}, logoDef),"nl":$.extend({}, logoDef),"de":$.extend({}, logoDef)};arrayType["fr"] = $.extend(arrayType["fr"], {	"FR":LOGO_TYPE_ACTIF_MANAGERS	});arrayType["de"] = $.extend(arrayType["de"], {	"CA":'-',	"CN":'-',	"JP":'-',	"SG":'-',	"FR":'-'});/*** Call the ip to country servlet to get infos on the country and prefered language* its format should be i.e. "200 CH {fr-ch}" or "200 CH fr-FR,fr,en-US,en"*/function getUserAgentInfo() {	$.ajax({		url:IP_TO_COUNTRY_SERVLET_LOCATION,		data:{},		async:false,		success:dependingOnCountry	});}function dependingOnCountry(data){	var prefLangsConvert = {cz:'cs',pt:'po',tr:'tu',ja:'jp'};	var prefCountryConvert = {en:'US',de:'',es:'',fr:'',it:'',nl:'',jp:'',po:'',tu:'',ru:''}; //if empty then put uppercase	if (data.length >= 6) {				if (data.substr(0, 4) == "200 ") {					// after the "200 " we find the country found by ip mapping. If 00 --> no match found			var countryTemp = data.substr(4, 2);			if (countryTemp != "00") {				country = countryTemp;				countryObtainedFromUserAgent = false;			}			// remove the leading "200 " and set an array containing all the values			var languagesString = data.substring(7, data.length);			var currentLanguage;						while ((languagesString.length > 0) && (country == null || preferredSupportedLanguage == null))			{				commaPosition = languagesString.indexOf(",");								if (commaPosition == -1)					currentLanguage = languagesString;				else					currentLanguage = languagesString.substr(0, commaPosition);							// check if we need to find a supported language				if (preferredSupportedLanguage == null) {					var language = currentLanguage.substr(0, 2).toLowerCase();					preferredSupportedLanguage = (prefLangsConvert[language] != null)?prefLangsConvert[language]:language;				}				// rules for default countries				if (country == null && preferredSupportedLanguage != null && currentLanguage.length == 2) {					(prefCountryConvert[preferredSupportedLanguage] != null)?(country=((prefCountryConvert[preferredSupportedLanguage]!='')?prefCountryConvert[preferredSupportedLanguage]:preferredSupportedLanguage.toUpperCase())):0;				}				if (country == null) {					if (currentLanguage.length == 5)						country = currentLanguage.substr(3, 2).toUpperCase();				}								// Go to the next language				languagesString = languagesString.substring(currentLanguage.length +1, languagesString.length);			}		}	}}getUserAgentInfo();function getLanguage() {	return preferredSupportedLanguage;}function getCountry() {	return country;}/* home */function goodContact(){	var lk = $("#supra-menu .item:eq(2) a");	var tmp =lk.attr('href').split('/');	if(country=='BE'){		switch(preferredSupportedLanguage){			case 'nl':				tmp[1]='NL';				tmp[2]='Brussel';				break;			case 'fr':				tmp[1]='fr';				tmp[2]='Bruxelles';				break;			default:				tmp[1]='en';				tmp[2]='Brussels';		}	}	else if(country=='NL'){		tmp[1]=(preferredSupportedLanguage=='nl')?'NL':'en';		tmp[2]='Amsterdam';	}	lk.attr('href',tmp.join('/'));}var nextBigAd,myTimeout;function goodAds(){	var title='Lombard Odier ',desc='',lk,path='/cosmetic/offices/img/Home/',img=path,pubpath='/cosmetic/banners/',norot=false,showpanel=true;	var lang=preferredSupportedLanguage;	var siteLang=location.href.split('/')[3].toLowerCase();	var pub,nbpub=3;	switch(country){		case 'CH':			if(lang!='it') lang=siteLang;			switch(lang){				case 'fr':					title+='en Suisse';desc='<ul><li><a href="/fr/Bureaux/suisse/Geneve/Presentation.html">Genève</a></li><li><a href="/fr/Bureaux/suisse/Fribourg/Presentation.html">Fribourg</a></li><li><a href="/fr/Bureaux/suisse/lausanne/Presentation.html">Lausanne</a></li><li><a href="/fr/Bureaux/suisse/lugano/Francais/Presentation.html">Lugano</a></li><li><a href="/fr/Bureaux/suisse/vevey/Presentation.html">Vevey</a></li><li><a href="/fr/Bureaux/suisse/zurich/Presentation.html">Zurich</a></li></ul>';				break;				case 'de':					title+='in der Schweiz';desc='<ul><li><a href="/de/Geschaftsstellen/Schweiz/Genf-1/Prasentation.html">Genf</a></li><li><a href="/de/Geschaftsstellen/Schweiz/Freiburg-1/Prasentation.html">Freiburg</a></li><li><a href="/de/Geschaftsstellen/Schweiz/Lausanne-1/Prasentation-3.html">Lausanne</a></li><li><a href="/de/Geschaftsstellen/Schweiz/Lugano-1/Deutsch/Prasentation.html">Lugano</a></li><li><a href="/de/Geschaftsstellen/Schweiz/Vevey-1/Prasentation-2.html">Vevey</a></li><li><a href="/de/Geschaftsstellen/Schweiz/Zurich-1/Prasentation-1.html">Zürich</a></li></ul>';var ad3 = $("#content .smallad:eq(2)"),adrHref="http://strategy.lombardodier.com/suisse/de/";$("h2 a",ad3).html("Schweizer Lösungen").attr("href",adrHref);$(".desc a",ad3).html("Suchen Sie einen Privatbankier?").attr("href",adrHref);$(".img img",ad3).attr("src","/img/home/ad4.jpg");$(".link a",ad3).html("Wir haben das Richtige für Sie").attr("href",adrHref);				break;				case 'it':					title+='a Lugano >';					lk='/en/Offices/Switzerland/Lugano/Italiano/Presentazione2.html';					img+='Lugano.jpg';				break;				default:					title+='in Switzerland';desc='<ul><li><a href="/en/Offices/Switzerland/Geneva/Presentation.html">Geneva</a></li><li><a href="/en/Offices/Switzerland/Fribourg/Presentation.html">Fribourg</a></li><li><a href="/en/Offices/Switzerland/Lausanne/Presentation.html">Lausanne</a></li><li><a href="/en/Offices/Switzerland/Lugano/English/Presentation.html">Lugano</a></li><li><a href="/en/Offices/Switzerland/Vevey/Presentation.html">Vevey</a></li><li><a href="/en/Offices/Switzerland/Zurich/Presentation.html">Zurich</a></li></ul>';			}		break;		case 'NL':			img+='Amsterdam.jpg';			if(lang!='nl') lang=siteLang;			title+='in Amsterdam >';			lk='/Amsterdam/Amsterdam.html';			norot=true;			switch(lang){				case 'nl':					lk='/NL'+lk;				break;				default:					lk='/en'+lk;			}		break;		case 'BE':			img+='Brussel.jpg';			norot=true;			if(lang!='nl') lang=siteLang;			switch(lang){				case 'fr':					title+='à Bruxelles';					lk='/fr/Bruxelles/Bruxelles.html';				break;				case 'nl':					title+='in Brussel';					lk='/NL/Brussel/Brussel.html';				break;				default:					title+='in Brussels';					lk='/en/Brussels/Brussels.html';			}			title+=' >';		break;		default:			showpanel=false;	}	var bigad = $("#bigad"),imgObj=$("img",bigad),panelInfo=$(".caption",bigad);	if(showpanel){		if(norot){			imgObj.attr('src',img);		}		if(desc.indexOf('<ul>')>-1){			$(".desc > strong",bigad).after(desc).remove();		}		else{			$(".desc a",bigad).html(desc).attr('href',lk);			bigad.css({cursor:"pointer"}).click(function(){				location.href=$("a",this).attr("href");			});		}		$("h2",bigad).html(title);	}	(showpanel && !pub)?panelInfo.css({marginLeft:"-280px"}).animate({marginLeft:0},500):((showpanel)?panelInfo.css({marginLeft:"-280px"}):$(".outer",bigad).remove());	if(!norot){		var currentIndex=0;		var bgnav = $('<div id="bg-nav" />');		var imgInner = $('<div id="imgInner" />');		var imgsObj = $("img",imgInner);		var mini = $('<div><img src="/img/r.gif" width="6" height="6" /></div>').css({cursor:'pointer'});		imgInner.append(imgObj).append(imgObj.clone().attr('src',path+'LODH_1.jpg'));		bgnav.append(mini).append(mini.clone()).append(mini.clone());		if(pub){			bgnav.css({top:"3px"});		//	nbpub++;			var imgpub = $('<img src="'+pub+'" width="828" height="238" />');			imgInner.css({width:828*(nbpub+1)+"px"}).prepend(imgpub).append(imgpub.clone());		//	imgInner.css({width:828*(nbpub+1)+"px"}).prepend(imgObj.clone().attr('src',pub)).append(imgObj.clone().attr('src',pub));		//	bgnav.append(mini.clone());		}		else{			imgInner.append(imgObj.clone().attr('src',path+'LODH_4.jpg')).append(imgObj.clone());		}		var moveBigAdTo = function(index){			clearTimeout(myTimeout);			if(currentIndex!=index){				minis.eq(currentIndex).removeClass("on");				currentIndex=index;				minis.eq((currentIndex==nbpub)?0:currentIndex).addClass("on");				if(pub && showpanel && ((currentIndex==0) || (currentIndex==nbpub))) panelInfo.stop().animate({marginLeft:"-280px"},500);				imgInner.stop(true).animate({marginLeft:-(currentIndex*828)+"px"},500,timerTonextBigAd);			}			else{				timerTonextBigAd();			}		}		nextBigAd = function(){			moveBigAdTo(currentIndex==nbpub?0:currentIndex+1);		}		var timerTonextBigAd = function(){			if(currentIndex==nbpub){				currentIndex=0;				imgInner.css({marginLeft:0});			}			if(pub && showpanel && (currentIndex>0)) panelInfo.stop().animate({marginLeft:0},500);			myTimeout = setTimeout('nextBigAd()',4000);		}		var minis = $('div',bgnav).click(function(){			moveBigAdTo(minis.index(this));		});		mini.addClass("on");		bigad.append($('<div id="imgOuter" />').append(imgInner)).append(bgnav);		$(window).load(timerTonextBigAd);	}	$("#content .smallad:not(#news)").css({cursor:"pointer"}).hover(function(){		if(this.id=="lk-book"){			var a=$("a",this);			var tab = a.attr("href").split('/');			tab[2]=getLanguage().toUpperCase();			lnk = tab.join('/');			a.each(function(){this.href=lnk});			$(this).removeAttr('id');		}		$(this).addClass('on');	},	function(){		$(this).removeClass('on');	}	).click(function(){		window.location=$("a",this).attr("href");		return false;	});	//.focus(function(){$(this).addClass('on')}).blur(function(){$(this)removeClass('on')}).keyup(function(){$(this).click()})}/* fin home */function getLogoFileName(language, area) {	(area!=null)?(area+='-'):(area='');	// Check if le arrayType language exists	(arrayType[language] == null)?(language = DEFAULT_LANGUAGE):0;			// Check if array country exists for language	logoType = (arrayType[language][country])?arrayType[language][country]:arrayType[language]["others"];	return area + LOGO_FILENAME + ((logoType!='-')?('-' + logoType + '-' + language):'') + LOGO_EXTENSION;}function getLogoFileNameForHome(language) {	return getLogoFileName(language, LOGO_AREA_HOME);}var max,newsIndex=0,newsContainer,lkNews,newsArray = new Array();var nextNextNews = function(){	var oldIndex=((newsIndex==0)?max:newsIndex)-1;	newsContainer.stop().animate({opacity:0},1500);	setTimeout('nextNews()',1500);};var nextNews = function(){	newsContainer.stop().css({opacity:0,display:'block'}).html(newsArray[newsIndex].txt).animate({opacity:1},1500);	lkNews.attr('href',newsArray[newsIndex++].href);	(newsIndex>=max)?(newsIndex=0):0;	setTimeout('nextNextNews()',7000);};var loadNews = function(obj,path){	newsContainer=$('#'+obj+' .desc a');	lkNews=$('#'+obj+' .caption :not(.link) a');	newsContainer.html('');	$.ajax({		url:path+'news.xml',		dataType: "text",		data:{},		success:showNews	});}var showNews = function(data){//ie only read known tags...	$('h2',$('<div>'+data.replace(/<\?xml[^>]*>/gi,'').replace(/tickerSummary/gi,'h2').replace(/urlLink/gi,'a')+'</div>')).each(function(){		newsArray.push({txt:$(this).text().replace(/&lt;/gi,'<').replace(/&gt;/gi,'>').replace(/<\/?(p|(div)|(script))[^>]*>/gi,''), href:$(this).next().text()});	});	max=newsArray.length;	nextNews();}$('#print').live('click', function(){print();return false;});$(document).ready(function(){	$('#print').die('click').click(function(){print();return false;});	var header=$("#header");	var topMenu=$("#top-menu > .menu > li:has(li)").hover(function(){		$(this).addClass('on');		header.css({zoom:1});	},	function(){		$(this).removeClass('on');		header.css({zoom:''});	});//	$(" > a",topMenu).focus(function(){$(this).parent().addClass('on')}).blur(function(){$(this).parent().removeClass('on')});	$("#top-menu > .menu > li:has(:not(li))").hover(function(){		header.css({zoom:1});	},	function(){		header.css({zoom:''});	});		$("#content .newslist li").hover(function(){		$(this).addClass("over");	},function(){		$(this).removeClass("over");	}).click(function(){		location.href = $("a",this).attr("href");	});	var iframeWebTv = $("#content iframe");	if((iframeWebTv.length>0)&&(iframeWebTv.attr("src").indexOf("menuwebtv=1")>0)){		$("#menu").remove();		$("#container").addClass("office");			}		var world = topMenu.filter(".worldmap");	$(" > a, > ul > li > a ",world).css({cursor:'default'}).click(function(){return false;});	$(" > ul > li > a ",world).css({color:'#FFFEFE'});});var hostFrameHeight;$(window).bind("message",function(event){	var e =event.originalEvent;	var iframeWebTv = $("#content iframe");	var param = e.data.split("=");	if(param[0] == "height"){		hostFrameHeight=param[1];		iframeWebTv.height(param[1]);	}	else if(param[0] == "fullscreen"){		if(param[1]=="on"){			iframeWebTv.css({position:'absolute',top:0,left:0,width:"100%",height:"100%",zIndex:'1500'});		}		else{			iframeWebTv.css({position:'',height:hostFrameHeight+"px"});		}	}});
