// JavaScript Document
try
{
	Shadowbox.init
	(
		{
			language: 'de-DE',
			players:  ['img', 'html', 'iframe', 'qt', 'wmp', 'swf', 'flv'],
			autoplayMovies: true,
			overlayColor: '#333'
		}
	);
}catch(e){}
function pageStart()
{
	/* Randompicheader */
	if(document.getElementById('el_hompageani_container') !== null)
	{
		try
		{
			var pageArray = new Array();
			var menupointArray = new Array();
			if(document.getElementById('el_hompageani_1') !== null)
			{
				pageArray.push(document.getElementById('el_hompageani_1'));
				menupointArray.push(document.getElementById('button_bg_1'));
			}
			if(document.getElementById('el_hompageani_2') !== null)
			{
				pageArray.push(document.getElementById('el_hompageani_2'));
				menupointArray.push(document.getElementById('button_bg_2'));
			}
			if(document.getElementById('el_hompageani_3') !== null)
			{
				pageArray.push(document.getElementById('el_hompageani_3'));
				menupointArray.push(document.getElementById('button_bg_3'));
			}
			AjaxStartmenu = new fusi_Ajax_Startmenu(pageArray, menupointArray, activeIndex = 0);
			AjaxStartmenu.construct();
			if(document.getElementById('button_bg_1') !== null)
			{
				hurra_addEvent(document.getElementById('button_bg_1'), 'mouseover', fusi_Ajax_Startmenu_activatePage);
			}
			if(document.getElementById('button_bg_2') !== null)
			{
				hurra_addEvent(document.getElementById('button_bg_2'), 'mouseover', fusi_Ajax_Startmenu_activatePage);
			}
			if(document.getElementById('button_bg_3') !== null)
			{
				hurra_addEvent(document.getElementById('button_bg_3'), 'mouseover', fusi_Ajax_Startmenu_activatePage);
			}
		}catch(e){}
	}
//	try
//	{
//		Set_AC_FL_RunContent_GET('');
//		document.getElementById('head_flash_container').innerHTML = AC_FL_RunContent( "codebase","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0","width","870","height","351","src","flash/header","quality","high","pluginspage","http://www.macromedia.com/go/getflashplayer","movie","flash/header", "wmode", "transparent" );
//		Set_AC_FL_RunContent_GET('');
//	}catch(e){}
//	try
//	{
//		hurra_addEvent(document.getElementById('contact_send'), 'click', send_contact);
//	}catch(e){}
}
hurra_registerOnLoad(pageStart);

/* Ajax Bildwechsler */
var AjaxStartmenu;
function fusi_Ajax_Startmenu(pageArray, menupointArray, activeIndex)
{
	this.PageArray = pageArray;
	this.MenupointArray = menupointArray;
	
	this.intervals = new Array();
	this.alphas = new Array();
	
	this.activeIndex = activeIndex;
	
	this.construct = function()
	{
		for(var i = 0; i < this.PageArray.length; i++)
		{
			this.MenupointArray[i].href = "javascript:void(hurra_empty)";
			this.intervals[i] = false;
			if(this.activeIndex != i)
			{
				try{this.PageArray[i].style.filter = "alpha(opacity=0)";}catch(e){}
				try{this.PageArray[i].style.opacity = 0;}catch(e){}
				this.PageArray[i].style.display = "none";
				this.alphas[i] = 0;
				this.MenupointArray[i].className = "";
			}
			else
			{
				try{this.PageArray[i].style.filter = "alpha(opacity=100)";}catch(e){}
				try{this.PageArray[i].style.opacity = 1;}catch(e){}
				this.PageArray[i].style.display = "block";
				this.alphas[i] = 100;
				this.MenupointArray[i].className = "active";
			}
		}
	}
	
	this.returnIndex_by_menupoint = function(menupoint)
	{
		for(var i = 0; i < this.MenupointArray.length ;i++)
		{
			if(this.MenupointArray[i].id == menupoint.id)
			{
				return i;
			}
		}
	}
	this.setFade = function(menupoint)
	{
		var index = this.returnIndex_by_menupoint(menupoint);
		if(index != this.activeIndex)
		{
			this.activeIndex = index;
			for(var i = 0; i < this.MenupointArray.length; i++)
			{
				if(i == this.activeIndex)
				{
					this.PageArray[i].style.display = "block";
					if(this.intervals[i] !== false)
					{
						window.clearInterval(this.intervals[i]);
						this.intervals[i] = false;
					}
					this.intervals[i] = window.setInterval("AjaxStartmenu.fadeIn("+i+")",50);
					this.MenupointArray[i].className = "active";
				}
				else
				{
					this.MenupointArray[i].className = "";
					if(this.alphas[i] != 0)
					{
						this.PageArray[i].style.display = "block";
						if(this.intervals[i] !== false)
						{
							window.clearInterval(this.intervals[i]);
							this.intervals[i] = false;
						}
						this.intervals[i] = window.setInterval("AjaxStartmenu.fadeOut("+i+")",50);
					}
				}
			}
		}
	}
	this.fadeOut = function(i)
	{
		var growth = -10;
		if(this.alphas[i] + growth > 0)
		{
			this.alphas[i] += growth;
			try{this.PageArray[i].style.filter = "alpha(opacity="+this.alphas[i]+")";}catch(e){}
			try{this.PageArray[i].style.opacity = this.alphas[i]/100;}catch(e){}
		}
		else
		{
			this.PageArray[i].style.display = "none";
			this.alphas[i] = 0;
			try{this.PageArray[i].style.filter = "alpha(opacity=0)";}catch(e){}
			try{this.PageArray[i].style.opacity = 0;}catch(e){}
			window.clearInterval(this.intervals[i]);
			this.intervals[i] = false;
		}
	}
	this.fadeIn = function(i)
	{
		var growth = 10;
		if(this.alphas[i] + growth < 100)
		{
			this.alphas[i] += growth;
			try{this.PageArray[i].style.filter = "alpha(opacity="+this.alphas[i]+")";}catch(e){}
			try{this.PageArray[i].style.opacity = this.alphas[i]/100;}catch(e){}
		}
		else
		{
			this.alphas[i] = 100;
			try{this.PageArray[i].style.filter = "alpha(opacity=100)";}catch(e){}
			try{this.PageArray[i].style.opacity = 1;}catch(e){}
			window.clearInterval(this.intervals[i]);
			this.intervals[i] = false;
		}
	}
}
function fusi_Ajax_Startmenu_activatePage()
{
	AjaxStartmenu.setFade(this);
	
}

