'); $('#output').slideDown(400); $('#selections').hide(400); } if(!debug && !excelmode){ $.ajax({ type: frm.attr('method'), url: frm.attr('action'), async: true, data: frm.serialize(), cache: false, success: function (data) { showit(data); }, error: function () {alert('Query failed.');} }); }else{ $('#ftaUD').submit(); }return; } errorMessage(); event.preventDefault(); } function showit(dataObj){ var strHtml = ''; var newjson = {}; var arrhead = Array(); var h = ''; var l = ''; var rowspan=0; //TRANSFORM THE OBJECT ARRAY //title'=>$row['title'], 'status'=>$row['status_description'], 'year'=>$row['status_year'] $.each(dataObj.output, function(key, value){ arrhead.push(key);rowspan++; }); $.each(dataObj.output, function(key, value){ $.each(value, function(header, set){ h = header.replace(/\W/g,''); newjson[h] = '

' + header + '

'; $.each(set, function(label, contents){ l = label.replace(/\W/g,''); if(typeof newjson[h + l] !== 'string'){ newjson[h + l] = '' + label + ''; } newjson[h + l] += '
' + contents.replace(/\\/g, '') + '
'; }); }); //newjson[h + l] += '
'; }); for(var ctr=0;ctr

'+arrayFTA[arrhead[ctr]]['title']+'

'; }strHtml = ''+strHtml+''; $.each(newjson, function(key, value){ strHtml += value + '
'; }); setTimeout(function(){ $('#queryoutput').html(''+strHtml+'
'); movepanes(); //ENABLE SUBMIT BUTTON WHEN DONE },1000); } function movepanes(){ $('#ftainfo').slideUp(400); $('#stats').css('overflow','hidden'); $('#stats').hide(400); $('#resultpane').animate( {width:'100%'} ); } function revise(){ $('#resultpane').css('float','right'); $('#resultpane').animate( {width:'70%'} ,400, function(){ $('#stats').slideDown(400); $('#selections').slideDown(400, function(){ $('#resultpane').css('float','left'); $('#queryoutput').html('
'); }); $('#output').slideUp(400); }); } function errorMessage(){ var errcode = 0; if( $(".ftaCheckbox:checked").length == 0 )errcode+=1; if( $(".ftaChkChapters:checked").length == 0 )errcode+=2; if( $("#fta_search_keyword").val().trim() == '')errcode+=4; switch(errcode){ case 3:msg="No FTAs to compaare/browse";break; case 5:msg="No FTAs to compaare/browse";break; case 6:msg="No Chapter OR Search term supplied";break; case 7:msg="Select FTAs to compare/browse with a Search term OR content Chapter";break; }alert(msg); } var isCompareOn = false; function ftaToggleCompare(bt){ if($('.ftaList input').css('display')=='none'){ $('.ftaList input').slideToggle(); $('.ftaList input').attr('disabled',false); $('.ftaList a').css('margin-left','10px'); //bt.children('.btdisc').css('background','#e0faff'); bt.children('.btdisc').addClass('btDepressed'); $('#ftaSelectMode').slideUp(function(){ $('#ftaCompareMode').slideDown(); }); $('.ftanotineffect').css('display','none'); //$('.ftanotineffect a').css('color','#bbb'); //$('.ftanotineffect input').prop('disabled', false); isCompareOn = true; return; } isCompareOn = false; $('.ftanotineffect').css('display','inline-block'); //$('.ftanotineffect a').css('color',''); //$('.ftanotineffect input').prop('disabled', false); $('.ftaList input').slideToggle(); $('.ftaList input').attr('disabled',true); //$('.ftaList a').css('margin-left',''); //bt.children('.btdisc').css('background','#959eaf'); bt.children('.btdisc').removeClass('btDepressed'); $('#ftaSelectionDescription p').text('The FTA Toolkit allows side-by-side comparative analysis of concluded FTAs (In Effect). It compares certain chapters of the FTAs such as market access of goods, trade facilitation, trade remedies, government procurement, and dispute settlement.'); $('#ftaCompareMode').slideUp(function(){ $('#ftaSelectMode').slideDown(); }); $('#ftaSelectMode').addClass('dontprint'); } var initialSelectedLabel=''; var selectedDescription=''; function selectgrouping(mode,bt){ initialSelectedKey=''; initialSelectedLabel=''; $('.ftaMainButtons a').removeClass('btselected'); bt.addClass('btselected'); //$('.ftaHeaderLabel').hide(0); //if(mode==1||mode==2||mode==3||mode==5)$('.ftaHeaderLabel').show(0); switch(mode){ case 5: isViewingWhat = 'Sort by WTO notification'; initialSelected = fta_makeList(arrayNotify,'coded','fulltitle'); fta_makeButtons('Sort by WTO notification:',arrayNotify,'notification','coded','ftaIndexButtonNot','fulltitle'); selectedDescription ='This section lists the free trade agreements according to the rules upon which they are notified to the WTO.

