// if JavaScript is enabled, hide the 'no-script' list of links, and show the ajax-driven menu
// these two lines MUST be below the elements they reference in the DOM (towards the bottom of the page)
$(".no-script").hide();
$(".sections").show();

// namespace
if (typeof HAT == "undefined" || !HAT) {
	var HAT = {};
}

HAT.Languages = {
	lang: [
		{
			intelcode:"ara",
			textdirection:"rtl",
			culture:"ar_AE",
			countryval:"GlobalGateway_UAE_Arabic",
			countrylang:["Algeria - Arabic", "Bahrain - Arabic", "Iraq - Arabic", "Jordan - Arabic", "Kuwait - Arabic", "Lebanon - Arabic", "Morocco - Arabic", "Mauritania - Arabic", "Oman - Arabic", "Qatar - Arabic", "Tunisia - Arabic", "United Arab Emirates - Arabic", "Yemen - Arabic"],
			fonttype:"HAT-font2"
		},
		{
			intelcode:"ara",
			textdirection:"rtl",
			culture:"ar_AR",
			countryval:"",
			countrylang:[],
			fonttype:"HAT-font2"
		},
		{
			intelcode:"ara",
			textdirection:"rtl",
			culture:"ar_EG",
			countryval:"GlobalGateway_Egypt_Arabic",
			countrylang:["Egypt - Arabic"],
			fonttype:"HAT-font2"
		},
		{
			intelcode:"ara",
			textdirection:"rtl",
			culture:"ar_SA",
			countryval:"GlobalGateway_SaudiArabia_Arabic",
			countrylang:["Saudi Arabia - Arabic", "Middle East - Arabic"],
			fonttype:"HAT-font2"
		},
		{
			intelcode:"eng",
			textdirection:"ltr",
			culture:"en_SA",
			countryval:"GlobalGateway_SaudiArabia_English.xml",
			countrylang:["Saudi Arabia - English", "United Arab Emirates - English", "Egypt - English", "Middle East - English"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"aze",
			textdirection:"ltr",
			culture:"az_AZ",
			countryval:"",
			countrylang:[],
			fonttype:"HAT-font6"
		},
		{
			intelcode:"ces",
			textdirection:"ltr",
			culture:"cs_CZ",
			countryval:"/cd/corporate/europe/emea/ces/index.htm",
			countrylang:["Czech Republic - Czech"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"deu",
			textdirection:"ltr",
			culture:"de_DE",
			countryval:"GlobalGateway_Germany_German",
			countrylang:["Austria - German", "Europe - German", "Germany - German", "Liechtenstein - German", "Switzerland - German"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"eng",
			textdirection:"ltr",
			culture:"en_AP",
			countryval:"GlobalGateway_APAC_English",
			countrylang:["Asia Pacific - English", "Hong Kong - English", "Indonesia - English", "Malaysia - English", "New Zealand - English", "Pakistan - English", "Philippines - English", "Singapore - English", "Vietnam - English"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"eng",
			textdirection:"ltr",
			culture:"en_AU",
			countryval:"GlobalGateway_Australia_English",
			countrylang:["Australia - English"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"eng",
			textdirection:"ltr",
			culture:"en_IN",
			countryval:"GlobalGateway_India_English",
			countrylang:["India - English"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"sin",
			textdirection:"ltr",
			culture:"en_SG",
			countryval:"",
			countrylang:[],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"eng",
			textdirection:"ltr",
			culture:"en_UK",
			countryval:"GlobalGateway_UnitedKingdom_English",
			countrylang:["Africa - English", "Belgium - English", "Czech Republic - English", "Denmark - English", "Estonia - English", "Europe - English", "Finland - English", "Gambia - English", "Greece - English", "Hungary - English", "Iceland - English", "Ireland - English", "Kenya - English", "Latvia - English", "Lithuania - English", "Luxembourg - English", "Nigeria - English", "Norway - English", "Romania - English", "Rwanda - English", "Tanzania - English", "United Kingdom - English", "Zimbabwe - English"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"eng",
			textdirection:"ltr",
			culture:"en_US",
			countryval:"GlobalGateway_UnitedStates_English",
			countrylang:["United States - English", "Canada - English"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"spa",
			textdirection:"ltr",
			culture:"es_ES",
			countryval:"GlobalGateway_Spain_Spanish",
			countrylang:["Spain - Spanish"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"esla",
			textdirection:"ltr",
			culture:"es_LA",
			countryval:"GlobalGateway_LatinAmerica_Spanish",
			countrylang:["Argentina - Spanish", "Chile - Spanish", "Colombia - Spanish", "Costa Rica - Spanish", "Latin America - Spanish", "Mexico - Spanish", "Venezuela - Spanish", "Peru - Spanish", "Bolivia - Spanish", "Uruguay - Spanish"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"espanol",
			textdirection:"ltr",
			culture:"es_MX",
			countryval:"",
			countrylang:[],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"fra",
			textdirection:"ltr",
			culture:"fr_FR",
			countryval:"GlobalGateway_France_French",
			countrylang:["Canada - French", "France - French", "Belgium – French"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"heb",
			textdirection:"rtl",
			culture:"he_IL",
			countryval:"/cd/corporate/europe/emea/heb/287256.htm",
			countrylang:["Israel - Hebrew"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"hun",
			textdirection:"ltr",
			culture:"hu_HU",
			countryval:"/cd/corporate/europe/emea/hun/index.htm",
			countrylang:["Hungary - Hungarian"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"bah",
			textdirection:"ltr",
			culture:"id_ID",
			countryval:"",
			countrylang:[],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"ita",
			textdirection:"ltr",
			culture:"it_IT",
			countryval:"GlobalGateway_Italy_Italian",
			countrylang:["Italy - Italian"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"jpn",
			textdirection:"ltr",
			culture:"ja_JP",
			countryval:"GlobalGateway_Japan_Japanese",
			countrylang:["Japan - Japanese"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"kor",
			textdirection:"ltr",
			culture:"ko_KR",
			countryval:"GlobalGateway_Korea_Korean",
			countrylang:["Korea - Korean"],
			fonttype:"HAT-font5"
		},
		{
			intelcode:"nla",
			textdirection:"ltr",
			culture:"nl_NL",
			countryval:"GlobalGateway_Netherlands_Dutch",
			countrylang:["Netherlands - Dutch", "Belgium – Netherlands"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"pol",
			textdirection:"ltr",
			culture:"pl_PL",
			countryval:"GlobalGateway_Poland_Polish",
			countrylang:["Poland - Polish"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"portugues",
			textdirection:"ltr",
			culture:"pt_BR",
			countryval:"GlobalGateway_Brazil_Portuguese",
			countrylang:["Brazil - Portuguese"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"rom",
			textdirection:"ltr",
			culture:"ro_RO",
			countryval:"",
			countrylang:[],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"rus",
			textdirection:"ltr",
			culture:"ru_RU",
			countryval:"GlobalGateway_Russia_Russian",
			countrylang:["Russia - Russian"],
			fonttype:"HAT-font4"
		},
		{
			intelcode:"swe",
			textdirection:"ltr",
			culture:"sv_SE",
			countryval:"GlobalGateway_Sweden_Swedish",
			countrylang:["Sweden - Swedish"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"tur",
			textdirection:"ltr",
			culture:"tr_TR",
			countryval:"GlobalGateway_Turkey_Turkish",
			countrylang:["Turkey - Turkish"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"tha",
			textdirection:"ltr",
			culture:"th_TH",
			countryval:"GlobalGateway_Thailand_Thai",
			countrylang:["Thailand - Thai"],
			fonttype:"GG-Thai-font"
		},
		{
			intelcode:"vie",
			textdirection:"ltr",
			culture:"vi_VN",
			countryval:"",
			countrylang:[],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"zho",
			textdirection:"ltr",
			culture:"zh_CN",
			countryval:"GlobalGateway_China_SimplifiedChinese",
			countrylang:["China - Simplified Chinese"],
			fonttype:"HAT-font3"
		},
		{
			intelcode:"ukr",
			textdirection:"ltr",
			culture:"uk_UA",
			countryval:"/cd/corporate/europe/emea/rus/ukraine/index.htm",
			countrylang:["Ukraine - Ukrainian"],
			fonttype:"HAT-font1"
		},
		{
			intelcode:"zht",
			textdirection:"ltr",
			culture:"zh_TW",
			countryval:"GlobalGateway_Taiwan_TraditionalChinese",
			countrylang:["Taiwan - Traditional Chinese"],
			//fonttype:"HAT-font3"
			fonttype:"GG-Taiwan-font"
		}
	]
}

HAT.Countries = [
	{
		deeplink: 'en_US_01',
		name: 'United States - English',
		sot: {
			image: '/homepage/pix/bg/bg-sot.en_US.gif',
			text: 'Today is so yesterday.'
		},
		menu: '/homepage/xml/GlobalGateway_UnitedStates_English.xml'
	},
	{
		deeplink: 'es_LA_06',
		name: 'Argentina - Spanish',
		sot: {
			image: '/homepage/pix/bg/bg-sot.es_LA.gif',
			text: 'El presente ya quedó en el pasado.'
		},
		localizedName: 'Argentina - Español',
		menu: '/homepage/xml/GlobalGateway_LatinAmerica_Spanish.xml'
	},
	{
		deeplink: 'en_AP_00',
		name: 'Asia Pacific - English',
		sot: {
			image: '/homepage/pix/bg/bg-sot.en_AP.gif',
			text: 'Today is so yesterday.'
		},
		menu: '/homepage/xml/GlobalGateway_APAC_English.xml'
	},
	{
		deeplink: 'en_AU_01',
		name: 'Australia - English',
		sot: {
			image: '/homepage/pix/bg/bg-sot.en_AU.gif',
			text: 'Your kid\'s kid\'s kid won\'t think what we\'re doing is crazy at all.'
		},
		menu: '/homepage/xml/GlobalGateway_Australia_English.xml'
	},
	{
		deeplink: 'de_DE_01',
		name: 'Austria - German',
		localizedName: 'Austria - Deutsch',
		sot: {
			image: '/homepage/pix/bg/bg-sot.de_DE.gif',
			text: 'Die Größe unserer Arbeit liegt in den winzigen Details.'
		},
		menu: '/homepage/xml/GlobalGateway_Germany_German.xml'
	},
	{
		deeplink: 'fr_BE_01',
		name: 'Belgium – French',
		sot: {
			image: '/homepage/pix/bg/bg-sot.fr_FR.gif',
			text: 'Le futur est déjà là.'
		},
		localizedName: 'Belgium – Français',
		menu: '/homepage/xml/GlobalGateway_France_French.xml'
	},
	{
		deeplink: 'nl_BE_01',
		name: 'Belgium – Netherlands',
		sot: {
			image: '/homepage/pix/bg/bg-sot.nl_NL.gif',
			text: 'Today is so yesterday.'
		},
		localizedName: 'Belgium – Nederlands',
		menu: '/homepage/xml/GlobalGateway_Netherlands_Dutch.xml'
	},
	{
		deeplink: 'es_LA_07',
		name: 'Bolivia - Spanish',
		sot: {
			image: '/homepage/pix/bg/bg-sot.es_LA.gif',
			text: 'El presente ya quedó en el pasado.'
		},
		localizedName: 'Bolivia - Español',
		menu: '/homepage/xml/GlobalGateway_LatinAmerica_Spanish.xml'
	},
	{
		deeplink: 'pt_BR_01',
		name: 'Brazil - Portuguese',
		sot: {
			image: '/homepage/pix/bg/bg-sot.pt_BR.gif',
			text: 'O presente já ficou no passado.'
		},
		localizedName: 'Brazil - Português',
		menu: '/homepage/xml/GlobalGateway_Brazil_Portuguese.xml'
	},
	{
		deeplink: 'en_CA_01',
		name: 'Canada - English',
		link: '/en_CA/index.htm'
	},
	{
		deeplink: 'fr_CA_01',
		name: 'Canada - French',
		localizedName: 'Canada - Français',
		link: '/fr_CA/index.htm'
	},
	{
		deeplink: 'es_LA_02',
		name: 'Chile - Spanish',
		sot: {
			image: '/homepage/pix/bg/bg-sot.es_LA.gif',
			text: 'El presente ya quedó en el pasado.'
		},
		localizedName: 'Chile - Español',
		menu: '/homepage/xml/GlobalGateway_LatinAmerica_Spanish.xml'
	},
	{
		deeplink: 'zh_CN_01',
		name: 'China - Simplified Chinese',
		localizedName: 'China - 简体中文',
		sot: {
			image: '/homepage/pix/bg/bg-sot.zh_CN.gif',
			text: '先天下之行 而行'
		},
		menu: '/homepage/xml/GlobalGateway_China_SimplifiedChinese.xml'
	},
	{
		deeplink: 'es_LA_03',
		name: 'Colombia - Spanish',
		sot: {
			image: '/homepage/pix/bg/bg-sot.es_LA.gif',
			text: 'El presente ya quedó en el pasado.'
		},
		localizedName: 'Colombia - Español',
		menu: '/homepage/xml/GlobalGateway_LatinAmerica_Spanish.xml'
	},
	{
		deeplink: 'es_CR_01',
		name: 'Costa Rica - Spanish',
		localizedName: 'Costa Rica - Español',
		link: '/costarica/index.htm'
	},
	{
		deeplink: 'cz_CZ_01',
		name: 'Czech Republic - English',
		sot: {
			image: '/homepage/pix/bg/bg-sot.en_UK.gif',
			text: 'Today is so yesterday.'
		},
		menu: '/homepage/xml/GlobalGateway_UnitedKingdom_English.xml'
	},
	{
		deeplink: 'en_EG_01',
		name: 'Egypt - English',
		sot: {
			image: '/homepage/pix/bg/bg-sot.en_UK.gif',
			text: 'Today is so yesterday.'
		},
		menu: '/homepage/xml/GlobalGateway_SaudiArabia_English.xml'
	},
	{
		deeplink: 'ar_EG_01',
		name: 'Egypt - Arabic',
		sot: {
			image: '/homepage/pix/bg/bg-sot.ar_SA.gif',
			text: 'اليوم اصبح من الماضي البعيد'
		},
		localizedName: 'Egypt - عربي',

		menu: '/homepage/xml/GlobalGateway_Egypt_Arabic.xml'
	},
	{
		deeplink: 'fr_FR_01',
		name: 'France - French',
		sot: {
			image: '/homepage/pix/bg/bg-sot.fr_FR.gif',
			text: 'Le futur est déjà là.'
		},
		localizedName: 'France - Français',
		menu: '/homepage/xml/GlobalGateway_France_French.xml'
	},
	{
		deeplink: 'de_DE_03',
		name: 'Germany - German',
		localizedName: 'Germany - Deutsch',
		sot: {
			image: '/homepage/pix/bg/bg-sot.de_DE.gif',
			text: 'Die Größe unserer Arbeit liegt in den winzigen Details.'
		},
		menu: '/homepage/xml/GlobalGateway_Germany_German.xml'
	},
	{
		deeplink: 'en_AP_01',
		name: 'Hong Kong - English',
		sot: {
			image: '/homepage/pix/bg/bg-sot.en_AP.gif',
			text: 'Today is so yesterday.'
		},
		menu: '/homepage/xml/GlobalGateway_APAC_English.xml'
	},
	{
		deeplink: 'hu_HU_01',
		name: 'Hungary - English',
		sot: {
			image: '/homepage/pix/bg/bg-sot.en_UK.gif',
			text: 'Today is so yesterday.'
		},
		menu: '/homepage/xml/GlobalGateway_UnitedKingdom_English.xml'
	},
	{
		deeplink: 'en_IN_01',
		name: 'India - English',
		sot: {
			image: '/homepage/pix/bg/bg-sot.en_IN.gif',
			text: 'We’re involved in science so big you can’t see it.'
		},
		menu: '/homepage/xml/GlobalGateway_India_English.xml'
	},
	{
		deeplink: 'en_AP_02',
		name: 'Indonesia - English',
		sot: {
			image: '/homepage/pix/bg/bg-sot.en_AP.gif',
			text: 'Today is so yesterday.'
		},
		menu: '/homepage/xml/GlobalGateway_APAC_English.xml'
	},
	{
		deeplink: 'en_UK_16',
		name: 'Ireland - English',
		link: '/corporate/europe/emea/irl/intel/index.htm'
	},
	{
		deeplink: 'he_IL_01',
		name: 'Israel - Hebrew',
		localizedName: 'Israel - עברית',
		link: 'http://www.intel.com/cd/corporate/europe/emea/heb/287256.htm'
	},
	{
		deeplink: 'it_IT_01',
		name: 'Italy - Italian',
		sot: {
			image: '/homepage/pix/bg/bg-sot.it_IT.gif',
			text: 'Oggi è già ieri.'
		},
		localizedName: 'Italy - Italiano',
		menu: '/homepage/xml/GlobalGateway_Italy_Italian.xml'
	},
	{
		deeplink: 'ja_JP_01',
		name: 'Japan - Japanese',
		localizedName: 'Japan - 日本語',
		sot: {
			image: '/homepage/pix/bg/bg-sot.ja_JP.gif',
			text: '明日へつながるテクノロジーようこそ、インテルのウェブサイトへ'
		},
		menu: '/homepage/xml/GlobalGateway_Japan_Japanese.xml',
		image: '/homepage/pix/bg/bg-global-gateway-ja-JP.jpg',
		imagelink: '#jp-link'
	},
	{
		deeplink: 'ko_KR_01',
		name: 'Korea - Korean',
		sot: {
			image: '/homepage/pix/bg/bg-sot.ko_KR.gif',
			text: '당신의 상상을 실현합니다'
		},
		localizedName: 'Korea - 한국어',
		menu: '/homepage/xml/GlobalGateway_Korea_Korean.xml'
	},
	{
		deeplink: 'es_LA_01',
		name: 'Latin America - Spanish',
		sot: {
			image: '/homepage/pix/bg/bg-sot.es_LA.gif',
			text: 'El presente ya quedó en el pasado.'
		},
		localizedName: 'Latin America - Español',
		menu: '/homepage/xml/GlobalGateway_LatinAmerica_Spanish.xml'
	},
	{
		deeplink: 'en_AP_03',
		name: 'Malaysia - English',
		sot: {
			image: '/homepage/pix/bg/bg-sot.en_AP.gif',
			text: 'Today is so yesterday.'
		},
		menu: '/homepage/xml/GlobalGateway_APAC_English.xml'
	},
	{
		deeplink: 'es_LA_04',
		name: 'Mexico - Spanish',
		sot: {
			image: '/homepage/pix/bg/bg-sot.es_LA.gif',
			text: 'El presente ya quedó en el pasado.'
		},
		localizedName: 'Mexico - Español',
		menu: '/homepage/xml/GlobalGateway_LatinAmerica_Spanish.xml'
	},
	{
		deeplink: 'en_XR_01',
		name: 'Middle East - English',
		sot: {
			image: '/homepage/pix/bg/bg-sot.en_UK.gif',
			text: 'Today is so yesterday.'
		},
		menu: '/homepage/xml/GlobalGateway_SaudiArabia_English.xml'
	},
	{
		deeplink: 'ar_XR_01',
		name: 'Middle East - Arabic',
		sot: {
			image: '/homepage/pix/bg/bg-sot.ar_SA.gif',
			text: 'اليوم اصبح من الماضي البعيد'
		},
		localizedName: 'Middle East – عربي',
		menu: '/homepage/xml/GlobalGateway_SaudiArabia_Arabic.xml'
	},
	{
		deeplink: 'nl_NL_01',
		name: 'Netherlands - Dutch',
		sot: {
			image: '/homepage/pix/bg/bg-sot.nl_NL.gif',
			text: 'Today is so yesterday.'
		},
		localizedName: 'Netherlands - Nederlands',
		menu: '/homepage/xml/GlobalGateway_Netherlands_Dutch.xml'
	},
	{
		deeplink: 'en_AP_04',
		name: 'New Zealand - English',
		sot: {
			image: '/homepage/pix/bg/bg-sot.en_AP.gif',
			text: 'Today is so yesterday.'
		},
		menu: '/homepage/xml/GlobalGateway_APAC_English.xml'
	},
	{
		deeplink: 'en_AP_05',
		name: 'Pakistan - English',
		sot: {
			image: '/homepage/pix/bg/bg-sot.en_AP.gif',
			text: 'Today is so yesterday.'
		},
		menu: '/homepage/xml/GlobalGateway_APAC_English.xml'
	},
	{
		deeplink: 'es_LA_08',
		name: 'Peru - Spanish',
		sot: {
			image: '/homepage/pix/bg/bg-sot.es_LA.gif',
			text: 'El presente ya quedó en el pasado.'
		},
		localizedName: 'Peru - Español',
		menu: '/homepage/xml/GlobalGateway_LatinAmerica_Spanish.xml'
	},
	{
		deeplink: 'en_AP_06',
		name: 'Philippines - English',
		sot: {
			image: '/homepage/pix/bg/bg-sot.en_AP.gif',
			text: 'Today is so yesterday.'
		},
		menu: '/homepage/xml/GlobalGateway_APAC_English.xml'
	},
	{
		deeplink: 'pl_PL_01',
		name: 'Poland - Polish',
		sot: {
			image: '/homepage/pix/bg/bg-sot.pl_PL.gif',
			text: 'Dzisiaj to dla nas już przeszłość.'
		},
		localizedName: 'Polska - Polski',
		menu: '/homepage/xml/GlobalGateway_Poland_Polish.xml'
	},
	{
		deeplink: 'ru_RU_05',
		name: 'Russia - Russian',
		sot: {
			image: '/homepage/pix/bg/bg-sot.ru_RU.gif',
			text: 'Сегодня - это уже вчерашний день.'
		},
		localizedName: 'Russia - Русский',
		menu: '/homepage/xml/GlobalGateway_Russia_Russian.xml'
	},
	{
		deeplink: 'en_SA_01',
		name: 'Saudi Arabia - English',
			sot: {
			image: '/homepage/pix/bg/bg-sot.en_UK.gif',
			text: 'Today is so yesterday.'
		},
		menu: '/homepage/xml/GlobalGateway_SaudiArabia_English.xml'
	},
	{
		deeplink: 'ar_SA_01',
		name: 'Saudi Arabia - Arabic',
		sot: {
			image: '/homepage/pix/bg/bg-sot.ar_SA.gif',
			text: 'اليوم اصبح من الماضي البعيد'
		},
		localizedName: 'Saudi Arabia – عربي',
		menu: '/homepage/xml/GlobalGateway_SaudiArabia_Arabic.xml'
	},
	{
		deeplink: 'en_AP_07',
		name: 'Singapore - English',
		sot: {
			image: '/homepage/pix/bg/bg-sot.en_AP.gif',
			text: 'Today is so yesterday.'
		},
		menu: '/homepage/xml/GlobalGateway_APAC_English.xml'
	},
	{
		deeplink: 'en_ZA_01',
		name: 'South Africa - English',
		link: 'http://www.intel.com/cd/corporate/africa/emea/eng/za/index.htm'
	},
	{
		deeplink: 'es_ES_01',
		name: 'Spain - Spanish',
		sot: {
			image: '/homepage/pix/bg/bg-sot.es_ES.gif',
			text: 'El presente ya quedó en el pasado.'
		},
		localizedName: 'Spain - Español',
		menu: '/homepage/xml/GlobalGateway_Spain_Spanish.xml'
	},
	{
		deeplink: 'sv_SE_01',
		name: 'Sweden - Swedish',
		sot: {
			image: '/homepage/pix/bg/bg-sot.sv_SE.gif',
			text: 'Idag är så passé.'
		},
		localizedName: 'Sweden - Svenska',
		menu: '/homepage/xml/GlobalGateway_Sweden_Swedish.xml'
	},
	{
		deeplink: 'de_DE_05',
		name: 'Switzerland - German',
		localizedName: 'Switzerland - Deutsch',
		sot: {
			image: '/homepage/pix/bg/bg-sot.de_DE.gif',
			text: 'Die Größe unserer Arbeit liegt in den winzigen Details.'
		},
		menu: '/homepage/xml/GlobalGateway_Germany_German.xml'
	},
	{
		deeplink: 'zh_TW_01',
		name: 'Taiwan - Traditional Chinese',
		sot: {
			image: '/homepage/pix/bg/bg-sot.zh_TW.gif',
			text: '早到未來, 才能驅動未來'
		},
		localizedName: 'Taiwan - 繁體中文',
		menu: '/homepage/xml/GlobalGateway_Taiwan_TraditionalChinese.xml'
	},
	{
		deeplink: 'th_TH_01',
		name: 'Thailand - Thai',
		sot: {
			image: '/homepage/pix/bg/bg-sot.th_TH.gif',
			text: 'เราล้ำหน้ากว่าวันนี้ Today is so yesterday'
		},
		localizedName: 'Thailand - ภาษาไทย',
		menu: '/homepage/xml/GlobalGateway_Thailand_Thai.xml'
	},
	{
		deeplink: 'tr_TR_01',
		name: 'Turkey - Turkish',
		sot: {
			image: '/homepage/pix/bg/bg-sot.tr_TR.gif',
			text: 'Bugün dünde kaldı.'
		},
		localizedName: 'Turkey - Türkçe',
		menu: '/homepage/xml/GlobalGateway_Turkey_Turkish.xml'
	},
	{
		deeplink: 'ru_RU_09',
		name: 'Ukraine - Ukrainian',
		localizedName: 'Ukraine - Українська',
		link: 'http://www.intel.com/cd/corporate/europe/emea/rus/ukraine/index.htm'
	},
	{
		deeplink: 'en_AE_01',
		name: 'United Arab Emirates - English',
		sot: {
			image: '/homepage/pix/bg/bg-sot.en_UK.gif',
			text: 'Today is so yesterday.'
		},
		menu: '/homepage/xml/GlobalGateway_SaudiArabia_English.xml'
	},
	{
		deeplink: 'ar_AE_01',
		name: 'United Arab Emirates - Arabic',
		sot: {
			image: '/homepage/pix/bg/bg-sot.ar_SA.gif',
			text: 'اليوم اصبح من الماضي البعيد'
		},
		localizedName: 'United Arab Emirates – عربي',
		menu: '/homepage/xml/GlobalGateway_UAE_Arabic.xml'
	},
	{
		deeplink: 'en_UK_15',
		name: 'United Kingdom - English',
		sot: {
			image: '/homepage/pix/bg/bg-sot.en_UK.gif',
			text: 'Today is so yesterday.'
		},
		menu: '/homepage/xml/GlobalGateway_UnitedKingdom_English.xml'
	},
	{
		deeplink: 'es_LA_09',
		name: 'Uruguay - Spanish',
		sot: {
			image: '/homepage/pix/bg/bg-sot.es_LA.gif',
			text: 'El presente ya quedó en el pasado.'
		},
		localizedName: 'Uruguay - Español',
		menu: '/homepage/xml/GlobalGateway_LatinAmerica_Spanish.xml'
	},
	{
		deeplink: 'es_LA_05',
		name: 'Venezuela - Spanish',
		sot: {
			image: '/homepage/pix/bg/bg-sot.es_LA.gif',
			text: 'El presente ya quedó en el pasado.'
		},
		localizedName: 'Venezuela - Español',
		menu: '/homepage/xml/GlobalGateway_LatinAmerica_Spanish.xml'
	},
	{
		deeplink: 'en_AP_09',
		name: 'Vietnam - English',
		sot: {
			image: '/homepage/pix/bg/bg-sot.en_AP.gif',
			text: 'Today is so yesterday.'
		},
		menu: '/homepage/xml/GlobalGateway_APAC_English.xml'
	}
];


// section hover behavior
$(document).ready(function() {
	var s = "fast";
	// fixes some occasional visual glitches when user moves mouse over/out of the section
	function resetHeight() { $(this).height('auto'); }
	$(".section").hover(function() {
		$(this)
			.find('h2').stop().slideUp(s, resetHeight).end()
			.find('.contents').stop().slideDown(s, resetHeight);
	}, function() {
		$(this)
			.find('h2').stop().slideDown(s, resetHeight).end()
			.find('.contents').stop().slideUp(s, resetHeight);
	});
});

var default_country_name;
var default_country;
var deeplink = location.hash.substr(2); // flash-style deeplinking: "#/country_code"
if (!deeplink) {
	default_country_name = param("country") || cookie("countrylang"); // passed-in param or cookie
	
	// If no cookie, then determine geo by language (geocheck.js)
	if((default_country_name=="undefined")&&(typeof(geocheck)!="undefined"))
	{
		checkGeo();
	}
}

var redirect = (!param("country") && !deeplink); // don't (initially) redirect if a country has been passed in
var initialTracking = false;
var omniture_page_name;

$.each(HAT.Countries, function(i, country) {
	// for convenience, set up a direct link the the appropriate item in HAT.Languages.lang
	$.each(HAT.Languages.lang, function(i, language) {
		if ($.inArray(country.name, language.countrylang) >= 0) {
			country.language = language;
			return false;
		}
	});
	
	// set up the default country value and an analytics tracking name
	if (deeplink == country.deeplink || default_country_name == country.name) {
		default_country = country;
		// set omniture page name, but NOT for the default (index 0, en_US) selection
		if (i && country.language) {
			omniture_page_name = country.language.countryval.replace(/_/g, ":");
		}
	}
});

$(document).ready(function() {
	// parse the country list into a select box when loaded
	$.each(HAT.Countries, function(i, n) {
		$("<option value='" + n.name + "'>")
			.html(n.localizedName || n.name)
			.attr("selected", (n == default_country ? "selected" : ""))
			.appendTo("#country-selector");
	});
	
	// show the country selector, and add a change handler
	$("#country-selector").show().change(function(e) {
		var country = HAT.Countries[this.selectedIndex];
		
		if (country.language && country.language.textdirection === "rtl") {  // to fix a positioning bug in IE if switching to a RTL language
			$("#supportbtn_wrapper").hide();
		}
	
		//document.cookie = "countrylang=" + country.name + ";path=/;max-age=" + (60*60*24*365);
		//IE6 Cookie Fix 2/1/2009
		var nextyear = new Date();
        nextyear.setFullYear(nextyear.getFullYear() + 1);
        var cookie_value = "countrylang=" + encodeURIComponent(country.name) + "; path=/; expires=" + nextyear.toGMTString();
        document.cookie = cookie_value;

		
		if (country.link && redirect) {
			location.href = country.link;
		} else if (country.menu && country.language) {
			location.hash = "/" + country.deeplink;
			var header = "sites/sitewide/HAT/30recode/"+ country.language.culture + "/json/global_header_gateway.js";
			var footer = "sites/sitewide/HAT/30recode/" + country.language.culture + "/" + country.language.textdirection + "_Standards_W1024_HTTP_UTF8/footer.inc";
			var languageClasses = "HAT-globalgateway HAT-wide " + country.language.fonttype + (country.language.textdirection == "rtl" ? " HAT-rtl" : "");
			var styleLink = "/sites/sitewide/HAT/30recode/css/" + country.language.textdirection + "_header.css";
			
			$.get(country.menu, parseCountryXML, "xml");
			$.getJSON(header, parseHeaderJSON);
			$("#footerdiv").load(footer);
			$("html").attr("dir", country.language.textdirection);
			
			$("#HAT-linkStyle").attr('href', styleLink);
			$("#HATlinkStyle").attr('href', styleLink);
			$("#HAT-globalheader, #ggw").attr('class', languageClasses);
			$("#ggw").css('background-image', (country.image ? 'url(' + country.image + ')' : ''));
			
			// track change after the language updates for better user experience
			// but only after the initial page load
			if (initialTracking) {
				var omniture_page_name = country.language.countryval.replace(/_/g, ":").toLowerCase();
				waTrackAsLink("global gateway selection: " + country.name, 'o', 'wa_prop14=cim:' + omniture_page_name);
			}
			
			showSOT(country);
			
			// fix a bug in IE6 where the country selector loses track of which item is selected when changing between LTR and RTL
			$("#country-selector").find("option").filter(function() {
				if($(this).val() === country.name) {
					$(this).attr("selected","selected");
				}
			});
		}
	});
	
	// load the selected language if it is not the first (0th)
	// this assumes that the default language is already set up
	if ($("#country-selector").get(0).selectedIndex) {
		$("#country-selector").trigger('change');
	} else {
		var country = HAT.Countries[0];
		showSOT(country);
		$("#main-c").addClass("postload");
	}


	redirect = true; // after the initial language is set up, re-enable redirects
	initialTracking = true;

	var previousImageLink; //previous image-map link
	function showSOT(country) {
		if(typeof(previousImageLink) != "undefined") //check if we're changing from a geo that had an image-map link.  If so, hide it so we can't accidentally click it.
		{
			$(previousImageLink).css('display','none');
		}
		if(country.sot) {
			$("#ggw").removeClass("nosot");
			$("#sot span#gfx").css('background-image', 'url(' + country.sot.image + ')');
			$("#sot span#sottxt").html(country.sot.text);
			$(country.imagelink).css('display','block'); //if this country has an image-map link, show it
			previousImageLink = country.imagelink; //this country's image-map link is now the "previous" image-map link
		} else {
			$("#ggw").addClass("nosot");
			$("#sot span#sottxt").html('');
			$("#sot span#gfx").css('background-image', 'none');
		}
	}
	
	function parseCountryXML(xml) {
		var $xml = $(xml);
		function update(selector, textnode, linknode) {
			$(selector).html($.trim($xml.find(textnode).text()) || "&nbsp;"); // insert a hard space even if item is empty, to preserve HTML layout
			if (linknode) { $(selector).attr('href', $xml.find(linknode).text()); }
		}
		update(".choose-location h2", "headercopy");
		update(".section.work h1 a", "worktitle", "worklink");
		update(".section.play h1 a", "playtitle", "playlink");
		update(".section.about h1 a", "abouttitle", "aboutlink");
		update(".section.work h2", "worksubtitle");
		update(".section.play h2", "playsubtitle");
		update(".section.about h2", "aboutsubtitle");
		update(".section.work .contents", "workbody");
		update(".section.play .contents", "playbody");
		update(".section.about .contents", "aboutbody");
		$("#main-c").addClass("postload");
	}
	
	function parseHeaderJSON(json) {
		$("#logo_link").attr('href', json.header.logo.href + "?iid=" + json.header.logo.iid);
		$("#logo_img")
			.attr('alt', json.header.logo.value)
			.attr('title', json.header.logo.value);
		$("#lbl_search").html(json.header.search.button.value);
		$("#culture").val(json.header.search.culture);
		$("#searchsubmit")
			.attr('alt', json.header.search.button.value)
			.attr('title', json.header.search.button.value)
			.attr('src', "/sites/sitewide/HAT/30recode/pix/searchbtn_" + json.header.search.button.language + ".gif");
	
		HAT.SearchFilterLUT.head = json.header.search.filter.filterhead;
		HAT.SearchFilterLUT.qs = $.map(json.header.search.filter.term, function(n) {
			return { filter: n.query, term: n.value };
		});

		$("#HAT-filter-menu").remove();
		setTimeout(function() {
			$("#HAT-filter-menu").remove();
			HAT.FilterMenu.BuildFilter();
			HAT.FilterMenu.AttachEvents();
		}, 50);

		$("#supportbtn_link").attr('href',json.header.support.link.href + "?iid=" + json.header.support.link.ggiid);
		$("#supportbtn").text(json.header.support.link.value);
		$("#supportbtn_wrapper").show();		
	}
	function parseSupportJSON(sjson) {
		var lang = cookie("culture");
		$("#supportbtn_link").attr('href',sjson.support[lang].support.href);
		$("#supportbtn").text(sjson.support[lang].support.button.value);
	}
});

function cookie(key) {
	//return parseParams(document.cookie, /; ?/)[key];
	//IE6 Cookie Fix 2/1/2009
	return decodeURIComponent(parseParams(document.cookie, /; ?/)[key]);
}

function param(key) {
	var params = parseParams(location.search.substr(1), "&");
	return params[key] ? unescape(params[key]) : null;
}

// can be used for cookies or URL search strings
function parseParams(str, delimiter) {
	var x = {};
	$.each(str.split(delimiter), function(i, n) {
		var keyVal = n.split(/=/);
		if (keyVal[0] && keyVal[1]) { x[keyVal[0]] = keyVal[1]; }
	});
	return x;
}

// utility function to generate the 'no script' list of country links
function createNoscriptList() {
	var $div = $(".no-script").empty().show();
	var $list = $("<ul>").appendTo($div);
	$.each(HAT.Countries, function(i, n) {
		var value = n.link;
		if (n.menu) {
			$.ajax({ async: false, url: n.menu,
				success: function(countryXML) { value = $(countryXML).find("worklink").text(); }
			});
		}
		$list.append("<li><a href='" + value + "'>" + (n.localizedName || n.name) + "<\/a><\/li>");
		if ((i+1) % 16 == 0) {
			if (i+1 == HAT.Countries.length) {
				$list.css("text-align", "right");
				$div.append("<div class='clear'>");
			} else {
				$list = $("<ul>").appendTo($div);
			}
		}
	});
}