ns=((navigator.appName=="Netscape") && (parseInt(navigator.appVersion)>=3));
ie=((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4));

function doAgency(mode)
{
	var agencyContainer = document.getElementById('agency');
	var firmaReqField = document.getElementById('firma');
	switch(mode)
	{
		case 1:
		agencyContainer.style.display = 'none';
		firmaReqField.style.display = 'none';
		break;
		case 2:
		agencyContainer.style.display = 'inline';
		firmaReqField.style.display = 'inline';
		break;
		default:
		agencyContainer.style.display = 'none';
		firmaReqField.style.display = 'none';
	}
	
}

function kontakt_onsubmit()
{
	if(document.kontakt.Email.value == "")
		{
			alert("Bitte füllen Sie alle Plichtfelder aus")
				return false
		}
		
	else
		return true;
}
function checkStep1()
{
	
 	var agencyContainer = document.getElementById('agency');
 	if (document.step1.accountname.value == "" ||  document.step1.accountemail.value == "" || document.step1.accountadresse.value == "" ||
		document.step1.accountplz.value == "" || document.step1.accountort.value == "" || 
		document.step1.accountland.selectedIndex == 0 || document.step1.userID.value == "")
		{
			alert("Bitte geben Sie alle nötigen Informationen an")
				return false;
		}
	if (isNaN(document.step1.accountplz.value) == true )
	{
		alert("Bitte geben Sie nur einen numerische PLZ an")
		document.step1.accountplz.focus();
			return false;
	}
	if(agencyContainer.style.display == 'inline' && document.step1.accountfirma.value == "")
	{
		alert("Bitte geben Sie einen Firmennamen ein");
		document.step1.accountfirma.focus();
		return false;
	}
	else
		return true;
}
function checkStep2()
{
	
 	if (document.step2.artistname.value == "" || document.step2.artistemail.value == "" )
		{
			alert("Bitte geben Sie alle nötigen Informationen an")
				return false;
		}
	if (isNaN(document.step2.gage.value) == true )
	{
		alert("Bitte geben Sie nur einen\nnumerischen Wert als Gage an\nz.B. 1000 oder 1000.00")
			return false;
	}
	
	else
		return true;
}
function show(theURL,winName,features) 
{ 
	var breite = 700;
	var hoehe = 600;
	var posX=(screen.availWidth-breite)/2;
	var posY=(screen.availHeight-hoehe)/2;
          
		if ((ns))
	bild = window.open(theURL,"bild1","toolbar=no,width=700,height=600,directories=no,status=no,scrollbars=yes,resize=yes,resizable=yes,menubar=no,screenX=" + posX + ",screenY=" + posY + ",left=" + posX + ",top=" + posY + "");
		if ((ie))
	bild = window.open(theURL,"bild1","toolbar=no,width=700,height=600,directories=no,status=no,scrollbars=yes,resize=yes,resizable=yes,menubar=no,screenX=" + posX + ",screenY=" + posY + ",left=" + posX + ",top=" + posY + "");
		
  	bild.focus()
}
function checkMaxSelected (select, maxSelected) {
  if (!select.storeSelections) {
    select.storeSelections = new Array(select.options.length);
    select.selectedOptions = 0;
  }
  for (var i = 0; i < select.options.length; i++) {
    if (select.options[i].selected && 
        !select.storeSelections[i]) {
      if (select.selectedOptions < maxSelected) {
        select.storeSelections[i] = true;
        select.selectedOptions++;
      }
      else {
        alert('Bitte wählen Sie maxmimal ' + maxSelected + ' Genres\nBesten Dank');
        select.options[i].selected = false;
      }
    }
    else if (!select.options[i].selected &&
             select.storeSelections[i]) {
      select.storeSelections[i] = false;
      select.selectedOptions--;
    }
  }
}
function checkSuchauftrag()
{
	
	if (document.events.eventkontakt.value == "" || document.events.eventkontaktstrasse.value == "" ||
 		document.events.eventkontaktplz.value == "" || document.events.eventkontaktort.value == "" ||
 		document.events.eventkontakttelefon.value == "" ||
 		document.events.eventkontaktemail.value == "" || document.events.eventtitel.value == ""  ||
 		document.events.eventzeit.value == ""  || document.events.eventdauer.value == ""  ||
		document.events.eventpeople.value == ""  ||
		document.events.eventplz.value == "" || document.events.eventort.value == "" || document.events.eventinfo.value == "")
		{
			alert("Bitte geben Sie alle nötigen Informationen an");
			
				return false;
		}
	if (isNaN(document.events.eventplz.value) == true )
	{
		alert("Bitte geben Sie nur einen\nnumerischen Wert als PLZ an");
			return false;
	}
	if (document.events.day.selectedIndex == 0 ||document.events.month.selectedIndex == 0 ||document.events.year.selectedIndex == 0 ||
		 document.events.eventkontaktland.selectedIndex == 0 || document.events.eventkontaktkanton.selectedIndex == 0 ||
		document.events.eventkanton.selectedIndex == 0 || document.events.eventland.selectedIndex == 0 || document.events.eventbudget.selectedIndex == 0
		|| document.events.anlass.selectedIndex == 0 || document.events.anlass.selectedIndex == -1 || document.events.genre.selectedIndex == 0 
		|| document.events.genre.selectedIndex == -1)
		{
			alert("Bitte geben Sie alle nötigen Informationen an");
				return false;
		}
	else
		return true;
	
}
function checkkey()
{
	
 	if (document.key.key.value == 'Event Key eingeben')
		{
			alert("Bitte geben Sie einen Event Key an")
				return false;
		}
	
	else
		return true;
}
function del()
{
	if (confirm("Sind Sie sicher?")) 
	   {
             
			  return true;
       }
	   else
	   {
			return false;
		}
}
function doEvent(mode)
{
	
 	if (mode == 1)
	{
		document.events.target = "_self";
		document.events.action = "index_suchauftrag.php";
		
		//document.checkout.submit();
	}
	else if(mode == 2)
	{
		document.events.target = "main";
		document.events.action = "index_suchauftragvorschau.php";
		
	}
}
function createWindow(theURL,breite,hoehe,scrollbar,winName) 
{ 
	var breite = breite;
	var hoehe = hoehe;
	var posX=(screen.availWidth-breite)/2;
	var posY=(screen.availHeight-hoehe)/2;
          
		if ((ns))
	bild = window.open(theURL,"bild1","toolbar=no,width="+breite+",height="+hoehe+",directories=no,status=no,scrollbars="+scrollbar+",resize=no,resizable=no,menubar=no,screenX=" + posX + ",screenY=" + posY + ",left=" + posX + ",top=" + posY + "");
		if ((ie))
	bild = window.open(theURL,"bild1","toolbar=no,width="+breite+",height="+hoehe+",directories=no,status=no,scrollbars="+scrollbar+",resize=no,resizable=no,menubar=no,screenX=" + posX + ",screenY=" + posY + ",left=" + posX + ",top=" + posY + "");
		
  	bild.focus()
}
function check_reset()
{
	if (document.reset.emailadress.value == "")
		{
			alert("Bitte geben Sie Ihre Emailadresse an")
				return false
		}
		
	else
		return true;
}
function checkAgb()
{
	if(!document.berechnen.agb.checked)
	{
		alert("Sie können die Registrierung nur ausführen, wenn Sie die allgemeinen Geschäftsbedingungen akzeptieren.");
		return false;
	}
}

