
var W3CDOM = (document.createElement && document.getElementsByTagName);

var mouseOvers = new Array();
var mouseOuts = new Array();

var description;
var description1;



function init()

{
//lookup='artists_data.php?artist=pena';
//ajaxManager('look_up', lookup);

	if (!W3CDOM) return;
	var nav = document.getElementById('subnav');
	
//	var lists=nav.getElementsByTagName('ul');
	var items=nav.getElementsByTagName('a');
//alert(items);
	for (var i=0;i<items.length;i++)
	{
	if(items[i].id!="")	{
		items[i].onmouseover = mouseGoesOver;
		//lists[i].onmouseout = mouseGoesOut;
		items[i].onclick = mouseClick;
		}
		
	}
}

function display(section, perf_id)	{
lookup='artists_data.php?artist=' + section + '&perf_id=' + perf_id;
//alert(perf_id);
curr=section;
document.getElementById(section).setAttribute('class','current');
	document.getElementById(section).setAttribute('className','current');
	document.getElementById(section).style.border='0';
	
		var nav = document.getElementById('subnav');
	
//	var lists=nav.getElementsByTagName('ul');
	var items=nav.getElementsByTagName('a');
//alert(items);
	for (var i=0;i<items.length;i++)
	{
		if(items[i].id != curr)	{
		items[i].setAttribute('class','none');
		items[i].setAttribute('className','none');
		}
		
	}
	
	
	
	ajaxManager('look_up', lookup);
}


function mouseGoesOver()
{

}

function mouseGoesOut()
{
	this.src = mouseOuts[this.number].src;
}


function mouseClick()	{
var exp= this.childNodes[0].nodeValue;

//alert(this.id)
	lookup='artists_data.php?artist='+this.id;
	curr=this.id
	this.setAttribute('class','current');
	this.style.border='0';
	
		var nav = document.getElementById('subnav');
	
//	var lists=nav.getElementsByTagName('ul');
	var items=nav.getElementsByTagName('a');
//alert(items);
	for (var i=0;i<items.length;i++)
	{
		if(items[i].id != curr)	{
		items[i].setAttribute('class','none');
		}
		
	}
	
	
	
	ajaxManager('look_up', lookup);
}


function titleClick()	{
//alert("t");
if(this.id != "sep")	{
if(this.id=='description_0')	{

	document.getElementById('desc').innerHTML=description;
	this.setAttribute('class', 'current');
	this.setAttribute('className', 'current');
	document.getElementById('description_1').setAttribute('class', 'none');
	document.getElementById('description_1').setAttribute('className', 'none');
	} else	{
		document.getElementById('desc').innerHTML=description1;
	this.setAttribute('class', 'current');
	this.setAttribute('className', 'current');
	document.getElementById('description_0').setAttribute('class', 'none');
	document.getElementById('description_0').setAttribute('className', 'none');
	}
}
}


function titleChoose(perf_id)	{
//alert("t");


if(perf_id=='description_0')	{

	document.getElementById('desc').innerHTML=description;
		document.getElementById('description_0').setAttribute('class', 'current');
		document.getElementById('description_0').setAttribute('className', 'current');
	document.getElementById('description_1').setAttribute('class', 'none');
	document.getElementById('description_1').setAttribute('className', 'none');
	} else	{
		document.getElementById('desc').innerHTML=description1;
	document.getElementById('description_1').setAttribute('class', 'current');
		document.getElementById('description_1').setAttribute('className', 'current');
	document.getElementById('description_0').setAttribute('class', 'none');
	document.getElementById('description_0').setAttribute('className', 'none');
	}

}


function titleOver()	{
this.style.cursor='pointer';
}







