var germanList = new Array();
var italianList = new Array();
var frenchList = new Array();

function setup() {
	populateGermanArray();
	populateItalianArray();
	populateFrenchArray();
	displayGerman();
}

function populateGermanArray() {

    germanList.push(new LinkObject("Geschichte Irlands", "http://de.wikipedia.org/wiki/Geschichte_Irlands", "History of Ireland on German Wikipedia"));
    germanList.push(new LinkObject("Geschichte in Überblick", "http://www.irish-net.de/Irland-Geschichte/Geschichte-im-Ueberblick/", "A guide to Irish History"));
    germanList.push(new LinkObject("Irlands Geschichte", "http://www.discoverireland.com/de/about-ireland/history/", "Discover Ireland's German language page"));
    germanList.push(new LinkObject("Geschichte Irlands bis 1921", "http://www.michaelmaxwolf.de/neuzeit/irland/geschichte_irlands.htm", "Irish History Timeline up to 1921 on a personal website"));
    germanList.push(new LinkObject("Geschichte Irlands", "http://www.planet-wissen.de/laender_leute/irland/geschichte_irlands/index.jsp", "Irish History up to 1998"));
    germanList.push(new LinkObject("Irlands Geschichte: ein kurzer Überblick", "http://www.ringofkerry.biz/de/irlands-geschichte.htm", "Ring of Kerry German page"));
    germanList.push(new LinkObject("Geschichte Irlands bis zur Unabhängigkeit", "http://www.dadalos.org/deutsch/vorbilder/vorbilder/peacepeople/geschichte.htm", "Irish History up to Independence"));
    germanList.push(new LinkObject("Geschichte Irlands", "http://www.uni-protokolle.de/Lexikon/Geschichte_Irlands.html", "German university timeline, with links"));
    germanList.push(new LinkObject("Die Geschichte Irlands - von der Steinzeit, den Kelten, englischer Unterdrückung und dem Kampf um Freiheit", "http://www.irland-insi.de/irlands_geschichte/index_ger.html",
"The History of Ireland - the Stone Age, the Celts, English oppression and the Freedom Struggle"));
    germanList.push(new LinkObject("Reise nach Irland", "http://www.irland-reise.org/pages/geschichte.htm", "Irish History up to 1937"));
    germanList.push(new LinkObject("Irische Geschichte im Überblick - Von der Frühzeit bis zum Friedensprozess", "http://www.droichead.net/landeskunde_irland/irische_geschichte/irische_geschichte_im_ueberblick.html", "An overview of Irish History, from the Stone Age to the Peace Process"));
    germanList.push(new LinkObject("The Troubles - Geschichte des Nordirland-Konflikts", "http://www.sorsch.de/Nordirlandkonflikt.html", "The Troubles - History of the Conflict in Northern Ireland"));
    germanList.push(new LinkObject("Irland - Kultur und Geschichte", "http://www.irland-tips.de/kultur.htm", "Ireland - Culture and History"));
    germanList.push(new LinkObject("Irland - frühe Geschichte und Altertum", "http://www.heckert-haus.de/pageID_5727077.html", "Irish History up to 1999"));
    germanList.push(new LinkObject("Irland, Ireland, Bevölkerung, Geschichte", "http://www.muz-online.de/europe/irland.html", "Facts about Ireland"));
    germanList.push(new LinkObject("Irland - Geschichte", "http://www.irlandfan.de/geschichte.php", "Very detailed history timeline"));
    germanList.push(new LinkObject("Die jüngere irische Geschichte", "http://livinginireland.de/irische_geschichte.html", "Recent Irish History"));
    germanList.push(new LinkObject("Die Geschichte Irlands", "http://www.diewagners.de/joerg/irland10.htm", "Early history of Ireland")); 
    germanList.push(new LinkObject("IRA Hungerstreik", "http://www.ira-hungerstreik.de/", "The IRA Hungerstrike"));
    germanList.push(new LinkObject("Das Karfreitagsabkommen und der Kampf um seine Umsetzung", "http://www.info-nordirland.de/key_gfa_d.htm", "The Good Friday Agreement")); 
}

