function StateSelector(b,a){this.SelectorClientID=b;this.SelectorClientName=a}StateSelector.prototype.SelectorClientID="";StateSelector.prototype.SelectorClientName="";StateSelector.prototype.LoadStateSelections=function(){var n=Get(this.SelectorClientID+"_HiddenFieldStateSelections").value.split(";");
var i=Get(this.SelectorClientID+"_HiddenFieldCountrySelections").value.split(";");if(n.length>0){var h=Get(this.SelectorClientID+"_DropDownListCountries");var l=Get(this.SelectorClientID+"_TextboxCountry");
var b=Get(this.SelectorClientID+"_DropDownListPrimaryState");var j=Get(this.SelectorClientID+"_DropDownListCAProvince");var m=Get(this.SelectorClientID+"_DropDownListAUState");var g=Get(this.SelectorClientID+"_TextboxState");
h.selectedIndex=4;for(var k=0,f;f=h.options[k];k++){if(f.value==i[0]){h.selectedIndex=k}}if(i[0].toString().toUpperCase()=="USA"){for(var e=0,a;a=b.options[e];e++){if(a.value==n[0]){b.selectedIndex=e}}}else{if(i[0].toString().toUpperCase()=="CANADA"){for(var e=0,a;
a=j.options[e];e++){if(a.value==n[0]){j.selectedIndex=e}}}else{if(i[0].toString().toUpperCase()=="AUSTRALIA"){for(var e=0,a;a=m.options[e];e++){if(a.value==n[0]){m.selectedIndex=e}}}else{g.value=n[0];if(h.selectedIndex==4){l.value=i[0]
}}}}for(var o=1,d,f;d=n[o],f=i[o];o++){this.AddState(d,f)}}};StateSelector.prototype.AddState=function(e,B){var A=this;var o=Get(this.SelectorClientID+"_DivStateSelector");var d=Get(this.SelectorClientID+"_DropDownListCountries");
var m=Get(this.SelectorClientID+"_TextboxCountry");var H=Get(this.SelectorClientID+"_DropDownListPrimaryState");var b=Get(this.SelectorClientID+"_DropDownListCAProvince");var f=Get(this.SelectorClientID+"_DropDownListAUState");
var D=Get(this.SelectorClientID+"_TextboxState");var u=Get(this.SelectorClientID+"_chkInternational");var g=Elem("div");var E=Elem("table");row=E.insertRow(E.rows.length);var w=row.insertCell(row.cells.length);
var v=row.insertCell(row.cells.length);var t=row.insertCell(row.cells.length);var q=row.insertCell(row.cells.length);var i=Elem("a");var I=Elem("img");var z=Elem("select",H.name);g.style.padding="2px 0 0 0";
z.style.verticalAlign="middle";z.style.width="190px";for(var r=0,l;l=H.options[r];r++){z.appendChild(l.cloneNode(true))}z.onchange=function(){A.UpdateSelectionList();return false};z.selectedIndex=0;var C=Elem("select",b.name);
C.style.verticalAlign="middle";C.style.width="190px";for(var r=0,l;l=b.options[r];r++){C.appendChild(l.cloneNode(true))}C.onchange=function(){A.UpdateSelectionList();return false};C.selectedIndex=0;var a=Elem("select",f.name);
a.style.verticalAlign="middle";a.style.width="190px";for(var r=0,l;l=f.options[r];r++){a.appendChild(l.cloneNode(true))}a.onchange=function(){A.UpdateSelectionList();return false};a.selectedIndex=0;var G=Elem("input",D.name);
G.type="text";G.style.verticalAlign="middle";G.style.width="196px";G.onchange=function(){A.UpdateSelectionList();return false};G.value="";i.style.textDecoration="none";i.style.fontWeight="bold";i.style.fontSize="11px";
i.style.color="#B81818";i.href="#";i.onclick=function(){A.RemoveState(g);return false};I.src="/images/delete_icon.gif";I.width=16;I.height=16;I.align="absmiddle";I.style.verticalAlign="text-bottom";I.alt="X";
i.appendChild(I);i.appendChild(Text("Remove"));w.appendChild(z);w.appendChild(C);w.appendChild(a);w.appendChild(G);var k=Elem("select",d.name);for(var r=0,y;y=d.options[r];r++){k.appendChild(y.cloneNode(true))
}k.onchange=function(){A.ChangeCountry();A.UpdateSelectionList();return false};var j=Elem("input",m.name);j.type="text";j.style.verticalAlign="middle";j.style.width="150px";j.onchange=function(){A.UpdateSelectionList();
return false};j.value="";v.appendChild(k);t.appendChild(j);q.appendChild(i);g.appendChild(E);o.appendChild(g);o=null;k.selectedIndex=d.selectedIndex;if(e!=null&&e!=undefined&&B!=null&&B!=undefined){for(var F=0,n;
n=k.options[F];F++){if(n.value==B){k.selectedIndex=F}}if(B.toString().toUpperCase()=="USA"){for(var x=0,h;h=z.options[x];x++){if(h.value==e){z.selectedIndex=x}}}else{if(B.toString().toUpperCase()=="CANADA"){for(var x=0,h;
h=C.options[x];x++){if(h.value==e){C.selectedIndex=x}}}else{if(B.toString().toUpperCase()=="AUSTRALIA"){for(var x=0,h;h=a.options[x];x++){if(h.value==e){a.selectedIndex=x}}}else{G.value=e}}}}this.ChangeCountry();
this.UpdateSelectionList();this.ShowHideCountries(u)};StateSelector.prototype.RemoveState=function(a){var b=Get(this.SelectorClientID+"_DivStateSelector");b.removeChild(a);b=null;this.UpdateSelectionList()
};StateSelector.prototype.UpdateSelectionList=function(){var e=this.GetAllSelects();var c="";var f="";for(var i=0,h;h=e[i];i++){var b="";var a="";if(h.name==this.SelectorClientName+"$DropDownListCountries"){if(h.value!=null){a=h.value;
if(h.value.toUpperCase()=="USA"){if(e[i-3].value!="-1"){b=e[i-3].value}}else{if(h.value.toUpperCase()=="CANADA"){if(e[i-2].value!="-1"){b=e[i-2].value}}else{if(h.value.toUpperCase()=="AUSTRALIA"){if(e[i-1].value!="-1"){b=e[i-1].value
}}else{var d=h.parentNode.parentNode.getElementsByTagName("input")[0];b=d.value.replace(/^\s+|\s+$/g,"");if(a.toUpperCase()=="OTHER"){var g=h.parentNode.parentNode.getElementsByTagName("input")[1];a=g.value.replace(/^\s+|\s+$/g,"")
}}}}}}if(b!=""){if(c.length>0){c+=";";f+=";"}c+=b;f+=a}}Get(this.SelectorClientID+"_HiddenFieldStateSelections").value=c;Get(this.SelectorClientID+"_HiddenFieldCountrySelections").value=f};StateSelector.prototype.GetAllSelects=function(){var b=new Array();
var a=Get(this.SelectorClientID+"_DivStateSelector");b[0]=Get(this.SelectorClientID+"_DropDownListPrimaryState");b[1]=Get(this.SelectorClientID+"_DropDownListCAProvince");b[2]=Get(this.SelectorClientID+"_DropDownListAUState");
b[3]=Get(this.SelectorClientID+"_DropDownListCountries");this.GetAdditionalSelectsRecursive(a,b);a=null;return b};StateSelector.prototype.GetAdditionalSelectsRecursive=function(a,c){var d=a.childNodes;
for(var e=0,b;b=d[e];e++){if(b.nodeName.toUpperCase()=="SELECT"){c[c.length]=b}else{if(b.childNodes.length>0){this.GetAdditionalSelectsRecursive(b,c)}}}return c};StateSelector.prototype.ChangeCountry=function(){var b=document.getElementsByName(this.SelectorClientName+"$DropDownListCountries");
for(var h=0;h<b.length;h++){var d=b[h];var a=d.parentNode.parentNode.getElementsByTagName("select")[0];var c=d.parentNode.parentNode.getElementsByTagName("select")[1];var g=d.parentNode.parentNode.getElementsByTagName("select")[2];
var f=d.parentNode.parentNode.getElementsByTagName("input")[0];var e=d.parentNode.parentNode.getElementsByTagName("input")[1];if(d.value.toString().toUpperCase()=="USA"){a.style.display="block";c.style.display="none";
g.style.display="none";f.style.display="none";e.style.display="none"}else{if(d.value.toString().toUpperCase()=="CANADA"){a.style.display="none";c.style.display="block";g.style.display="none";f.style.display="none";
e.style.display="none"}else{if(d.value.toString().toUpperCase()=="AUSTRALIA"){a.style.display="none";c.style.display="none";g.style.display="block";f.style.display="none";e.style.display="none"}else{a.style.display="none";
c.style.display="none";g.style.display="none";f.style.display="block";e.style.display="none";if(d.value.toString().toUpperCase()=="OTHER"){e.style.display="block"}}}}}};StateSelector.prototype.ShowHideCountries=function(b){var a=document.getElementsByName(this.SelectorClientName+"$DropDownListCountries");
for(var c=0;c<a.length;c++){if(b.checked){a[c].style.display="block";Get(this.SelectorClientID+"_internationalDisclaimer").style.display="block";if(Get(this.SelectorClientID+"_AddLocationLabel")){Get(this.SelectorClientID+"_AddLocationLabel").innerHTML="Add Another Location"
}}else{a[c].style.display="none";a[c].selectedIndex=0;this.ChangeCountry();Get(this.SelectorClientID+"_internationalDisclaimer").style.display="none";if(Get(this.SelectorClientID+"_AddLocationLabel")){Get(this.SelectorClientID+"_AddLocationLabel").innerHTML="Add A State"
}}}};StateSelector.prototype.SetDefaultCountries=function(b){var a=document.getElementsByName(this.SelectorClientName+"$DropDownListCountries");for(var c=0;c<a.length;c++){if(b.checked){a[c].selectedIndex=2;
this.ChangeCountry()}}};
