function gtw_cl_a(id,_2,_3,_4,_5){var _6=document.getElementById(id);if(_6==null){return;}if(gtw_ffs_cl){var _7=gtw_cl_fn(null,_3,_2);if(_7!=null){gtw_ffs_cl(_7.id+_3+"collapse",1);}}var _8=_6.value=gtw_cl_c(id,_3,parseFloat(_6.value));if(_5!=-1&&_8==_5){return;}var _9=null,_a=_8;for(;_a>0&&_9==null;_a--){_9=document.getElementById(id+_3+"item_"+(_a-1));}if(_9==null||_9.nextSibling==null){return;}var _b=_9.cloneNode(true);_b.id=id+_3+"item_"+(++_a);gtw_cl_fx(_b,id,_a,_3,_4);gtw_cl_e(_b);_9.parentNode.insertBefore(_b,_9.nextSibling);_6.value=_a+1;}function gtw_cl_r(id,_d,_e,_f,min){var val=document.getElementById(id);var _12=gtw_cl_fn(id,_e,_d);if(val==null||_12==null){return;}var _13=gtw_cl_c(id,_e,parseFloat(val.getAttribute("value")));val.setAttribute("value",_13);if(_13==min){return;}var pos=parseFloat(_12.id.substring(id.length+6));gtw_cl_ch(id,_e,-1,_d);var _15=_12.nextSibling;while(_15!=null){if(_12.nodeType==1&&_15.nodeName.toLowerCase()=="fieldset"){gtw_cl_fx(_15.firstChild,id,pos,_e,_f);var ch=gtw_cl_gr[_15.id];gtw_cl_gr[_15.id]=null;_15.id=id+_e+"item_"+pos++;gtw_cl_gr[_15.id]=ch;}_15=_15.nextSibling;}var _17=gtw_cl_pk(_12);if(_17!=null){var d=document.getElementById(id+_e+"deleted");if(d==null){d=document.createElement("input");d.id=id+_e+"deleted";d.setAttribute("type","hidden");d.setAttribute("name",d.id.replace(_e,_f,"g"));d.setAttribute("value",_17);_12.parentNode.insertBefore(d,val);}else{d.setAttribute("value",d.getAttribute("value")+","+_17);}}if(_13==1){gtw_cl_e(_12);gtw_cl_gr[_12.id]==null;}else{_12.parentNode.removeChild(_12);val.value=_13-1;}}function gtw_cl_pk(_19){if(_19==null){return null;}var _1a=null;if(_19.hasChildNodes()){_1a=gtw_cl_pk(_19.firstChild);}while(_19!=null&&_1a==null){if(_19.nodeType==1&&_19.id!=null&&_19.nodeName.toLowerCase()=="input"&&_19.getAttribute("type")=="hidden"){_1a=_19.getAttribute("value");if(_1a==null||_1a.length==0||isNaN(_1a)){_1a=null;}else{if(_19.id!=null&&_19.id.length>6&&_19.id.substring(_19.id.length-5)=="clctl"){_1a=null;}}}_19=_19.nextSibling;}return _1a;}function gtw_cl_fx(_1b,id,pos,_1e,_1f){if(_1b==null){return;}if(_1b.hasChildNodes()){gtw_cl_fx(_1b.firstChild,id,pos,_1e,_1f);}var idb=id+_1e+"ctl";var _21=idb+((pos<10)?"0"+pos:pos);while(_1b!=null){if(_1b.nodeType==1&&_1b.id!=null&&_1b.id.indexOf(idb)==0){_1b.id=_21+_1b.id.substring(_1b.id.indexOf(_1e,idb.length));var _22=_1b.getAttribute("name");if(_22!=null&&_22!=""){_1b.setAttribute("name",_21.replace(_1e,_1f,"g")+_22.substring(_22.indexOf(_1f,idb.length)));}}_1b=_1b.nextSibling;}}function gtw_cl_c(id,_24,_25){for(var i=0;i<_25;i++){if(document.getElementById(id+_24+"item_"+i)==null){return i;}}return _25;}function gtw_cl_fn(id,_28,_29){while(_29!=null){if(_29.nodeType==1&&_29.nodeName.toLowerCase()=="fieldset"&&(id==null||_29.id.indexOf(id+_28+"item_")==0)){return _29;}_29=_29.parentNode;}return null;}function gtw_cl_fn_ctl(id,_2b,_2c){while(_2c!=null){if(_2c.nodeType!=1||_2c.id==null||_2c.id.length<id.length+6||_2c.id.indexOf(id+_2b)!=0||_2c.nodeName.toLowerCase()!="input"){_2c=_2c.previousSibling;continue;}if(_2c.id.substring(_2c.id.length-5)=="clctl"){return _2c;}_2c=_2c.previousSibling;}}function gtw_cl_e(_2d){if(_2d==null){return;}if(_2d.hasChildNodes()){gtw_cl_e(_2d.firstChild);}while(_2d!=null){if(_2d.nodeType==1){var tag=_2d.nodeName.toLowerCase();if(tag=="fieldset"){gtw_cl_css(_2d,"gtw-citem-new",false);gtw_cl_css(_2d,"gtw-citem-changed",true);}else{if(tag=="input"){if(_2d.id==null||_2d.id.length<6||_2d.id.substring(_2d.id.length-5)!="clctl"){_2d.value="";}else{if(_2d.id.substring(_2d.id.length-5)=="clctl"){_2d.value="0";}}}else{if(tag=="textarea"){_2d.value="";}else{if(tag=="select"){_2d.selectedIndex=0;}}}}}_2d=_2d.nextSibling;}}function gtw_cl_css(_2f,css,_31){if(_2f==null){return;}var cn=_2f.className;if(_31){if(cn==null||cn.length==0||cn.indexOf(css)==-1){return;}var pos=cn.indexOf(css);if(pos>0){pos--;}if(cn.indexOf(" ",pos+css.length)!=-1){_2f.className=cn.substring(0,pos)+cn.substring(cn.indexOf(" ",pos+css.length));}else{_2f.className=cn.substring(0,pos);}}else{if(cn.length!=0&&cn.indexOf(css)!=-1){return;}_2f.className=cn+" "+css;}}var gtw_cl_gr=new Array();function gtw_cl_ch(id,_35,c,s){var _38=document.getElementById(id);var _39=document.getElementById(id+_35+"counter");if(_38==null){return;}var _3a=(_39!=null&&_39.nodeType==1&&_39.firstChild!=null&&_39.firstChild.nodeType==3);var ffs=gtw_cl_fn(id,_35,s);if(gtw_cl_pk(ffs)!=null){gtw_cl_gr[ffs.id]=true;}var i=parseFloat(_38.value);if(_3a){i=parseFloat(_39.firstChild.nodeValue)+c;}if(i<0){return;}var ctl=gtw_cl_fn_ctl(id,_35,ffs.lastChild);if(ctl!=null&&ctl.value=="0"){ctl.value=(gtw_cl_gr[ffs.id]==null)?"1":"2";if(gtw_cl_gr[ffs.id]!=null){gtw_cl_css(ffs,"gtw-citem-changed",false);}}if(gtw_cl_gr[ffs.id]==null&&c>0){if(_3a){_39.firstChild.nodeValue=i;}gtw_cl_gr[ffs.id]=true;}else{if(gtw_cl_gr[ffs.id]!=null&&c<0){if(_3a){_39.firstChild.nodeValue=i;}gtw_cl_gr[ffs.id]=null;}}}