// JavaScript Document
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// Div Expander
function toggleBox (obj) {
	theObject = document.getElementById(obj);
	if (theObject.style.display == "block") {
		theObject.style.display = "none";
	} else {
		theObject.style.display = "block";
	}
}

function setClassName(objId, className) {
    	document.getElementById(objId).className = className;
}

function toggleClass (obj, c1, c2) {
	classObject = document.getElementById(obj);
	if (classObject.className == c1) {
		classObject.className = c2;
	} else {
		classObject.className = c1;
	}
}

function showLayer(layer) {
	if (document.all) {
		document.all[layer].style.visibility = "visible";
	} else if (document.layers) {
    	document.layers[layer].visibility = "visible";
	} else if (document.getElementById) {
    	document.getElementById(layer).style.visibility = "visible";
	}
}

function hideLayer(d) {
	hideBox(d);
}

function hideBox(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
}

function showInfoLayer(content) {
	document.getElementById("infolayer").innerHTML= content;
	showFloatingBox('infolayer');
}

function showFloatingBox(d) {
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	assignPosition(dd);
	dd.style.display = "block";
}

function assignPosition(dd) {
	dd.style.left = (cX+10) + "px";
	dd.style.top = (cY+10) + "px";
}

function showDateDetails(date_id){
	showFloatingBox('calendar-details');
	var dd = document.getElementById('calendar-details');
	assignPosition(dd);
	var url = '/dates/details';
	var pars = 'id='+date_id;
	var target = 'calendar-details';
	var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars,asynchronous:true, evalScripts:true});
}

function hideDateDetails(){
	hideBox('calendar-details');
}

function openAdminPopup(url,view) {
	if (view == 'list') {
		window.open(url, "Administration", "width=720,height=520,scrollbars=yes,resizable=yes,menubar=no,status=no,toolbar=no");
	} else {
		window.open(url, "Administration", "width=460,height=540,scrollbars=yes,resizable=yes,menubar=no,status=no,toolbar=no");
	}
}

function openVideoPopup(id) {
	window.open("/verleihung/video/"+id, "Video", "width=720,height=580,scrollbars=no,resizable=no,menubar=no,status=no,toolbar=no");	
}

function anpassen(){
  document.getElementById('meinIframe').style.height = document.getElementById('meinIframe').document.getElementById('inhalt').offsetHeight + 'px'; //alles in einer Zeile!
}

/*
var myrules = {
	'#calendar a.new' : function(el){
		el.onclick = function(){
			//alert('new entry');
		}
	}
};

Behaviour.register(myrules);
*/

