// JavaScript Document

function checkAllSelections(form_name,element_name,type)
{
	for(i=0;i<document.getElementById(form_name).length;i++)
	{
		if(document.getElementById(form_name).elements[i].name == element_name)
			document.getElementById(form_name).elements[i].checked = (type == 1 ? true : false);
	}
}

function admin_DatesFlyer()
{
	fenster = window.open("http://fevarus-records.de/popups/flyer.html", "Fevarus_Records_Events_Flyer_Hochladen", "width=400,height=230,left=100,top=75, status=yes,scrollbars=yes,resizable=no");
	fenster.focus();
}
function admin_DatesGenre()
{
	fenster = window.open("http://fevarus-records.de/popups/genre.html", "Fevarus_Records_Events_Neues_Genre", "width=600,height=400,left=100,top=75, status=yes,scrollbars=yes,resizable=no");
	fenster.focus();
}
function admin_DatesLocation()
{
	fenster = window.open("http://fevarus-records.de/popups/location.html", "Fevarus_Records_Events_Neue_Location", "width=700,height=550,left=100,top=75, status=yes,scrollbars=yes,resizable=no");
	fenster.focus();
}


function admin_NewEvent()
{
	if(document.getElementById('admin_new_event_name').value.trim() == "")
	{
		alert("Bitte geben Sie den Namen des Events an.");
		return false;
	}
	else
	{
		document.getElementById('admin_dates_form_new_js').name = "admin_dates_form_new_js";	
		document.getElementById('admin_dates_form_new_js').value = "js";	
		return true;
	}
}

function admin_SELECTEvent()
{
	checked = false;
	for(i=0;i<document.admin_dates_form.length;i++)
	{
		if(document.admin_dates_form.elements[i].name == "selected_dates[]")
			if(document.admin_dates_form.elements[i].checked)
			{
				checked =  true;
				break;
			}
	}
	
	if(checked)
	{
		if(document.getElementById('admin_edit_selection').value == "delete")
		{
    		Check = confirm("Sind Sie sicher, dass Sie das/die ausgewählte(n) Event(s) löschen?");
    		if(Check == true)
    	    	return true;
    	  	else
    	    	return false;
		}
		else
		{
			return true;
		}
	}
	else
	{
		alert("Bitte wählen Sie mindestens ein Event aus.");
		return false;
	}
}
