var offerId;
var requestInUse = false;
var ibeTdInnerHtml = new Array();
var ibeTrClassName = '';
function xmlRequestSend(url) {
	// branch for native XMLHttpRequest object
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
		req.onreadystatechange = xmlRequestProcessReqChange;
		req.open("GET", url, true);
		req.send(null);

		// branch for IE/Windows ActiveX version
	} else if (window.ActiveXObject) {
		isIE = true;
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req) {
			req.onreadystatechange = xmlRequestProcessReqChange;
			req.open("GET", url, true);
			req.send();
		}
	}
}


function xmlRequestProcessReqChange() {
	// only if req shows "loaded"
	if (req.readyState == 4) {
		// only if "OK"
		if (req.status == 200) {
			var index = getElement(offerId).rowIndex;
			document.getElementById( 'hotelofferlist' ).deleteRow( index );
			var row = document.getElementById( 'hotelofferlist' ).insertRow( index );
			var td = document.createElement( 'td' );
			td.setAttribute('colSpan', '6' );
			td.innerHTML = req.responseText;
			row.appendChild( td );
			requestInUse = false;
		}

		requestInUse = false;
	}
}

function  abortBookingQuestionReq ( ) {
	//document.getElementById( 'hotelofferlist' ).rows[ibeIndex].innerHTML = ibeInnerHtml;
	var index = getElement(offerId).rowIndex;
	document.getElementById( 'hotelofferlist' ).deleteRow( index );
	var row = document.getElementById( 'hotelofferlist' ).insertRow( index );
	for (i=0;i<ibeTdInnerHtml.length;i++) {
		var td = document.createElement( 'td' );
		td.innerHTML = ibeTdInnerHtml[i];

		if ( i==0 || i==4 ) {
			td.style.textAlign = 'left';
		}else if  ( i==5 ) {
			td.style.textAlign = 'right';
		}
		row.appendChild( td );
	}

	row.id = offerId;

	row.className = ibeTrClassName;
	requestInUse = false;
}

function bookingQuestionReq ( host, id, pid ) {
	if ( requestInUse == true ) return;
	requestInUse = true;
	offerId = id;

	var html = '<div style="padding:1px 3px 3px 0px; background:#E0D4F7 url(' + host + 'img/line/dotted-line-black.gif) repeat-x bottom;">';
	html += '	<div>';
	html += '		<b>Bitte warten! Es werden freie Pl\xE4tze direkt beim Veranstalter gepr\xFCft.</b>';
	html += '	</div>';
	html += '	<div style="text-align:center; width:100%; padding-top: 5px">';
	html += '		<img src="http://buchung.ab-in-den-urlaub.de/kunden_parameter/aidu2/ibe_v2/images/flieger.gif" align=absmiddle>';
	html += '	</div>';
	html += '	<div align="right"><a onclick="abortBookingQuestionReq()" style="margin-left:200px; cursor:pointer; text-decoration:underline">Abbrechen</a></div>';
	html += '</div>';


	index = getElement(offerId).rowIndex;
	ibeRow = document.getElementById( 'hotelofferlist' ).rows[index];

	for ( i=0; i<ibeRow.cells.length;i++) {
		ibeTdInnerHtml[i] = ibeRow.cells[i].innerHTML;
	}
	ibeTrClassName = ibeRow.className;
	document.getElementById( 'hotelofferlist' ).deleteRow( index );
	var row = document.getElementById( 'hotelofferlist' ).insertRow( index );
	var td = document.createElement( 'td' );
	row.id = offerId;
	td.setAttribute('colSpan', '6' );
	//td.setAttribute('style', 'background:#E0D4F7 url(' + host + 'img/line/dotted-line-black.gif) repeat-x bottom;');
	td.innerHTML = html;
	row.appendChild( td );

	xmlRequestSend ( host+'hotel/ttbookingquestion/offerId/'+offerId+'/id/'+pid );
}



function resizeIframe(id , height){
	document.getElementById(id).height = height; // required for Moz bug, value can be "", null, or integer
	document.getElementById(id).height = window.frames[id].document.body.scrollHeight ;
}

function getElement(obj)
{
	if(document.getElementById)
		return document.getElementById(obj);
	else if(document.all)
		return document.all[obj];
	else if(document.layers)
		return document.obj;
}

function switchDisplay (id, mode) {
	if( mode == true )
		displayType = "block";
	else
		displayType = "none";

	element = getElement(id);
	element.style.display = displayType;
}

function setFormText (id, value) {
	self.document.getElementById (id).value = value;
	return;
}

function getFormText (id) {
	return self.document.getElementById (id).value;
}

function setFormField (key, value) {
	var formObj = self.document.getElementById (ibeFormId);
	if (!formObj)
		return false;

	alert(key);
	formObj.elements[key].value = value;
}

function setFormFieldParent (key, value) {
	var formObj = parent.top.document.getElementById (ibeFormId);
	if (!formObj) return false;
	formObj.elements[key].value = value;
}

