if (navigator.appName == "Microsoft Internet Explorer") {
	var displayType = 'block';
} else {
	var displayType = 'table-row';
}


function changetext(dropdownName, dropdownSelectedIndex) {

	switch (dropdownName) {
		case "account_select": document.email.detailsarea.value=document.email.detailsarea.value+detail_account[dropdownSelectedIndex];
			break
		case "connection_select": document.email.detailsarea.value=document.email.detailsarea.value+detail_connection[dropdownSelectedIndex];
			break
		case "error_select": document.email.detailsarea.value=document.email.detailsarea.value+detail_errormsg[dropdownSelectedIndex];
			break
		case "download_select": document.email.detailsarea.value=document.email.detailsarea.value+detail_download[dropdownSelectedIndex];
			break
		case "authorization_select": document.email.detailsarea.value=document.email.detailsarea.value+detail_authorization[dropdownSelectedIndex];
			break
		case "cards_codes_select": document.email.detailsarea.value=document.email.detailsarea.value+detail_cards_codes[dropdownSelectedIndex];
			break
		case "app_store_select": document.email.detailsarea.value=document.email.detailsarea.value+detail_app_store[dropdownSelectedIndex];
			break
		case "device_select": document.email.detailsarea.value=document.email.detailsarea.value+detail_device[dropdownSelectedIndex];
			break
		case "music_purchase_select": document.email.detailsarea.value=document.email.detailsarea.value+detail_music[dropdownSelectedIndex];
			break
		case "video_purchase_select": document.email.detailsarea.value=document.email.detailsarea.value+detail_video[dropdownSelectedIndex];
			break
		case "store_features_select": document.email.detailsarea.value=document.email.detailsarea.value+detail_iTunes_store[dropdownSelectedIndex];
			break
		default :
			document.email.detailsarea.value="";
			break
	}
}

