
// Loginfunktion Hauptseite
function emptyInput(objekt) {
	objekt.value = "";
}

// DIV anzeigen/ausblenden. Beispiel: Userinfos (Detail)
function toggle(objekt) {
	if(document.getElementById(objekt).style.display == "none") {
		document.getElementById(objekt).style.display = "block";
	}
	else {
		document.getElementById(objekt).style.display = "none";
	}
}

function show(objekt) {
	document.getElementById(objekt).style.display = "block";
}

function hide(objekt) {
	document.getElementById(objekt).style.display = "none";
}

function setDate(value, type) {
	document.getElementById("inpDate"+type).value = value;
	hide('calendarBox'+type);
}


function showMenu(item) {
	show('item_submenu_'+item);
	show('coverer_'+item);
}

function hideMenu(item) {
	hide('item_submenu_'+item);
	hide('coverer_'+item);
}

  var oc=0;

function fadeIn() {
	image.style.filter="Alpha(opacity="+oc+", finishopacity=100, style=2)"
	if(oc!=100) setTimeout('oc++;fadeIn()',40);
	else setTimeout('fadeOut()',5000);
}

function fadeOut() {
	image.style.filter="Alpha(opacity="+oc+", finishopacity=0, style=2)"
	if(oc!=0) setTimeout('oc--;fadeOut()',40);
	else setTimeout('fadeIn()',1000);
}

//Ein-/Ausblenden der Mitarbeiter

function shEmp(id)
{
	for(var c=1;c<=3;c++)
	{
		d = "none";
		if(c == id)
		{
			d = "block";
		}
		document.getElementById('ma_'+c).style.display = d;
	}
}

function surcharge_row(val) {
	if(val == 0) {
		document.getElementById('tbl_surcharge_row').style.display = "none";
	} else {
		document.getElementById('tbl_surcharge_row').style.display = "block";
	}	
}

function adminPopup(pagesec) {
	var page = "?p=adm_"+pagesec+"&popup";
	var mywindow = window.open(page,'','width=980,height=650,directories=no,location=no,resizable=yes,scrollbars=yes,toolbar=no,status=no,menubar=no');
	mywindow.focus();
}

function adminMiscPopup(pagesec) {
	var page = "?p=adm_misc&tablename="+pagesec+"&popup";
	var mywindow = window.open(page,'','width=980,height=650,directories=no,location=no,resizable=yes,scrollbars=yes,toolbar=no,status=no,menubar=no');
	mywindow.focus();
}

function removePreSetContent(objectId){
	document.getElementById(objectId).value = "";
	document.getElementById(objectId).style.color = "#000000";
}

function updateForm(Formitem,page,attribut) {	
	var page = "?p="+page+"&"+attribut+"="+Formitem.value;
	document.location.href = page;
	//var mywindow = window.open(page,'','width=750,height=550,directories=no,location=no,resizable=yes,scrollbars=yes,toolbar=no,status=no,menubar=no');
}

function applyroomtype(formitem, nb) {
	var split = formitem.value.split('-');
	document.getElementById('RName'+"-"+nb).value = split[0];
	document.getElementById('RMeal'+"-"+nb).value = split[1];
	document.getElementById('RPersons'+"-"+nb).value = split[2];
	document.getElementById('RMaxPersons'+"-"+nb).value = split[3];
	document.getElementById('RMaxChildren'+"-"+nb).value = split[4];

}

function popup(page, width, height) {
	var page = page;
	var mywindow = window.open(page,'','width=' + width + ',height=' + height + ',directories=no,location=no,resizable=yes,scrollbars=yes,toolbar=no,status=no,menubar=no');
	mywindow.focus();
}

function printFlash(divID,url,width,height,param,flashvars)
{
	nb = Math.ceil(Math.random()*1000000);
	var d = document.getElementById(divID);
	var arrParam = param.split(",");
	var strIE = "";
	var strFF = "";


	if(arrParam[0] != '')
	{
		for(var c=0;c<arrParam.length;c++)
		{
			var spar = arrParam[c].split("=");
			strIE += "<param name='" + spar[0] + "' value='" + spar[1] + "' />";
			strFF += spar[0] + "='" + spar[1] + "' ";
		}
	}
	if(flashvars != '')
	{
		strIE += "<param name='FlashVars' value=\"" +  flashvars + "\" />";
		strFF += "flashvars=\"" + flashvars + "\" ";
	}

	d.innerHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='" + width + "' height='" + height + "' id='id_" + nb + "' align='middle'><param name='allowScriptAccess' value='always' /><param name='wmode' value='transparent' /><param name='movie' value='" + url + "' /><param name='quality' value='high' />" + strIE + "<embed src='" + url + "' wmode='transparent' quality='high' " +  strFF + " width='" + width + "' height='" + height + "' name='nm_" + nb + "' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";
}