/**
 * Copyright 2009 Fabuso, LLC
 *
 * $Id: global_user_interface_popup.js 4440 2011-01-13 20:45:21Z dlarson $
 */

var isPublic = false;
var contextPath;

function setContextPath(ctxPath){
   contextPath = ctxPath;
}

function getContextPath(){
   if (!contextPath) {
      return '';
   } else {
      return contextPath;
   }
}

function fabPop(url){
   var newwindow = window.open(url, 'name', cfg);
   if (window.focus) {
      newwindow.focus();
   }
   return false;
}

function isLeapYear(theYear){
   return (theYear % 4 === 0) ? (theYear % 100 === 0) ? (theYear % 400 === 0) : true : false;
}

/*
 var eventKeys = {
 keys: ['enter', 'esc', 'left', 'up', 'right', 'down', 'delete', 'A', 'B', 'B', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'],
 keyCodes: [13, 27, 37, 38, 39, 40, 46, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122],
 keyConstruct: function(key, keyCode){
 this.key = key;
 this.keyCode = keyCode;
 },
 makeKeyConstruct: function(){
 var constructedKeys = [];
 for (var i = 0; i < eventKeys.keys.length; i++) {
 constructedKeys.push(new eventKeys.keyConstruct(eventKeys.keys[i], eventKeys.keyCodes[i]));
 }
 return constructedKeys;
 }
 }
 var keyAPI = eventKeys.makeKeyConstruct();*/
var keyAPI = [{
   key: 'tab',
   keyCode: 9
}, {
   key: 'enter',
   keyCode: 13
}, {
   key: 'esc',
   keyCode: 27
}, {
   key: 'left',
   keyCode: 37
}, {
   key: 'up',
   keyCode: 38
}, {
   key: 'right',
   keyCode: 39
}, {
   key: 'down',
   keyCode: 40
}, {
   key: 'delete',
   keyCode: 46
}, {
   key: 'A',
   keyCode: 65
}, {
   key: 'B',
   keyCode: 66
}, {
   key: 'C',
   keyCode: 67
}, {
   key: 'D',
   keyCode: 68
}, {
   key: 'E',
   keyCode: 39
}, {
   key: 'F',
   keyCode: 70
}, {
   key: 'G',
   keyCode: 71
}, {
   key: 'H',
   keyCode: 72
}, {
   key: 'I',
   keyCode: 73
}, {
   key: 'J',
   keyCode: 74
}, {
   key: 'K',
   keyCode: 75
}, {
   key: 'L',
   keyCode: 76
}, {
   key: 'M',
   keyCode: 77
}, {
   key: 'N',
   keyCode: 78
}, {
   key: 'O',
   keyCode: 79
}, {
   key: 'P',
   keyCode: 80
}, {
   key: 'Q',
   keyCode: 81
}, {
   key: 'E',
   keyCode: 82
}, {
   key: 'S',
   keyCode: 83
}, {
   key: 'T',
   keyCode: 84
}, {
   key: 'U',
   keyCode: 85
}, {
   key: 'V',
   keyCode: 86
}, {
   key: 'W',
   keyCode: 87
}, {
   key: 'X',
   keyCode: 88
}, {
   key: 'Y',
   keyCode: 89
}, {
   key: 'Z',
   keyCode: 90
}, {
   key: 'a',
   keyCode: 97
}, {
   key: 'b',
   keyCode: 98
}, {
   key: 'c',
   keyCode: 99
}, {
   key: 'd',
   keyCode: 100
}, {
   key: 'e',
   keyCode: 101
}, {
   key: 'f',
   keyCode: 102
}, {
   key: 'g',
   keyCode: 103
}, {
   key: 'h',
   keyCode: 104
}, {
   key: 'i',
   keyCode: 105
}, {
   key: 'k',
   keyCode: 106
}, {
   key: 'k',
   keyCode: 107
}, {
   key: 'l',
   keyCode: 108
}, {
   key: 'm',
   keyCode: 109
}, {
   key: 'n',
   keyCode: 110
}, {
   key: 'o',
   keyCode: 111
}, {
   key: 'p',
   keyCode: 112
}, {
   key: 'q',
   keyCode: 113
}, {
   key: 'r',
   keyCode: 114
}, {
   key: 's',
   keyCode: 115
}, {
   key: 't',
   keyCode: 116
}, {
   key: 'u',
   keyCode: 117
}, {
   key: 'v',
   keyCode: 118
}, {
   key: 'w',
   keyCode: 119
}, {
   key: 'x',
   keyCode: 120
}, {
   key: 'y',
   keyCode: 121
}, {
   key: 'z',
   keyCode: 122
}];

