var language = "IT";
var news_titles = null, news_bodies = null;
var news_currently_shown = -1;

function getStudioImagesString(lang) {
	return "<table class='studioImagesTable'>" +
		"<tr><th colspan=4 style='color:#ccc;font-size:12px;'>Luca (" + (lang == "IT" ? "chitarra" : "guitar") + ") @ Nativity Studios</th></tr>" +
		"<tr><td><img src='images/Luca_1_s.jpg' onclick=\"showImage('Luca_1.jpg')\" /></td><td><img src='images/Luca_2_s.jpg' onclick=\"showImage('Luca_2.jpg')\" /></td>" +
		"<td><img src='images/Luca_3_s.jpg' onclick=\"showImage('Luca_3.jpg')\" /></td><td><img src='images/Luca_4_s.jpg' onclick=\"showImage('Luca_4.jpg')\" /></td></tr>" +
		"</table>" +
		"<table class='studioImagesTable'>" +
		"<tr><th colspan=2 style='color:#ccc;font-size:12px;'>Marco (" + (lang == "IT" ? "chitarra" : "guitar") + ") @ Nativity Studios</th></tr>" +
		"<tr><td><img src='images/Marco_1_s.jpg' onclick=\"showImage('Marco_1.jpg')\" /></td><td><img src='images/Marco_2_s.jpg' onclick=\"showImage('Marco_2.jpg')\" /></td></tr>" +
		"</table>" +
		"<table class='studioImagesTable'>" +
		"<tr><th colspan=3 style='color:#ccc;font-size:12px;'>Gabriele (" + (lang == "IT" ? "voce" : "vocals") + ") @ Nativity Studios</th></tr>" +
		"<tr><td><img src='images/Gab_1_s.jpg' onclick=\"showImage('Gab_1.jpg')\" /></td><td><img src='images/Gab_2_s.jpg' onclick=\"showImage('Gab_2.jpg')\" /></td>" +
		"<td><img src='images/Gab_3_s.jpg' onclick=\"showImage('Gab_3.jpg')\" /></td></tr>" +
		"</table>" +
		"<table class='studioImagesTable'>" +
		"<tr><th colspan=2 style='color:#ccc;font-size:12px;'>Paolo (" + (lang == "IT" ? "basso" : "bass guitar") + ") @ Nativity Studios</th></tr>" +
		"<tr><td><img src='images/Paolo_1_s.jpg' onclick=\"showImage('Paolo_1.jpg')\" /></td><td><img src='images/Paolo_2_s.jpg' onclick=\"showImage('Paolo_2.jpg')\" /></td></tr>" +
		"</table>" +
		"<table class='studioImagesTable'>" +
		"<tr><th colspan=3 style='color:#ccc;font-size:12px;'>Manuel (" + (lang == "IT" ? "batteria" : "drums") + ") @ Stairway Recording Studios</th></tr>" +
		"<tr><td><img src='images/Manuel_1_s.jpg' onclick=\"showImage('Manuel_1.jpg')\" /></td><td><img src='images/Manuel_2_s.jpg' onclick=\"showImage('Manuel_2.jpg')\" /></td>" +
		"<td><img src='images/Manuel_3_s.jpg' onclick=\"showImage('Manuel_3.jpg')\" /></td></tr>" +
		"</table>" +
		"<table class='studioImagesTable'>" +
		"<tr><th colspan=4 style='color:#ccc;font-size:12px;'>Mixing @ Hate Studios</th></tr>" +
		"<tr><td><img src='images/Hate_Studio_1_s.jpg' onclick=\"showImage('Hate_Studio_1.jpg')\" /></td>" +
		"<td><img src='images/Hate_Studio_2_s.jpg' onclick=\"showImage('Hate_Studio_2.jpg')\" /></td>" +
		"<td><img src='images/Hate_Studio_3_s.jpg' onclick=\"showImage('Hate_Studio_3.jpg')\" /></td>" +
		"<td><img src='images/Hate_Studio_4_s.jpg' onclick=\"showImage('Hate_Studio_4.jpg')\" /></td></tr>" +
		"</table>";
}

var news_titles_it = new Array();
news_titles_it[0] = "<b>09/01/2012 : Nuovo sito e singolo in streaming gratuito il 30 gennaio!</b> &minus; Alla fine di gennaio pubblicheremo il nuovo sito, e il singolo &quot;No Need to Surrender&quot; sar&agrave; disponibile in streaming gratuito!";
news_titles_it[1] = "<b>27/12/2011 : Ecco l'artwork di Eliran Kantor!</b> &minus; Vi mostriamo in anteprima la copertina del nostro prossimo album, opera di Eliran Kantor.";
news_titles_it[2] = "<b>19/12/2011 : Titolo e tracklist del nuovo album!</b> &minus; Svelati nuovi dettagli sul nuovo album! Il nuovo lavoro targato Clairvoyants sarà composto da 11 brani.";
news_titles_it[3] = "<b>12/12/2011 : Nuovo album in dirittura d'arrivo!</b> &minus; Abbiamo appena terminato le registrazioni del nuovo album, che probabilmente vedr&agrave; la luce tra febbraio e marzo 2012.";