function ajaxManager()

	{
	
	var args = ajaxManager.arguments;
	var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP"): new XMLHttpRequest();
	switch (args[0])
		{

		case "look_up":
			if (document.getElementById)
				{
				//document.getElementById("contentLYR").style.left = 2000+px;	
				//alert("lookup");
				}
			if (x)
				{
				x.onreadystatechange = function()
					{
						if (x.readyState <4)
						{
						//
					//alert("waiting...");
						}
				
					if (x.readyState == 4 )
					//&& x.status == 200 removed for Ie problem temp.
						{

						t=x.responseText;
					//alert(t);
						var artist=t.substring(t.indexOf("=")+1, t.indexOf("&&"));
							//alert(artist);
						var title = t.substring(t.indexOf("=", t.indexOf("title=")) +1, t.indexOf("&&", t.indexOf("title=")));
	var title1 = t.substring(t.indexOf("=", t.indexOf("title1=")) +1, t.indexOf("&&", t.indexOf("title1=")));
var schedule = t.substring(t.indexOf("=", t.indexOf("schedule=")) +1, t.indexOf("&&", t.indexOf("schedule=")));
var schedule1 = t.substring(t.indexOf("=", t.indexOf("schedule1=")) +1, t.indexOf("&&", t.indexOf("schedule1=")));
description = t.substring(t.indexOf("=", t.indexOf("description=")) +1, t.indexOf("&&", t.indexOf("description=")));
 description1 = t.substring(t.indexOf("=", t.indexOf("description1=")) +1, t.indexOf("&&", t.indexOf("description1=")));
var bio = t.substring(t.indexOf("=", t.indexOf("bio=")) +1, t.indexOf("&&", t.indexOf("bio=")));

var url = t.substring(t.indexOf("=", t.indexOf("url=")) +1, t.indexOf("&&", t.indexOf("url=")));
var img = t.substring(t.indexOf("=", t.indexOf("img")) +1, t.indexOf("&&", t.indexOf("img=")));
var perf_id = t.substring(t.indexOf("=", t.indexOf("perf_id")) +1, t.indexOf("&&", t.indexOf("perf_id=")));
//alert('perf='+perf_id);
if(artist.substring(0, 4) == "Laet" && artist.indexOf("Sue") != -1)	{
r=Math.round(Math.random() * 1);
if(r==0)	{
img="images/artists/sonami/portal.jpg";
} else	{
img="images/artists/costabile/portal.jpg";
}
}
 tnav=document.getElementById("switch_description");
					document.getElementById('artist').innerHTML=artist;
					lineup=document.location.toString();
					if(title1 != "" && lineup.indexOf('symposium')==-1) title+=" & " + title1;	
					document.getElementById('title').innerHTML=title;
					if(schedule1 != "") schedule+="<br/>" + schedule1;	
					document.getElementById('schedule').innerHTML=schedule;
					
					//for multiple descriptions
					
					if(description1 != "")	{
				
				
					
					if(lineup.indexOf('symposium')==-1)	{
					
					t=title.substring(0, title.indexOf("&"));
					} else	{
					t="bio";
					}
					
					if(artist.substring(0, 4) == "Laet")	{
					title1="The Appearance of Silence";
					}
					
tnav.innerHTML="<span id='description_0' 'class='current'>" + t + "</span><span id='sep'> | </span> <span id='description_1'>" + title1 + "</span>";
tnav.style.display='block';

			titles=tnav.getElementsByTagName('span');

	for (var i=0;i<titles.length;i++)
	{
		
		titles[i].onclick = titleClick;
		titles[i].onmouseover = titleOver;
	
		
	}	

					} else	{
					tnav.style.display='none';
					}
					
					
					//end multiple descriptions
					
					
				//	alert(document.getElementById('bio'));
					
					document.getElementById('bio').innerHTML=bio;	
						if(perf_id== 'description_0' || perf_id== 'description_1') 	{
		titleChoose(perf_id);
	} else	{
	document.getElementById('desc').innerHTML=description;
	}

					if(url!="")	{
					if(url.indexOf("&url2") == -1)	{
					document.getElementById('url').innerHTML="<a href='" + url + "' target='_blank'>" + "=> " + url.substring(url.indexOf("www"), url.length) + "</a>";
}	else	{
url2=url.substring(url.lastIndexOf("=")+1, url.length);
url=url.substring(0, url.indexOf("&url2="));
	document.getElementById('url').innerHTML="<a href='" + url + "' target='_blank'>" + "=> " + url.substring(url.indexOf("www"), url.length) + "</a>" + " <span style='padding-left: 12px'>" + "<a href='" + url2 + "' target='_blank'>" + "=> " + url2.substring(url2.indexOf("www"), url2.length) + "</a></span>" ;
}
} else	{
document.getElementById('url').innerHTML="";
}



document.getElementById('backdrop').style.background="url(" + img + ") no-repeat 430px 150px";	

						
			
						}
					}
				x.open("GET", args[1], true);
				x.send(null);
				}
			break;
			

			}
			}
	