// JavaScript Document
function pageStart()
{
	try
	{
		Set_AC_FL_RunContent_GET('');
		document.getElementById('flame_container').innerHTML = AC_FL_RunContent( "codebase","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0","width","313","height","150","src","feuereffekt","quality","high","pluginspage","http://www.macromedia.com/go/getflashplayer","movie","feuereffekt", "wmode", "transparent" );
		Set_AC_FL_RunContent_GET('');
	}catch(e){}
	try
	{
		hurra_addEvent(document.getElementById('bttn_order'), 'click', show_contactform);
	}catch(e){}
}
hurra_registerOnLoad(pageStart);
function show_contactform()
{
	var html = 
	  '<img id="form_header" src="pix/form_header.gif" alt="Bestellen / Reservieren" />'
	+ '<div id="form_left_content_container">'
		+ '<input type="text" id="contact_name" class="input" />'
		+ '<div class="input_desc">Name*</div>'
		+ '<input type="text" id="contact_street" class="input" />'
		+ '<div class="input_desc">Straße*</div>'
		+ '<input type="text" id="contact_zip" class="input" />'
		+ '<input type="text" id="contact_city" class="input" />'
		+ '<div clas="clear_both" style="display:block;	font-size:1px; line-height:1px;	clear:both;	margin-bottom:-1px;">&nbsp;</div>'
		+ '<div class="input_desc">PLZ / ORT</div>'
		+ '<input type="text" id="contact_phone" class="input" />'
		+ '<div class="input_desc">Telefon*</div>'
		+ '<input type="text" id="contact_email" class="input" />'
		+ '<div class="input_desc">Email*</div>'
		+ '<textarea id="contact_message"></textarea>'
		+ '<div class="input_desc">Anmerkungen</div>'
	+ '</div>'
	+'<div id="form_right_content_container">'
		+'<div class="form_product_container">'
			+'<div class="form_product_title_container">'
				+ '<div class="form_product_title">T-Shirt</div>'
				+ '<div class="form_product_price">EUR 25,- inkl. Mwst</div>'
			+ '</div>'
//			+ '<div class="input_container">'
//				+ '<input onfocus="this.select()" type="text" id="shirt_xxxl" class="input" value="0" />'
//				+ '<div class="desc">XXXL</div>'
//			+ '</div>'
			+ '<div class="input_container">'
				+ '<input onfocus="this.select()" type="text" id="shirt_xxl" class="input" value="0" />'
				+ '<div class="desc">XXL</div>'
			+ '</div>'
			+ '<div class="input_container">'
				+ '<input onfocus="this.select()" type="text" id="shirt_xl" class="input" value="0" />'
				+ '<div class="desc">XL</div>'
			+ '</div>'
			+ '<div class="input_container">'
				+ '<input onfocus="this.select()" type="text" id="shirt_l" class="input" value="0" />'
				+ '<div class="desc">L</div>'
			+ '</div>'
			+ '<div class="input_container">'
				+ '<input onfocus="this.select()" type="text" id="shirt_m" class="input" value="0" />'
				+ '<div class="desc">M</div>'
			+ '</div>'
			+ '<div class="input_container">'
				+ '<input onfocus="this.select()" type="text" id="shirt_s" class="input" value="0" />'
				+ '<div class="desc">S</div>'
			+ '</div>'
			+ '<div clas="clear_both" style="display:block;	font-size:1px; line-height:1px;	clear:both;	margin-bottom:-1px;">&nbsp;</div>'
		+ '</div>'
		+'<div class="form_product_container">'
			+'<div class="form_product_title_container">'
				+ '<div class="form_product_title">Polo Shirt</div>'
				+ '<div class="form_product_price">EUR 35,- inkl. Mwst</div>'
			+ '</div>'
//			+ '<div class="input_container">'
//				+ '<input onfocus="this.select()" type="text" id="polo_xxxl" class="input" value="0" />'
//				+ '<div class="desc">XXXL</div>'
//			+ '</div>'
			+ '<div class="input_container">'
				+ '<input onfocus="this.select()" type="text" id="polo_xxl" class="input" value="0" />'
				+ '<div class="desc">XXL</div>'
			+ '</div>'
			+ '<div class="input_container">'
				+ '<input onfocus="this.select()" type="text" id="polo_xl" class="input" value="0" />'
				+ '<div class="desc">XL</div>'
			+ '</div>'
			+ '<div class="input_container">'
				+ '<input onfocus="this.select()" type="text" id="polo_l" class="input" value="0" />'
				+ '<div class="desc">L</div>'
			+ '</div>'
			+ '<div class="input_container">'
				+ '<input onfocus="this.select()" type="text" id="polo_m" class="input" value="0" />'
				+ '<div class="desc">M</div>'
			+ '</div>'
			+ '<div class="input_container">'
				+ '<input onfocus="this.select()" type="text" id="polo_s" class="input" value="0" />'
				+ '<div class="desc">S</div>'
			+ '</div>'
			+ '<div clas="clear_both" style="display:block;	font-size:1px; line-height:1px;	clear:both;	margin-bottom:-1px;">&nbsp;</div>'
		+ '</div>'
		+'<div class="form_product_container">'
			+'<div class="form_product_title_container">'
				+ '<div class="form_product_title">Zip-Sweater</div>'
				+ '<div class="form_product_price">EUR 50,- inkl. Mwst</div>'
			+ '</div>'
//			+ '<div class="input_container">'
//				+ '<input onfocus="this.select()" type="text" id="sweater_xxxl" class="input" value="0" />'
//				+ '<div class="desc">XXXL</div>'
//			+ '</div>'
//			+ '<div class="input_container">'
//				+ '<input onfocus="this.select()" type="text" id="sweater_xxl" class="input" value="0" />'
//				+ '<div class="desc">XXL</div>'
//			+ '</div>'
			+ '<div class="input_container">'
				+ '<input onfocus="this.select()" onfocus="this.select()" type="text" id="sweater_xl" class="input" value="0" />'
				+ '<div class="desc">XL</div>'
			+ '</div>'
			+ '<div class="input_container">'
				+ '<input onfocus="this.select()" type="text" id="sweater_l" class="input" value="0" />'
				+ '<div class="desc">L</div>'
			+ '</div>'
			+ '<div class="input_container">'
				+ '<input onfocus="this.select()" type="text" id="sweater_m" class="input" value="0" />'
				+ '<div class="desc">M</div>'
			+ '</div>'
//			+ '<div class="input_container">'
//				+ '<input onfocus="this.select()" type="text" id="sweater_s" class="input" value="0" />'
//				+ '<div class="desc">S</div>'
//			+ '</div>'
			+ '<div clas="clear_both" style="display:block;	font-size:1px; line-height:1px;	clear:both;	margin-bottom:-1px;">&nbsp;</div>'
		+ '</div>'
	+ '</div>'
	+ '<div clas="clear_both" style="display:block;	font-size:1px; line-height:1px;	clear:both;	margin-bottom:-1px;">&nbsp;</div>'
	+ '<div class="duty_desc">* Pflichtfelder</div>'
	+ '<div class="reminder_desc">Es handelt sich nur um eine Anfrage und keine verbindliche Bestellung.</div>'
	+ '<img id="submit_bttn" onclick="send_contact();" src="pix/bttn_submit.gif" alt="Absenden" />'
	+ '<div clas="clear_both" style="display:block;	font-size:1px; line-height:1px;	clear:both;	margin-bottom:-1px;">&nbsp;</div>';
	hurra_create_2ndWindow(860, html);
}