var news_titles_en = new Array();
news_titles_en[0] = "<b>01/09/2012 : New website and free single on January 30th!</b> &minus; At the end of January we'll put online our new website, and you'll be able to listen to our new single in free streaming!";
news_titles_en[1] = "<b>12/27/2011 : Here is the artwork by Eliran Kantor!</b> &minus; We show you a preview of the cover artwork of our new album, made by Eliran Kantor.";
news_titles_en[2] = "<b>12/19/2011 : Title and tracklist of the new album!</b> &minus; We are unveiling new details about the new album! The new Clairvoyants record will contain 11 songs.";
news_titles_en[3] = "<b>12/12/2011 : New album almost done!</b> &minus; We just finished the recording sessions for the new album, that will be released in February or March 2012.";

var news_bodies_it = new Array();
news_bodies_it[0] = "<h1>Nuovo sito e singolo in streaming gratuito il 30 gennaio!</h1><p>Il 30 gennaio pubblicheremo il nostro nuovo sito, e direttamente dal sito stesso sarà possibile ascoltare in streaming gratuito <span style=\"font-weight:bold;color:white;\">&quot;No Need to Surrender&quot;</span>, il nuovo singolo tratto da &quot;The Shape of Things to Come&quot;!</p><p>Fino alla pubblicazione del nuovo sito non ci saranno ulteriori aggiornamenti, quindi ci rivediamo su <a href=\"http://www.clairvoyants.it\">www.clairvoyants.it</a> il 30 gennaio!</p><p>Rock on!</p>";
news_bodies_it[1] = "<h1>Ecco l'artwork di Eliran Kantor!</h1><p>Ecco svelata la copertina del nostro prossimo album &quot;The Shape of Things to Come&quot;, opera di <a href=\"http://www.elirankantor.com\">Eliran Kantor</a> che in passato ha gi&agrave; lavorato con Testament, Sodom, Atheist, Sigh, Gwar e molti altri.</p><img src=\"images/Artwork.jpg\" style=\"display:block;width:40%;margin:0px auto;cursor:pointer;\" onclick=\"showImage('Artwork.jpg')\" /><p>Lo stesso Eliran si è cos&igrave; espresso riguardo al concetto che sta dietro il disegno:</p><p style=\"font-style:italic;padding:0px 15px;\">&Egrave; una metafora del coraggio e del conflitto interiore &minus; il chiaroveggente &egrave; l'unico sopravvissuto in uno scenario apocalittico, e sa che deve raggiungere la cima dell'albero pi&ugrave; alto per riuscire a sopravvivere. I suoi abiti sono strappati in un modo che ricorda le raffigurazioni dei santi nei dipinti rinascimentali (insieme allo stile reminiscente di un dipinto ad olio), e si sporge verso l'unico segno di speranza che indica il nascere di un nuovo mondo dai resti del disastro.</p><p>L'aspetto del &quot;chiaroveggente&quot; &egrave; volutamente ambiguo, e lancia uno sguardo che rompe la quarta parete, fissando la persona che sta per avventurarsi nel suo mondo.</p><p>Prossimo aggiornamento il 9 gennaio! Buon anno a tutti... and stay tuned for the news to come!</p><p>Seguiteci regolarmente anche su <a href=\"http://www.facebook.com/Clairvoyants\">Facebook</a> e su <a href=\"http://twitter.com/clairvoyantstw\">Twitter</a>!</p>";
news_bodies_it[2] = "<h1>Titolo e tracklist del nuovo album!</h1><p>Ecco svelati nuovi dettagli riguardanti il nuovo album targato Clairvoyants! Il titolo sarà</p><p style='font-weight:bold;font-size:13px;text-align:center;color:white;'>&quot; The Shape of Things to Come &quot;</p><p>e sarà composto da 11 brani.</p><p>Ecco la tracklist completa:<ol><li>No Need to Surrender</li><li>I Don't Believe Their Lie</li><li>Endure and Survive</li><li>Just the Same Story</li><li>The Shape of Things to Come</li><li>Prometheus</li><li>The Only Way Out Is Through</li><li>Sinner's Tale</li><li>To Heaven and Back</li><li>Here Today, Gone Tomorrow</li><li>Horizon Calling</li></ol></p><p>Per quanto riguarda l'artwork, siamo fieri di comunicare che abbiamo scelto <a href=\"http://www.elirankantor.com\">Eliran Kantor</a>, uno dei migliori disegnatori sul mercato che ha lavorato con Testament, Sodom, Atheist, Sigh, Gwar e molti altri.</p><p>Il prossimo 27 dicembre ci sarà un nuovo aggiornamento con la pubblicazione dell'artwork!</p><p>Seguiteci regolarmente anche su <a href=\"http://www.facebook.com/Clairvoyants\">Facebook</a> e su <a href=\"http://twitter.com/clairvoyantstw\">Twitter</a>!</p>";
news_bodies_it[3] = "<h1>Nuovo album in dirittura d'arrivo!</h1><p>Abbiamo appena terminato le registrazioni del nuovo album, che probabilmente vedr&agrave la luce tra febbraio e marzo 2012.<br><br>La registrazione della batteria ha avuto luogo allo <a href=\"http://www.myspace.com/stairwaystudio\">Stairway Recording Studio</a> di Melano (Svizzera), mentre gli altri strumenti sono stati registrati presso il <a href=\"http://www.myspace.com/nativitystudio\">Nativity Studio</a> di Luca Princiotta a Chiasso (Svizzera); mix e mastering sono stati eseguiti presso gli <a href=\"http://www.myspace.com/hatestudio\">Hate Studio</a> di Vicenza e curati da Maurizio &quot;Icio&quot; Baggio.<br><br>L'album sar&agrave; pubblicato in tutto il mondo nuovamente da <a href=\"http://www.myspace.com/valeryrecords\">Valery Records</a> e sar&agrave; distribuito in Italia tramite <a href=\"http://www.frontiers.it\">Frontiers</a>/<a href=\"http://www.edel.it\">Edel</a>.<br><br>Ecco qui di seguito alcune immagini scattate nei vari studi durante le sessioni di registrazione. Presto nuovi aggiornamenti con altri dettagli.<br><br>Stay Tuned !!!</p>" + getStudioImagesString("IT");
										
