function showBackCurrent()	{document.getElementById('backToBox').style.opacity = '0'; 
document.getElementById('backToBox').innerHTML = '<a class="menu" onclick="javascript: Disparition(\'mainArea\'); Disparition(\'backToBox\'); '
+'SomeTime(\'showbackcurrentexhibitions\',\'backToBox\',600);"><br>back to current exhibitions &uarr;</a>'; Apparition('backToBox');}

function showBackComing()	{document.getElementById('backToBox').style.opacity = '0'; 
document.getElementById('backToBox').innerHTML = '<a class="menu" onclick="javascript: Disparition(\'mainArea\'); Disparition(\'backToBox\'); '
+'SomeTime(\'showbackcomingexhibitions\',\'backToBox\',600);"><br>back to coming exhibitions &uarr;</a>'; Apparition('backToBox');}

function showBackPast()	{document.getElementById('backToBox').style.opacity = '0'; 
document.getElementById('backToBox').innerHTML = '<a class="menu" onclick="javascript: Disparition(\'mainArea\'); Disparition(\'backToBox\'); '
+'SomeTime(\'showbackpastexhibitions\',\'backToBox\',600);"><br>back to past exhibitions &uarr;</a>'; Apparition('backToBox');}

function showBack(x,y)	{document.getElementById('backToBox').style.opacity = '0'; 
document.getElementById('backToBox').innerHTML = '<a class="menu" onclick="javascript: Disparition(\'mainArea\'); Disparition(\'backToBox\'); var e = \'models/artists.php\'; callBigPage(e); SomeTime(\'clearinnerHTML\',\'backToBox\',600);"><br>back to '+y+' &uarr;</a>'; Apparition('backToBox');}

function SomeTime(x,y,z)	{
	if(x == "clearinnerHTML")	{setTimeOut('document.getElementById("'+y+'").innerHTML = ""',z);}
	if(x == "showbackpastexhibitions")	{
		setTimeout('callPage(\'models/exhibitions_past.php?place=2\',\'models/exhibitions_past.php?place=1\')',1200); 
		setTimeout('Apparition(\'mainArea\')',1600);
		setTimeOut('document.getElementById(\''+y+'\').innerHTML = \'\'',z);
	}
	if(x == "showbackcurrentexhibitions")	{
		setTimeout('showExhibitSlider(\'londonText\',CurrentExhibitLondon,\'Current\',2)',1200);
		setTimeout('showExhibitSlider(\'solothurnText\',CurrentExhibitSolothurn,\'Current\',1)',1200);
		setTimeout('Apparition(\'mainArea\')',1600);
		setTimeOut('document.getElementById(\''+y+'\').innerHTML = \'\'',z);
	}
	if(x == "showbackcomingexhibitions")	{
		setTimeout('showExhibitSlider(\'londonText\',CurrentExhibitLondon,\'Coming\',2)',1200);
		setTimeout('showExhibitSlider(\'solothurnText\',CurrentExhibitSolothurn,\'Coming\',1)',1200);
		setTimeout('Apparition(\'mainArea\')',1600);
		setTimeOut('document.getElementById(\''+y+'\').innerHTML = \'\'',z);
	}
}

function preload(){
	var imgload = new Array();
	for(var j=0; j<preload.arguments.length; j++){
		imgload[j] = new Image();
		imgload[j].src = preload.arguments[j];
	}
//alert(document.images.length);
}

mainAreaStatus = 'visible';

function getXMLHttpRequest() {
	if (window.XMLHttpRequest) {
		return new window.XMLHttpRequest;
	} else {
		try {return new ActiveXObject("MSXML2.XMLHTTP.3.0");}
		catch(ex) {return null;}
	}
}