function popup(url, media, name) {
	var width = 0;
	var height = 0;
	var left = 0;
	var top = 0;

	switch(media) {
		case "print": {
			width = 700;
			height = 480;
			left = (screen.availWidth - width) / 2;
			top = (screen.availHeight - height) / 2;
			options = "left="+String(left)+", screenX="+String(left)+", top="+String(top)+", screenY="+String(top)+", height="+String(height)+", location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no, width="+String(width)+"";
			break;
		}
		case "info": {
			width = 360;
			height = 480;
			left = (screen.availWidth - width) / 2;
			top = (screen.availHeight - height) / 2;
			options = "left="+String(left)+", screenX="+String(left)+", top="+String(top)+", screenY="+String(top)+", height="+String(height)+", location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no, width="+String(width)+"";
			break;
		}
		case "screen": {
			width = 800;
			height = 600;
			left = (screen.availWidth - width) / 2;
			top = (screen.availHeight - height) / 2;
			options = "left="+String(left)+", screenX="+String(left)+", top="+String(top)+", screenY="+String(top)+", height="+String(height)+", location=yes, menubar=yes, resizable=yes, status=yes, scrollbars=yes, toolbar=yes, width="+String(width)+"";
			break;
		}
		case "flightinfo": {
			width = 600;
			height = 400;
			left = (screen.availWidth - width) / 2;
			top = (screen.availHeight - height) / 2;
			options = "left="+String(left)+", screenX="+String(left)+", top="+String(top)+", screenY="+String(top)+", height="+String(height)+", location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no, width="+String(width)+"";
			break;
		}

		case "evaluation": {
			width = 660;
			height = 680;
			left = (screen.availWidth - width) / 2;
			top = (screen.availHeight - height) / 2;
			options = "left="+String(left)+", screenX="+String(left)+", top="+String(top)+", screenY="+String(top)+", height="+String(height)+", location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no, width="+String(width)+"";
			break;
		}
		case "vaitin": {
			width = 525;
			height = 355;
			left = (screen.availWidth - width) / 2;
			top = (screen.availHeight - height) / 2;
			options = "left="+String(left)+", screenX="+String(left)+", top="+String(top)+", screenY="+String(top)+", width="+String(width)+",height="+String(height)+", location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no, width="+String(width)+"";
			break;
		}
		case "voucher": {
			width = 650;
			height = 550;
			left = (screen.availWidth - width) / 2;
			top = (screen.availHeight - height) / 2;
			options = "left="+String(left)+", screenX="+String(left)+", top="+String(top)+", screenY="+String(top)+", height="+String(height)+", location=no, menubar=no, resizable=yes, status=no, scrollbars=no, toolbar=no, width="+String(width)+"";
			break;
		}
		case "sponsors": {
			width = 833;
			height = 380;
			left = (screen.availWidth - width) / 2;
			top = (screen.availHeight - height) / 2;
			options = "left="+String(left)+", screenX="+String(left)+", top="+String(top)+", screenY="+String(top)+", height="+String(height)+", location=no, menubar=no, resizable=yes, status=no, scrollbars=no, toolbar=no, width="+String(width)+"";
			break;
		}
		case "ervpayment": {
			width = 570;
			height = 520;
			left = (screen.availWidth - width) / 2;
			top = (screen.availHeight - height) / 2;
			options = "left="+String(left)+", screenX="+String(left)+", top="+String(top)+", screenY="+String(top)+", height="+String(height)+", location=no, menubar=no, resizable=yes, status=no, scrollbars=no, toolbar=no, width="+String(width)+"";
			break;
		}
		case "itinerary": {
			width = 620;
			height = 700;
			left = (screen.availWidth - width) / 2;
			top = (screen.availHeight - height) / 2;
			options = "left="+String(left)+", screenX="+String(left)+", top="+String(top)+", screenY="+String(top)+", height="+String(height)+", location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no, width="+String(width)+"";
			break;
		}
		case "tariffinfo": {
			width = 450;
			height = 600;
			left = (screen.availWidth - width) / 2;
			top = (screen.availHeight - height) / 2;
			options = "left="+String(left)+", screenX="+String(left)+", top="+String(top)+", screenY="+String(top)+", height="+String(height)+", location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no, width="+String(width)+"";
			break;
		}
		case "lctariffinfo": {
			width = 800;
			height = 600;
			left = (screen.availWidth - width) / 2;
			top = (screen.availHeight - height) / 2;
			options = "left="+String(left)+", screenX="+String(left)+", top="+String(top)+", screenY="+String(top)+", height="+String(height)+", location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no, width="+String(width)+"";
			break;
		}
		case "cvc": {
			width = 500;
			height = 400;
			left = (screen.availWidth - width) / 2;
			top = (screen.availHeight - height) / 2;
			options = "left="+String(left)+", screenX="+String(left)+", top="+String(top)+", screenY="+String(top)+", height="+String(height)+", location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no, width="+String(width)+"";
			break;
		}
		default: {
			options = "";
			break;
		}
	}
	// set default name
	if (!name)
		name = "popup";
	// open popup
	var popupObj = window.open(url, name, options);
	// set into foreground
	popupObj.focus ();
}


function paymentFeeHandler(type, cctype) {
	var fee = 0;
	if(type == 'debit') {
		fee =  parseFloat( paymentFeeDebit.toString().replace(/,/g, ".") );
	}
	else if(type = 'cc') {
		var paymentFee = 0;
		if(cctype == 'VI') { paymentFee = parseFloat( paymentFeeVI.toString().replace(/,/g, ".") ); }
		else if(cctype == 'AX') { paymentFee = parseFloat( paymentFeeAX.toString().replace(/,/g, ".") ); }
		else if(cctype == 'CA') { paymentFee = parseFloat( paymentFeeCA.toString().replace(/,/g, ".") ); }
		else if(cctype == 'DC') { paymentFee = parseFloat( paymentFeeDC.toString().replace(/,/g, ".") ); }

		fee = (paymentFee > 0) ?paymentFee : parseFloat( paymentFeeCC.toString().replace(/,/g, ".") );
	}

	if($('ibePrice[paymentFee]')) {
		$('ibePrice[paymentFee]').update(fee);

		ervPrice = (typeof(ervPrice) == 'undefined') ? '0.00' :  parseFloat( ervPrice.toString().replace(/,/g, ".") );
		travelPrice = (typeof(travelPrice) == 'undefined') ? '0.00' : parseFloat ( travelPrice.toString().replace(/,/g, ".") );
		serviceFee = (typeof(serviceFee) == 'undefined') ? '0.00' : parseFloat( serviceFee.toString().replace(/,/g, ".") );
		baseFee = (typeof(baseFee) == 'undefined') ? '0.00' : parseFloat( baseFee.toString().replace(/,/g, ".") );
		
		cumulateFees();
	}
}

function HaHandler(fee) {
	if(parent.top.document.getElementById('ibePrice[HaPrice]')) {
		parent.top.document.getElementById('ibePrice[HaPrice]').innerHTML = fee;
		parent.top.document.getElementById('ibeBookingInput[ha][price]').fire('ha:haChanged');
	}
}

function cumulateFees() {
	// new servicefee-handling
	if($('ibePrice[taxPrice]')) {
		var value = parseFloat ( serviceFee );
		if(!($('ibePrice[HaPrice]').innerHTML.match(/^0/))) {
			value = parseFloat ( parseFloat ( serviceFee ) - parseFloat( $('ibePrice[HaPrice]').innerHTML ) );
		}

		if( $('ibeBookingInput[erv][offerId]').getValue() == '2') {
			value = parseFloat ( value - parseFloat ( baseFee ) );
		}
		if( value <= parseFloat( 0 ) ) {
			value = parseFloat( 0 );
		}
		
		var specialService = ($('specialServicesTotalPrice') && parseFloat($('specialServicesTotalPrice').getValue()) > 0) ? $('specialServicesTotalPrice').getValue() : 0;
		var ervOfferPrice = (parseFloat($('ibePrice[ervOffer]').innerHTML) > 0) ? $('ibePrice[ervOffer]').innerHTML : 0;
		var fullPrice = parseFloat(travelPrice) + (parseFloat(value) * parseFloat(paxCount)) + parseFloat(ervOfferPrice) + parseFloat( $('ibeBookingInput[ha][price]').getValue() ) + parseFloat(specialService) + parseFloat( $('ibePrice[paymentFee]').innerHTML) - parseFloat( $('ibePrice[voucherPrice]').innerHTML);

		$('ibePrice[taxPrice]').update(value.toFixed(2).replace(/\./g, ",") + " &euro;");
		$('ibePrice[full]').update(fullPrice.toFixed(2).replace(/\./g, ",") + " &euro;");
	}
}

