/*
*	JavaScript defintions for musicpoint24
*	(c) Tobias Orth
*/

function showEventInfo(w,d) {
	var info_box = document.getElementById("event_info");
	var info_box_wrapper = document.getElementById("event_info_wrapper");
	var id = w*7+d;
	
	info_box_wrapper.style.display = "none";
	
	//reset content
	info_box.innerHTML = '';
	var innerhtml = '';
	
	//new placement
	w_const = 19;
	d_const = 26;
	info_box_wrapper.style.top = (w * w_const + 249) + 'px';
	info_box_wrapper.style.left = (d * d_const + 25) + 'px';
					
	
	var info = document.getElementById(id);
	var date = info.childNodes[1].getAttribute('value');
	
	// close button
	innerhtml += '<div style="position: absolute; top: 0px; right: 0px;">' +
					'<a href="javascript:close_infoBox()">' +
						'<img src="img/icons/close.png" style="border: 0px">' +
					'</a>' +
				'</div>';
	
	innerhtml += '<div id="event_info_date" style="font-family:serif; font-size: 16px; font-weight: bold; margin-bottom: 5px; color: #e0001b">' +
				date +
				'</div>';
	
	//fetch child nodes
	for(i = 2; i < info.childNodes.length; i += 4) {
		var time = info.childNodes[i].getAttribute('value');
		var place = info.childNodes[i+1].getAttribute('value');
		
		var bid = info.childNodes[i+2].getAttribute('name');
		var bname = info.childNodes[i+2].getAttribute('value');
		
		var eid = info.childNodes[i+3].getAttribute('name');
		var ename = info.childNodes[i+3].getAttribute('value');
		
		innerhtml += '<div style="background-color: #FFB; padding-bottom: 10px; margin-bottom: 5px;">' +
					 	'<div style="border-bottom: 1px dotted black"><strong>' + time + ' Uhr</strong> - <em>' + ename + '</em></div>'+
					 	'<div style="padding: 5px; line-height: 120%;" >';
		
		if(bid != 0){
			innerhtml += '<img src="img/icons/mic_xsmall.png" style="vertical-align: text-bottom; margin: 2px;"/> <a href="?content=bbband&bid='+bid+'" class="black">' + bname + '</a><br/>';
		}
		
		innerhtml += '<img src="img/icons/place_xsmall.png" style="vertical-align: text-bottom; margin: 2px;"/> ' + place + '</div></div>';
	}
	
	//set inner html
	info_box.innerHTML = innerhtml;
	
	//make visible
	info_box_wrapper.style.display = "block";
}

function close_infoBox() {
	document.getElementById("event_info_wrapper").style.display = "none";	
}

function closeAlertBox() {
	document.getElementById("alertbox").style.display = "none";	
}

//function checkpasswd() {
//	var passw = document.getElementById('bbpassw').value;
//	var img = document.getElementById('bbpasscheckimg');
//	
//	if(passw.length > 5) {
//		//set image to good
//		img.src = 'img/icons/good.png';
//	} else {
//		//set image to bad
//		img.src = 'img/icons/bad.png';
//	}
//}

//BANDBOARD
function togglebbadmin(str) {
	if(typeof(str) == 'string') {
		var id = 'bb_' + str;
		var ele = document.getElementById(id);
		var button = document.getElementById('bb_' + str + '_button');
		
		//switch to visible or invisible
		if(ele.style.display == 'block') {
			ele.style.display = 'none';
			button.innerHTML = '+';
		} else {
			ele.style.display = 'block';
			button.innerHTML = '—';
		}
	}
}

function Test(param)
{
  switch(typeof(param))
  { 
    case 'number': alert('param = '+param+' (Typ: number)');
    break;
    case 'string': alert('param = '+param+' (Typ: string)');
    break;
    case 'boolean': alert('param = '+param+' (Typ: boolean)');
    break;
    case 'object': alert('param = '+param+' (Typ: object)');
    break;
    case 'function': alert('param = '+param+' (Typ: function)');
    break;
    case 'undefined': alert('param = '+param+' (Typ: undefined)');
    break;
   }
}