When a WTO member enters into a free trade agreement (FTA), it grants favorable trade conditions to its FTA partners compared to other WTO Members. This deviates from the principles of non-discrimination under the GATT and GATS. WTO Members are allowed to enter into such agreements under certain conditions outlined in the following set of rules: (1) GATT; (2) GATS V; (3) Enabling Clause; and (4) early announcement of an FTA. Each of these rules provides for the notification of FTAs to the WTO.

'; selectedDescription+=' toggle info
'; selectedDescription+=''; break; case 4: isViewingWhat = 'Sort by type'; initialSelected = fta_makeList(arrayType,'coded','typename'); fta_makeButtons('Sort by type:',arrayType,'typename','coded','ftaIndexButtonNot','typename'); selectedDescription='This section lists FTAs according to type.'; break; case 3: isViewingWhat = 'Sort by group'; initialSelected = fta_makeList(arrayGroup,'coded','grpName'); fta_makeButtons('Sort by group:',arrayGroup,'shtName','coded','ftaIndexButtonFul','grpName'); selectedDescription='Lists the Free Trade Agreements engaged into by any of the 49 ADB members in Asia and the Pacific with another economy or an economic bloc within or outside the region.'; break; case 2: isViewingWhat = 'Sort by country'; initialSelected = fta_makeList(arrayCountry,'ctyCode','ctyName'); fta_makeOptions('Sort by economy:',arrayCountry,'ctyName','ctyCode','ftaIndexButtonCty','ctyName'); selectedDescription='This section lists FTAs by economy.'; break; case 1: isViewingWhat = 'Sort by status'; initialSelected = fta_makeList(arrayStatus,'coded','status'); //fta_makeButtons('Sort by status:',arrayStatus,'shorthand','coded','ftaIndexButtonSta','status'); fta_makeButtonsHardCode('Sort by status:',arrayStatus,'shorthand','coded','ftaIndexButtonSta','status'); selectedDescription ='This section lists FTAs according to status.

show/hide info
'; selectedDescription+=''; break; default: isViewingWhat = 'Alphabetical'; initialSelected = fta_makeList(arrayAlpha,'alpha','alpha'); fta_makeButtons('Alphabetical:',arrayAlpha,'alpha','','ftaIndexButtonAlpha',''); selectedDescription='Lists the Free Trade Agreements engaged into by any of the 49 ADB members in Asia and the Pacific with another economy or an economic bloc within or outside the region.'; break; } document.forms['ftaUD']['fy'].value = mode; if(isCompareOn){ $('.ftanotineffect').css('display','none'); //$('.ftanotineffect a').css('color','#bbb'); //$('.ftanotineffect input').prop('disabled', true); } //$("#ftaIndexButtonContainer[name='"+initialSelected+"']").addClass('ftaIndexButtonSelected'); //initialSelectedLabel += initialSelected[1]; //$("#" + initialSelected[0] ).slideToggle('slow'); } function fta_makeOptions(label,arr,idxName,idxCode,classname,idxTitle){ var titlestr=''; var initialClass='ftaIndexButtonSelected'; if(idxCode=='')idxCode=idxName; //var s='