function checkBoxes()
{
	var check = false;
	var list = document.getElementById('boxes');
	for (i = 0; i < list.length; i++)
	{
		if(list[i].checked == true)
			check = true;
	}
	if(check == false)
	{
		alert("Bitte wählen Sie eine Dienstleistung");
		return false;
	}
	else
		return check;
}
function doZufall()
{
	var div = document.getElementById('cont');
	div.innerHTML = '';
	new Ajax.PeriodicalUpdater('cont', 'home_unterhalter_zufall2.php',
  {
    method: 'get',
    frequency: 5,
    decay: 2
  });
}
function showHelpEvent()
{
	var div = document.getElementById('help');
	if(div.innerHTML == '')
	{
		new Ajax.Request('../inhalt/hilfe_suchauftrag.html',
	  	{
	    method:'get',
	    onSuccess: function(transport)
	    {
			div.innerHTML = transport.responseText;
	    }
	    ,
	    onFailure: function()
	    {
			alert('Something went wrong...') 
		}
		,
		onCreate: function()
	    {
			
		}
	  	});
	 }
	 else
	 	div.innerHTML = '';
}
function onFocusEffect(obj)
{
	obj.style.background='#b1dbdb';
	obj.style.border='1px solid #37a9aa'
	obj.select();
}
function onBlurEffect(obj)
{
	obj.style.background='#FFFFFF';
	obj.style.border='1px solid #A5ACB2'
}