var CANADA = 41;
var USA = 233;
var typeDomain = null;
var modelsDomain = null;
var industryDomain = null;
var productDomain = null;
var countryDomain = null;
var stateDomain = null;
var crmDomain = null;
var ccDomain = null;

function populatePBXManufacturers(elementID) {
//debugger;
	var browserName=navigator.appName;
	if (typeDomain == null) {
		typeDomain = new Array();
      	typeDomain = ['Select PBX Type', '3Com', 'Alcatel', 'Allworx', 'Altigen', 'Artisoft', 'Asterisk', 'Avaya', 'Broadsoft', 'Cisco', 'Comdial', 'Covad', 'Digium', 'EADS', 'ESI', 'Fonality', 'Genband', 'Intertel', 'Iwatsu', 'M5', 'Microsoft', 'Mitel', 'NEC', 'Nitsuko', 'Nortel', 'Other', 'Panasonic', 'Samsung', 'ShoreTel', 'Siemens', 'SIP', 'Sylantro', 'Tekelec', 'Telrad', 'Toshiba', 'Vertical', 'Vodavi', 'Whaleback', 'Zultys'];
	}

	objSub = document.getElementById(elementID);
	for(x=0; x < typeDomain.length; x++){	
		listOpt = document.createElement("option");
		listOpt.value = typeDomain[x];
		listOpt.text = typeDomain[x];
		if (browserName == "Microsoft Internet Explorer"){
			objSub.add(listOpt);
		} else {
			objSub.add(listOpt, null);
		}
	}
	objSub.options[0].selected=true;
} // function populatePBXManufacturers

function populatePBXModels(elementID) {
//debugger;
	if (modelsDomain == null) {
		modelsDomain = new Array(typeDomain.length+1);
		for (i=0; i<typeDomain.length+1; i++)
			modelsDomain[i]=new Array();
		
		modelsDomain[0][0] = new Option("Select PBX Type", "Select PBX Type");

		modelsDomain[1][0] = new Option("3Com NBX 100","3Com NBX 100");
		modelsDomain[1][1] = new Option("3Com V3000","3Com V3000");
		modelsDomain[1][2] = new Option("3Com V5000","3Com V5000");
		modelsDomain[1][3] = new Option("3Com V6000","3Com V6000");
		modelsDomain[1][4] = new Option("3Com V7000","3Com V7000");
		modelsDomain[1][5] = new Option("VCX","VCX");

		modelsDomain[6][0] = new Option("Avaya IP Office","Avaya IP Office");
		modelsDomain[6][1] = new Option("Avaya Multivantage","Avaya Multivantage");
		modelsDomain[6][2] = new Option("Avaya S8700","Avaya S8700");

		modelsDomain[8][0] = new Option("Cisco Call Manager","Cisco Call Manager");
		modelsDomain[8][1] = new Option("Cisco Call Manager Express","Cisco Call Manager Express");
		
		modelsDomain[13][0] = new Option("Fonality PBXtra","Fonality PBXtra");
		modelsDomain[13][1] = new Option("Fonality TrixBox","Fonality TrixBox");

		modelsDomain[14][0] = new Option("Genband","Genband");
		
		modelsDomain[15][0] = new Option("InterTel 3000","InterTel 3000");
		modelsDomain[15][1] = new Option("InterTel 5000","InterTel 5000");

		modelsDomain[17][0] = new Option("M5 Elvis (7.0)","M5 Elvis (7.0)");
		
		modelsDomain[18][0] = new Option("Mitel 3300","Mitel 3300");
		modelsDomain[18][1] = new Option("Mitel SX-200 IP", "Mitel SX-200 IP");
		modelsDomain[18][2] = new Option("Mitel SX-2000", "Mitel SX-2000");

		modelsDomain[19][0] = new Option("NEC Electra Elite IPK","NEC Electra Elite IPK");
		modelsDomain[19][1] = new Option("NEC NEAX 2400", "NEC NEAX 2400");
		modelsDomain[19][2] = new Option("NEC NEAX IPX-DM", "NEC NEAX IPX-DM");

		modelsDomain[21][0] = new Option("Nortel BCM","Nortel BCM");
		modelsDomain[21][1] = new Option("Nortel Communications Server","Nortel Communications Server");

		modelsDomain[24][0] = new Option("Shortel Shoregear","Shortel Shoregear");

		modelsDomain[31][0] = new Option("Zulty MX 250","Zulty MX 250");
		modelsDomain[31][1] = new Option("Zulty MX 30","Zulty MX 30");

		modelsDomain[typeDomain.length][0] = new Option("Other","Other");
	}

	objSub = document.getElementById(elementID);
	for (m=objSub.options.length-1;m>0;m--)
		objSub.options[m]=null;
	
	for (i=0;i<modelsDomain[0].length;i++){
		objSub.options[i]=modelsDomain[0][i];
	}
	objSub.options[0].selected=true;
} // function populatePBXModels

