var aCountry = new Array();
var aReference = new Array();
var aPreselect = new Array();
var csTimeout = false;
var csDefaultTxt = 'Bitte auswählen';
var aSelectReference = new Array();
aCountry['Germany'] = ['Baden-Württemberg','Bayern','Berlin','Brandenburg','Bremen','Hamburg','Hessen','Mecklenburg-Vorpommern','Niedersachsen','Nordrhein-Westfalen','Rheinland-Pfalz','Saarland','Sachsen','Sachsen-Anhalt','Schleswig-Holstein','Thüringen',''];
aCountry['United States of America'] = ['Alabama','Alaska','Arizona','Arkansas','California','Colorado','Connecticut','Delaware','District of Columbia','Florida','Georgia','Hawaii','Idaho','Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana','Maine','Maryland','Massachusetts','Michigan','Minnesota','Mississippi','Missouri','Montana','Nebraska','Nevada','New Hampshire','New Jersey','New Mexico','New York','North Carolina','North Dakota','Ohio','Oklahoma','Oregon','Pennsylvania','Rhode Island','South Carolina','South Dakota','Tennessee','Texas','Utah','Vermont','Virginia','Washington','West Virginia','Wisconsin','Wyoming',''];
aCountry['Australia'] = [''];
aCountry['Canada'] = ['Alberta','British Columbia','Manitoba','New Brunswick','Newfoundland and Labrador','Nunavut','Northwest Territories','Nova Scotia','Ontario','Prince Edward Island','Quebec','Saskatchewan','Yukon',''];
aCountry['France'] = [''];
aCountry['India'] = [''];
aCountry['Afghanistan'] = [''];
aCountry['Albania'] = [''];
aCountry['Algeria'] = [''];
aCountry['American Samoa'] = [''];
aCountry['Andorra'] = [''];
aCountry['Angola'] = [''];
aCountry['Anguilla'] = [''];
aCountry['Antarctica'] = [''];
aCountry['Antigua and Barbuda'] = [''];
aCountry['Argentina'] = [''];
aCountry['Armenia'] = [''];
aCountry['Aruba'] = [''];
aCountry['Ashmore'] = [''];
aCountry['Australia'] = [''];
aCountry['Austria'] = [''];
aCountry['Azerbaijan'] = [''];
aCountry['The Bahamas'] = [''];
aCountry['Bahrain'] = [''];
aCountry['Baker Island'] = [''];
aCountry['Bangladesh'] = [''];
aCountry['Barbados'] = [''];
aCountry['Bassas da India'] = [''];
aCountry['Belarus'] = [''];
aCountry['Belgium'] = [''];
aCountry['Belize'] = [''];
aCountry['Benin'] = [''];
aCountry['Bermuda'] = [''];
aCountry['Bhutan'] = [''];
aCountry['Bolivia'] = [''];
aCountry['Bosnia and Herzegovina'] = [''];
aCountry['Botswana'] = [''];
aCountry['Bouvet Island'] = [''];
aCountry['Brazil'] = [''];
aCountry['British Indian Ocean'] = [''];
aCountry['British Virgin Islands'] = [''];
aCountry['Brunei'] = [''];
aCountry['Bulgaria'] = [''];
aCountry['Burkina Faso'] = [''];
aCountry['Burma'] = [''];
aCountry['Burundi'] = [''];
aCountry['Cambodia'] = [''];
aCountry['Cameroon'] = [''];
aCountry['Canada'] = ['Alberta','British Columbia','Manitoba','New Brunswick','Newfoundland and Labrador','Nunavut','Northwest Territories','Nova Scotia','Ontario','Prince Edward Island','Quebec','Saskatchewan','Yukon',''];
aCountry['Cape Verde'] = [''];
aCountry['Cartier Islands'] = [''];
aCountry['Cayman Islands'] = [''];
aCountry['Central African Republic'] = [''];
aCountry['Chad'] = [''];
aCountry['Chile'] = [''];
aCountry['China'] = [''];
aCountry['Christmas Island'] = [''];
aCountry['Clipperton Island'] = [''];
aCountry['Cocos (Keeling) Islands'] = [''];
aCountry['Colombia'] = [''];
aCountry['Comoros'] = [''];
aCountry['Congo'] = [''];
aCountry['Cook Islands'] = [''];
aCountry['Coral Sea Islands'] = [''];
aCountry['Costa Rica'] = [''];
aCountry['Cote d\'Ivoire'] = [''];
aCountry['Croatia'] = [''];
aCountry['Cuba'] = [''];
aCountry['Cyprus'] = [''];
aCountry['Czech Republic'] = [''];
aCountry['Denmark'] = [''];
aCountry['Djibouti'] = [''];
aCountry['Dominica'] = [''];
aCountry['Dominican Republic'] = [''];
aCountry['Ecuador'] = [''];
aCountry['Egypt'] = [''];
aCountry['El Salvador'] = [''];
aCountry['Equatorial Guinea'] = [''];
aCountry['Eritrea'] = [''];
aCountry['Estonia'] = [''];
aCountry['Ethiopia'] = [''];
aCountry['Europa Island'] = [''];
aCountry['Falkland Islands'] = [''];
aCountry['Islas Malvinas'] = [''];
aCountry['Faroe Islands'] = [''];
aCountry['Fiji'] = [''];
aCountry['Finland'] = [''];
aCountry['France'] = [''];
aCountry['French Guiana'] = [''];
aCountry['French Polynesia'] = [''];
aCountry['French Southern'] = [''];
aCountry['Antarctic Lands'] = [''];
aCountry['Gabon'] = [''];
aCountry['The Gambia'] = [''];
aCountry['Gaza Strip'] = [''];
aCountry['Georgia'] = [''];
aCountry['Ghana'] = [''];
aCountry['Gibraltar'] = [''];
aCountry['Glorioso Islands'] = [''];
aCountry['Greece'] = [''];
aCountry['Greenland'] = [''];
aCountry['Grenada'] = [''];
aCountry['Guadeloupe'] = [''];
aCountry['Guam'] = [''];
aCountry['Guatemala'] = [''];
aCountry['Guernsey'] = [''];
aCountry['Guinea'] = [''];
aCountry['Guinea-Bissau'] = [''];
aCountry['Guyana'] = [''];
aCountry['Haiti'] = [''];
aCountry['Heard Island'] = [''];
aCountry['Holy See (Vatican City)'] = [''];
aCountry['Honduras'] = [''];
aCountry['Hong Kong'] = [''];
aCountry['Howland Island'] = [''];
aCountry['Hungary'] = [''];
aCountry['Iceland'] = [''];
aCountry['India'] = [''];
aCountry['Indonesia'] = [''];
aCountry['Iran'] = [''];
aCountry['Iraq'] = [''];
aCountry['Ireland'] = [''];
aCountry['Israel'] = [''];
aCountry['Italy'] = [''];
aCountry['Jamaica'] = [''];
aCountry['Jan Mayen'] = [''];
aCountry['Japan'] = [''];
aCountry['Jarvis Island'] = [''];
aCountry['Jersey'] = [''];
aCountry['Johnston Atoll'] = [''];
aCountry['Jordan'] = [''];
aCountry['Juan de Nova Island'] = [''];
aCountry['Kazakstan'] = [''];
aCountry['Kenya'] = [''];
aCountry['Kingman Reef'] = [''];
aCountry['Kiribati'] = [''];
aCountry['Korea, North'] = [''];
aCountry['Korea, South'] = [''];
aCountry['Kuwait'] = [''];
aCountry['Kyrgyzstan'] = [''];
aCountry['Laos'] = [''];
aCountry['Latvia'] = [''];
aCountry['Lebanon'] = [''];
aCountry['Lesotho'] = [''];
aCountry['Liberia'] = [''];
aCountry['Libya'] = [''];
aCountry['Liechtenstein'] = [''];
aCountry['Lithuania'] = [''];
aCountry['Luxembourg'] = [''];
aCountry['Macau'] = [''];
aCountry['Macedonia'] = [''];
aCountry['Madagascar'] = [''];
aCountry['Malawi'] = [''];
aCountry['Malaysia'] = ['Alor Setar','George Town','Johore Baharu','Kelang','Kota Baharu','Kota Kinabalu','Kuala Lumpur','Kuala Terengganu','Kuantan','Kuching',''];
aCountry['Maldives'] = [''];
aCountry['Mali'] = [''];
aCountry['Malta'] = [''];
aCountry['Man, Isle of'] = [''];
aCountry['Marshall Islands'] = [''];
aCountry['Martinique'] = [''];
aCountry['Mauritania'] = [''];
aCountry['Mauritius'] = [''];
aCountry['Mayotte'] = [''];
aCountry['McDonald Islands'] = [''];
aCountry['Mexico'] = [''];
aCountry['Micronesia'] = [''];
aCountry['Midway Islands'] = [''];
aCountry['Moldova'] = [''];
aCountry['Monaco'] = [''];
aCountry['Mongolia'] = [''];
aCountry['Montserrat'] = [''];
aCountry['Morocco'] = [''];
aCountry['Mozambique'] = [''];
aCountry['Namibia'] = [''];
aCountry['Nauru'] = [''];
aCountry['Navassa Island'] = [''];
aCountry['Nepal'] = [''];
aCountry['Netherlands'] = [''];
aCountry['Netherlands Antilles'] = [''];
aCountry['New Caledonia'] = [''];
aCountry['New Zealand'] = [''];
aCountry['Nicaragua'] = [''];
aCountry['Niger'] = [''];
aCountry['Nigeria'] = [''];
aCountry['Niue'] = [''];
aCountry['Norfolk Island'] = [''];
aCountry['Northern Mariana Islands'] = [''];
aCountry['Norway'] = [''];
aCountry['Oman'] = [''];
aCountry['Pakistan'] = [''];
aCountry['Palau'] = [''];
aCountry['Palmyra Atoll'] = [''];
aCountry['Panama'] = [''];
aCountry['Papua New Guinea'] = [''];
aCountry['Paracel Islands'] = [''];
aCountry['Paraguay'] = [''];
aCountry['Peru'] = [''];
aCountry['Philippines'] = [''];
aCountry['Pitcairn Islands'] = [''];
aCountry['Poland'] = [''];
aCountry['Portugal'] = [''];
aCountry['Puerto Rico'] = [''];
aCountry['Qatar'] = [''];
aCountry['Reunion'] = [''];
aCountry['Romania'] = [''];
aCountry['Russia'] = [''];
aCountry['Rwanda'] = [''];
aCountry['Saint Helena'] = [''];
aCountry['Saint Kitts and Nevis'] = [''];
aCountry['Saint Lucia'] = [''];
aCountry['Saint Pierre and Miquelon'] = [''];
aCountry['Saint Vincent'] = [''];
aCountry['Grenadines'] = [''];
aCountry['San Marino'] = [''];
aCountry['Sao Tome and Principe'] = [''];
aCountry['Saudi Arabia'] = [''];
aCountry['Scotland'] = [''];
aCountry['Senegal'] = [''];
aCountry['Serbia and Montenegro'] = [''];
aCountry['Seychelles'] = [''];
aCountry['Sierra Leone'] = [''];
aCountry['Singapore'] = [''];
aCountry['Slovakia'] = [''];
aCountry['Slovenia'] = [''];
aCountry['Solomon Islands'] = [''];
aCountry['Somalia'] = [''];
aCountry['South Africa'] = [''];
aCountry['South Georgia'] = [''];
aCountry['South Sandwich Islands'] = [''];
aCountry['Spain'] = [''];
aCountry['Spratly Islands'] = [''];
aCountry['Sri Lanka'] = [''];
aCountry['Sudan'] = [''];
aCountry['Suriname'] = [''];
aCountry['Svalbard'] = [''];
aCountry['Swaziland'] = [''];
aCountry['Sweden'] = [''];
aCountry['Switzerland'] = ['Aargau','Appenzell','Basel','Bern','Fribourg','Genf','Glarus','Graubünden','Jura','Luzern','Neuchâtel','Sankt Gallen','Schaffhausen','Schwyz','Solothurn','Thurgau','Ticino','Unterwalden','Uri','Valais','Vaud','Zug','Zürich',''];
aCountry['Syria'] = [''];
aCountry['Taiwan'] = [''];
aCountry['Tajikistan'] = [''];
aCountry['Tanzania'] = [''];
aCountry['Thailand'] = [''];
aCountry['Togo'] = [''];
aCountry['Tokelau'] = [''];
aCountry['Tonga'] = [''];
aCountry['Trinidad and Tobago'] = [''];
aCountry['Tromelin Island'] = [''];
aCountry['Tunisia'] = [''];
aCountry['Turkey'] = [''];
aCountry['Turkmenistan'] = [''];
aCountry['Turks and Caicos Islands'] = [''];
aCountry['Tuvalu'] = [''];
aCountry['Uganda'] = [''];
aCountry['Ukraine'] = [''];
aCountry['United Arab Emirates'] = [''];
aCountry['United Kingdom'] = ['--ENGLAND--','Bedfordshire','Berkshire','Buckinghamshire','Cambridgeshire','Cheshire','Cornwall','Cumberland','Derbyshire','Devon','Dorset','Durham','Essex','Gloucestershire','Hampshire','Herefordshire','Hertfordshire','Huntingdonshire','Kent','Lancashire','Leicestershire','Lincolnshire','Middlesex','Norfolk','Northamptonshire','Northumberlan','Nottinghamshire','Oxfordshire','Rutland','Shropshire','Somerset','Staffordshire','Suffolk','Surrey','Sussex','Warwickshire','Westmorland','Wiltshire','Worcestershire','Yorkshire','--WALES--','Anglesey/Sir Fon','Brecknockshire/Sir Frycheiniog','Caernarfonshire/Sir Gaernarfon','Carmarthenshire/Sir Gaerfyrddin','Cardiganshire/Ceredigion','Denbighshire/Sir Ddinbych','Flintshire/Sir Fflint','Glamorgan/Morgannwg','Merioneth/Meirionnydd','Monmouthshire/Sir Fynwy','Montgomeryshire/Sir Drefaldwyn','Pembrokeshire/Sir Benfro','Radnorshire/Sir Faesyfed','--SCOTLAND--','Aberdeenshire','Angus/Forfarshire','Argyllshire','Ayrshire','Banffshire','Berwickshire','Buteshire','Cromartyshire','Caithness','Clackmannanshire','Dumfriesshire','Dunbartonshire/Dumbartonshire','East Lothian/Haddingtonshire','Fife','Inverness-shire','Kincardineshire','Kinross-shire','Kirkcudbrightshire','Lanarkshire','Midlothian/Edinburghshire','Morayshire','Nairnshire','Orkney','Peeblesshire','Perthshire','Renfrewshire','Ross-shire','Roxburghshire','Selkirkshire','Shetland','Stirlingshire','Sutherland','West Lothian/Linlithgowshire','Wigtownshire',''];
aCountry['United States of America'] = ['Alabama','Alaska','Arizona','Arkansas','California','Colorado','Connecticut','Delaware','District of Columbia','Florida','Georgia','Hawaii','Idaho','Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana','Maine','Maryland','Massachusetts','Michigan','Minnesota','Mississippi','Missouri','Montana','Nebraska','Nevada','New Hampshire','New Jersey','New Mexico','New York','North Carolina','North Dakota','Ohio','Oklahoma','Oregon','Pennsylvania','Rhode Island','South Carolina','South Dakota','Tennessee','Texas','Utah','Vermont','Virginia','Washington','West Virginia','Wisconsin','Wyoming',''];
aCountry['Uruguay'] = [''];
aCountry['Uzbekistan'] = [''];
aCountry['Vanuatu'] = [''];
aCountry['Venezuela'] = [''];
aCountry['Vietnam'] = [''];
aCountry['Virgin Islands'] = [''];
aCountry['Wake Island'] = [''];
aCountry['Wales'] = [''];
aCountry['Wallis and Futuna'] = [''];
aCountry['West Bank'] = [''];
aCountry['Western Sahara'] = [''];
aCountry['Western Samoa'] = [''];
aCountry['Yemen'] = [''];
aCountry['Zaire'] = [''];
aCountry['Zambia'] = [''];
aCountry['Zimbabwe'] = [''];
$(function(){
for(e in aReference){
try{
var tmpObj = document.getElementById(e);
var tmpRefObj = document.getElementById(aReference[e]);
if(tmpObj.tagName && tmpRefObj.tagName){
$(tmpObj).change(function(){
aPreselect[aReference[$(this).attr('id')]] = -1;
var tmpHtml = $('option:selected', this).html();
if(typeof aCountry[tmpHtml] != 'undefined'){
if(aCountry[tmpHtml].length>1){
updateOption(aReference[$(this).attr('id')], aCountry[tmpHtml]);
} else {
var refObj = document.getElementById(aReference[$(this).attr('id')]);
csReferenceHide(refObj);
}
} else {
var refObj = document.getElementById(aReference[$(this).attr('id')]);
csReferenceHide(refObj);
}
});
// init
$('option:selected', tmpObj).each(function(){
if(typeof aCountry[$(this).html()] != 'undefined'){
if(aCountry[$(this).html()].length>1){
updateOption(aReference[e], aCountry[$(this).html()], true);
} else {
csReferenceHide(tmpRefObj);
}
} else {
csReferenceHide(tmpRefObj);
}
});
}
} catch(e) {}
}
});
function updateOption(refId, aOpt, onInit){
var refObj = document.getElementById(refId);
var tmpOpt = '';
$.each(aOpt, function(i, n){
if($.trim(n) != ''){
tmpOpt += '';
}
});
$(refObj).html(tmpOpt);
var tmpCnt = (aOpt.length)? aOpt.length : 1;
if(tmpCnt<=1){
csReferenceHide(refObj);
} else {
csReferenceShow(refObj);
var tmpPreSel = false;
if(aPreselect[refId]){
$('option', $(refObj)).each(function(){
if($(this).html() == aPreselect[refId] || $(this).val() == aPreselect[refId]){
$(this).attr('selected','selected');
tmpPreSel = true;
}
});
}
// preselect frist option
if(!tmpPreSel){$('option:first', $(refObj)).attr('selected','selected');}
}
}
function csReferenceHide(refObj){
var tmpRefId = $(refObj).attr('id');
var tmpRefName = $(refObj).attr('name');
var oInput = document.getElementById('csInput_'+tmpRefId);
var oSpan = document.getElementById('csSpan_'+tmpRefId);
if(!oInput){
if(!oSpan){
$(refObj).wrap('');
oSpan = document.getElementById('csSpan_'+tmpRefId);
}
refObj.disabled = true;
$(refObj).hide();
var preSelVal = (aPreselect[tmpRefId])? aPreselect[tmpRefId] : '';
if(preSelVal == -1){preSelVal = ''}
$(oSpan).append('');
}
}
function csReferenceShow(refObj){
var tmpRefId = $(refObj).attr('id');
var oInput = document.getElementById('csInput_'+tmpRefId);
if(oInput){
$(oInput).remove();
refObj.disabled = false;
$(refObj).show();
}
}