function callPage(page_url1,page_url2)	{
document.getElementById('bigArea').innerHTML = '';
var txtFile1 = getXMLHttpRequest();
var txtFile2 = getXMLHttpRequest();
txtFile1.open("GET", page_url1, true);
txtFile2.open("GET", page_url2, true);
txtFile1.onreadystatechange = function() {
  if (txtFile1.readyState === 4) {  // Makes sure the document is ready to parse.
    if (txtFile1.status === 200) {  // Makes sure it's found the file.
      var allText1 = txtFile1.responseText; 
	  document.getElementById('londonText').innerHTML = String(allText1);
	}
  }
}

txtFile2.onreadystatechange = function() {
  if (txtFile2.readyState === 4) {  // Makes sure the document is ready to parse.
    if (txtFile2.status === 200) {  // Makes sure it's found the file.
      var allText2 = txtFile2.responseText; 
		document.getElementById('solothurnText').innerHTML = String(allText2);
	}
  }
}
txtFile1.send(null);
txtFile2.send(null);
	if(page_url1 == 'models/location.php?id=2')	{
	document.getElementById('webmasterCredits').innerHTML = '&nbsp;&nbsp;<font style="font-size: 10px;">Website by <a href="mailto:lauro.foletti@gmail.com" target="_blank" style="text-decoration: none; border-bottom: 1px dotted black; color: black;">Lauro Foletti</a>, Geneva</font>';
	}
}

function callSinglePage(target,page_url1)	{
document.getElementById('bigArea').innerHTML = '';
var txtFile1 = getXMLHttpRequest();
txtFile1.open("GET", page_url1, true);
txtFile1.onreadystatechange = function() {
  if (txtFile1.readyState === 4) {  // Makes sure the document is ready to parse.
    if (txtFile1.status === 200) {  // Makes sure it's found the file.
      var allText1 = txtFile1.responseText; 
	  document.getElementById(target).innerHTML = String(allText1);
	}
  }
}
txtFile1.send(null);
}

var text = 'texte';
var varText = '';

function callBigPage(page_url)	{
//alert(target_id+' / '+page_url);
var txtFile = getXMLHttpRequest();
txtFile.open("GET", page_url, true);
txtFile.onreadystatechange = function() {
  if (txtFile.readyState === 4) {  // Makes sure the document is ready to parse.
    if (txtFile.status === 200) {  // Makes sure it's found the file.
      var allText = txtFile.responseText; 
      var lines = txtFile.responseText.split("\r\n"); // Will separate each line into an array
	  if(lines.length == 1)	{lines = txtFile.responseText.split("\r");}
	  if(lines.length == 1)	{lines = txtFile.responseText.split("\n")}
	  //alert(allText);
	  var allTextLines = lines.join('<br>');
	  text = String(allText);
		setTimeout("document.getElementById('londonText').innerHTML = ''",1200);
		setTimeout("document.getElementById('solothurnText').innerHTML = ''",1200);
		setTimeout("document.getElementById('bigArea').innerHTML = text",1200);
		setTimeout("Apparition()",1800);
	}
  }
}
txtFile.send(null);
}

function preloadPage(page_url)	{
//alert(page_url);
var txtFile = getXMLHttpRequest();
txtFile.open("GET", page_url, true);
txtFile.onreadystatechange = function() {
  if (txtFile.readyState === 4) {  // Makes sure the document is ready to parse.
    if (txtFile.status === 200) {  // Makes sure it's found the file.
     var allText = txtFile.responseText; 
	  alert(allText);
	document.getElementById('secretBox').innerHTML = String(allText);
//	setTimeout("Apparition('main')",100);*/
	}
  }
}
txtFile.send(null);
}