function flightErvTrueHandler (offerId,ervPrice,update) {
	$('ibeBookingInput[erv][offerId]').value = offerId;
	$('ibeBookingInput[erv][book]').value = "TRUE";
	$('insuranceOffTeaser').hide();

	if ( update == true ) {
		
		ervPrice = (typeof(ervPrice) == 'undefined') ? '0.00' :  parseFloat( ervPrice.toString().replace(/,/g, ".") );
		travelPrice = (typeof(travelPrice) == 'undefined') ? '0.00' : parseFloat ( travelPrice.toString().replace(/,/g, ".") );
		serviceFee = (typeof(serviceFee) == 'undefined') ? '0.00' : parseFloat( serviceFee.toString().replace(/,/g, ".") );
		baseFee = (typeof(baseFee) == 'undefined') ? '0.00' : parseFloat( baseFee.toString().replace(/,/g, ".") );

		if(typeof(ibeErvOffersTravelPrice1) == 'undefined') {
			ibeErvOffersTravelPrice1 = '0';
		}
		if(typeof(ibeErvOffersTravelPrice2) == 'undefined') {
			ibeErvOffersTravelPrice2 = '0';
		}
		if(typeof(ibeErvOffersTravelPrice3) == 'undefined') {
			ibeErvOffersTravelPrice3 = '0';
		}

		if ( offerId == '0' ) {
			if($('ibeErvOffersPriceTd1')) {
				$('ibeErvOffersPriceTd1').update("Inbegriffen");
			}
			tPrice2 = parseFloat ( ibeErvOffersTravelPrice2 ) - parseFloat ( ibeErvOffersTravelPrice1 );
			$('ibeErvOffersPriceTd2').update(addSign( tPrice2 ) + ",00 &euro;");
			tPrice3 = parseFloat ( ibeErvOffersTravelPrice3 ) - parseFloat ( ibeErvOffersTravelPrice1 );
			$('ibeErvOffersPriceTd3').update(addSign( tPrice3 ) + ",00 &euro;");
			$('ibeErvOffersPriceTd4').update('- ' + parseFloat ( ibeErvOffersTravelPrice1 ) + ",00 &euro;");
			$('ibePrice[ervOfferPrice]').update(parseFloat ( ibeErvOffersTravelPrice1 )+",00 &euro;");

			if($('ibePrice[taxPrice]')) {
				$('ibePrice[taxPrice]').update(parseFloat ( parseFloat ( serviceFee ) ).toFixed(2)+" &euro;");
				$('ibePrice[ervOffer]').update(parseFloat(ibeErvOffersTravelPrice1));
			}
		}
		else if( offerId == '1' ) {
			tPrice1 = parseFloat ( ibeErvOffersTravelPrice1 ) - parseFloat ( ibeErvOffersTravelPrice2 );
			if($('ibeErvOffersPriceTd1')) {
				$('ibeErvOffersPriceTd1').update(addSign( tPrice1 ) + ",00 &euro;");
			}
			$('ibeErvOffersPriceTd2').update("Inbegriffen");
			tPrice3 = parseFloat ( ibeErvOffersTravelPrice3 ) - parseFloat ( ibeErvOffersTravelPrice2 );
			$('ibeErvOffersPriceTd3').update(addSign( tPrice3 ) + ",00 &euro;");
			$('ibeErvOffersPriceTd4').update('- ' + parseFloat ( ibeErvOffersTravelPrice2 ) + ",00 &euro;");
			$('ibePrice[ervOfferPrice]').update(parseFloat ( ibeErvOffersTravelPrice2 ) +",00 &euro;");
			if($('ibePrice[taxPrice]')) {
				$('ibePrice[taxPrice]').update(parseFloat ( parseFloat ( serviceFee ) ).toFixed(2)+" &euro;");
				$('ibePrice[ervOffer]').update(parseFloat(ibeErvOffersTravelPrice2));
			}
		}
		else if( offerId == '2' ) {
			tPrice1 = parseFloat ( ibeErvOffersTravelPrice1 ) - parseFloat ( ibeErvOffersTravelPrice3 );
			if($('ibeErvOffersPriceTd1')) {
				$('ibeErvOffersPriceTd1').update(addSign( tPrice1 ) + ",00 &euro;");
			}
			tPrice2 = parseFloat ( ibeErvOffersTravelPrice2 ) - parseFloat ( ibeErvOffersTravelPrice3 );
			$('ibeErvOffersPriceTd2').update(addSign( tPrice2 ) + ",00 &euro;");
			$('ibeErvOffersPriceTd3').update("Inbegriffen");
			
			$('ibeErvOffersPriceTd4').update('- ' + parseFloat ( ibeErvOffersTravelPrice3 ) + ",00 &euro;");
			$('ibePrice[ervOfferPrice]').update(parseFloat ( ibeErvOffersTravelPrice3 )+",00 &euro;");
			$('ibePrice[taxPrice]').update(parseFloat ( parseFloat ( serviceFee ) - parseFloat ( baseFee ) ).toFixed(2)+" &euro;");
			$('ibePrice[ervOffer]').update(parseFloat(ibeErvOffersTravelPrice3));
		}
		cumulateFees();
		$('ervTeaser').style.visibility = '';
	}

	return;
}

function flightErvFalseHandler () {
	$('ibePrice[ervOfferPrice]').update("keine Versicherung ausgewählt");
	
	ervPrice = (typeof(ervPrice) == 'undefined') ? '0.00' :  parseFloat( ervPrice.toString().replace(/,/g, ".") );
	travelPrice = (typeof(travelPrice) == 'undefined') ? '0.00' : parseFloat ( travelPrice.toString().replace(/,/g, ".") );
	serviceFee = (typeof(serviceFee) == 'undefined') ? '0.00' : parseFloat( serviceFee.toString().replace(/,/g, ".") );
	baseFee = (typeof(baseFee) == 'undefined') ? '0.00' : parseFloat( baseFee.toString().replace(/,/g, ".") );

	if(typeof(ibeErvOffersTravelPrice1) == 'undefined') {
		ibeErvOffersTravelPrice1 = '0';
	}
	if(typeof(ibeErvOffersTravelPrice2) == 'undefined') {
		ibeErvOffersTravelPrice2 = '0';
	}
	if(typeof(ibeErvOffersTravelPrice3) == 'undefined') {
		ibeErvOffersTravelPrice3 = '0';
	}
	
	if($('ibePrice[taxPrice]')) {
		$('ibePrice[taxPrice]').update(parseFloat ( serviceFee ).toFixed(2) + " &euro;");
		$('ibePrice[ervOffer]').update(parseFloat(0));
	}
	
	if($('ibeErvOffersPriceTd1')) {
		$('ibeErvOffersPriceTd1').update("+ " + ibeErvOffersTravelPrice1 + ",00 &euro;");
	}
	$('ibeErvOffersPriceTd2').update("+ " + ibeErvOffersTravelPrice2 + ",00 &euro;");
	$('ibeErvOffersPriceTd3').update("+ " + ibeErvOffersTravelPrice3 + ",00 &euro;");
	$('ibeErvOffersPriceTd4').update("0,00 &euro;");

	$('ibeBookingInput[erv][offerId]').value = "";
	$('ibeBookingInput[erv][book]').value = "FALSE";

	$('insuranceOffTeaser').show();
	$('ervTeaser').style.visibility = 'hidden';

	cumulateFees();
}