function scopePBXModelByType(elementID, selection) {
//debugger;
	objSub = document.getElementById(elementID);
	for (m=objSub.options.length-1;m>0;m--)
		objSub.options[m]=null;

	for (i=0;i<modelsDomain[selection].length;i++){
		objSub.options[i]=modelsDomain[selection][i];
	}
	objSub.options[modelsDomain[selection].length] = modelsDomain[typeDomain.length][0];
	objSub.options[0].selected=true;
}

function populateIndustries(elementID) {
//debugger;
	var browserName=navigator.appName;
	if (industryDomain == null) {
		industryDomain = new Array();
      	industryDomain = ['Select Industry', 'Automotive', 'Banking/Finance', 'Biotechnology/Pharmaceutical', 'Education', 'Government', 'Healthcare', 'Information Technology', 'Insurance', 'Legal', 'Manufacturing', 'Nonprofit', 'Other', 'Outsourcing', 'Professional Services', 'Real Estate/Construction', 'Retail', 'Telecommunications', 'Transportation', 'Travel/Hospitality', 'Utilities'];
	}

	objSub = document.getElementById(elementID);
	for(x=0; x < industryDomain.length; x++){	
		listOpt = document.createElement("option");
		listOpt.value = industryDomain[x];
		listOpt.text = industryDomain[x];
		if (browserName == "Microsoft Internet Explorer"){
			objSub.add(listOpt);
		} else {
			objSub.add(listOpt, null);
		}
	}
	objSub.options[0].selected=true;
}

function populateProducts(elementID) {
//debugger;
	var browserName=navigator.appName;
	if (productDomain == null) {
		productDomain = new Array();
      	productDomain = ['Select a Product', 'CallRex API', 'CallRex Agent Evaluation', 'CallRex Express', 'CallRex Hosted', 'CallRex Multi-Media', 'CallRex Professional', 'CallRex Speech Analytics', 'CallRex Training & eLearning', 'CallRex WFM'];
	}

	objSub = document.getElementById(elementID);
	for(x=0; x < productDomain.length; x++){	
		listOpt = document.createElement("option");
		listOpt.value = productDomain[x];
		listOpt.text = productDomain[x];
		if (browserName == "Microsoft Internet Explorer"){
			objSub.add(listOpt);
		} else {
			objSub.add(listOpt, null);
		}
	}
	objSub.options[0].selected=true;
}

