$(function(){$('body').removeClass('scriptless');if($('#home')){var nS=$('#newsSlide');var choosenHeight=Math.ceil((nS.height()-nS.children('a.more').outerHeight(false))/nS.children('h3').length);$('#newsSlide h3').each(function(index){var vPad=Math.abs((choosenHeight-$(this).height())/2);$(this).css('padding',vPad+'px 0 '+vPad+'px 0');});var selNews=Math.round(Math.random()*nS.children('h3').length)-1;nS.tabs($('#newsSlide .pane'),{tabs:'h3',effect:'fade',fadeOutSpeed:"slow",event:'mouseover',initialIndex:selNews});var focus=$('#accordion');focus.children('.pane').each(function(index){if(index!=0)$(this).css('display','none');});choosenHeight=Math.ceil(focus.height()-(focus.children('h3').outerHeight(false)*focus.children('h3').length));focus.children('.pane').css('height',choosenHeight);$.tools.tabs.addEffect("simulSlide",function(i,done){this.getPanes().slideUp();this.getPanes().eq(i).slideDown(function(){done.call();});});focus.tabs(focus.children('.pane'),{tabs:'h3',effect:'simulSlide',initialIndex:null});var tallest=0;$('.keyIssue p').each(function(){var thisHeight=$(this).height();if(thisHeight>tallest){tallest=thisHeight;}});$('.keyIssue p').height(tallest);$('#accordion .pane').blockify({hoverClass:'hover'});$('#homeKeyissues .keyIssue').blockify({hoverClass:'hover'});$('#newsSlide .pane').blockify({hoverClass:'hover'});}
$('.sideNav li').first().addClass('first');if($('country')||$('topic')){$('#cFocus .pane').each(function(index){$('<a>'+(index+1)+'</a>').appendTo('#cFocus .tabs');});$('#cFocus').tabs($('#cFocus .pane'),{tabs:'.tabs a',event:'mouseover',initialIndex:0});}
if($('#subPanels')){var listHeight=$('#subSubList').height(),tallest=listHeight;$('.subSubPane').each(function(){var tH=$(this).height();tallest=(tH<tallest)?tallest:tH;});$('#subSubList, .subSubPane').css('height',tallest);if(tallest>listHeight){var sI=$('#subSubList').find('li'),choosenHeight=Math.floor(tallest/sI.length);sI.each(function(index){var vPad=Math.abs((choosenHeight-$(this).height())/2);$(this).css('padding-top',vPad+'px').css('padding-bottom',vPad+'px');});}
$("#subPanels").tabs($('#subPanels .subSubPane'),{tabs:'li',effect:'default',event:'mouseover',initialIndex:0});var $highestCol=Math.max($('#cResearch').height(),$('#subPanels').height());$('#cResearch').height($highestCol);$('#subPanels').height($highestCol);}
if($('#newsRow')){var tallest=0;$('#newsRow > div').each(function(){var thisHeight=$(this).height();if(thisHeight>tallest){tallest=thisHeight;}});$('#newsRow .morebg').each(function(){var thisHeight=tallest-$(this).parent().parent().height();$(this).css('margin-top',thisHeight+'px');});}
var lastbreadbrumb=$('.breadCrumb a:last').text();if(lastbreadbrumb=="By Country"){$('body').attr('id','bycountry');$('.topicsList').addClass('bycountry').removeClass('topicsList');}
else if(lastbreadbrumb=="Par pays"){$('body').attr('id','bycountry');$('.topicsList').addClass('bycountry').removeClass('topicsList');}
else if(lastbreadbrumb=="By Topic"){$('body').attr('id','countryByTopics');}
else{}
function asc_sort3(a,b){return-($(b).text().toUpperCase()).localeCompare($(a).text().toUpperCase());}
$('.bycountry').addClass('topicsList');$('#countriesList .pane > ul').makeacolumnlists({cols:5});$('#topicsList .pane > ul').makeacolumnlists({cols:4});$('#nav a.hasPanel').each(function(){$($(this).attr('href')).detach().appendTo($(this).parent());});$('#mainPanels').remove();$("#nav a.hasPanel").click(function(e){e.preventDefault();$($(e.target).closest('li')).toggleClass('active').siblings().removeClass('active');$($(e.target).closest('ul')).bind("mouseoveroutside",function(event){$(this).children('.active').removeClass('active').unbind();});});$("#countriesList .tabs").tabs("#countriesList .pane",{event:'mouseover'});$('#nav .pane').bgiframe();$("#form-1, #form-2, #form-3").hide();$("#choose-form").change(function(){$("#form-1, #form-2, #form-3").hide();$("#"+$(this).val()).show();});if($("#dialog-form")&&($("#dialog-form").length>0)){$("#dialog-form").dialog({autoOpen:false,modal:true,width:600,height:600});$("#open-form").click(function(){$("#dialog-form").dialog("open");});}
$("#countrylisting .azblock h2").each(function(){var currentcountry=$(this);var countryvalue=currentcountry.text();var firstchar=countryvalue.charAt(0);currentcountry.parent().attr('id',firstchar);countryvalue=countryvalue.replace(/\s+/g,'').replace(',','').replace('(','').replace(')','').replace('â€™','').replace('Ã‰','E').replace('Ã©','e').replace('ÃŽ','i').replace('Ã´','o').replace('\'','').toLowerCase();currentcountry.addClass(countryvalue);});function asc_sort(a,b){return-($(b).text()).toLowerCase().localeCompare(($(a).text().toLowerCase()));}
$(".azblock").sort(asc_sort).appendTo('#countrylisting');var clazz='.Topics';if(!$(clazz).length){clazz='.Thèmes';}
$(clazz+' .bycountry li a').each(function(){var thiscountry=$(this);var countryname=thiscountry.text();var firstcharacter=countryname.charAt(0);thiscountry.parent().addClass(firstcharacter);countryname=countryname.replace(/\s+/g,'').replace(',','').replace('(','').replace(')','').replace('â€™','').replace('Ã´','o').replace('Ã‰','E').replace('Ã©','e').replace('ÃŽ','i').replace('\'','').toLowerCase();var newcountryname=countryname.charAt(0).toUpperCase()+countryname.slice(1);thiscountry.parent().addClass(newcountryname);thiscountry.before('<span class="flag"></span>');});for(var i=65;i<=90;i++){var letter=(String.fromCharCode(i));$(clazz+' .countrylisting .bycountry li.'+letter+':first').before('<li class="aSplit li_col1"><a name="#'+letter+'"><span>'+letter+'</span></a></li>');}
$(clazz+' .countrylisting .bycountry li').sort(asc_sort3).appendTo('.bycountry');$(clazz+' .countrylisting .bycountry').makeacolumnlists({cols:3,colWidth:220});function asc_sort4(a,b){return($(b).text())<($(a).text());}
var newlist=$('#countryByTopics .topicsList li').sort(asc_sort4).appendTo('.topicsList');;$('#countryByTopics .topicsList').makeacolumnlists({cols:4,equalHeight:'li'});$.fn.inGroupsOf=function(countPerGroup){var groups=[],offset=0,$group;while(($group=this.slice(offset,(countPerGroup+offset))).length){groups.push($group);offset+=countPerGroup;}
for(i=0;i<groups.length;i++){}
return groups;};});$(document).ready(function(){if(typeof String.prototype.endsWith!='function'){String.prototype.endsWith=function(str){return this.substring(this.length-str.length,this.length)===str;}};$("#pageContent a[href]").each(function(){var linkValue=$(this).attr("href").replace(/[#]|\//g,'');if(linkValue.endsWith(".pdf")||linkValue.endsWith(".doc")||linkValue.endsWith(".docx")||linkValue.endsWith(".ppt")||linkValue.endsWith(".pptx")||linkValue.endsWith(".xls")||linkValue.endsWith(".xlsx")){$(this).attr("onMouseDown","javascript:_gaq.push(['_trackPageview', '"+$(this).attr('href')+"']);");}});});