function ervBookingTypeManualHandler () {
	switchDisplay('insuranceOffTeaser', false);
	$('ibeBookingInput[erv][offerId]').value = "";
	$('ibeBookingInput[erv][book]').value = "MANUAL";


	return;
}

function ervBookingTypeFalseManualHandler () {
	//iframeSize = 165;
	$('ibeBookingInput[erv][offerId]').value = "";
	$('ibeBookingInput[erv][book]').value = "FALSE";

	switchDisplay('insuranceOffTeaser', true);

	return;
}
function ervBookingTypeTrueHandler (offerId,thisErvPrice,update) {
	//iframeSize = 198;
	$('ibeBookingInput[erv][offerId]').value = offerId;
	$('ibeBookingInput[erv][book]').value = "TRUE";
	switchDisplay('insuranceOffTeaser', false);

	if ( update == true ) {
		thisErvPrice = parseFloat( thisErvPrice );
		tPrice = parseFloat ( travelPrice ) + thisErvPrice;
		taxPrice = parseFloat(taxPrice);
		serviceFee = (typeof(serviceFee) == 'undefined') ? '0.00' : parseFloat( serviceFee);
		baseFee = (typeof(baseFee) == 'undefined') ? '0.00' : parseFloat( baseFee);
		if ( tPrice.toFixed )
			tPrice = tPrice.toFixed(2);
		if ( thisErvPrice.toFixed )
			thisErvPrice = thisErvPrice.toFixed(2);
		if ( taxPrice.toFixed )
			taxPrice = taxPrice.toFixed(2);

		if(typeof(ibeErvOffersTravelPrice1) == 'undefined') {
			ibeErvOffersTravelPrice1 = '0.00';
		}
		if(typeof(ibeErvOffersTravelPrice2) == 'undefined') {
			ibeErvOffersTravelPrice2 = '0.00';
		}
		if(typeof(ibeErvOffersTravelPrice3) == 'undefined') {
			ibeErvOffersTravelPrice3 = '0.00';
		}

		//$('ibePrice[ervOfferPrice]').innerHTML = thisErvPrice.replace(/\./g, ",") + " &euro;";
		$('ibePrice[ervOfferPrice]').innerHTML = thisErvPrice.replace(/\./g, ",");
		$('ibePrice[totalTravelPrice]').innerHTML = tPrice.replace(/\./g, ",") + " &euro;"; ;
		//$('ibePrice[taxPrice]').innerHTML = taxPrice.replace(/\./g, ",") + " &euro;"; ;

		if ( offerId == '0' ) {
			$('ibeErvOffersPriceTd1').innerHTML = "Inbegriffen";
			tPrice2 = parseFloat ( ibeErvOffersTravelPrice2 ) - parseFloat ( ibeErvOffersTravelPrice1 );
			$('ibeErvOffersPriceTd2').innerHTML = addSign( tPrice2 ) + ",00 &euro;";
			tPrice3 = parseFloat ( ibeErvOffersTravelPrice3 ) - parseFloat ( ibeErvOffersTravelPrice1 );
			$('ibeErvOffersPriceTd3').innerHTML = addSign( tPrice3 ) + ",00 &euro;";
			$('ibeErvOffersPriceTd4').innerHTML = '- ' + parseFloat ( ibeErvOffersTravelPrice1 ) + ",00 &euro;";
			if(!$('feeTable')) {
				$('ibePrice[ervOfferPrice]').innerHTML = parseFloat ( ibeErvOffersTravelPrice1 )+",00 &euro;";
			}
			else {
				$('ibePrice[ervOfferPrice]').innerHTML = parseFloat ( ibeErvOffersTravelPrice1 );
			}
				$('ibePrice[taxPrice]').innerHTML = parseFloat(serviceFee).toFixed(2)+" &euro;";
				$('ibePrice[ervOffer]').innerHTML = parseFloat(ibeErvOffersTravelPrice1);
			
			//$('ibePrice[taxPrice]').innerHTML = parseFloat ( taxPrice )+",00 &euro;";
		}
		else if( offerId == '1' ) {
			tPrice1 = parseFloat ( ibeErvOffersTravelPrice1 ) - parseFloat ( ibeErvOffersTravelPrice2 );
			$('ibeErvOffersPriceTd1').innerHTML = addSign( tPrice1 ) + ",00 &euro;";
			$('ibeErvOffersPriceTd2').innerHTML = "Inbegriffen";
			tPrice3 = parseFloat ( ibeErvOffersTravelPrice3 ) - parseFloat ( ibeErvOffersTravelPrice2 );
			$('ibeErvOffersPriceTd3').innerHTML = addSign( tPrice3 ) + ",00 &euro;";
			$('ibeErvOffersPriceTd4').innerHTML = '- ' + parseFloat ( ibeErvOffersTravelPrice2 ) + ",00 &euro;";
			if(!$('feeTable')) {
				$('ibePrice[ervOfferPrice]').innerHTML = parseFloat ( ibeErvOffersTravelPrice2 ) +",00 &euro;";
			}
			else {
				$('ibePrice[ervOfferPrice]').innerHTML = parseFloat ( ibeErvOffersTravelPrice2 );
			}
				$('ibePrice[taxPrice]').innerHTML = parseFloat(serviceFee).toFixed(2)+" &euro;";
				$('ibePrice[ervOffer]').innerHTML = parseFloat(ibeErvOffersTravelPrice2);
			//$('ibePrice[taxPrice]').innerHTML = parseFloat ( parseFloat ( taxPrice ) + parseFloat ( ibeErvOffersTravelPrice2 ) - parseFloat ( ibeErvOffersTravelPrice1 ) )+",00 &euro;";
		}
		else if( offerId == '2' ) {
			tPrice1 = parseFloat ( ibeErvOffersTravelPrice1 ) - parseFloat ( ibeErvOffersTravelPrice3 );
			$('ibeErvOffersPriceTd1').innerHTML = addSign( tPrice1 ) + ",00 &euro;";
			tPrice2 = parseFloat ( ibeErvOffersTravelPrice2 ) - parseFloat ( ibeErvOffersTravelPrice3 );
			$('ibeErvOffersPriceTd2').innerHTML = addSign( tPrice2 ) + ",00 &euro;";
			$('ibeErvOffersPriceTd3').innerHTML = "Inbegriffen";
			$('ibeErvOffersPriceTd4').innerHTML = '- ' + parseFloat ( ibeErvOffersTravelPrice3 ) + ",00 &euro;";
			if(!$('feeTable')) {
				$('ibePrice[ervOfferPrice]').innerHTML = parseFloat ( ibeErvOffersTravelPrice3 )+",00 &euro;";
			}
			else {
				$('ibePrice[ervOfferPrice]').innerHTML = parseFloat ( ibeErvOffersTravelPrice3 );
			}
			$('ibePrice[taxPrice]').innerHTML = parseFloat ( parseFloat ( serviceFee ) - parseFloat ( baseFee ) ).toFixed(2)+" &euro;";
/*			$('ibePrice[taxPrice]').innerHTML = parseFloat ( parseFloat ( taxPrice ) + parseFloat ( ibeErvOffersTravelPrice3 ) - parseFloat ( ibeErvOffersTravelPrice1 ) )+",00 &euro;"; */
		}
		if($('ervTeaser')) { $('ervTeaser').style.visibility = 'visible';};
	}

	/*if(currentIframeSize != iframeSize) {
		parent.resizeIframe('frmIbeErvOffers',iframeSize);
		currentIframeSize = iframeSize;
	}*/
	/*
  	self.resizeIframe ("ervIframe", getBodyHeight(320));
	*/
	return;
}