function populateItalianArray() {

    italianList.push(new LinkObject("Storia d'Irlanda", "http://it.wikipedia.org/wiki/Storia_d%27Irlanda", "Irish History on Italian Wikipedia"));
    italianList.push(new LinkObject("Storia dell'Irlanda", "http://www.irlanda.cc/storia-irlanda.html", "Comprehensive overview of Irish History"));
    italianList.push(new LinkObject("IRLANDA Cenni storici", "http://www.nbts.it/catalogo_guide/irlanda_storia.htm", "Irish History up to 1937"));
    italianList.push(new LinkObject("Breve storia d’Irlanda (dal 1916 al 1969)", "http://www.paolomarzola.com/blog/irlandahouse/breve-storia-dirlanda-dal-1916-al-1969", "Brief history of Ireland from 1916 to 1969"));
    italianList.push(new LinkObject("Breve Storia d'Irlanda", "http://www.rivstoricavirt.com/rivstoricavirt_sito/CorpoIrlanda.html", "Brief History of Ireland up to 1998"));
    italianList.push(new LinkObject("Conflitti interni: Dossier Irlanda del Nord", "http://www.studiperlapace.it/view_news_html?news_id=irlanda", "History of the conflict in Northern Ireland"));
    italianList.push(new LinkObject("Storia di Dublino e dell'Irlanda", "http://www.londraweb.com/Dublino%20Storia.htm", "History of Dublin and Ireland"));
    italianList.push(new LinkObject("Il portale sull'Irlanda", "http://www.ireland.it/storia-irlanda.cfm", "Brief history on a tourist website"));
    italianList.push(new LinkObject("Bunratty, nella storia d’Irlanda", "http://www.ilreporter.com/reportage/bunratty-nella-storia-d-irlanda", "History of Bunratty Castle"));
    italianList.push(new LinkObject("L'Informazione dall'Irlanda del Nord", "http://thefivedemands.org/", "Information site about Northern Ireland"));
    italianList.push(new LinkObject("Irlanda", "http://www.irlandando.it/cultura/storia/", "Highly detailed History site"));
    italianList.push(new LinkObject("L'isola d'Irlanda", "http://www.discoverireland.com/it/about-ireland/", "Discovery Ireland's Italian page"));
    italianList.push(new LinkObject("Il prezzo del genio: la sindrome di Asperger e la storia irlandese ", "http://www.threemonkeysonline.com/it/article_la_sindrome_di_asperger_e_la_storia_irlandese_wb_yeats_eamonn_devalera.htm", "Article discussing Aspergers Syndrome in Irish History"));
    italianList.push(new LinkObject("Irlanda del Nord", "http://www.regnounito.net/storia_irlanda_del_nord.html", "Brief history of Northern Ireland"));
    italianList.push(new LinkObject("Storia irlandese", "http://www.sheep-travel.com/it/irlanda_storia.htm", "Overview of Irish history up to 1998"));
    italianList.push(new LinkObject("Guida viaggio Irlanda", "http://www.viaggiare.it/IT/europa/europa_occidentale/irlanda/storia_irlanda.php", "Short 20th century history"));
    italianList.push(new LinkObject("Le tracce del passato", "http://irlande-tourisme.fr/it/ireland-things-to-see-and-do/culture-and-sights/history-and-heritage/", "Castles, momuments and heritage sites"));
    italianList.push(new LinkObject("Croke Park tra sport e sangue", "http://www.repubblica.it/2009/10/sport/calcio/nazionale/irlanda-italia/crocke-park/crocke-park.html", "Croke Park article on the Repubblica website"));
    italianList.push(new LinkObject("Il conflitto anglo-irlandese", "http://www.centrostudilaruna.it/il-conflitto-anglo-irlandese.html", "Description of a book on the Anglo-Irish conflict"));
    italianList.push(new LinkObject("Bobby Sands La lotta e la fam", "http://biografieonline.it/biografia.htm?BioID=1541&biografia=Bobby+Sands", "Biography of Bobby Sands"));
 
}