function send_contact()
{
	var errorReport = '';
	
	var name = document.getElementById('contact_name');
	if(!hurra_check_length(name.value, 2))
	{
		errorReport += "Bitte füllen Sie das Feld Name 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 phone = document.getElementById('contact_phone');
	if(!hurra_check_length(phone.value, 2))
	{
		errorReport += "Bitte füllen Sie das Feld Telefon 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 message = document.getElementById('contact_message');
//	if(!hurra_check_length(message.value, 2))
//	{
//		errorReport += "Bitte füllen Sie das Feld Anmerkungen aus!<br />";
//	}
	
	var shirt_s = document.getElementById('shirt_s');
	var shirt_m = document.getElementById('shirt_m');
	var shirt_l = document.getElementById('shirt_l');
	var shirt_xl = document.getElementById('shirt_xl');
	var shirt_xxl = document.getElementById('shirt_xxl');
//	var shirt_xxxl = document.getElementById('shirt_xxxl');

	var polo_s = document.getElementById('polo_s');
	var polo_m = document.getElementById('polo_m');
	var polo_l = document.getElementById('polo_l');
	var polo_xl = document.getElementById('polo_xl');
	var polo_xxl = document.getElementById('polo_xxl');
//	var polo_xxxl = document.getElementById('polo_xxxl');

//	var sweater_s = document.getElementById('sweater_s');
	var sweater_m = document.getElementById('sweater_m');
	var sweater_l = document.getElementById('sweater_l');
	var sweater_xl = document.getElementById('sweater_xl');
//	var sweater_xxl = document.getElementById('sweater_xxl');
//	var sweater_xxxl = document.getElementById('sweater_xxxl');

	if(errorReport.length > 0)
	{
		hurra_alert("Achtung", errorReport, "");
		return false;	
	}
	postVars = "pass=petzner&Name="+name.value+"&Straße="+street.value+"&PLZ="+zip.value+"&Ort="+city.value+"&Telefon="+phone.value+"&Email="+email.value+"&Anmerkungen="+message.value;
	
//	postVars += "&Menge T-Shirt S="+shirt_s.value+"&Menge T-Shirt M="+shirt_m.value+"&Menge T-Shirt L="+shirt_l.value+"&Menge T-Shirt XL="+shirt_xl.value+"&Menge T-Shirt XXL="+shirt_xxl.value+"&Menge T-Shirt XXXL="+shirt_xxxl.value;
//	postVars += "&Menge Polo Shirt S="+polo_s.value+"&Menge Polo Shirt M="+polo_m.value+"&Menge Polo Shirt L="+polo_l.value+"&Menge Polo Shirt XL="+polo_xl.value+"&Menge Polo Shirt XXL="+polo_xxl.value+"&Menge Polo Shirt XXXL="+polo_xxxl.value;
//	postVars += "&Menge Zip-Sweater S="+sweater_s.value+"&Menge Zip-Sweater M="+sweater_m.value+"&Menge Zip-Sweater L="+sweater_l.value+"&Menge Zip-Sweater XL="+sweater_xl.value+"&Menge Zip-Sweater XXL="+sweater_xxl.value+"&Menge Zip-Sweater XXXL="+sweater_xxxl.value;
	
	
	postVars += "&Menge T-Shirt S="+shirt_s.value+"&Menge T-Shirt M="+shirt_m.value+"&Menge T-Shirt L="+shirt_l.value+"&Menge T-Shirt XL="+shirt_xl.value+"&Menge T-Shirt XXL="+shirt_xxl.value;
	postVars += "&Menge Polo Shirt S="+polo_s.value+"&Menge Polo Shirt M="+polo_m.value+"&Menge Polo Shirt L="+polo_l.value+"&Menge Polo Shirt XL="+polo_xl.value+"&Menge Polo Shirt XXL="+polo_xxl.value;
	postVars += "&Menge Zip-Sweater M="+sweater_m.value+"&Menge Zip-Sweater L="+sweater_l.value+"&Menge Zip-Sweater XL="+sweater_xl.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)
			{
				hurra_unlockPage_firstLevel()
				hurra_alert("Vielen Dank für Ihre Reservierung!", "Wir werden uns umgehend um Ihre Anfrage kümmern.", "");
				requestQue.requExecuted();
			}
			else
			{
				requestQue.requExecuted();
			}
		}
	}
	requestQue.add(request);
}