function send_contact()
{
	var errorReport = '';
	
	var salutation = document.getElementsByName('contact_salutation');
	var foundSalutation = false;
	for(var i=0; i< salutation.length; i++)
	{
		if(salutation[i].checked)
		{
			salutation = salutation[i];
			foundSalutation = true;
			break;
		}
	}
	if(foundSalutation == false)
	{
		errorReport += "Bitte wählen Sie Ihre Anrede aus!<br />";
	}

	var name = document.getElementById('contact_name');
	if(!hurra_check_length(name.value, 2))
	{
		errorReport += "Bitte füllen Sie das Feld Name aus!<br />";
	}
	
	var firstname = document.getElementById('contact_firstname');
	if(!hurra_check_length(firstname.value, 2))
	{
		errorReport += "Bitte füllen Sie das Feld Vorame aus!<br />";
	}

	var lastname = document.getElementById('contact_lastname');
	if(!hurra_check_length(lastname.value, 2))
	{
		errorReport += "Bitte füllen Sie das Feld Nachname aus!<br />";
	}

	var company = document.getElementById('contact_company');
	if(!hurra_check_length(company.value, 2))
	{
		errorReport += "Bitte füllen Sie das Feld Firma aus!<br />";
	}

	var email = document.getElementById('contact_email');
	if(!hurra_check_length(email.value, 2))
	{
		errorReport += "Bitte füllen Sie das Feld Email aus!<br />";
	}
	else if(!hurra_check_mail(email.value))
	{
		errorReport += "Bitte füllen Sie das Feld Email korrekt aus!<br />";
	}
	
	var phone = document.getElementById('contact_phone');
	if(!hurra_check_length(phone.value, 2))
	{
		errorReport += "Bitte füllen Sie das Feld Telefon aus!<br />";
	}
	
	var street = document.getElementById('contact_street');
	if(!hurra_check_length(street.value, 2))
	{
		errorReport += "Bitte füllen Sie das Feld Straße aus!<br />";
	}

	var zip = document.getElementById('contact_zip');
	if(!hurra_check_length(zip.value, 2))
	{
		errorReport += "Bitte füllen Sie das Feld Postleitzahl aus!<br />";
	}

	var city = document.getElementById('contact_city');
	if(!hurra_check_length(city.value, 2))
	{
		errorReport += "Bitte füllen Sie das Feld Ort aus!<br />";
	}

	var country = document.getElementById('contact_country');
	if(!hurra_check_length(country.value, 2))
	{
		errorReport += "Bitte füllen Sie das Feld Land aus!<br />";
	}

	var message = document.getElementById('contact_message');
	if(!hurra_check_length(message.value, 2))
	{
		errorReport += "Bitte füllen Sie das Feld Nachricht aus!<br />";
	}

	if(errorReport.length > 0)
	{
		hurra_alert("Achtung", errorReport, "");
		return false;	
	}
	postVars = "pass=ju236ju&Name="+name.value+"&Email="+email.value+"&Telefon="+phone.value+"&Nachricht="+message.value;
	request = new Http(
		"send_mail.php",
		null,
		'POST',
		postVars,
		['Content-Type', 'application/x-www-form-urlencoded']
	);
	request.onreadyst = function()
	{
		if (requestQue.List[0].req.readyState == 4)
		{
			if (requestQue.List[0].req.status == 200)
			{
				document.getElementById('contact_name').value = '';
				document.getElementById('contact_firstname').value = '';
				document.getElementById('contact_lastname').value = '';
				document.getElementById('contact_company').value = '';
				document.getElementById('contact_email').value = '';
				document.getElementById('contact_phone').value = '';
				document.getElementById('contact_street').value = '';
				document.getElementById('contact_zip').value = '';
				document.getElementById('contact_city').value = '';
				document.getElementById('contact_country').value = '';
				document.getElementById('contact_message').value = '';
				hurra_alert("Vielen Dank für Ihre Anfrage!", "Wir werden uns umgehend um Ihr Anliegen kümmern.", "");
				requestQue.requExecuted();
			}
			else
			{
				requestQue.requExecuted();
			}
		}
	}
	requestQue.add(request);
}