function ervBookingTypeFalseHandler () {
	$('ibePrice[ervOfferPrice]').innerHTML = "keine Versicherung ausgew&auml;hlt";
	//$('ibePrice[ervOfferPrice]').innerHTML = "0";

	travelPrice = parseFloat ( travelPrice );
	taxPrice = parseFloat(taxPrice);
	if ( travelPrice.toFixed )
		travelPrice = travelPrice.toFixed(2);
	if ( taxPrice.toFixed )
		taxPrice = taxPrice.toFixed(2);

	$('ibePrice[totalTravelPrice]').innerHTML = travelPrice.replace(/\./g, ",") + " &euro;";
	//$('ibePrice[taxPrice]').innerHTML = parseFloat ( taxPrice - parseFloat ( ibeErvOffersTravelPrice1 ) )+",00 &euro;";

	$('ibeErvOffersPriceTd1').innerHTML = "+ " + ibeErvOffersTravelPrice1 + ",00 &euro;";
	$('ibeErvOffersPriceTd2').innerHTML = "+ " + ibeErvOffersTravelPrice2 + ",00 &euro;";
	$('ibeErvOffersPriceTd3').innerHTML = "+ " + ibeErvOffersTravelPrice3 + ",00 &euro;";
	$('ibeErvOffersPriceTd4').innerHTML = "0,00 &euro;";

	$('ibePrice[taxPrice]').innerHTML = parseFloat ( serviceFee ).toFixed(2) + " &euro;";
	$('ibePrice[ervOffer]').innerHTML = parseFloat(0);

	
	//iframeSize = 165;
	$('ibeBookingInput[erv][offerId]').value = "";
	$('ibeBookingInput[erv][book]').value = "FALSE";

	switchDisplay('insuranceOffTeaser', true);
	if($('ervTeaser')) { $('ervTeaser').style.visibility = 'hidden';};
	/*if(currentIframeSize != iframeSize) {
		parent.resizeIframe('frmIbeErvOffers',iframeSize);
		currentIframeSize = iframeSize;
	}*/
}

function addSign( val ) {
	var retval = val;
	if( val > 0.00 || val > 0 ) {
		retval = '+ ' + val;
	} else if ( val < 0.00 || val < 0 ) {
		retval = '- ' + Math.abs( val );
	}
	return retval;
}

function setTTDate( calendar ) {
	var curDate = new Date();
	if( ( curDate.getTime() + 360*24*60*60*1000 ) > calendar.date.getTime() ) {
		if( calendar.params.inputField.id == 'depVal' ) {
			var dayEl = document.getElementById( 'depDay' );
			var monthEl = document.getElementById( 'depMonth' );
		} else {
			var dayEl = document.getElementById( 'retDay' );
			var monthEl = document.getElementById( 'retMonth' );
		}
		dayEl.selectedIndex = calendar.date.getDate() - 1;
		var selectedMonthYear = '';

		// RS: 09.07.2008, Bugfix: getMonth() => 0..11
		if( calendar.date.getMonth() < 9 ) {
			selectedMonthYear+='0'+eval( calendar.date.getMonth() + 1 );
		} else {
			selectedMonthYear += eval( calendar.date.getMonth() + 1 );
		}
		selectedMonthYear += '.'+calendar.date.getFullYear();
		for( var i = 0; i < monthEl.options.length; i++ ) {
			if( monthEl.options[i].value == selectedMonthYear ) {
				monthEl.options.selectedIndex = i;
				break;
			}
		}
		if( calendar.params.inputField.id == 'depVal' ) {
			IBE.SetDay( 'dep', 'Day', 'Month' );
			IBE.SetMonth( 'dep', 'Day', 'Month' );
		} else {
			IBE.SetDay( 'ret' );
			IBE.SetMonth( 'ret' );
		}
	}
	updateDateVal();
	if (calendar.dateClicked) {
		calendar.callCloseHandler();
	}
}

function closeCalendar() {
	calendar.hide();
}

function updateDateVal() {
	var depDayEl = document.getElementById( 'depDay' );
	var depMonthEl = document.getElementById( 'depMonth' );
	var depValEl = document.getElementById( 'depVal' );
	if( depDayEl != undefined && depMonthEl != undefined && depValEl != undefined) {
		var depMonthYear = depMonthEl.options[depMonthEl.options.selectedIndex].value.split( '.' );
		depValEl.value = depMonthYear[1]+'-'+depMonthYear[0]+'-'+depDayEl.options[depDayEl.options.selectedIndex].value;
	}
	var retDayEl = document.getElementById( 'retDay' );
	var retMonthEl = document.getElementById( 'retMonth' );
	var retValEl = document.getElementById( 'retVal' );
	if( retDayEl != undefined && retMonthEl != undefined && retValEl != undefined) {
		var retMonthYear = retMonthEl.options[retMonthEl.options.selectedIndex].value.split( '.' );
		retValEl.value = retMonthYear[1]+'-'+retMonthYear[0]+'-'+retDayEl.options[retDayEl.options.selectedIndex].value;
	}
}

function dateStatusHandler(date, y, m, d) {
	curDate = new Date();
/*	if( curDate.getTime() + 30*24*60*60*100 > date.getTime()  ) {
		return 'disabled';
	}*/
}