var usState = new Array(), stateCode = new Array();
usState[0] = "Alabama";
stateCode[0] = "AL";
usState[1] = "Alaska";
stateCode[1] = "AK";
usState[2] = "Arizona";
stateCode[2] = "AZ";
usState[3] = "Arkansas";
stateCode[3] = "AR";
usState[4] = "California";
stateCode[4] = "CA";
usState[5] = "Colorado";
stateCode[5] = "CO";
usState[6] = "Connecticut";
stateCode[6] = "CT";
usState[7] = "Delaware";
stateCode[7] = "DE";
usState[8] = "Florida";
stateCode[8] = "FL";
usState[9] = "Georgia";
stateCode[9] = "GA";
usState[10] = "Hawaii";
stateCode[10] = "HI";
usState[11] = "Idaho";
stateCode[11] = "ID";
usState[12] = "Illinois";
stateCode[12] = "IL";
usState[13] = "Indiana";
stateCode[13] = "IN";
usState[14] = "Iowa";
stateCode[14] = "IA";
usState[15] = "Kansas";
stateCode[15] = "KS";
usState[16] = "Kentucky";
stateCode[16] = "KY";
usState[17] = "Louisiana";
stateCode[17] = "LA";
usState[18] = "Maine";
stateCode[18] = "ME";
usState[19] = "Maryland";
stateCode[19] = "MD";
usState[20] = "Massachusetts";
stateCode[20] = "MA";
usState[21] = "Michigan";
stateCode[21] = "MI";
usState[22] = "Minnesota";
stateCode[22] = "MN";
usState[23] = "Mississippi";
stateCode[23] = "MS";
usState[24] = "Missouri";
stateCode[24] = "MO";
usState[25] = "Montana";
stateCode[25] = "MT";
usState[26] = "Nebraska";
stateCode[26] = "NE";
usState[27] = "Nevada";
stateCode[27] = "NV";
usState[28] = "New Hampshire";
stateCode[28] = "NH";
usState[29] = "New Jersey";
stateCode[29] = "NJ";
usState[30] = "New Mexico";
stateCode[30] = "NM";
usState[31] = "New York";
stateCode[31] = "NY";
usState[32] = "North Carolina";
stateCode[32] = "NC";
usState[33] = "North Dakota";
stateCode[33] = "ND";
usState[34] = "Ohio";
stateCode[34] = "OH";
usState[35] = "Oklahoma";
stateCode[35] = "OK";
usState[36] = "Oregon";
stateCode[36] = "OR";
usState[37] = "Pennsylvania";
stateCode[37] = "PA";
usState[38] = "Rhode Island";
stateCode[38] = "RI";
usState[39] = "South Carolina";
stateCode[39] = "SC";
usState[40] = "South Dakota";
stateCode[40] = "SD";
usState[41] = "Tennessee";
stateCode[41] = "TN";
usState[42] = "Texas";
stateCode[42] = "TX";
usState[43] = "Utah";
stateCode[43] = "UT";
usState[44] = "Vermont";
stateCode[44] = "VT";
usState[45] = "Virginia";
stateCode[45] = "VA";
usState[46] = "Washington";
stateCode[46] = "WA";
usState[47] = "West Virginia";
stateCode[47] = "WV";
usState[48] = "Wisconsin";
stateCode[48] = "WI";
usState[49] = "Wyoming";
stateCode[49] = "WY";