function populateCountryAndState(countryEleID, stateEleID) {
//debugger;
	var browserName=navigator.appName;

    if (countryDomain == null) {
		countryDomain = new Array();
		countryDomain = ['Select Country', 'Afghanistan', 'Albania', 'Algeria', 'American Samoa', 'Andorra', 'Angola', 'Anguilla', 'Antarctica', 'Antigua', 'Argentina', 
		'Armenia', 'Aruba', 'Ascension Island', 'Australia', 'Australian Antarctic Territory', 'Austria', 'Azerbaijan', 'Bahamas', 'Bahrain', 'Bangladesh', 'British Indian Ocean Territory', 
		'Barbados', 'Barbuda', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bermuda', 'Bhutan', 'Bolivia', 'Bosnia and Herzegovina', 'Botswana', 'Brazil', 
		'British Virgin Islands', 'Brunei', '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 (DRC)', 
		'Cook Islands', 'Costa Rica', 'Cote dIvoire', 'Country', 'Croatia', 'Cuba', 'Cyprus', 'Czech Republic', 'Denmark', 'Diego Garcia', 'Djibouti', 
		'Dominica', 'Dominican Republic', 'Ecuador', 'Egypt', 'El Salvador', 'Equatorial Guinea', 'Eritrea', 'Estonia', 'Ethiopia', 'F.Y.R.O. Macedonia', 
		'Falkland Islands', 'Faroe Islands', 'Fiji Islands', 'Finland', 'France', 'French Antilles', 'French Guiana', 'French Polynesia', 'Gabon', 
		'Gambia', 'Georgia', 'Germany', 'Ghana', 'Gibraltar', 'Greece', 'Greenland', 'Grenada', 'Guadeloupe', 'Guam', 'Guantanamo Bay', 'Guatemala', 'Guinea', 
		'Guinea-Bissau', 'Guyana', 'Haiti', 'Honduras', 'Hong Kong S.A.R.', 'Hungary', 'Iceland', 'India', 'Indonesia', 'Iran', 'Iraq', 'Ireland', 'Israel', 
		'Italy', 'Ivory Coast', 'Jamaica', 'Japan', 'Jordan', 'Kazakhstan', 'Kenya', 'Kiribati', 'Korea', 'Kuwait', 'Kyrgyzstan', 'Laos', 'Latvia', 'Lebanon', 
		'Lesotho', 'Liberia', 'Libya', 'Liechtenstein', 'Lithuania', 'Luxembourg', 'Macao', 'Madagascar', 'Malawi', 'Malaysia', 'Maldives', 'Mali', 'Malta', 
		'Marshall Islands', 'Martinique', 'Mauritania', 'Mauritius', 'Mayotte', 'Mexico', 'Micronesia', 'Moldova', 'Monaco', 'Mongolia', 'Montenegro', 'Montserrat', 
		'Morocco', 'Mozambique', 'Myanmar', 'Namibia', 'Nauru', 'Nepal', 'Netherlands', 'Netherlands Antilles', 'Nevis', 'New Caledonia', 'New Zealand', 
		'Nicaragua', 'Niger', 'Nigeria', 'Niue', 'Norfolk Island', 'North Korea', 'Norway', 'Oman', 'Pakistan', 'Palau', 'Palestinian Territory', 'Panama', 'Papua New Guinea', 
		'Paraguay', 'Peru', 'Philippines', 'Poland', 'Portugal', 'Puerto Rico', 'Qatar', 'Reunion Island', 'Romania', 'Rota Island', 'Russia', 'Rwanda', 
		'Saipan', 'Samoa', 'San Marino', 'Sao Tome and Principe', 'Saudi Arabia', 'Scotland', 'Senegal', 'Serbia', 'Seychelles', 'Sierra Leone', 'Singapore', 'Slovakia', 
		'Slovenia', 'Solomon Islands', 'Somalia', 'South Africa', 'Spain', 'Sri Lanka', 'St. Helena', 'St. Kitts', 'St. Lucia', 'St. Pierre and Miquelon', 
		'St. Vincent and the Grenadines', 'Sudan', 'Suriname', 'Svalbard and Jan Mayen', 'Swaziland', 'Sweden', 'Switzerland', 'Syria', 'Taiwan', 'Tajikistan', 'Tanzania', 'Thailand', 
		'Tinian Island', 'Togo', 'Tokelau', 'Tonga', 'Trinidad and Tobago', 'Tunisia', 'Turkey', 'Turkmenistan', 'Turks and Caicos Islands', 'Tuvalu', 'UK', 
		'Uganda', 'Ukraine', 'United Arab Emirates', 'United States', 'United States Virgin Islands', 'Uruguay', 'Uzbekistan', 'Vanuatu', 'Vatican City', 
		'Venezuela', 'Vietnam', 'Wallis and Futuna Islands', 'Western Sahara', 'Yemen', 'Zambia', 'Zimbabwe'];
		objSub = document.getElementById(countryEleID);
		for(x=0; x < countryDomain.length; x++) {	
			listOpt = document.createElement("option");
			listOpt.value = countryDomain[x];
			listOpt.text = countryDomain[x];
			if (browserName == "Microsoft Internet Explorer"){
				objSub.add(listOpt);
			} else {
				objSub.add(listOpt, null);
			}
		}

		objSub.options[USA].selected=true;		// US

		stateDomain = new Array(3);
		for (i=0; i<3; i++)
			stateDomain[i]=new Array();
		
		stateDomain[0][0] = new Option("Other", "Other");
		
		var provs = new Array();
		provs = ['Select Province', 'AB', 'BC', 'MB', 'NB', 'NL', 'NS', 'NT/NU', 'ON', 'OTHER', 'PE', 'QC', 'SK', 'YT'];
		for (i=0; i<provs.length; i++)
			stateDomain[1][i] = new Option(provs[i], provs[i]);

		var states = new Array();
		states = ['Select State', 'AK', 'AL', 'AR', 'AS', 'AZ', 'CA', 'CO', 'CT', 'DC', 'DE', 'FL', 'FM', 'GA', 'GU', 'HI', 'IA', 'ID', 'IL', 'IN', 'KS', 'KY', 'LA', 'MA', 'MD', 'ME',
		'MH', 'MI', 'MN', 'MO', 'MP', 'MS', 'MT', 'NC', 'ND', 'NE', 'NH', 'NJ', 'NM', 'NV', 'NY', 'OH', 'OK', 'OR', 'OTHER', 'PA', 'PR', 'PW', 'RI', 'SC', 
		'SD', 'TN', 'TX', 'UT', 'VA', 'VI', 'VT', 'WA', 'WI', 'WV', 'WY'];
		for (i=0; i<states.length; i++)
			stateDomain[2][i] = new Option(states[i], states[i]);

		objSub = document.getElementById(stateEleID);
		for (i=0;i<stateDomain[2].length;i++)
			objSub.options[i]=stateDomain[2][i];
	}
}