function switchFormDisplay ( type ) {
	switch ( type ) {
		case 'package' :
			//getElement ('ibeDepAirportEls').style.display = 'block';
			getElement ('ibeDepAirportIn').disabled = false;
			getElement ( 'ibeOptMeal' ).style.display = 'block';
			getElement ( 'ibeOptShotel' ).style.display = 'block';
			getElement( 'ibeOptHotelName' ).innerHTML = 'Hotelname';
			getElement ( 'ibeOptCategory' ).style.display = 'block';
			getElement ( 'ibeOptRoom' ).style.display = 'block';
			getElement ( 'ibeOptObjectType' ).style.display = 'none';
			getElement ( 'ibeOptObjectTypeSpacer' ).style.display = 'none';
			getElement ( 'ibeOptBedrooms' ).style.display = 'none';
			getElement ( 'ibeOptBedroomsSpacer' ).style.display = 'none';
			getElement( 'ibeOptHotelNameNotice' ).innerHTML = '&nbsp;Hotel&nbsp;';
			var sel = document.getElementsByName( 'ibeInput[adult]' )[0];
			while( sel.options.length > 4 ) {
				sel.options[sel.options.length-1] = null;
			}
			getElement ( 'ibeOptChild1' ).style.display = 'block';
			getElement ( 'ibeOptChild3' ).style.display = 'block';

			getElement( 'depLabel' ).innerHTML = 'Fr&uuml;hester Abflugtermin';
			getElement( 'retLabel' ).innerHTML = 'Sp&auml;tester R&uuml;ckflugtermin';

			getElement ('ibeInput[port]').value = '654';
			getElement ( 'divTT' ).style.display = 'block';
			getElement ( 'divScheduledFlight' ).style.display = 'none';
			getElement ( 'divHotel' ).style.display = 'none';

			//getElement ( 'ibeOptMeal' )[0].selected = true;

			getElement ( 'ibeOptMealSel' ).selectedIndex = 0;
			if ( IBE.port != 654 ) {
				IBE.port = 654;
				IBE.UpdateArea();
			}

			if ( getElement ( 'optFields' ) != null ) {
				getElement ( 'optFields' ).style.display = "block";
			}
			selectLabel( 'pauschalLabel' );
			if( $('ibeInput[offerType]') ) $('ibeInput[offerType]').value = 'packagetour';
			termin_hin = defaultDateDep.split("-")[2]+'.'+defaultDateDep.split("-")[1]+'.'+defaultDateDep.split("-")[0];
			termin_rueck = defaultDateRet.split("-")[2]+'.'+defaultDateRet.split("-")[1]+'.'+defaultDateRet.split("-")[0];

			IBE.InitDays(1);
            IBE.InitMonth(1);
            IBE.InitDays(0);
            IBE.InitMonth(0);

			IBE.SetDatum(termin_hin, 1, 0, 'bengine');
			IBE.SetDatum(termin_rueck, 0, 0, 'bengine');

			if( IBE.FillDuration ) IBE.FillDuration( '654' );
			break;
		case 'earlybookers' :
			//getElement ('ibeDepAirportEls').style.display = 'block';
			getElement ('ibeDepAirportIn').disabled = false;
			getElement ( 'ibeOptMeal' ).style.display = 'block';
			getElement ( 'ibeOptShotel' ).style.display = 'block';
			getElement( 'ibeOptHotelName' ).innerHTML = 'Hotelname';
			getElement ( 'ibeOptCategory' ).style.display = 'block';
			getElement ( 'ibeOptRoom' ).style.display = 'block';
			getElement ( 'ibeOptObjectType' ).style.display = 'none';
			getElement ( 'ibeOptObjectTypeSpacer' ).style.display = 'none';
			getElement ( 'ibeOptBedrooms' ).style.display = 'none';
			getElement ( 'ibeOptBedroomsSpacer' ).style.display = 'none';
			getElement( 'ibeOptHotelNameNotice' ).innerHTML = '&nbsp;Hotel&nbsp;';
			var sel = document.getElementsByName( 'ibeInput[adult]' )[0];
			while( sel.options.length > 4 ) {
				sel.options[sel.options.length-1] = null;
			}
			getElement ( 'ibeOptChild1' ).style.display = 'block';
			getElement ( 'ibeOptChild3' ).style.display = 'block';

			getElement( 'depLabel' ).innerHTML = 'Fr&uuml;hester Abflugtermin';
			getElement( 'retLabel' ).innerHTML = 'Sp&auml;tester R&uuml;ckflugtermin';

			getElement ('ibeInput[port]').value = '654';
			getElement ( 'divTT' ).style.display = 'block';
			getElement ( 'divScheduledFlight' ).style.display = 'none';
			getElement ( 'divHotel' ).style.display = 'none';

			//getElement ( 'ibeOptMeal' )[0].selected = true;

			getElement ( 'ibeOptMealSel' ).selectedIndex = 0;
			if ( IBE.port != 654 ) {
				IBE.port = 654;
				IBE.UpdateArea();
			}

			if ( getElement ( 'optFields' ) != null ) {
				getElement ( 'optFields' ).style.display = "block";
			}
			selectLabel( 'earlybookersLabel' );
			if( $('ibeInput[offerType]') ) $('ibeInput[offerType]').value = 'packagetour';
			termin_hin = earlybookersDateDep.split("-")[2]+'.'+earlybookersDateDep.split("-")[1]+'.'+earlybookersDateDep.split("-")[0];
			termin_rueck = earlybookersDateRet.split("-")[2]+'.'+earlybookersDateRet.split("-")[1]+'.'+earlybookersDateRet.split("-")[0];

			IBE.InitDays(1);
            IBE.InitMonth(1);
            IBE.InitDays(0);
            IBE.InitMonth(0);

			IBE.SetDatum(termin_hin, 1, 0, 'bengine');
			IBE.SetDatum(termin_rueck, 0, 0, 'bengine');

			if( IBE.FillDuration ) IBE.FillDuration( '654' );
			break;

		case 'hotel' :
			getElement ( 'divTT' ).style.display = 'none';
			getElement ( 'divScheduledFlight' ).style.display = 'none';
			if (getElement('divHotel')) getElement ( 'divHotel' ).style.display = 'block';
			selectLabel( 'hotelLabel' );
			break;

		case 'ownarrival' :

			//getElement ('ibeDepAirportEls').style.display = 'none';
			getElement ('ibeDepAirportIn').disabled = true;
			getElement ( 'ibeOptMeal' ).style.display = 'block';
			getElement ( 'ibeOptShotel' ).style.display = 'block';
			getElement ( 'ibeOptCategory' ).style.display = 'block';
			getElement ( 'ibeOptRoom' ).style.display = 'block';

			getElement ( 'ibeOptChild1' ).style.display = 'block';
			getElement ( 'ibeOptChild3' ).style.display = 'block';
			getElement( 'ibeOptHotelName' ).innerHTML = 'Hotelname';

			getElement( 'depLabel' ).innerHTML = 'Fr&uuml;hester Anreisetermin';
			getElement( 'retLabel' ).innerHTML = 'Sp&auml;tester Abreisetermin';
			getElement ('ibeInput[port]').value = '653';
			getElement ( 'divTT' ).style.display = 'block';
			getElement ( 'divHotel' ).style.display = 'none';
			getElement ( 'divScheduledFlight' ).style.display = 'none';
			getElement ( 'ibeOptObjectType' ).style.display = 'none';
			getElement ( 'ibeOptObjectTypeSpacer').style.display = 'none';
			getElement ( 'ibeOptBedrooms' ).style.display = 'none';
			getElement ( 'ibeOptBedroomsSpacer' ).style.display = 'none';
			//getElement ( 'ibeOptMeal' )[0].selected = true;

			getElement ( 'ibeOptMealSel' ).selectedIndex = 0;
			if ( IBE.port != 653 ) {
				IBE.port = 653;
				IBE.UpdateArea();
			}
			if ( getElement ( 'optFields' ) != null ) {
				getElement ( 'optFields' ).style.display = "block";
			}
			selectLabel( 'ownarrivalLabel' );
			if( IBE.FillDuration ) IBE.FillDuration( '653' );
			break;

		case 'scheduledFlight' :
			getElement ( 'divTT' ).style.display = 'none';
			getElement ( 'divHotel' ).style.display = 'none';
			getElement ( 'divScheduledFlight' ).style.display = 'block';
			selectLabel( 'scheduledFlightLabel' );
			break;

		case 'lastminute' :
			//getElement ('ibeDepAirportEls').style.display = 'block';
			getElement ('ibeDepAirportIn').disabled = false;
			getElement ( 'ibeOptMeal' ).style.display = 'block';
			getElement ( 'ibeOptShotel' ).style.display = 'block';
			getElement( 'ibeOptHotelName' ).innerHTML = 'Hotelname';
			getElement ( 'ibeOptCategory' ).style.display = 'block';
			getElement ( 'ibeOptRoom' ).style.display = 'block';
			getElement ( 'ibeOptObjectType' ).style.display = 'none';
			getElement ( 'ibeOptObjectTypeSpacer' ).style.display = 'none';
			getElement ( 'ibeOptBedrooms' ).style.display = 'none';
			getElement ( 'ibeOptBedroomsSpacer' ).style.display = 'none';
			getElement( 'ibeOptHotelNameNotice' ).innerHTML = '&nbsp;Hotel&nbsp;';
			var sel = document.getElementsByName( 'ibeInput[adult]' )[0];
			while( sel.options.length > 4 ) {
				sel.options[sel.options.length-1] = null;
			}
			getElement ( 'ibeOptChild1' ).style.display = 'block';
			getElement ( 'ibeOptChild3' ).style.display = 'block';
			getElement( 'depLabel' ).innerHTML = 'Fr&uuml;hester Abflugtermin';
			getElement( 'retLabel' ).innerHTML = 'Sp&auml;tester R&uuml;ckflugtermin';
			getElement ('ibeInput[port]').value = '654';
			getElement ( 'divTT' ).style.display = 'block';
			getElement ( 'divScheduledFlight' ).style.display = 'none';
			getElement ( 'divHotel' ).style.display = 'none';
			//getElement ( 'ibeOptMeal' )[0].selected = true;

			getElement ( 'ibeOptMealSel' ).selectedIndex = 0;
			if ( IBE.port != 654 ) {
				IBE.port = 654;
				IBE.UpdateArea();
			}

			if ( getElement ( 'optFields' ) != null ) {
				getElement ( 'optFields' ).style.display = "block";
			}
			selectLabel( 'lastminuteLabel' );
			if( $('ibeInput[offerType]') ) $('ibeInput[offerType]').value = 'lastminute';
			termin_hin = lastminuteDateDep.split("-")[2]+'.'+lastminuteDateDep.split("-")[1]+'.'+lastminuteDateDep.split("-")[0];
			termin_rueck = lastminuteDateRet.split("-")[2]+'.'+lastminuteDateRet.split("-")[1]+'.'+lastminuteDateRet.split("-")[0];
			IBE.InitDays(1);
            IBE.InitMonth(1);
            IBE.InitDays(0);
            IBE.InitMonth(0);
			IBE.SetDatum(termin_hin, 1, 0, 'bengine');
			IBE.SetDatum(termin_rueck, 0, 0, 'bengine');
			if( IBE.FillDuration ) IBE.FillDuration( '654' );
			break;
		case 'allinclusive' :
			//getElement ('ibeDepAirportEls').style.display = 'block';
			getElement ('ibeDepAirportIn').disabled = false;
			getElement ( 'ibeOptMeal' ).style.display = 'none';
			getElement ( 'ibeOptShotel' ).style.display = 'block';
			getElement( 'ibeOptHotelName' ).innerHTML = 'Hotelname';
			getElement ( 'ibeOptCategory' ).style.display = 'block';
			getElement ( 'ibeOptRoom' ).style.display = 'block';
			getElement ( 'ibeOptObjectType' ).style.display = 'none';
			getElement ( 'ibeOptObjectTypeSpacer' ).style.display = 'none';
			getElement ( 'ibeOptBedrooms' ).style.display = 'none';
			getElement ( 'ibeOptBedroomsSpacer' ).style.display = 'none';
			getElement( 'ibeOptHotelNameNotice' ).innerHTML = '&nbsp;Hotel&nbsp;';
			var sel = document.getElementsByName( 'ibeInput[adult]' )[0];
			while( sel.options.length > 4 ) {
				sel.options[sel.options.length-1] = null;
			}
			getElement ( 'ibeOptChild1' ).style.display = 'block';
			getElement ( 'ibeOptChild3' ).style.display = 'block';
			getElement( 'depLabel' ).innerHTML = 'Fr&uuml;hester Abflugtermin';
			getElement( 'retLabel' ).innerHTML = 'Sp&auml;tester R&uuml;ckflugtermin';
			getElement ('ibeInput[port]').value = '654';
			getElement ( 'divTT' ).style.display = 'block';
			getElement ( 'divScheduledFlight' ).style.display = 'none';
			getElement ( 'divHotel' ).style.display = 'none';

			//getElement ( 'ibeOptMealSel' ).options[5].selected = true;
			getElement ( 'ibeOptMealSel' ).selectedIndex = 5;
			if ( IBE.port != 654 ) {
				IBE.port = 654;
				IBE.UpdateArea();
			}

			if ( getElement ( 'optFields' ) != null ) {
				getElement ( 'optFields' ).style.display = "block";
			}
			selectLabel( 'allinclusiveLabel' );
			if( $('ibeInput[offerType]') ) $('ibeInput[offerType]').value = 'allinclusive';
			termin_hin = defaultDateDep.split("-")[2]+'.'+defaultDateDep.split("-")[1]+'.'+defaultDateDep.split("-")[0];
			termin_rueck = defaultDateRet.split("-")[2]+'.'+defaultDateRet.split("-")[1]+'.'+defaultDateRet.split("-")[0];

			IBE.InitDays(1);
            IBE.InitMonth(1);
            IBE.InitDays(0);
            IBE.InitMonth(0);

			IBE.SetDatum(termin_hin, 1, 0, 'bengine');
			IBE.SetDatum(termin_rueck, 0, 0, 'bengine');

			if( IBE.FillDuration ) IBE.FillDuration( '654' );
			break;
		case 'vacationhome' :
			//getElement ('ibeDepAirportEls').style.display = 'none';
			getElement ('ibeDepAirportIn').disabled = true;
			getElement ( 'ibeOptMeal' ).style.display = 'none';
			var sel = document.getElementsByName( 'ibeInput[adult]' )[0];
			for( var i = 5; i < 9; i++ ) {
				newoption = new Option( i, i );
				sel.options[sel.length] = newoption;
			}
			getElement ( 'ibeOptChild1' ).style.display = 'none';
			getElement ( 'ibeOptChild3' ).style.display = 'none';
			getElement( 'depLabel' ).innerHTML = 'Fr&uuml;hester Anreisetermin';
			getElement( 'retLabel' ).innerHTML = 'Sp&auml;tester Abreisetermin';
			getElement ( 'ibeOptShotel' ).style.display = 'block';
			getElement( 'ibeOptHotelName' ).innerHTML = 'Objektname';
			getElement( 'ibeOptHotelNameNotice' ).innerHTML = '&nbsp;Objekt&nbsp;';
			getElement ( 'ibeOptCategory' ).style.display = 'none';
			getElement ( 'ibeOptRoom' ).style.display = 'none';
			getElement ( 'ibeOptObjectType' ).style.display = 'block';
			getElement ( 'ibeOptObjectTypeSpacer' ).style.display = 'block';
			getElement ( 'ibeOptBedrooms' ).style.display = 'block';
			getElement ( 'ibeOptBedroomsSpacer' ).style.display = 'block';
			getElement ('ibeInput[port]').value = '655';
			getElement ( 'divTT' ).style.display = 'block';
			getElement ( 'divScheduledFlight' ).style.display = 'none';
			getElement ( 'divHotel' ).style.display = 'none';

			//getElement ( 'ibeOptMeal' )[0].selected = true;

			getElement ( 'ibeOptMealSel' ).selectedIndex = 0;

			if ( IBE.port != 655 ) {
				IBE.port = 655;
				IBE.UpdateArea();
			}

			if ( getElement ( 'optFields' ) != null ) {
				getElement ( 'optFields' ).style.display = "none";
			}
			selectLabel( 'vacationhomeLabel' );
			if( $('ibeInput[offerType]') ) $('ibeInput[offerType]').value = 'vacationhome';

			termin_hin = lastminuteDateDep.split("-")[2]+'.'+lastminuteDateDep.split("-")[1]+'.'+lastminuteDateDep.split("-")[0];
			termin_rueck = lastminuteDateRet.split("-")[2]+'.'+lastminuteDateRet.split("-")[1]+'.'+lastminuteDateRet.split("-")[0];

			IBE.InitDays(1);
            IBE.InitMonth(1);
            IBE.InitDays(0);
            IBE.InitMonth(0);
			IBE.SetDatum(termin_hin, 1, 0, 'bengine');
			IBE.SetDatum(termin_rueck, 0, 0, 'bengine');

			if( IBE.FillDuration ) IBE.FillDuration( '655' );
			break;

		case 'charterflight' :

			//getElement ('ibeDepAirportEls').style.display = 'block';
			getElement ('ibeDepAirportIn').disabled = false;
			getElement ( 'ibeOptMeal' ).style.display = 'none';
			getElement ( 'ibeOptShotel' ).style.display = 'none';
			getElement ( 'ibeOptCategory' ).style.display = 'none';
			getElement ( 'ibeOptRoom' ).style.display = 'none';
			getElement ( 'ibeOptObjectType' ).style.display = 'none';
			getElement ( 'ibeOptObjectTypeSpacer' ).style.display = 'none';
			getElement ( 'ibeOptBedrooms' ).style.display = 'none';
			getElement ( 'ibeOptBedroomsSpacer' ).style.display = 'none';
			var sel = document.getElementsByName( 'ibeInput[adult]' )[0];
			while( sel.options.length > 4 ) {
				sel.options[sel.options.length-1] = null;
			}
			getElement ( 'ibeOptChild1' ).style.display = 'block';
			getElement ( 'ibeOptChild3' ).style.display = 'block';

			getElement( 'depLabel' ).innerHTML = 'Fr&uuml;hester Abflugtermin';
			getElement( 'retLabel' ).innerHTML = 'Sp&auml;tester R&uuml;ckflugtermin';

			getElement ('ibeInput[port]').value = '652';
			getElement ( 'divTT' ).style.display = 'block';
			getElement ( 'divScheduledFlight' ).style.display = 'none';
			getElement ( 'divHotel' ).style.display = 'none';

			//getElement ( 'ibeOptMeal' )[0].selected = true;

			getElement ( 'ibeOptMealSel' ).selectedIndex = 0;

			if ( IBE.port != 652 ) {
				IBE.port = 652;
				IBE.UpdateArea();
			}

			if ( getElement ( 'optFields' ) != null ) {
				getElement ( 'optFields' ).style.display = "none";
			}
			selectLabel( 'charterflightLabel' );
			if( $('ibeInput[offerType]') ) $('ibeInput[offerType]').value = 'charter';


			termin_hin = defaultDateDep.split("-")[2]+'.'+defaultDateDep.split("-")[1]+'.'+defaultDateDep.split("-")[0];
			termin_rueck = defaultDateRet.split("-")[2]+'.'+defaultDateRet.split("-")[1]+'.'+defaultDateRet.split("-")[0];

			IBE.InitDays(1);
            IBE.InitMonth(1);
            IBE.InitDays(0);
            IBE.InitMonth(0);

			IBE.SetDatum(termin_hin, 1, 0, 'bengine');
			IBE.SetDatum(termin_rueck, 0, 0, 'bengine');

			if( IBE.FillDuration ) IBE.FillDuration( '652' );
			break;
	}
}

