function fenster(url,breite,hoehe,options)
{
	posleft=screen.width/2-breite/2;
	postop=screen.height/2-hoehe/2-10;
	window.open(url,'_blank','width='+breite+',height='+hoehe+',left='+posleft+',top='+postop+','+options);
}

function code(field,tag)
{
	if (document.all) sel=document.selection.createRange();
    else              document.getSelection();
  	oldText=sel.text;
	if (sel.text.length>0)
  	{
		if (oldText.charAt(oldText.length-1)==" ") oldText=oldText.substr(0,oldText.length-1);
		if (tag=="a")
		{
			if (oldText.substr(0,7)=="http://") newText="<a href=\""+oldText+"\" target=\"_blank\" class=\"blau\">"+oldText+"</a>";
			else								newText="<a href=\"http://"+oldText+"\" target=\"_blank\" class=\"blau\">"+oldText+"</a>";
		}
		else if (tag=="red")
		{
			newText="<font style='color:#FF4466'>"+oldText+"</font>";
		}
		else if (tag=="blue")
		{
			newText="<font style='color:#3399FF'>"+oldText+"</font>";
		}
		else if (tag=="yellow")
		{
			newText="<font style='color:yellow'>"+oldText+"</font>";
		}
		else if (tag=="center")
		{
			newText="<center>"+oldText+"</center>";
		}
		else
		{
			newText="<"+tag+">"+oldText+"</"+tag+">";
		}
		if (sel.text.charAt(sel.text.length-1)==" ") sel.text=newText+" ";
  		else                                         sel.text=newText;
  	}
}


function checkContact()
{
	if (document.mail.field_name.value=="") 
		{alert("Bitte geben Sie ihren Namen an!");document.mail.field_name.focus();return false}
	if (document.mail.field_vorname.value=="") 
		{alert("Bitte geben Sie ihren Vornamen an!");document.mail.field_vorname.focus();return false}
	if (document.mail.field_tel.value=="") 
		{alert("Bitte geben Sie ihre Telefonnummer an!");document.mail.field_tel.focus();return false}
	if (document.mail.field_email.value=="") 
		{alert("Bitte geben Sie ihre E-Mail-Adresse an!");document.mail.field_email.focus();return false}
	if (document.mail.field_text.value=="") 
		{alert("Bitte formulieren Sie eine Anfrage!");document.mail.field_text.focus();return false}
	return true;
}

function checkContactOrder()
{
	if (document.mail.field_company.value=="") 
		{alert("Bitte geben Sie ihre Firma an!");document.mail.field_company.focus();return false}
	if (document.mail.field_name.value=="") 
		{alert("Bitte geben Sie ihren Namen an!");document.mail.field_name.focus();return false}
	if (document.mail.field_vorname.value=="") 
		{alert("Bitte geben Sie ihren Vornamen an!");document.mail.field_vorname.focus();return false}
	if (document.mail.field_tel.value=="") 
		{alert("Bitte geben Sie ihre Telefonnummer an!");document.mail.field_tel.focus();return false}
	if (document.mail.field_email.value=="") 
		{alert("Bitte geben Sie ihre E-Mail-Adresse an!");document.mail.field_email.focus();return false}
	if (document.mail.field_menge.value=="") 
		{alert("Bitte geben Sie mindestens für ein Produkt die Anzahl an!");document.mail.field_email.focus();return false}
	if (document.mail.field_productnumber.value=="") 
		{alert("Bitte geben Sie mindestens für ein Produkt die Produktnummer an!");document.mail.field_email.focus();return false}
	return true;
}

function checkCallback()
{
	if (document.mail.field_vorname.value=="") 
		{alert("Bitte geben Sie ihren Vornamen an!");document.mail.field_vorname.focus();return false}
	if (document.mail.field_name.value=="") 
		{alert("Bitte geben Sie ihren Namen an!");document.mail.field_name.focus();return false}
	if (document.mail.field_tel.value=="") 
		{alert("Bitte geben Sie ihre Telefonnummer an!");document.mail.field_tel.focus();return false}
	if (document.mail.field_email.value=="") 
		{alert("Bitte geben Sie ihre E-Mail-Adresse an!");document.mail.field_email.focus();return false}
	return true;
}

function checkEntry()
{
	if (document.data.name.value=="") 
		{alert("Bitte geben Sie einen Namen an!");document.data.name.focus();return false}
	if (document.data.firstname.value=="") 
		{alert("Bitte geben Sie einen Vornamen an!");document.data.firstname.focus();return false}
	if (document.data.street.value=="") 
		{alert("Bitte geben Sie eine Strasse an!");document.data.street.focus();return false}
	if (document.data.postcode.value=="") 
		{alert("Bitte geben Sie eine PLZ an!");document.data.postcode.focus();return false}
	if (document.data.city.value=="") 
		{alert("Bitte geben Sie einen Ort an!");document.data.city.focus();return false}
	if (document.data.email.value=="") 
		{alert("Bitte geben Sie eine E-Mail an!");document.data.email.focus();return false}
	return true;
}
	   
function updateState(countryList,stateList,selectedEntry)
{
	germany=new Array("Baden-Württemberg","Bayern","Berlin","Brandenburg","Bremen","Hessen","Hamburg","Mecklenburg-Vorpommern","Niedersachsen","Nordrhein-Westfalen","Rheinland-Pfalz","Saarland","Sachsen","Sachsen-Anhalt","Schleswig-Holstein","Thüringen");
	austria=new Array("Burgenland","Kärnten","Niederösterreich","Oberösterreich","Salzburg","Steiermark","Tirol","Vorarlberg","Wien");
	switzerland=new Array("Aargau","Appenzell-Ausserhoden","Appenzell-Innerhoden","Basel-Stadt","Basel-Landschaft","Bern","Freiburg","Genf","Glarus","Jura","Luzern","Neuenburg","Niderwalden","Oberwalden","Schwyz","Schaffhausen","Solothurn","St. Gallen","Tessin","Thurgau","Uri","Waadt","Wallis","Zug","Zürich");
	switch (countryList.selectedIndex)
	{
		case 1: stateList.options.length=austria.length;
				for (i=0;i<austria.length;i++)
				{
					stateList.options[i].text=austria[i];
					if (selectedEntry==austria[i]) stateList.options[i].selected=true;
				}
				break;
		case 2: stateList.options.length=switzerland.length;
				for (i=0;i<switzerland.length;i++)
				{
					stateList.options[i].text=switzerland[i];
					if (selectedEntry==switzerland[i]) stateList.options[i].selected=true;
				}
				break;
		default:stateList.options.length=germany.length;
				for (i=0;i<germany.length;i++)
				{
					stateList.options[i].text=germany[i];
					if (selectedEntry==germany[i]) stateList.options[i].selected=true;
				}
				break;
	}
}