var news_bodies_en = new Array();
news_bodies_en[0] = "<h1>New website and free single at the end of January!</h1><p>On January 30th we'll put online our new website, and you'll be able to listen in free streaming to <span style=\"font-weight:bold;color:white;\">&quot;No Need to Surrender&quot;</span>, the new single from &quot;The Shape of Things to Come&quot;, directly from the website!</p><p>There will be no other updates until the site's publishing, so see you back on <a href=\"http://www.clairvoyants.it\">www.clairvoyants.it</a> on January 30th!</p><p>Rock on!</p>"
news_bodies_en[1] = "<h1>Here is the artwork by Eliran Kantor!</h1><p>We show you a preview of the cover of out next album, &quot;The Shape of Things to Come&quot;, made by <a href=\"http://www.elirankantor.com\">Eliran Kantor</a> who worked with Testament, Sodom, Atheist, Sigh, Gwar and many others.</p><img src=\"images/Artwork.jpg\" style=\"display:block;width:40%;margin:0px auto;cursor:pointer;\" onclick=\"showImage('Artwork.jpg')\" /><p>About the idea that lies behind the drawing, Eliran said:</p><p style=\"font-style:italic;padding:0px 15px;\">It's a metaphore to breavery and personal struggle &minus; the clairvoyant is the only survivor from an apocalyptic scenario, and he knows that he has to climb the highest tree in order to stay alive. His clothes are ripped in a way that reminds (along with the oil painting feel) of the classic saints as portrayed in Renaissance paintings, and is reaching for the only sign of hope for a brave new world to emerge from this disaster.</p><p>The clairvoyant's gender is deliberately ambiguous, and (s)he's looking out, breaking the fourth wall, glancing at the person that is about to venture into his/her world.</p><p>Next update on the 9th of January! Happy new year to everybody... and stay tuned for the news to come!</p><p>Follow us regularly on <a href=\"http://www.facebook.com/Clairvoyants\">Facebook</a> and <a href=\"http://twitter.com/clairvoyantstw\">Twitter</a>!</p>";
news_bodies_en[2] = "<h1>Title and tracklist of the new album!</h1><p>Here are some new details about the new Clairvoyants record! The title will be</p><p style='font-weight:bold;font-size:13px;text-align:center;color:white;'>&quot; The Shape of Things to Come &quot;</p><p>and it will be made up of 11 songs.</p><p>Here is the complete tracklist:<ol><li>No Need to Surrender</li><li>I Don't Believe Their Lie</li><li>Endure and Survive</li><li>Just the Same Story</li><li>The Shape of Things to Come</li><li>Prometheus</li><li>The Only Way Out Is Through</li><li>Sinner's Tale</li><li>To Heaven and Back</li><li>Here Today, Gone Tomorrow</li><li>Horizon Calling</li></ol></p><p>As for the artwork, we are proud to announce that we chose <a href=\"http://www.elirankantor.com\">Eliran Kantor</a>, one of the best cover artist on the market, who worked with Testament, Sodom, Atheist, Sigh, Gwar and many others.</p><p>The next 27th of December there will be a new update, and we'll publish the official artwork for the album!</p><p>Follow us regularly on <a href=\"http://www.facebook.com/Clairvoyants\">Facebook</a> and <a href=\"http://twitter.com/clairvoyantstw\">Twitter</a>!</p>";
news_bodies_en[3] = "<h1>New album almost done!</h1><p>We just finished the recording sessions for the new album, that will be released in February or March 2012.<br><br>The drums were recorded at the <a href=\"http://www.myspace.com/stairwaystudio\">Stairway Recording Studio</a> in Melano (Switzerland), while all the other instruments and vocals were recorded at Luca Princiotta's own <a href=\"http://www.myspace.com/nativitystudio\">Nativity Studio</a> in Chiasso (Switzerland); mixing and mastering were done at <a href=\"http://www.myspace.com/hatestudio\">Hate Studio</a> in Vicenza by Maurizio &quot;Icio&quot; Baggio.<br><br>The album will be released worldwide by <a href=\"http://www.myspace.com/valeryrecords\">Valery Records</a> and will be distributed in Italy by <a href=\"http://www.frontiers.it\">Frontiers</a>/<a href=\"http://www.edel.it\">Edel</a>.<br><br>Here are some photos taken during the recording and mixing sessions. Check back soon for new updates and details.<br><br>Stay Tuned !!!</p>" + getStudioImagesString("EN");