function scopeFederationByCountry(elementID, selection) {
//debugger;
	objSub = document.getElementById(elementID);
	for (m=objSub.options.length-1;m>0;m--)
		objSub.options[m]=null;

	var mappedSelection = 0;
	if (selection == CANADA)
		mappedSelection = 1;
	else if (selection == USA)
		mappedSelection = 2;

	for (i=0;i<stateDomain[mappedSelection].length;i++){
		objSub.options[i]=stateDomain[mappedSelection][i];
	}
	objSub.options[0].selected=true;
}

function populateCRMSoftware(elementID) {
//debugger;
	var browserName=navigator.appName;
	if (crmDomain == null) {
		crmDomain = new Array();
      	crmDomain = ['Select CRM Software', 'ACT', 'Affiniti', 'Altitude', 'AMC Technology', 'AMcat', 'ATIS Systems GmBH', 'AudioText Telecom AG', 'Com-Centers International', 'ComputerTalk Technology', 'Convergys', 'CreaLog GmBH', 'Custom DB', 'Goldmine', 'Maximizer', 'Merced', 'MS CRM', 'NetSuite', 'None', 'Oaisys', 'OnviSource', 'Onyx', 'Other', 'RightNow', 'Sage CRM', 'SalesForce', 'SalesLogix', 'Salesnet', 'Stratasoft', 'Sugar CRM', 'Syman', 'Talisma', 'Teleformix', 'Teleopti AB', 'Vayusphere', 'Voxtron', 'Xtend', 'Zeacom'];
	}

	objSub = document.getElementById(elementID);
	for(x=0; x < crmDomain.length; x++){	
		listOpt = document.createElement("option");
		listOpt.value = crmDomain[x];
		listOpt.text = crmDomain[x];
		if (browserName == "Microsoft Internet Explorer"){
			objSub.add(listOpt);
		} else {
			objSub.add(listOpt, null);
		}
	}
	objSub.options[0].selected=true;
}

function populateCCSoftware(elementID) {
//debugger;
	var browserName=navigator.appName;
	if (ccDomain == null) {
		ccDomain = new Array();
      	ccDomain = ['Select Contact Center Software', '3Com eXchange', 'Aheeva', 'Amcat', 'Aprapo', 'Aspect Software', 'Astute Solutions', 'Avaya MultiVantage', 'BBX Technolgies', 'Braxtel', 'Broadsoft', 'Call Media', 'Cisco UCC Hosted', 'Cisco UCCE', 'Concerto Software', 'Contactual', 'Cosmo', 'Customer 1', 'Dirigosoft', 'Eagle ACD', 'EasyRun', 'eOn Communications', 'Five9', 'FrontRange', 'Genesys', 'Genticity', 'Interactive Intelligence', 'Internal', 'Intertel', 'Kall8', 'Kana', 'Mitel Contact Center', 'None', 'Nuasis', 'Oblicore', 'Other', 'PrairieFyre Software', 'ShoreTel Contact Center', 'Stayinfront', 'Telphony At Work', 'Upstream'];
	}

	objSub = document.getElementById(elementID);
	for(x=0; x < ccDomain.length; x++){	
		listOpt = document.createElement("option");
		listOpt.value = ccDomain[x];
		listOpt.text = ccDomain[x];
		if (browserName == "Microsoft Internet Explorer"){
			objSub.add(listOpt);
		} else {
			objSub.add(listOpt, null);
		}
	}
	objSub.options[0].selected=true;
}