function populateFrenchArray() {

    frenchList.push(new LinkObject("Histoire de l'Irlande", "http://fr.wikipedia.org/wiki/Histoire_de_l%27Irlande", "French Wikipedia on Irish History"));
    frenchList.push(new LinkObject("Histoire de l'Irlande", "http://www.linternaute.com/histoire/histoire-de-l-irlande/irlande.shtml", "Timeline up to 2007"));
    frenchList.push(new LinkObject("Histoire d'Irlande", "http://eire.land.free.fr/histoire.html", "History of Ireland up to the early 20th Century"));
    frenchList.push(new LinkObject("Histoire Irlandaise", "http://www.guide-irlande.com/culture-irlandaise/histoire-irlandaise/", "Comprehensive overview of Irish History"));

    frenchList.push(new LinkObject("Irlande (Éire)", "http://www.tlfq.ulaval.ca/axl/europe/irlande.htm", "Detailed overview of Irish history up to 1998"));
    frenchList.push(new LinkObject("Les deux << Bloody Sunday >> de l'histoire Irlandaise", "http://vouloirtoujourstoutsavoir.blogspot.com/2009/11/les-deux-bloody-sunday-de-lhistoire.html", "The two Bloody Sundays"));
    frenchList.push(new LinkObject("Mado en Irlande - Culture et histoire irlandaises", "http://travelmad.free.fr/fr/fculture.htm", "Irish history, with links"));
    frenchList.push(new LinkObject("Irlande - MEMO - Le site de l'Histoire", "http://www.memo.fr/dossier.asp?id=143", "Irish History site"));
    frenchList.push(new LinkObject("L’Histoire de l’île", "http://www.discoverireland.com/fr/about-ireland/history/", "Discovery Ireland's French page"));
    frenchList.push(new LinkObject("Hauts Personnages en Irlande", "http://www.guide-irlande.com/culture-irlandaise/personnalites-irlandaises/", "Leading figures in Irish History"));
    frenchList.push(new LinkObject("Dublin Panorama: Histoire, Irlande - Guide pour expatriés","http://www.easyexpat.com/fr/dublin/panorama/histoire.htm", "Dublin guide for expats"));
    frenchList.push(new LinkObject("L'héritage du Centre Culturel Irlandais à Paris", "http://www.centreculturelirlandais.com/modules/movie/scenes/home/index.php?fuseAction=historique", "Irish cultural centre in Paris"));
    frenchList.push(new LinkObject("1801 à 1916 La Question d'Irlande ", "http://www.herodote.net/histoire/synthese.php?ID=37", "The Irish Question: 1801 to 1916"));
    frenchList.push(new LinkObject("La grande famine et ses conséquences sur la démographie.", "http://www.irlande.net/histoire/grande-famine-et-consequences-sur-la-demographie/", "The Great Famine and the consequences for demography"));
    frenchList.push(new LinkObject("1 000 000 de Morts Un Champignon provoque la plus grande catastrophe humanitaire d'Europe", "http://mycologia34.canalblog.com/archives/2009/07/16/14411285.html", "A million dead: Europe's greatest humanitarian catastrophe"));
    frenchList.push(new LinkObject("Republique d' Irlande - Poblacht na hEireann - Republic of Ireland", "http://svowebmaster.free.fr/Histoire_Irlande.htm", "Brief history up to 1998"));
    frenchList.push(new LinkObject("Histoire de la langue irlandaise", "http://www.irlandais.org/frirish/history.asp", "History of the Irish language"));
    frenchList.push(new LinkObject("La sanglante histoire de l'Irlande du Nord", "http://www.lepoint.fr/actualites-monde/regardez-la-sanglante-histoire-de-l-irlande-du-nord/924/0/324171", "The bloody history of Northern Ireland"));
    frenchList.push(new LinkObject("Histoire de l'Irlande", "http://www.kerrygold.com/intl/fr/index.jsp?1nID=153&2nID=156&3nID=156&4nID=156&5nID=156&nID=200&aID=124", "Brief tourist-oriented history"));
    frenchList.push(new LinkObject("Histoire: brève Histoire de l'Irlande", "http://www.irlande.org/histoire-irlande.php", "Short history of Ireland"));

}

function displayGerman() {

    setMainContentDiv(germanList, "tab1");
}


function displayItalian() {
    setMainContentDiv(italianList, "tab2");
}

function displayFrench() {
    setMainContentDiv(frenchList, "tab3");
}

function setMainContentDiv(langList, latesttag) {

    for (var x = 1; x < 4; x++) {
        var tabname = "tab" + x;
	var focustab = document.getElementById(tabname);
        if (tabname == latesttag) {
		focustab.style.backgroundColor= "#ADFF2F";
	}
	else {
		focustab.style.backgroundColor= "#FAF0E6";
	}
    }


    document.body.removeChild(document.getElementById('maincontent'));

    var maincontent = document.createElement("div");
    maincontent.setAttribute("id", "maincontent");
    maincontent.appendChild(document.createElement("br"));

    var contentTable = document.createElement("table");
    var tableBody = document.createElement("tbody");
    

     for (var i = 0; i < langList.length; i++) {

	    var row = document.createElement("tr");
	    var cell1 = document.createElement("td");
	    var cell2 = document.createElement("td");

	    var linkBody = document.createElement("a");
	
    	    linkBody.setAttribute("href", langList[i].source);

 
            var linkBodyText = document.createTextNode(langList[i].txt);

	    linkBody.appendChild(linkBodyText); 
            linkBody.appendChild(document.createElement("br"));

	    cell1.appendChild(linkBody);
            cell2.appendChild(document.createTextNode(langList[i].description));


	    row.appendChild(cell1);
            row.appendChild(cell2);

            tableBody.appendChild(row);

            contentTable.appendChild(tableBody);

    }

    maincontent.appendChild(contentTable);
  
    for (var y = 0; y < 3; y++) {
    	maincontent.appendChild(document.createElement("br"));
    }    


    var returnLink = document.createElement("a");
    returnLink.setAttribute("href", "./index.html");
    var linkBodyText = document.createTextNode("Return to More Links Index");
    returnLink.appendChild(linkBodyText); 

    var mainLink = document.createElement("a");
    mainLink.setAttribute("href", "../index.html");
    var linkBodyText2 = document.createTextNode("Return to Main Index");
    mainLink.appendChild(linkBodyText2); 


    maincontent.appendChild(returnLink);
    maincontent.appendChild(document.createElement("br")); 

    maincontent.appendChild(mainLink);
    maincontent.appendChild(document.createElement("br"));       

    document.body.appendChild(maincontent);


}

function LinkObject(argA, argB, argC)
{
	 this.txt = argA;
	 this.source = argB;
	 this.description = argC;
}



