init = function(){
	if(document.getElementById('ac')){
		for(i = 1 ; i <= 3 ; i++){
			document.getElementById('a' + i).style.display = 'none';
			document.getElementById('b' + i).className = '';
			}
		document.getElementById('b0').className = 'active';
		}
	if(document.getElementById('apcb1')){
		if(navigator.userAgent.toLowerCase().indexOf('msie 8') != -1){
			document.getElementById('apc').style.marginBottom = '-3px';
			}
		document.getElementById('apcb0').className = 'active';
		document.getElementById('preise1').style.display = 'none';
		}	
	if(document.getElementById('spot')){
		fl = "<div><object type=\"application/x-shockwave-flash\" data=\"/layout/appz/flashfader.swf\" height=\"168\" width=\"256\" id=\"object\">";
		fl += "<param name=\"bgcolor\" value=\"#F9E4CF\" />";
		fl += "<param name=\"movie\" value=\"/layout/appz/flashfader.swf\" />";
		fl += "<param name=\"FlashVars\" value=\"path2xml=";
		fl += document.getElementById('spot').getAttribute('src').substring(0,document.getElementById('spot').getAttribute('src').indexOf('/haupt') + 1);
		fl += "ss.xml\" />";
		fl += "<param name=\"quality\" value=\"high\" />";
		fl += "</object></div>";
		if(document.getElementById('spot').outerHTML){
			document.getElementById('spot').outerHTML = fl;
			}
		else{
			document.getElementById('ab').removeChild(document.getElementById('ab').firstChild);
			document.getElementById('ab').innerHTML = fl + document.getElementById('ab').innerHTML;
			}
		}
	if(document.getElementById('requester')){
		rq = document.getElementById('requester');
		rq.setAttribute('action','/anfrage.php');
		rq.setAttribute('method','post');
		}
	}


function apc(arg){
	hideme = (arg == 0) ? 1 : 0;
	document.getElementById('apcb' + arg).className = 'active';
	document.getElementById('apcb' + hideme).className = '';
	document.getElementById('preise' + arg).style.display = 'block';
	document.getElementById('preise' + hideme).style.display = 'none';
	}


function ac(arg1){
	for(i = 0 ; i <= 3 ; i++){
		if(i != arg1){
			document.getElementById('a' + i).style.display = 'none';
			document.getElementById('b' + i).className = '';
			}
		else{
			document.getElementById('a' + i).style.display = "block";
			document.getElementById('b' + i).className = 'active';
			}
		}
	}