//
// Funktionen für die 2te Inhaltsebene
//
var Hurra2ndWindow = null;
function hurra_create_2ndWindow(width, html)
{
	hurra_lockPage_firstLevel();
	var pageSize = hurra_getPageSize();
	var pageScroll = hurra_getPageScroll();
	
	Hurra2ndWindow  = document.createElement('div');
	Hurra2ndWindow.id = 'hurra2ndWindow';
	document.body.appendChild(Hurra2ndWindow);
	Hurra2ndWindow.innerHTML =
	'<div class="close_hurra2ndWindow" onclick="hurra_unlockPage_firstLevel()">X</div>'
	+'<div id="hurra2ndWindow_scrollContentContainer"><div id="hurra2ndWindow_contentContainer">'+html+'</div></div>';
	Hurra2ndWindow.style.width = width + 'px';
	Hurra2ndWindow.style.top = (pageScroll.yScroll + (pageSize.windowHeight - Hurra2ndWindow.offsetHeight) / 2) + 'px';
	Hurra2ndWindow.style.left = ((pageSize.pageWidth - Hurra2ndWindow.offsetWidth) / 2) + 'px';
	//Hinzufügen zu den zu schließenden Elementen
	HurraLockPageFirstLevelChilds[HurraLockPageFirstLevelChilds.length] = Hurra2ndWindow;
}