function selectLabel( label ) {
	if( getElement( 'pauschalLabel' ) ) getElement( 'pauschalLabel' ).className = 'notchecked';
	if( getElement( 'allinclusiveLabel' ) ) getElement( 'allinclusiveLabel' ).className = 'notchecked';
	if( getElement( 'lastminuteLabel' ) ) getElement( 'lastminuteLabel' ).className = 'notchecked';
	if( getElement( 'ownarrivalLabel' ) ) getElement( 'ownarrivalLabel' ).className = 'notchecked';
	if( getElement( 'earlybookersLabel' ) ) getElement( 'earlybookersLabel' ).className = 'notchecked';
	if( getElement( 'hotelLabel' ) ) getElement( 'hotelLabel' ).className = 'notchecked';
	if( getElement( 'scheduledFlightLabel' ) ) getElement( 'scheduledFlightLabel' ).className = 'notchecked';
	if( getElement( 'charterflightLabel' ) ) getElement( 'charterflightLabel' ).className = 'notchecked';
	if( getElement( 'vacationhomeLabel' ) ) getElement( 'vacationhomeLabel' ).className = 'notchecked';
	if( getElement( label ) ) getElement( label ).className = 'checked';

}


function sfHover(){
	var sfEls = document.getElementById("nav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++){
  		sfEls[i].onmouseover=function(){
  			this.className+=" over";
  			zeigVersteckIframe(this.id,'visible');
  		};
  		sfEls[i].onmouseout=function(){
  			this.className=this.className.replace(new RegExp(" over\\b"), " out");
  			zeigVersteckIframe(this.id,'hidden');
  		};
	}
}

function zeigVersteckIframe(elId,v){
	var ifr = $('killSelect2');
	if($('dropdwn_'+elId)){
		el=$('dropdwn_'+elId);
		if(v=='visible'){
			ifr.setStyle({'top': ((Element.viewportOffset(el)[1]))+'px', 'left': ((Element.viewportOffset(el)[0])-10)+'px', 'height': (el.getHeight()-1)+'px', 'width': (el.getWidth()+20)+'px'});
		}
	}
	else{
		v='hidden';
	}
	ifr.style.visibility=v;
}