function changeLanguage(new_language) {
	language = new_language;
	if(language == "IT") {
		news_titles = news_titles_it;
		news_bodies = news_bodies_it;
	} else {
		news_titles = news_titles_en;
		news_bodies = news_bodies_en;
	}
	showNewsTitles();
	if(news_currently_shown != -1) {
		toggleNewsBody(news_currently_shown, true);
	}
}

function showNewsTitles() {
	var table = document.getElementById("newsBoxTable");
	while(table.hasChildNodes()) {
		table.removeChild(table.childNodes[0]);
	}
	var row = table.insertRow(-1);
	var cell = document.createElement("th");
	if(language == "IT") {
		cell.innerHTML = "Ultime Notizie:";
	} else {
		cell.innerHTML = "Latest News:";
	}
	row.appendChild(cell);
	for(i in news_titles) {
		row = table.insertRow(-1);
		cell = row.insertCell(0);
		cell.innerHTML = news_titles[i];
		cell.onclick = Function("toggleNewsBody(" + i + ")");
	}
}

function toggleNewsBody(i, translate) {
	if(news_currently_shown == -1) {
		var newsBody = document.createElement("div");
		newsBody.setAttribute("id", "newsBody");
		newsBody.setAttribute("class", "newsBody");
		newsBody.className = "newsBody";
		newsBody.innerHTML = news_bodies[i];
		document.getElementById("newsDiv").appendChild(newsBody);
		document.getElementById("newsDiv").style.height = "200%";
		news_currently_shown = i;
	} else if(translate || i != news_currently_shown) {
		var newsBody = document.getElementById("newsBody");
		newsBody.innerHTML = news_bodies[i];
		news_currently_shown = i;
	} else {
		var newsDiv = document.getElementById("newsDiv");
		var newsBody = document.getElementById("newsBody");
		newsDiv.removeChild(newsBody);
		news_currently_shown = -1;
	}
}

function showImage(filename) {
	var overlay = document.createElement("div");
	overlay.setAttribute("id", "overlay");
	overlay.setAttribute("class", "overlay");
	overlay.className = "overlay";
	overlay.onclick = restore;
	document.body.appendChild(overlay);
	
	var imageOver = document.createElement("div");
	imageOver.setAttribute("id", "imageOver");
	imageOver.setAttribute("class", "imageOver");
	imageOver.className = "imageOver";
	imageOver.onclick = restore;
	imageOver.innerHTML = "<img style='border: 20px solid black;' src='images/" + filename + "' />";
	document.body.appendChild(imageOver);
}

function restore() {
	document.body.removeChild(document.getElementById("imageOver"));
	document.body.removeChild(document.getElementById("overlay"));
}