var HurraLockPageFirstLevelChilds = new Array();

var HurraLockPageFirstLevelOpacity = 90;
var HurraLockPageFirstLevel = null;
function hurra_lockPage_firstLevel()
{
	var pageSize = hurra_getPageSize();
	HurraLockPageFirstLevel = document.createElement('div');
	HurraLockPageFirstLevel.id = 'page_lock_firstLevel';
	HurraLockPageFirstLevel.style.display = 'block';
	document.body.appendChild(HurraLockPageFirstLevel);
	HurraLockPageFirstLevel.style.filter = 'alpha(opacity='+HurraLockPageFirstLevelOpacity +')';
	HurraLockPageFirstLevel.style.opacity = HurraLockPageFirstLevelOpacity/100;
	HurraLockPageFirstLevel.style.height = pageSize.pageHeight + 'px';
	HurraLockPageFirstLevel.style.width = '100%';
	hurra_addEvent(HurraLockPageFirstLevel,'click',hurra_unlockPage_firstLevel);
}
function hurra_lockPage_firstLevel_fix()
{
	var pageSize = hurra_getPageSize();
	HurraLockPageFirstLevel = document.createElement('div');
	HurraLockPageFirstLevel.id = 'page_lock_firstLevel';
	HurraLockPageFirstLevel.style.display = 'block';
	document.body.appendChild(HurraLockPageFirstLevel);
	HurraLockPageFirstLevel.style.filter = 'alpha(opacity='+HurraLockPageFirstLevelOpacity +')';
	HurraLockPageFirstLevel.style.opacity = HurraLockPageFirstLevelOpacity/100;
	HurraLockPageFirstLevel.style.height = pageSize.pageHeight + 'px';
	HurraLockPageFirstLevel.style.width = '100%';
}
function hurra_unlockPage_firstLevel()
{
	try
	{
		hurra_removeNode(HurraLockPageFirstLevel);
		HurraLockPageFirstLevel = null;
		for(var i = 0; i < HurraLockPageFirstLevelChilds.length; i++)
		{
			hurra_removeNode(HurraLockPageFirstLevelChilds[i]);
		}
		HurraLockPageFirstLevelChilds = new Array();
		
		//Zum abfangen von Fehlern beim Community Window
		myTC_communityWindowIsOpen = false;
		//requestQue.requExecuted();
	}
	catch(e){}
}