function printExpose(){
	h1neu = '<h1>' + document.getElementsByTagName('h1')[0].innerHTML + '</h1>';
	h2alt = '<h1>' + document.getElementsByTagName('h1')[2].innerHTML + '</h1>';
	h2neu = document.getElementsByTagName('h1')[2].innerHTML.replace(/\<BR\>/ig,'; ').replace(/Gegend: /i,'\n<h2>Gegend:</h2>\n');
	printMarkup = '<html>\n';
	printMarkup += '<head>\n';
	printMarkup += '<title>Die wichtigsten INFOS auf einen Blick</title>\n';
	printMarkup += '<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">\n';
	printMarkup += '<link rel="stylesheet" type="text/css" href="/sys/print.css">\n';
	printMarkup += '</head>\n';
	printMarkup += '<body>\n';
	seite1 = h1neu + h2neu + document.getElementById("a0").innerHTML.replace(/\n/,'').substring(h2alt.length);
	seite2 = document.getElementById("a2").innerHTML;
	seite3 = '';
	for(i = 0 ; i < document.getElementById('ab').childNodes.length ; i++){
		if(document.getElementById('ab').childNodes[i].nodeName.toLowerCase() == 'p'){
			seite3 += document.getElementById('ab').childNodes[i].innerHTML.replace(/\<BR\>\<BR\>/ig,'<hr>').replace(/\<BR\>/ig,' ').replace(/\<HR\>/ig,'<BR><BR>');
			}
		if(document.getElementById('ab').childNodes[i].nodeName.toLowerCase() == 'ul'){
			seite3 += '<BR>'+document.getElementById('ab').childNodes[i].innerHTML.replace(/<LI\>/ig,', ');
			}
		}
	seite4 = document.getElementById("ap").innerHTML.replace(/<TABLE /ig,'<TABLE CLASS="preise" ');
	printMarkup += '<center><img src="/layout/print-header.jpg" alt="" id="header"><table border="0" cellpadding="0" cellspacing="0" class="print-it">';
	printMarkup += '<tr><td height="100" align="right" valign="top" style="padding-top: 10px">';
	printMarkup += '<a href="javascript:window.print()"><img border="0" src="/layout/drucken-js.gif" alt=""></a>' + '&nbsp;' + '<a href="javascript:window.close()"><img border="0" src="/layout/abbrechen-js.gif" alt=""></a></td></tr>';
	printMarkup += '<tr>';
	printMarkup += '<td style="border-top: 1px solid rgb(202, 202, 202)">\n' + seite1 + '\n</td>';
	printMarkup += '</tr>';
	printMarkup += '<tr>';
	printMarkup += '<td><h2>Ausstattung</h2>' + seite2 + '</td>';
	printMarkup += '</tr>';
	printMarkup += '<tr>';
	printMarkup += '<td><h2>Details</h2>' + seite3 + '</td>';
	printMarkup += '</tr>';				
	printMarkup += '<tr>';
	printMarkup += '<td>' + seite4 + '<br><br></td>';
	printMarkup += '</tr>';				
	printMarkup += '<tr><td height="21" align="center" valign="middle" style="font-size: 11px; border-top: 1px solid rgb(202, 202, 202); padding: 5px 0px;">';
	printMarkup += 'Toskana Ferienhäuser | Toskana Ferienwohnungen | Weingüter | Villen | Landhäuser<br>Vermittlungsagentur seit 1998<br>';
	printMarkup += 'TERRA ANTIQUA | Sylvia Stich (Dipl. Geographin) | Hildebrandtstraße 49 | D-85057 Ingolstadt<br>';
	printMarkup += 'Tel: +49 (0) 841 493 65 08 | Fax: +49 (0) 841 466 69 | E-Mail: info@terra-antiqua.de</p>';	
	printMarkup += '</td></tr>';		
	printMarkup += '</table></center>';
	printMarkup += '</body>';
	printMarkup += '</html>';
	myPrinter = window.open('','MyPrintWindow','top=12,left=12,width=640,height=460,scrollbars=1,scroll=1,resizable=1');
	myPrinter.document.open('text/html');
	myPrinter.document.write(printMarkup);
	myPrinter.document.close();
	myPrinter.focus();
	}

function oops(){
	fo = document.foo;
	rqf = document.requester;
	cAdddy = /^\w[\w|\.|\-]+@\w[\w|\.|\-]+\.[a-zA-Z]{2,6}$/;
	cFrage = /^[0-9a-zA-ZÄÖÜäöüß´ \n\t\r\*\€\§\%\$\/_.,\;\:\!\?\(\)-]*$/;
	cFon = /^[0-9 \/\(\).-]*$/;
	cName = /^[a-zA-ZÄÖÜäöüß´\s]*$/;
	wrong = false;
	if(!cAdddy.test(fo.eMail.value)){
		wrong = "Die eMail Adresse ist nicht gültig";
		}
	if(!cName.test(fo.Name.value)){
		wrong = "Bitte verwenden Sie ausschließlich deutsche Buchstaben im Namen";
		}
	if(!cFon.test(fo.Telefon.value)){
		wrong = "Bitte geben Sie eine korrekte Telefonnummer an";
		}
	if(fo.Name.value.length < 2 || fo.Telefon.value.length < 2 || fo.eMail.value.length < 7){
		wrong = "Bitte füllen Sie alle Pflichtfelder aus";
		}
	if(wrong != false){
		confirm(wrong);
		}
	else{	
		for(i = 0 ; i < rq.elements.length ; i++){
			rqf.elements[rqf.elements[i].name].value = fo.elements[rqf.elements[i].name].value;
			}
		rqf.submit();
		}
	}

window.onload = init;