﻿var b_stopp=false;
function funct_submit(t,SA)
{
	
	// return funct_check_pc4_quantum(0,null);
		
	if(!b_stopp)
	{
		b_stopp=true;
	
		
		var showDIVSAVE = true;
		try
		{
			if( navigator.userAgent.indexOf("Gecko")>-1 )
				showDIVSAVE = false;
		}
		catch(e){}
			
		if( showDIVSAVE )
		{
			for(var i = 0; i < document.getElementsByTagName("select").length; ++i)
				document.getElementsByTagName("select")[i].style.visibility="hidden";
				
			//document.getElementById("DIVCONT").style.visibility="hidden";
			document.getElementById("DIVSAVE").style.visibility="visible";
		}
		
		if(document.all)
		{
			if(SA>0)
				document.forms[0].b83b72e94ab64bd2922537daf82d0b30.value = document.body.scrollTop;
				
			document.all.TBSAVE.style.top=(document.body.offsetHeight/2)-206+document.body.scrollTop;
		}
		else if(document.layers)
		{
			if(SA>0)
				document.forms[0].b83b72e94ab64bd2922537daf82d0b30.value = pageYOffset;
	
			document.TBSAVE.pageY = (window.innerHeight/2)-206+pageYOffset;
		}
		else if(document.getElementById)
		{
			if(SA>0)
				document.forms[0].b83b72e94ab64bd2922537daf82d0b30.value = pageYOffset;
	
			myObj = document.getElementById("TBSAVE");
		 	myObj.style.top = (window.innerHeight/2)-206+pageYOffset;
		}

		//window.location.href = "#top";
			
		if(t==2)
			document.forms[0].submit();
		else
			return true;
		
	}
	else
		return false;
}


function funct_check_pc4_quantum(t,ob)
{
	
	try
	{
		if( document.getElementById("pc4_quantum") )
		{
			
			if (isNaN(parseInt(document.getElementsByName("pc4_quantum")[0].value)))
				document.getElementsByName("pc4_quantum")[0].value = "";
			else
				document.getElementsByName("pc4_quantum")[0].value = parseInt(document.getElementsByName("pc4_quantum")[0].value);
					
			
			if( document.getElementById("pc4_quantum_275") || document.getElementById("pc4_quantum_274") )
			{
				var i_pc4_quantum_x = 0;
			
				if( document.getElementById("pc4_quantum_275") )
				{
					if (isNaN(parseInt(document.getElementsByName("pc4_quantum_275")[0].value)))
						document.getElementsByName("pc4_quantum_275")[0].value = "";
					else				
					{
						i_pc4_quantum_x += parseInt(document.getElementsByName("pc4_quantum_275")[0].value);
						document.getElementsByName("pc4_quantum_275")[0].value = parseInt(document.getElementsByName("pc4_quantum_275")[0].value);
					}
				}
			
				if( document.getElementById("pc4_quantum_274") )
				{
					if (isNaN(parseInt(document.getElementsByName("pc4_quantum_274")[0].value)))
						document.getElementsByName("pc4_quantum_274")[0].value = "";
					else
					{
						i_pc4_quantum_x += parseInt(document.getElementsByName("pc4_quantum_274")[0].value);
						document.getElementsByName("pc4_quantum_274")[0].value = parseInt(document.getElementsByName("pc4_quantum_274")[0].value);
					}
				}
				
				
				if( i_pc4_quantum_x != parseInt(document.getElementsByName("pc4_quantum")[0].value) )
				{		
					if (isNaN(parseInt(document.getElementsByName("pc4_quantum")[0].value)))
						alert("Ups – hier liegt ein Fehler vor.\n\nBitte prüfen Sie die Gesamt-Personenzahl.");
					else
						alert("Ups – hier liegt ein Fehler in der Addition vor.\n\nBitte prüfen Sie, ob die Summe der Personen im Doppel- und im Einzelzimmer der Gesamt-Personenzahl entspricht.");
						
					document.getElementsByName("pc4_quantum")[0].focus();
					
					return false;
				}
			}
		}
	}
	catch (e) {}
	
}



function funct_ScrollAnchor(p)
{
	if( p>0 )
	{		
		window.scrollTo(p,p);
	}
}


function funct_return(e,id)
{
	try
	{
		if(document.all)
		{
			if(window.event.keyCode==13)
				document.getElementById(id).click();
		}
		else
		{
			if(e.which==13)
				document.getElementById(id).click();
		}
	}
	catch (e) {}
}



