var bannerContent = [
'bayview_park_ad_t.jpg','http://www.sino-leasing.com/v4/residential_sect_tc.asp?id=56','灣景園介紹連結','_blank',
'bowens_lookout_ad.jpg','http://www.sino-leasing.com/v4/residential_sect_tc.asp?id=40','Bowen\'s Lookout介紹連結','_blank',
'central_plaza_ad_t.jpg','http://www.sino-leasing.com/v4/office_sect_tc.asp?id=2','中環廣場介紹連結','_blank',
'china_hk_ctr_ad_t.jpg','http://www.sino-leasing.com/v4/office_sect_tc.asp?id=3','中港城介紹連結','_blank',
'clifford_centre_ad_t.jpg','http://www.sino-leasing.com/v4/industrial_sect_tc.asp?id=96','香港中心介紹連結','_blank',
'corp_park_ad_t.jpg','http://www.sino-leasing.com/v4/industrial_sect_tc.asp?id=110','企業中心介紹連結','_blank',
'exchange_tower_ad_t.jpg','http://www.sino-leasing.com/v4/office_sect_tc.asp?id=129','國際交易中心介紹連結','_blank',
'hk_gold_coast_ad_t.jpg','http://www.sino-leasing.com/v4/residential_sect_tc.asp?id=45','香港黃金海岸介紹連結','_blank',
'island_resort_ad_t.jpg','default.asp?xid=hkp_pfs_r_hk_ir','藍灣半島介紹連結','_self',
'one_silversea_ad_t.jpg','default.asp?xid=hkp_pfs_r_k_oss','一號銀海介紹連結','_self',
'pacific_plaza_ad_t.jpg','http://www.sino-leasing.com/v4/retail_sect_tc.asp?id=71','太平洋廣場介紹連結','_blank',
'pacific_trade_ctr_ad_t.jpg','http://www.sino-leasing.com/v4/industrial_sect_tc.asp?id=101','太平洋貿易中心介紹連結','_blank',
'sino_plaza_ad_t.jpg','http://www.sino-leasing.com/v4/office_sect_tc.asp?id=12','信和廣場介紹連結','_blank',
'the_centrium_ad_t.jpg','http://www.sino-leasing.com/v4/retail_sect_tc.asp?id=74','中央廣場介紹連結','_blank',
'the_hennessy_ad.jpg','http://www.sino-leasing.com/v4/retail_sect_tc.asp?id=128','The Hennessy介紹連結','_blank',
'tst_ctr_ad_t.jpg','http://www.sino-leasing.com/v4/retail_sect_tc.asp?id=62','尖沙咀中心介紹連結','_blank',
'vision_city_ad_t.jpg','default.asp?xid=hkp_pfs_r_nt_vc','萬景峯介紹連結','_self'
]




function displayBanner(w,h,x){ // x=contentName
    var ar = bannerContent;
    if(ar.length == 0 || typeof ar[0] == 'string'){

      return banner_v1x(w,h);
    }
    var ar = banner_getArrayByContentName(typeof x!='undefined'?x:'*');
    var i = Math.floor(Math.random()*(ar.length/4));
    var str = '<A href="'+ar[4*i+1]+'" target="'+ar[4*i+3]+'"><IMG border=0 src="images/banner/'+ar[4*i]+'" width='+w+' height='+h+' '+(x?x:'')+'alt=\"'+ar[4*i+2]+'\">'

    return str;
}


function banner_v1x(w,h){ // for v1.x legacy support
    var ar = bannerContent;
    var i = Math.floor(Math.random()*(ar.length/4));
    return '<A href="'+ar[4*i+1]+'" target="'+ar[4*i+3]+'"><IMG border=0 src="images/banner/'+ar[4*i]+'" width='+w+' height='+h+' alt=\"'+ar[4*i+2]+'\">';
}

function banner_getArrayByContentName(x){
    var arEtc = [];
    for(var i=0; i<ar.length; i++){
      if(x.indexOf(ar[i][0])==0){

        return ar[i][1];
      }
      if(ar[i][0]=='*') arEtc = ar[i][1];
    }

    return arEtc;
}

