/*
	Main JavaScript functions for website CIPL [2008]
*/

function startup() {
	frames['iframe'].location.href = 'data/home.html';
	document.getElementById('interestingLinksContainer').style.display = 'none';
}
function calcHeight() // minimal height ( = height menu)
{
  //find the height of the internal page
  var the_height=document.getElementById('iframe').contentWindow.
  document.body.scrollHeight;

  //change the height of the iframe
  document.getElementById('iframe').height=the_height+ 20; // weird. why +20? (otherwise you miss bottom lines...)
  
  //set minimum height if necessary (make sure home page fits exactly and is just below maximum screen heigt)
  if(the_height < 700) {
		document.getElementById('iframe').height = '700px';
  }
}
function initPopup() {
	document.getElementById('popup').style.display = 'none';
}
function showPopUp(textmessage) {
	var txt = "";
	switch(textmessage) {
		case '18' :
			txt = "The Hague 1928, Geneva 1931, Rome 1933, Copenhagen 1936, Brussels 1939 (was cancelled because of the War II), Paris 1948, London 1952, Oslo 1957, Cambridge, Mass. 1962, Bucharest 1967, Bologna 1972, Vienna 1977, Tokyo 1982, Berlin 1987, Quebec 1992, Paris 1997, Prague 2003, Seoul 2008.";
		break;
		case 'foo' :
			txt = "this is a foo message";
		break;			
	}
	document.getElementById('popupMessage').innerHTML = txt;
	document.getElementById('popup').style.backgroundColor = "#fad9b1";
	document.getElementById('popup').style.display = 'block'			
}
function closePopUp() {
	document.getElementById('popup').style.display = 'none';				
}
function toggleLinks() {
	if (document.getElementById('interestingLinksContainer').style.display == 'none') {
		document.getElementById('interestingLinksContainer').style.display = 'block';
	} else {
		document.getElementById('interestingLinksContainer').style.display = 'none';
		startup();
	}
}