var setProgramValue = function() {
	var locale = ACWPod.getLocale();
	var url_params = window.location.search.toQueryParams();
	var topic = url_params.topic;
	var subtopic = url_params.subtopic;
	
	if (window.location.pathname.match(/\/support\/latino\/itunes\//)){
		return 'itunesmac_la';
	}
	else if (programTable[locale] != undefined) {
		if (programTable[locale][subtopic] != undefined) {
			return programTable[locale][subtopic];
		}
		else if (programTable[locale][topic] != undefined) {
			return programTable[locale][topic];
		}
		else if (programTable[locale]._default != undefined) {
			return programTable[locale]._default;
		}
		else {
			return programTable['en_US']._default;
		}
	}
	else {
		return programTable['en_US']._default;
	}
};

var programTable = {
	'en_US': {
		'_default': 'itunesmac',
		// TOPICS
		'iTunes Store Account and Billing' : 'itunesaccount',
		'iTunes Ping' : 'itunescontent', 
		'Connecting to iTunes Store' : 'itunestech', 
		'Downloading iTunes Store Purchases' : 'itunesdownload',
		'Authorization' : 'itunestech',
		'iTunes Cards and Codes' : 'itunesgiftcard',
		'App Store and iBooks' : 'itunescontent',
		'Music Purchases' : 'itunescontent',
		'Video Purchases' : 'itunescontent',
		'Other iTunes Store Features' : 'itunescontent',
		// SUBTOPICS
		'Account Security' : 'itunesaccount-security'
	},
	'en_CA': {
		'_default': 'ITMS_CAN_Mac_Eng'
	},
	'en_AU': {
		'_default': 'itunesmacaus'
	},
	'en_NZ': {
		'_default': 'itunesmacaus'
	},
	'en_IE': {
		'_default': 'itms_pan_euro_mac'
	},
	'en_LA': {
		'_default': 'itunesappstore_amer'
	},
	'en_AP': {
		'_default': 'itunesappstore_apac'
	},
	'en_GB': {
		'_default': 'itunesmac_uk'
	},
	'en_EM': {
		'_default': 'itunesappstore_emea'
	},
	'es_ES': {
		'_default': 'itunesmac_es'
	},
	'es_LA': {
		'_default': 'itunesappstore_amer'
	},
	'es_MX': {
		'_default': 'itunesmac_es'
	},
	'es_US': {
		'_default': 'itunesmac_la'
	},
	'de_DE': {
		'_default': 'itunesmac_de'
	},
	'de_AT': {
		'_default': 'itunesmac_de'
	},
	'de_CH': {
		'_default': 'itunesmac_chde'
	},
	'fr_FR': {
		'_default': 'itunesmac_fr'
	},
	'fr_BE': {
		'_default': 'itunesmac_fr'
	},
	'fr_CA': {
		'_default': 'ITMS_CAN_Mac_FR'
	},
	'fr_CH': {
		'_default': 'itunesmac_chfr'
	},
	'fi_FI': {
		'_default': 'itms_pan_euro_mac'
	},
	'da_DK': {
		'_default': 'itunesmac_sc'
	},
	'sv_SE': {
		'_default': 'itunesmac_sc'
	},
	'it_IT': {
		'_default': 'itunesmac_it'
	},
	'ja_JP': {
		'_default': 'itunesmac_jp',
		// SUBTOPICS
		'Account Security' : 'itunesaccount-security-jp'
	},
	'nl_BE': {
		'_default': 'itms_pan_euro_mac'
	},
	'nl_NL': {
		'_default': 'itms_pan_euro_mac'
	},
	'no_NO': {
		'_default': 'itunesmac_sc'
	},
	'pt_BR': {
		'_default': 'itunesappstore_amer'
	},
	'pt_PT': {
		'_default': 'itms_pan_euro_mac'
	},
	'en_HK': {
		'_default': 'itunesappstore_apac'
	},
	'zh_HK': {
		'_default': 'itunesappstore_apac'
	},
	'zh_CN': {
		'_default': 'itunesmac_cn'
	},
	'zh_TW': {
		'_default': 'itunesappstore_apac'
	},
	'ko_KR': {
		'_default': 'itunesappstore_apac'
	},
	'pl_PL': {
		'_default': 'itunesappstore_emea'
	},
	'ru_RU': {
		'_default': 'itunesappstore_emea'
	}
};

function doReset() {

	//63 variables defined
	$('fname').style.display = displayType;
	$('lname').style.display = displayType;
	$('itunesmemname').style.display = displayType;
	$('email1').style.display = displayType;
	$('email1input').enable();
	$('osver').style.display = displayType;
	$('osverselect').enable();
	$('osverbtmm').style.display = "none";
	$('osverbtmmselect').disable();
	$('cntry').style.display = displayType;
	$('cntryselect').enable();
	$('iTunesVersion').style.display = displayType;
	$('iTunesVersionSelect').enable();
	$('request_account').style.display = "none";
	$('request_accountselect').disable();
	$('AOL_account_billing_address').style.display = "none";
	$('AOL_account_billing_addressinput').disable();
	$('AOL_account_billing_city').style.display = "none";
	$('AOL_account_billing_cityinput').disable();
	$('AOL_account_billing_state').style.display = "none";
	$('AOL_account_billing_stateinput').disable();
	$('AOL_account_billing_zip').style.display = "none";
	$('AOL_account_billing_zipinput').disable();
	$('AOL_account_phoneNum').style.display = "none";
	$('AOL_account_phoneNuminput').disable();
	$('AOL_account_name').style.display = "none";
	$('AOL_account_nameinput').disable();
	$('acct_security_order_num').style.display = "none";
	$('acct_security_order_numinput').disable();
	$('request_connection').style.display = "none";
	$('request_connectionselect').disable();
	$('error_msg').style.display = "none";
	$('error_msgselect').disable();
	$('request_download').style.display = "none";
	$('request_downloadselect').disable();
	$('dl_item_title_req').style.display = "none";
	$('dl_item_title_reqinput').disable();
	$('dl_item_title_opt').style.display = "none";
	$('dl_item_title_optinput').disable();
	$('dl_order_num').style.display = "none";
	$('dl_order_numinput').disable();
	$('request_authorization').style.display = "none";
	$('request_authorizationselect').disable();
	$('request_cards_codes').style.display = "none";
	$('request_cards_codesselect').disable();
	$('itunes_activation_code').style.display = "none";
	$('itunes_activation_codeinput').disable();
	$('itunes_gc_serial_num').style.display = "none";
	$('itunes_gc_serial_numinput').disable();
	$('purchased_from').style.display = "none";
	$('purchased_frominput').disable();
	$('request_app_store').style.display = "none";
	$('request_app_storeselect').disable();
	$('device').style.display = "none";
	$('deviceselect').disable();
	$('request_music_purchase').style.display = "none";
	$('request_music_purchaseselect').disable();
	$('request_video_purchase').style.display = "none";
	$('request_video_purchaseselect').disable();
	$('request_store_features').style.display = "none";
	$('request_store_featuresselect').disable();
	$('details').style.display = displayType;
	$('detailstextarea').enable();

}

function doShowAccount() {

	doReset();
	$('request_account').style.display = displayType;
	$('request_accountselect').enable();
	
	if (topic == "Account &amp; Billing") {
	  topic = "Account & Billing";
	}
	document.getElementById("category").value = subtopic;
	document.getElementById("subject1").value = topic;
	document.getElementById("program").value = this.setProgramValue();

}

function doShowPing() {
	
	doReset();
	
	document.getElementById("category").value = subtopic;
	document.getElementById("subject1").value = topic;
	document.getElementById("program").value = this.setProgramValue();

}

function doShowEL() {
	
	doReset();
	$('dl_item_title_opt').style.display = displayType;
	$('dl_item_title_optinput').enable();
	$('dl_order_num').style.display = displayType;
	$('dl_order_numinput').enable();
	
	document.getElementById("category").value = subtopic;
	document.getElementById("subject1").value = topic;
	document.getElementById("program").value = this.setProgramValue();

}

function doShowConnection() {
	
	doReset();
	$('request_connection').style.display = displayType;
	$('request_connectionselect').enable();
	$('error_msg').style.display = displayType;
	$('error_msgselect').enable();

	document.getElementById("category").value = subtopic;
	document.getElementById("subject1").value = topic;
	document.getElementById("program").value = this.setProgramValue();
}

function doShowDownload() {

	doReset();
	$('request_download').style.display = displayType;
	$('request_downloadselect').enable();

	document.getElementById("category").value = subtopic;
	document.getElementById("subject1").value = topic;
	document.getElementById("program").value = this.setProgramValue();

}

function doShowAuthorization() {

	doReset();
	$('request_authorization').style.display = displayType;
	$('request_authorizationselect').enable();

	document.getElementById("category").value = subtopic;
	document.getElementById("subject1").value = topic;
	document.getElementById("program").value = this.setProgramValue();

}

function doShowCards_codes() {

	doReset();
	$('request_cards_codes').style.display = displayType;
	$('request_cards_codesselect').enable();

	document.getElementById("category").value = subtopic;
	document.getElementById("subject1").value = topic;
	document.getElementById("program").value = this.setProgramValue();
}

function doShowApp_store() {

	doReset();
	$('request_app_store').style.display = displayType;
	$('request_app_storeselect').enable();
	
	document.getElementById("category").value = subtopic;
	document.getElementById("subject1").value = topic;
	document.getElementById("program").value = this.setProgramValue();

}

function doShowMusicPurchace() {

	doReset();
	$('request_music_purchase').style.display = displayType;
	$('request_music_purchaseselect').enable();

	document.getElementById("category").value = subtopic;
	document.getElementById("subject1").value = topic;
	document.getElementById("program").value = this.setProgramValue();
	
}

function doShowVideoPurchace() {
	
	doReset();
	$('request_video_purchase').style.display = displayType;
	$('request_video_purchaseselect').enable();
	
	document.getElementById("category").value = subtopic;
	document.getElementById("subject1").value = topic;
	document.getElementById("program").value = this.setProgramValue();

}

function doShowStoreFeatures() {

	doReset();
	$('request_store_features').style.display = displayType;
	$('request_store_featuresselect').enable();

	document.getElementById("category").value = subtopic;
	document.getElementById("subject1").value = topic;
	document.getElementById("program").value = this.setProgramValue();

}

function doDefault() {

	doReset();
	
	document.getElementById("category").value = subtopic;
	document.getElementById("subject1").value = topic;
	document.getElementById("program").value = this.setProgramValue();

}

function doHideAll() {

	$('fname').style.display = "none";
	$('lname').style.display = "none";
	$('itunesmemname').style.display = "none";
	$('email1').style.display = "none";
	$('cntry').style.display = "none";
	$('osver').style.display = "none";
	$('osverbtmm').style.display = "none";
	$('').style.display = "none";
	$('request_account').style.display = "none";
	$('AOL_account_billing_address').style.display = "none";
	$('AOL_account_billing_city').style.display = "none";
	$('AOL_account_billing_state').style.display = "none";
	$('AOL_account_billing_zip').style.display = "none";
	$('AOL_account_phoneNum').style.display = "none";
	$('AOL_account_name').style.display = "none";
	$('acct_security_order_num').style.display = "none";
	$('request_connection').style.display = "none";
	$('error_msg').style.display = "none";
	$('request_download').style.display = "none";
	$('dl_item_title_req').style.display = "none";
	$('dl_item_title_opt').style.display = "none";
	$('dl_order_num').style.display = "none";
	$('request_authorization').style.display = "none";
	$('request_cards_codes').style.display = "none";
	$('itunes_activation_code').style.display = "none";
	$('itunes_gc_serial_num').style.display = "none";
	$('purchased_from').style.display = "none";
	$('request_app_store').style.display = "none";
	$('device').style.display = "none";
	$('request_music_purchase').style.display = "none";
	$('request_video_purchase').style.display = "none";
	$('request_store_features').style.display = "none";
	$('details').style.display = "none";

}


function doAOLCheck(op) {
	if (op == 0 || op == 1 || op == 3 || op == 5 || op == 6 || op == 7 || op == 8 || op == 9 || op == 10) {
		$('AOL_account_billing_address').style.display = "none";
		$('AOL_account_billing_addressinput').disable();
		$('AOL_account_billing_city').style.display = "none";
		$('AOL_account_billing_cityinput').disable();
		$('AOL_account_billing_state').style.display = "none";
		$('AOL_account_billing_stateinput').disable();
		$('AOL_account_billing_zip').style.display = "none";
		$('AOL_account_billing_zipinput').disable();
		$('AOL_account_phoneNum').style.display = "none";
		$('AOL_account_phoneNuminput').disable();
		$('AOL_account_name').style.display = "none";
		$('AOL_account_nameinput').disable();
		$('acct_security_order_num').style.display = "none";
		$('acct_security_order_numinput').disable();
		$('details').style.display = displayType;
		$('detailstextarea').enable();
	}

	if (op == 2) {
		$('AOL_account_billing_address').style.display = displayType;
		$('AOL_account_billing_addressinput').enable();
		$('AOL_account_billing_city').style.display = displayType;
		$('AOL_account_billing_cityinput').enable();
		$('AOL_account_billing_state').style.display = displayType;
		$('AOL_account_billing_stateinput').enable();
		$('AOL_account_billing_zip').style.display = displayType;
		$('AOL_account_billing_zipinput').enable();
		$('AOL_account_phoneNum').style.display = displayType;
		$('AOL_account_phoneNuminput').enable();
		$('AOL_account_name').style.display = displayType;
		$('AOL_account_nameinput').enable();
		$('acct_security_order_num').style.display = "none";
		$('acct_security_order_numinput').disable();
		$('details').style.display = displayType;
		$('detailstextarea').enable();
	}
	
	if (op == 4) {
		$('AOL_account_billing_address').style.display = "none";
		$('AOL_account_billing_addressinput').disable();
		$('AOL_account_billing_city').style.display = "none";
		$('AOL_account_billing_cityinput').disable();
		$('AOL_account_billing_state').style.display = "none";
		$('AOL_account_billing_stateinput').disable();
		$('AOL_account_billing_zip').style.display = "none";
		$('AOL_account_billing_zipinput').disable();
		$('AOL_account_phoneNum').style.display = "none";
		$('AOL_account_phoneNuminput').disable();
		$('AOL_account_name').style.display = "none";
		$('AOL_account_nameinput').disable();
		$('acct_security_order_num').style.display = displayType;
		$('acct_security_order_numinput').enable();
		$('details').style.display = displayType;
		$('detailstextarea').enable();
	}
}


function doDownloadCheck(op) {
	if (op == 0 || op == 1 || op == 2){
		$('error_msg').style.display = displayType;
		$('error_msgselect').enable();
		$('dl_item_title_req').style.display = displayType;
		$('dl_item_title_reqinput').enable();
		$('dl_item_title_opt').style.display = "none";
		$('dl_item_title_optinput').disable();
		$('dl_order_num').style.display = displayType;
		$('dl_order_numinput').enable();
		$('details').style.display = displayType;
		$('detailstextarea').enable();
	}
	
	if (op == 3){
		$('error_msg').style.display = displayType;
		$('error_msgselect').enable();
		$('dl_item_title_req').style.display = "none";
		$('dl_item_title_reqinput').disable();
		$('dl_item_title_opt').style.display = displayType;
		$('dl_item_title_optinput').enable();
		$('dl_order_num').style.display = displayType;
		$('dl_order_numinput').enable();
		$('details').style.display = displayType;
		$('detailstextarea').enable();
	}
	
}

function doAppStoreCheck(op) {
	if (op == 0 || op == 1 || op == 2 || op == 3 || op == 4) {
		$('dl_item_title_req').style.display = displayType;
		$('dl_item_title_reqinput').enable();
		$('dl_item_title_opt').style.display = "none";
		$('dl_item_title_optinput').disable();
		$('dl_order_num').style.display = displayType;
		$('dl_order_numinput').enable();
		$('device').style.display = displayType;
		$('deviceselect').enable();
		$('details').style.display = displayType;
		$('detailstextarea').enable();
	}
	
	if (op == 5 || op == 6) {
		$('dl_item_title_req').style.display = "none";
		$('dl_item_title_reqinput').disable();
		$('dl_item_title_opt').style.display = displayType;
		$('dl_item_title_optinput').enable();
		$('dl_order_num').style.display = displayType;
		$('dl_order_numinput').enable();
		$('device').style.display = displayType;
		$('deviceselect').enable();
		$('details').style.display = displayType;
		$('detailstextarea').enable();
	}

}


function doCardsCodesCheck(op) {
	if (op == 0 || op == 3 || op == 5 || op == 6) {
		$('itunes_activation_code').style.display = "none";
		$('itunes_activation_codeinput').disable();
		$('itunes_gc_serial_num').style.display = "none";
		$('itunes_gc_serial_numinput').disable();
		$('purchased_from').style.display = "none";
		$('purchased_frominput').disable();
	}
	
	if (op == 1 || op == 2) {
		$('itunes_activation_code').style.display = displayType;
		$('itunes_activation_codeinput').enable();
		$('itunes_gc_serial_num').style.display = displayType;
		$('itunes_gc_serial_numinput').enable();
		$('purchased_from').style.display = displayType;
		$('purchased_frominput').enable();
	}
	if (op == 4) {
		$('itunes_activation_code').style.display = "none";
		$('itunes_activation_codeinput').disable();
		$('itunes_gc_serial_num').style.display = "none";
		$('itunes_gc_serial_numinput').disable();
		$('purchased_from').style.display = displayType;
		$('purchased_frominput').enable();		
	}

}



function doMusicCheck(op) {
	if (op == 0 || op == 1 || op == 2 || op == 3 || op == 4 || op == 5 || op == 6 || op == 7 || op == 8) {
		$('dl_item_title_req').style.display = displayType;
		$('dl_item_title_reqinput').enable();
		$('dl_item_title_opt').style.display = "none";
		$('dl_item_title_optinput').disable();
		$('dl_order_num').style.display = displayType;
		$('dl_order_numinput').enable();
		$('details').style.display = displayType;
		$('detailstextarea').enable();
	}
	
	if (op == 9){
		$('dl_item_title_req').style.display = "none";
		$('dl_item_title_reqinput').disable();
		$('dl_item_title_opt').style.display = displayType;
		$('dl_item_title_optinput').enable();
		$('dl_order_num').style.display = displayType;
		$('dl_order_numinput').enable();
		$('details').style.display = displayType;
		$('detailstextarea').enable();
	}

}

function doVideoCheck(op) {
	if (op == 0 || op == 1 || op == 2 || op == 3 || op == 4 || op == 5 || op == 6 || op == 7 || op == 8 || op == 9 || op == 10) {
		$('dl_item_title_req').style.display = displayType;
		$('dl_item_title_reqinput').enable();
		$('dl_item_title_opt').style.display = "none";
		$('dl_item_title_optinput').disable();
		$('dl_order_num').style.display = displayType;
		$('dl_order_numinput').enable();
		$('details').style.display = displayType;
		$('detailstextarea').enable();
	}
	
	if (op == 11 || op == 12){
		$('dl_item_title_req').style.display = "none";
		$('dl_item_title_reqinput').disable();
		$('dl_item_title_opt').style.display = displayType;
		$('dl_item_title_optinput').enable();
		$('dl_order_num').style.display = displayType;
		$('dl_order_numinput').enable();
		$('details').style.display = displayType;
		$('detailstextarea').enable();
	}

}

function doStoreFeatureCheck(op) {
	if (op == 0 || op == 1 || op == 2 || op == 3 || op == 4 || op == 5 || op == 6) {
		$('dl_item_title_req').style.display = displayType;
		$('dl_item_title_reqinput').enable();
		$('dl_item_title_opt').style.display = "none";
		$('dl_item_title_optinput').disable();
		$('dl_order_num').style.display = displayType;
		$('dl_order_numinput').enable();
		$('details').style.display = displayType;
		$('detailstextarea').enable();
	}
	
	if (op == 7 || op == 8 || op == 9 || op == 10){
		$('dl_item_title_req').style.display = "none";
		$('dl_item_title_reqinput').disable();
		$('dl_item_title_opt').style.display = displayType;
		$('dl_item_title_optinput').enable();
		$('dl_order_num').style.display = displayType;
		$('dl_order_numinput').enable();
		$('details').style.display = displayType;
		$('detailstextarea').enable();
	}

}

