function findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function showHideLayers() {
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function getCoords(element){
		for (var lx=0,ly=0;element!=null;
			lx+=element.offsetLeft,ly+=element.offsetTop,element=element.offsetParent);
		return {x:lx,y:ly}
	}

function show(target,parent) {
	if (targetobj = findObj(target)) {
		if (show.arguments.length > 1) {
			if (parentobj = findObj(parent)) {
				targetobj.style.top = getCoords(parentobj).y - targetobj.offsetHeight + 26 + "px";
			} 
		}
	}
	//targetobj.style.display = 'block';
	targetobj.style.visibility = 'visible';
}

function hide(target) {
	//if (targetobj = findObj(target)) targetobj.style.display = 'none';
	if (targetobj = findObj(target)) targetobj.style.visibility = 'hidden';
}

function highlight(target) {
	if (targetobj = findObj(target)) targetobj.className += ' highlight';
}

function unhighlight(target) {
	if (targetobj = findObj(target)) targetobj.className = trimString(targetobj.className.replace("highlight", ""));
}

function setselected(target) {
	if (targetobj = findObj(target)) targetobj.className += ' selected';
}

function unselect(target) {
	if (targetobj = findObj(target)) targetobj.className = trimString(targetobj.className.replace("selected", ""));
}

function trimString(sInString) {
  sInString = sInString.replace( /^\s+/g, "" );// strip leading
  return sInString.replace( /\s+$/g, "" );// strip trailing
}

function moreinfo(infonmbr) {
	var divs = document.getElementsByTagName('div');	
	var lis = document.getElementsByTagName('li');
	//hide all infos
	for(i=0;i<divs.length;i++){							
		if(divs[i].id.match('showinfo')){				
			findObj((divs[i].id)).style.display = 'none';							
		}
	}
	
	for(i=0;i<lis.length;i++){							
		if(lis[i].id.match('show')){				
			unselect(lis[i].id);							
		}
	}
	
	// set one selected if needed
	if (infonmbr!=null) {
		// get list item y-coordinate
		var obj,locV;
		if (obj=findObj('show' + infonmbr)) {
			setselected('show' + infonmbr);
			locV = getCoords(obj).y + obj.offsetHeight - getCoords(findObj('showlist')).y;
			findObj('showlist').style.backgroundPosition = '15px ' + locV + 'px';
		}
		if (obj=findObj('showinfo' + infonmbr)) {
			obj.style.display = 'block';
		}
	}
	return false;
}

function moregiginfo(infonmbr) {
	var divs = document.getElementsByTagName('div');	
	var lis = document.getElementsByTagName('li');
	//hide all infos
	for(i=0;i<divs.length;i++){							
		if(divs[i].id.match('giginfo')){				
			findObj((divs[i].id)).style.display = 'none';							
		}
	}
	
	for(i=0;i<lis.length;i++){							
		if(lis[i].id.match('gig')){				
			unselect(lis[i].id);							
		}
	}
	
	// set one selected if needed
	if (infonmbr!=null) {
		// get list item y-coordinate
		var obj,locV;
		if (obj=findObj('gig' + infonmbr)) {
			setselected('gig' + infonmbr);
			locV = getCoords(obj).y + obj.offsetHeight - getCoords(findObj('eventlist')).y;
			findObj('eventlist').style.backgroundPosition = '15px ' + locV + 'px';
		}
		if (obj=findObj('giginfo' + infonmbr)) {
			obj.style.display = 'block';
		}
	}
	return false;
}

function accordion(itemnmbr) {
	var lis = document.getElementsByTagName('li');
	// unselect all other items 
	for(i=0;i<lis.length;i++){							
		if(lis[i].id.match('accordionitem') && !(lis[i].id.match('accordionitem' + itemnmbr))){				
			unselect(lis[i].id);							
		}
	}
	// set the given one selected or unselected if needed
	if (itemnmbr!=null) {
		if (obj=findObj('accordionitem' + itemnmbr)) {
			if (obj.className.match('selected')) unselect(obj.id);
			else setselected(obj.id);
		}
	}		
}

 
// TABLE STRIPES

onload = function() { stripe ('leftcol') };

 function stripe(id) {
    var table = document.getElementById(id);
    if (! table) { return; }
    
    var trs = table.getElementsByTagName("tr");

    for (var i = 0; i < trs.length; i += 2) {
      trs[i].className += " even";
    }
  }