ALL
'; //s += '
Select a country/economy:
'; //var s='
All
'; for(var ctr=0;ctr'+arr[ctr][idxName]+''; initialClass=''; }s += '
'; $('#ftaIndexHeader').slideUp(function(){ $('#ftaSelectionDescription p').html(selectedDescription); $('#ftainfo_notification').slideDown(400); $('#ftainfo_status').slideDown(400); $('#ftaIndexButtonContainer').html(s); //$('#ftaSortLabel').html(label + '
'); $('#ftaSortLabel').html(label); //$('#ftaSelectedLabel').hide(0); $('#ftaIndexHeader').slideDown(function(){ //$("#ftaSelectedLabel").html(initialSelectedLabel); //$('#ftaSelectedLabel').slideDown(200); }); }); } function fta_selectOption(bt){ //$("#ftaBtAll").removeClass('ftaIndexButtonSelected'); bt.blur(); bt = bt.options[bt.selectedIndex]; selected = bt.value; if(selected=='ftaBtAll'){ $(".ftalist").slideDown(); return; } $(".ftalist").hide(0); $("#ftaSelectedLabel").html(bt.title); $("#" + selected).slideToggle('slow'); } function fta_makeButtonsHardCode(label,arr,idxName,idxCode,classname,idxTitle){ var titlestr=''; var initialClass='ftaIndexButtonSelected'; if(idxCode=='')idxCode=idxName; var s=''; $('#ftaIndexHeader').slideUp(function(){ $('#ftaSelectionDescription p').html(selectedDescription); $('#ftainfo_status').slideDown(400); $('#ftaIndexButtonContainer').html(s); //$('#ftaSortLabel').html(label + '
'); $('#ftaSortLabel').html(label); //$('#ftaSelectedLabel').hide(0); $('#ftaIndexHeader').slideDown(function(){ //$("#ftaSelectedLabel").html(initialSelectedLabel); //$('#ftaSelectedLabel').slideDown(200); }); }); } function fta_makeButtons(label,arr,idxName,idxCode,classname,idxTitle){ var titlestr=''; var initialClass='ftaIndexButtonSelected'; if(idxCode=='')idxCode=idxName; var s='

ALL
'; //var s='
All
'; for(var ctr=0;ctr
'+arr[ctr][idxName]+'
'+(itmcount>1 ? itmcount+' FTAs' : '1 FTA')+'
'; initialClass='' } $('#ftaIndexHeader').slideUp(function(){ $('#ftaSelectionDescription p').html(selectedDescription); $('#ftainfo_notification').slideDown(400); $('#ftaIndexButtonContainer').html(s); //$('#ftaSortLabel').html(label + '
'); $('#ftaSortLabel').html(label); //$('#ftaSelectedLabel').hide(0); $('#ftaIndexHeader').slideDown(function(){ //$("#ftaSelectedLabel").html(initialSelectedLabel); //$('#ftaSelectedLabel').slideDown(200); }); }); } function fta_makeList(arr,keyname,labelname){ var htmStart = '
').appendTo($(target)); } function popupAnnotation(o){ const _offsetICO = o.offset(); const _offsetPARA = o.parent().offset(); const trg = o.parent().hasClass('annotspop') ? o.closest('.annotspop') : o.next().closest('.annotspop'); const l = _offsetICO.left - _offsetPARA.left; //const l = (_offset.left-trg.width()) / 2; $('.annotspop').each(function(){ if($(this).is($(trg))==false){ $(this).hide(); } }) trg.slideToggle(200); this.event.stopPropagation(); } function popupClose(o){ o.closest('.annotspop').hide(); this.event.stopPropagation(); } function disableVicinity(target){ $(target).removeAttr('onclick').addClass('deactivated'); $(target).prev().addClass('deactivated').attr("disabled", true); } //]]>