/* first element: redir will redirect to contributing page, then to url, here
 * will offer the download here and skip will directly go to the NL-page
 * (nl-group has its own contributing page */

/* skip for all, since contributing-page doesn't redirect anymore... */
var languages = {
"ar": {"-": ['skip', 'Arabic',              'http://ar.openoffice.org/']}, 
"eu": {"-": ['skip', 'Basque',              'http://eu.openoffice.org/index.html']},
"bn": {"-": ['skip', 'Bengali',             'http://bn.openoffice.org/index.html']}, 
"bg": {"-": ['skip', 'Bulgarian',           'http://bg.openoffice.org/index.html']}, 
"ca": {"-": ['skip', 'Catalan',             'http://www.softcatala.org/projectes/openoffice/']}, 
"cs": {"-": ['skip', 'Cesky',               'http://cs.openoffice.org/']}, 
"zh": {"-": ['skip', 'Chinese',     				'http://zh.openoffice.org/downloads.html']},  
"hr": {"-": ['skip', 'Croatian',            'http://hr.openoffice.org/']}, 
"da": {"-": ['skip', 'Danish',              'http://da.openoffice.org/']}, 
"nl": {"-": ['skip', 'Dutch',               'http://nl.openoffice.org/downloaden.html']}, 
"en": {"-":  ['here',  'US English',          ''],
			 "gb": ['skip', 'British English',     'http://l10n.openoffice.org/download/en-GB.html'],
       "us": ['here',  'US English',          '']}, 
"et": {"-": ['skip', 'Estonian',            'http://openoffice.offline.ee']}, 
"fr": {"-": ['skip', 'French',              'http://fr.openoffice.org/about-downloads.html']}, 
"de": {"-": ['skip',  'German',              'http://de.openoffice.org/downloads/quick.html']}, 
"el": {"-": ['skip', 'Greek',               'http://el.openoffice.org']}, 
"he": {"-": ['skip', 'Hebrew',              'http://www.openoffice.org.il/']}, 
"hi": {"-": ['skip', 'Hindi',               'http://hi.openoffice.org/about-downloads.html']}, 
"hu": {"-": ['skip', 'Hungarian',           'http://hu.openoffice.org/about-downloads.html']}, 
"it": {"-": ['skip', 'Italian',             'http://it.openoffice.org/download/']}, 
"ja": {"-": ['skip', 'Japanese',            'http://ja.openoffice.org/']}, 
"km": {"-": ['skip', 'Khmer',               'http://km.openoffice.org/']}, 
"ko": {"-": ['skip', 'Korean',              'http://ko.openoffice.org/']}, 
"lo": {"-": ['skip', 'Laotian',             'http://lo.openoffice.org/']}, 
"mk": {"-": ['skip', 'Macedonian',          'http://mk.openoffice.org/']}, 
"ms": {"-": ['skip', 'Malaysian',           'http://ms.openoffice.org/']}, 
"no": {"-": ['skip', 'Norwegian',           'http://no.openoffice.org/']}, 
"pl": {"-": ['skip', 'Polish',              'http://pl.openoffice.org/product.download.html']}, 
"pt": {"-":  ['skip', 'Português',           'http://pt.openoffice.org/'], 
       "pt": ['skip', 'Português',           'http://pt.openoffice.org/'], 
       "br": ['skip', 'Português do Brasil', 'http://br-pt.openoffice.org/']}, 
"ro": {"-": ['skip', 'Romana',              'http://ro.openoffice.org/']}, 
"ru": {"-": ['skip', 'Russian',             'http://ru.openoffice.org']}, 
"sr": {"-": ['skip', 'Serbian',             'http://sr.openoffice.org/']}, 
"sk": {"-": ['skip', 'Slovak',              'http://sk.openoffice.org/']}, 
"sl": {"-": ['skip', 'Slovenian',           'http://sl.openoffice.org/']}, 
"fi": {"-": ['skip', 'Suomi',               'http://fi.openoffice.org/lataa.html']}, 
"es": {"-": ['skip', 'Spanish',             'http://es.openoffice.org/programa/']}, 
"sv": {"-": ['skip', 'Swedish',             'http://sv.openoffice.org/']}, 
"ta": {"-": ['skip', 'Tamil',               'http://ta.openoffice.org/']},
"th": {"-": ['skip', 'Thai',                'http://th.openoffice.org/about-downloads.html']}, 
"tr": {"-": ['skip', 'Turkish',             'http://tr.openoffice.org/about-downloads.html']}, 
"vi": {"-": ['skip', 'Vietnamese',          'http://vi.openoffice.org']}, 
"cy": {"-": ['skip', 'Welsh',               'http://cy.openoffice.org/index.html']}
};

function informNativeLanguage() {
  var language = "";
  if (navigator.language)
    language = navigator.language;
  else if (navigator.userLanguage)
    language = navigator.userLanguage;
  else if (navigator.systemLanguage)
    language = navigator.systemLanguage;
	
	// Convert "en" to "en-US" as well since en-US build is the canonical
  // translation, and thus better tested.
  if (language == "" || language == "en")
    language = "en-US";
  
  // Konqueror uses '_' where other browsers use '-'.
	if (language.indexOf("_") != -1) language = language.split("_").join("-");
  
	language = language.toLowerCase();
  var languageCode = language.split("-")[0];
  var regionCode = language.split("-")[1];
	
	thisLanguageSet = languages[languageCode];
//	alert (languageCode + regionCode);
	if (thisLanguageSet.length > 1) {
    if (thisLanguageSet[regionCode] != null) {
		  thisLanguage = thisLanguageSet[regionCode];
		}
		else {
		  thisLanguage = thisLanguageSet["-"]
		}
	} else {
	  thisLanguage = thisLanguageSet["-"];
	};
	if (languageCode != "en" && regionCode != "us"){
    document.writeln("You might be interested in the <a href=\""+thisLanguage[2]+"\">" + thisLanguage[1] + "</a> version.");
	} 
};



function askToContribute(uri) {
  uri=uri.replace("http://openoffice.bouncer.osuosl.org/","");
  document.location = "contribute.html"+uri;
}

function openItem(itemid,uri) {
  var thisDocument = document.getElementById("downloadextendedtext");
	thisDocument.style.display = "none"
  var thisDocument = document.getElementById(itemid);
	thisDocument.style.cursor = "default"
		if (itemid=="optionitem1") {
  		var thisContent = document.getElementById("downloadextendedtext");
		// expand the block
  		thisContent.style.display = "block"
			thisDocument.onclick = null;
		// reset the input
		if (itemid!="optionitem1") {
		  document.getElementById("optionitem1").onclick = "openItem('optionitem1',null)";
		}
	}
	else  {
	  document.location = uri;
	}
  return false;
};

function submitwithcontribute() {
  
}