function showArtistContent(target,type,url,legend)	{
	if(type=='image')	{
		Disparition('mainBoxArtistArea');
		setTimeout("document.getElementById('textBox').style.visibility = 'hidden'",1200);
		setTimeout("document.getElementById('imageBox').style.visibility = 'hidden'",1200);
		setTimeout("document.getElementById('articlesBox').style.visibility = 'hidden'",1200);
		setTimeout("document.getElementById('imageLarge').src = '"+url+"'",1200);
		setTimeout("document.getElementById('imageLegend').innerHTML = '"+legend+"'",1200);
		setTimeout("document.getElementById('imageBox').style.visibility = 'visible'",1500);
		setTimeout("Apparition('mainBoxArtistArea')",1600);
	}	else if(type=='articles')	{
		Disparition('mainBoxArtistArea');
		setTimeout("document.getElementById('imageBox').style.visibility = 'hidden'",1200);
		setTimeout("document.getElementById('textBox').style.visibility = 'hidden'",1200);
		setTimeout("document.getElementById('articlesBox').style.visibility = 'visible'",1200);
		setTimeout("Apparition('mainBoxArtistArea')",1600);
	}	else if(type=='exhibition')	{
		Disparition('imageBox');
		setTimeout("document.getElementById('imageLarge').src = '"+url+"'",1200);
		setTimeout("document.getElementById('imageLegend').innerHTML = '"+legend+"'",1200);
		setTimeout("document.getElementById('imageBox').style.visibility = 'visible'",1500);
		setTimeout("Apparition('imageBox')",1600);
	}	else	{
		Disparition('mainBoxArtistArea');
		setTimeout("document.getElementById('imageBox').style.visibility = 'hidden'",1200);
		setTimeout("document.getElementById('articlesBox').style.visibility = 'hidden'",1200);
		setTimeout("document.getElementById('textBox').style.visibility = 'visible'",1200);
		setTimeout("Apparition('mainBoxArtistArea')",1600);
	}
}

function Disparition(id){
	if (!id)	{id = 'mainArea';}
	var AlphaBegin = document.getElementById(id).style.opacity;
	var opacity = 1;
	for(var a=0; a<35; a++)	{	
		setTimeout("document.getElementById('"+id+"').style.opacity = "+opacity,(35*a)+1);
		opacity = opacity-0.03;
		if (a == 34)	{mainAreaStatus = 'invisible';}
	}
}

function DisparitionIE(id){
	if (!id)	{id = 'mainArea';}
	var AlphaBegin = document.getElementById(id).style.opacity;
	var opacity = 1;
	for(var a=0; a<35; a++)	{	
		setTimeout("document.getElementById('"+id+"').style.opacity = "+opacity,(35*a)+1);
		opacity = opacity-0.03;
		if (a == 34)	{mainAreaStatus = 'invisible';}
	}
}

function Apparition(id){
	if (!id)	{id = 'mainArea';}
	var AlphaBegin = document.getElementById(id).style.opacity;
	var opacity = 0;
	for(var a=0; a<35; a++)	{	
	setTimeout("document.getElementById('"+id+"').style.opacity = "+opacity,(35*a)+1);
	opacity = opacity+0.03;
	if (a == 34)	{mainAreaStatus = 'visible';}
	}
}

function ApparitionIE(id){
	if (!id)	{id = 'mainArea';}
	var AlphaBegin = document.getElementById(id).style.opacity;
	var opacity = 0;
	for(var a=0; a<35; a++)	{	
	setTimeout("document.getElementById('"+id+"').style.opacity = "+opacity,(35*a)+1);
	opacity = opacity+0.03;
	if (a == 34)	{mainAreaStatus = 'visible';}
	}
}

sousMenus = new Array();
sousMenus[0] = new Array();
sousMenus[0][0] = 'current';
sousMenus[0][1] = 'coming';
sousMenus[0][2] = 'past';

hrefs = new Array();
hrefs[0] = new Array();
hrefs[0][0] = 'models/exhibitions.php?time=current&place=';
hrefs[0][1] = 'models/exhibitions_coming.php?place=';
hrefs[0][2] = 'models/exhibitions_past.php?place=';

function openMenu(target,place,id)	{
	closeMenus(place);
	document.getElementById('link_'+place+'_'+id).className = 'menu_active';
}

function closeMenus(place)	{
	document.getElementById('link_'+place+'_0').className = 'menu';
	document.getElementById('link_'+place+'_1').className = 'menu';
	document.getElementById('link_'+place+'_2').className = 'menu';
	document.getElementById('link_'+place+'_3').className = 'menu';
	document.getElementById('link_'+place+'_5').className = 'menu';
	for(var a=0;a<3;a++)	{
		document.getElementById('sous_link_lo_'+a).className = 'sous-menu';
	}
}

function blackSquare(id,nb,id_link)	{
	document.getElementById(id_link).className = 'sous-menu_active';
}

function callObject(page_url)	{
	document.getElementById('main').className = 'plain';
	document.getElementById('main').innerHTML = '<object data="'+page_url+'" type="text/html" width="545" height="300">test</object>';	
}