var worldCountries = [];
var worldCountries_str = 'United States,United Kingdom,Afghanistan,Albania,Algeria,American Samoa,Andorra,Angola,Anguilla,Antarctica,Antigua and Barbuda,Argentina,Armenia,Aruba,Australia,Austria,Azerbaijan,Bahamas,Bahrain,Bangladesh,Barbados,Belarus,Belgiu,Belize,Benin,Bermuda,Bhutan,Bolivia,Bosnia and Herzegovina,Botswana,Bouvet Island,Brazil,British Indian Ocean Territory,Brunei Darussalam,Bulgaria,Burkina Faso,Burundi,Cambodia,Cameroon,Canada,Cape Verde,Cayman Islands,Central African Republic,Chad,Chile,China,Christmas Island,Cocos (Keeling) Islands,Colombia,Comoros,Congo,Congo - Democratic Republic of,Cook Islands,Costa Rica,Cote D\'ivoire,Croatia,Cuba,Cyprus,Czech Republic,Denmark,Djibouti,Dominica,Dominican Republic,Ecuador,Egypt,El Salvador,Equatorial Guinea,Eritrea,Estonia,Ethiopia,Falkland Islands (Malvinas),Faroe Islands,Fiji,Finland,France,French Guiana,French Polynesia,French Southern Territories,Gabon,Gambia,Georgia,Germany,Ghana,Gibraltar,Greece,Greenland,Grenada,Guadeloupe,Guam,Guatemala,Guinea,Guinea-bissau,Guyana,Haiti,Heard Island and Mcdonald Islands,Holy See (Vatican City State),Honduras,Hong Kong,Hungary,Iceland,India,Indonesia,Iran - Islamic Republic of,Iraq,Ireland,Israel,Italy,Jamaica,Japan,Jordan,Kazakhstan,Kenya,Kiribati,Korea - Democratic People\'s Republic of,Korea - Republic of,Kuwait,Kyrgyzstan,Lao People\'s Democratic Republic,Latvia,Lebanon,Lesotho,Liberia,Libyan Arab Jamahiriya,Liechtenstein,Lithuania,Luxembourg,Macao,Macedonia - Republic of,Madagascar,Malawi,Malaysia,Maldives,Mali,Malta,Marshall Islands,Martinique,Mauritania,Mauritius,Mayotte,Mexico,Micronesia - Federated States of,Moldova - Republic of,Monaco,Mongolia,Montserrat,Morocco,Mozambique,Myanmar,Namibia,Nauru,Nepal,Netherlands,Netherlands Antilles,New Caledonia,New Zealand,Nicaragua,Niger,Nigeria,Niue,Norfolk Island,Northern Mariana Islands,Norway,Oman,Pakistan,Palau,Palestinian Territory - Occupied,Panama,Papua New Guinea,Paraguay,Peru,Philippines,Pitcairn,Poland,Portugal,Puerto Rico,Qatar,Reunion,Romania,Russian Federation,Rwanda,Saint Helena,Saint Kitts and Nevis,Saint Lucia,Saint Pierre and Miquelon,Saint Vincent and The Grenadines,Samoa,San Marino,Sao Tome de Principe,Saudi Arabia,Senegal,Serbia and Montenegro,Seychelles,Sierra Leone,Singapore,Slovakia,Slovenia,Solomon Islands,Somalia,South Africa,South Georgia/South Sandwich Islands,Spain,Sri Lanka,Sudan,Suriname,Svalbard and Jan Mayen,Swaziland,Sweden,Switzerland,Syrian Arab Republic,Taiwan,Tajikistan,Tanzania - United Republic of,Thailand,Timor-leste,Togo,Tokelau,Tonga,Trinidad and Tobago,Tunisia,Turkey,Turkmenistan,Turks and Caicos Islands,Tuvalu,Uganda,Ukraine,United Arab Emirates,United States Minor Outlying Islands,Uruguay,Uzbekistan,Vanuatu,Venezuela,Viet Nam,Virgin Islands - British,Virgin Islands - U.S.,Wallis and Futuna,Western Sahara,Yemen,Zambia,Zimbabwe';
worldCountries = worldCountries_str.split(',');

