function showPic (whichpic) {
	 
	resetATagClass('imgasno')
	setATagClassAtive('imgasno',whichpic);
	 
	if (document.getElementById) {
		document.getElementById('placeholder').src = whichpic.href;

		// Image Caption
		//alert("test:" + whichpic.title + "Ende");
		if (whichpic.title) {
			document.getElementById('desc').childNodes[0].nodeValue = whichpic.title;
			document.getElementById('imgcap').childNodes[0].nodeValue = whichpic.title;
		} else {
			document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
			//document.getElementById('imgcap').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
		}  
		return false;
	} else {
		return true;
	} 
}


function showImgAsNo(){		
	
	//Nummer-Menu erstellen
	if (document.getElementById('imgaspic')) {
		var elem = document.getElementById('imgaspic');
		var items = elem.getElementsByTagName('a');
		var sContent = 'VIEW IMAGE ';
		
		for (i=0; i<items.length; i++) {
			var iPicNo = i + 1;
			//sContent += '<a onclick="showPic(this); resetATagClass(\'imgasno\'); this.className=\'active\'; return false;" href="'+items[i].getAttribute('href')+'" title="'+items[i].getAttribute('title')+'" target="_blank">'+iPicNo+'</a> ';
			sContent += '<a onclick="showPic(this); return false;" href="'+items[i].getAttribute('href')+'" title="'+items[i].getAttribute('title')+'" target="_blank">'+iPicNo+'</a> ';
		}	
		document.getElementById('imgasno').innerHTML = sContent;
	}
	
	//Die erste Nummer als "active" markieren
	if (document.getElementById('imgasno')) {
		var elem = document.getElementById('imgasno');
		var items = elem.getElementsByTagName('a');
		items[0].className='active';
	}
}


function resetATagClass(idName){
	if (document.getElementById(idName)) {
		var elem = document.getElementById(idName);
		var items = elem.getElementsByTagName('a');
		for (i=0; i<items.length; i++) {
			items[i].className='';
		}
	}
}


function setATagClassAtive(idName,whichpic){
	var baseUrl = 'http://www.mystop.ch/';

	if (document.getElementById(idName)) {
		var elem = document.getElementById(idName);
		var items = elem.getElementsByTagName('a');
		for (i=0; i<items.length; i++) {
			//alert(whichpic.href+' '+items[i].getAttribute('href'));
			if (baseUrl + items[i].getAttribute('href') == whichpic.href){
				items[i].className='active';
			}	
		}
	}
}

