function afl(ab,hb,re,uk,te,vk,wk,xk,yk,zk,$k,_k,al,mf,bl){var mk=0;while(true){if(document.getElementById(_k+(mk+1))!=null){mk++;}
else
{break;}
}
var vh=mk+1;if(mk<uk){var cl=document.getElementById('flexibleLocation');var kf=document.createElement('select');kf.name=_k+vh;kf.id=_k+vh;kf.className='location';if(te==2){kf.onchange=new Function("rsaa('"+ab+"', document.getElementById('"+al+"AjaxLoader"+vh+"'), document.getElementById('"+_k+vh+"'), document.getElementById('"+al+vh+"'), document.getElementById('"+bl+vh+"'), '"+xk+"');");}
var option=document.createElement('option');option.value=0;var text=document.createTextNode(vk);option.appendChild(text);kf.appendChild(option);var nk=new Array();var ok=new Array();for(var i=0;i<zk.length;i++){nk[i]=document.createElement('option');nk[i].value=zk[i];ok[i]=document.createTextNode($k[i]);nk[i].appendChild(ok[i]);kf.appendChild(nk[i]);}
var button=document.createElement('input');button.type='button';button.id='removeFlexibleLocation'+vh;if(ab=='zh-tw'){button.value='刪除';}
else if(ab=='zh-cn'){button.value='删除';}
else
{button.value='Remove';}
button.onclick=new Function("rfl("+vh+", "+te+", '"+_k+"', '"+al+"');");cl.appendChild(kf);cl.appendChild(button);if(te>1){var lf=document.createElement('select');lf.name=al+vh;lf.id=al+vh;lf.className='location';lf.disabled=true;var option=document.createElement('option');option.value=0;var text=document.createTextNode(wk);option.appendChild(text);lf.appendChild(option);var nf=document.createElement('img');nf.id=al+'AjaxLoader'+vh;nf.src='/image/ajax_loader.gif';nf.alt='AJAX loading';nf.className='ajax';cl.appendChild(nf);cl.appendChild(lf);}
var dl=document.createElement('div');dl.id='flexibleAddressSection'+vh;var el=document.createElement('input');el.type='text';el.name=bl+vh;el.id=bl+vh;el.size=42;el.maxlength=1024;el.value=xk;dl.appendChild(el);var ze=document.createElement('img');ze.id='flexibleAddressStatus'+vh;ze.src='/image/ajax_loader.gif';ze.alt='AJAX loading';ze.className='hidden';dl.appendChild(ze);cl.appendChild(dl);var fl=document.createElement('div');fl.id='showFlexibleStreetNumber'+vh;cl.appendChild(fl);var $e=document.createElement('div');$e.id='flexibleAddressInformation'+vh;cl.appendChild($e);var gl=document.createElement('input');gl.type='text';gl.name='flexibleLocationDescription'+vh;gl.id='flexibleLocationDescription'+vh;gl.size=42;gl.maxlength=1024;gl.value=yk;cl.appendChild(gl);if(te<=1){var hl=document.createElement('input');hl.type='hidden';hl.name='flexibleSubAdministrativeArea'+vh;hl.id='flexibleSubAdministrativeArea'+vh;dl.appendChild(hl);}
var il=document.createElement('input');il.type='hidden';il.name='flexibleUserAddress'+vh;il.id='flexibleUserAddress'+vh;dl.appendChild(il);var jl=document.createElement('input');jl.type='hidden';jl.name='flexibleGeocodeAccuracy'+vh;jl.id='flexibleGeocodeAccuracy'+vh;dl.appendChild(jl);var kl=document.createElement('input');kl.type='hidden';kl.name='flexibleLocality'+vh;kl.id='flexibleLocality'+vh;dl.appendChild(kl);var ll=document.createElement('input');ll.type='hidden';ll.name='flexibleDependentLocality'+vh;ll.id='flexibleDependentLocality'+vh;dl.appendChild(ll);var ml=document.createElement('input');ml.type='hidden';ml.name='flexiblePostcode'+vh;ml.id='flexiblePostcode'+vh;dl.appendChild(ml);var nl=document.createElement('input');nl.type='hidden';nl.name='flexibleThoroughfare'+vh;nl.id='flexibleThoroughfare'+vh;dl.appendChild(nl);var ol=document.createElement('input');ol.type='hidden';ol.name='flexibleIntersection'+vh;ol.id='flexibleIntersection'+vh;dl.appendChild(ol);var pl=document.createElement('input');pl.type='hidden';pl.name='flexiblePremise'+vh;pl.id='flexiblePremise'+vh;dl.appendChild(pl);var ql=document.createElement('input');ql.type='hidden';ql.name='flexibleLatitude'+vh;ql.id='flexibleLatitude'+vh;dl.appendChild(ql);var sl=document.createElement('input');sl.type='hidden';sl.name='flexibleLongitude'+vh;sl.id='flexibleLongitude'+vh;dl.appendChild(sl);var tl=document.createElement('input');tl.type='hidden';tl.name='previousFlexibleGoogleMapAddress'+vh;tl.id='previousFlexibleGoogleMapAddress'+vh;dl.appendChild(tl);el.onfocus=new Function("document.getElementById('submit').disabled = true; document.getElementById('flexibleAddressWarning').className = 'block red'; this.select();");el.onblur=new Function("gfll(true, "+vh+"); document.getElementById('"+tl.id+"').value = document.getElementById('"+el.id+"').value;");var yd=document.createElement('div');yd.id='flexibleLocationDiv'+vh;yd.className='newLine';var tk=document.createElement('hr');tk.id='flexibleLocationHr'+vh;yd.appendChild(tk);cl.appendChild(yd);}
else
{if(ab=='zh-tw'){alert('現階段最多只能有'+uk+'個彈性地點');}
else if(ab=='zh-cn'){alert('现阶段最多只能有'+uk+'个弹性地点');}
else
{alert('Currently only '+uk+' flexible locations are allowed.');}
}
}
function rfl(ki,te,_k,al){var cl=document.getElementById('flexibleLocation');cl.removeChild(document.getElementById('flexibleLocationDescription'+ki));cl.removeChild(document.getElementById('flexibleAddressInformation'+ki));cl.removeChild(document.getElementById('flexibleAddressSection'+ki));if(te>1){cl.removeChild(document.getElementById(al+'AjaxLoader'+ki));cl.removeChild(document.getElementById(al+ki));}
cl.removeChild(document.getElementById(_k+ki));cl.removeChild(document.getElementById('flexibleLocationDiv'+ki));cl.removeChild(document.getElementById('removeFlexibleLocation'+ki));}
