';
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] = '
');
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+='
';
selectedDescription+='Paragraphs 4 to 10 of Article XXIV of GATT 1994 (as clarified in the Understanding on the Interpretation of Article XXIV of the GATT 1994) provide legal basis to the formation and operation of customs unions and free-trade areas involving trade in goods and interim agreements resulting to either one or the other.
';
selectedDescription+='Paragraph 2(c) of the so-called Enabling Clause covers preferential trade arrangements in trade in goods involving WTO developing member economies.
';
selectedDescription+='Article V of GATS governs FTAs in the area of trade in services involving both developed and developing WTO member economies.
';
selectedDescription+='The Transparency Mechanism allows for the early announcement of any FTA.';
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.
';
selectedDescription+='Proposed: The parties consider an FTA, governments or ministries issue a joint statement on the FTA’s desirability, or establish a joint-study group and joint-task force to conduct feasibility studies.
';
selectedDescription+='Framework Agreement signed: The parties initially negotiate the contents of a framework agreement (FA), which serves as a framework for future negotiations.
';
selectedDescription+='Negotiations launched: The parties, through the relevant ministries, declare the official launch of negotiations or set the date for such, or start the first round of negotiations.
';
selectedDescription+='Signed but not yet in effect: Parties sign the agreement after negotiations have been completed. However, the agreement has yet to be implemented.
';
selectedDescription+='Signed and in effect: Provisions of FTA come into force, after legislative or executive ratification.';
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='