function set_flights_marked()
{
	// alert(selected_out);
	// alert(selected_return);
	if (selected_out > 0) {
		//
		// selected_out = selected_out-1;
		var idx = selected_out-1;
		var obj = document.getElementById('liste_hin_'+idx);
		// do_onmousedown(obj, idx);
		this.markEntry(obj, idx, marker_colors['selected'], marker_classes['selected']);
		hin.selected_obj = obj;
		hin.selected  = idx;
		// this.selected = idx;
		// this.selected_obj = obj;
		// rueck.do_onmousedown(obj, idx);
		//  FIXME: bad
		document.form1.selected_out.value=idx;
	}

	if (selected_return > 0) {
		//
		// selected_return = selected_return-1;
		var idx = selected_return-1;
		var obj = document.getElementById('liste_rueck_'+idx);
		this.markEntry(obj, idx, marker_colors['selected'], marker_classes['selected']);
		// do_onmousedown(obj, idx);
		// this.markEntry(obj, idx, marker_colors['selected'], marker_classes['selected']);
		rueck.selected_obj = obj;
		rueck.selected  = idx;

		// rueck.do_onmousedown(obj, idx);
		//  FIXME: bad
		document.form1.selected_return.value=idx;
	}
}


function handle_flightselection(tr_travel_days, tr_days, tr_price, tr_attention, tr_min_days) {

	var text_from 	= from_day[hin.selected] + '<br />' + from_time[hin.selected] + '<br />' + from_airline[hin.selected];
	var text_to 	= to_day[rueck.selected] + '<br />' + to_time[rueck.selected] + '<br />' + to_airline[rueck.selected];
	
	//alert(hin.selected);
	//alert(rueck.selected);

	if ( diffdays_out[hin.selected]>=0 && diffdays_return[rueck.selected]>=0  ) {
		var diffdays=diffdays_return[rueck.selected]-diffdays_out[hin.selected];
		
		if (diffdays>6) {
			var price = parseInt(travel_price[hin.selected]) + parseInt(return_travel_price[rueck.selected]);

			setElememtHTML(text_from, 'msgFrom');
			setElememtHTML(text_to, 'msgTo');
			setElememtHTML(diffdays + ' Tage', 'msgDuration');
			setElememtHTML('pro Erw.: <strong>EUR ' + price + ',-</strong>', 'msgPrice');
			setElememtHTML('', 'msgContainer')

			MM_changeProp('msgFrom','','style.display','block','SPAN');
			MM_changeProp('msgTo','','style.display','block','SPAN');
			MM_changeProp('msgDuration','','style.display','block','SPAN');
			MM_changeProp('msgPrice','','style.display','block','SPAN');

			MM_changeProp('msgContainer','','style.display','none','SPAN');

			MM_changeProp('buttonsEnabled','','style.display','block','DIV');
			MM_changeProp('buttonsDisabled','','style.display','none','DIV');

		}else{
			
			setElememtHTML(text_from, 'msgFrom');
			setElememtHTML(text_to, 'msgTo');
			setElememtHTML('', 'msgDuration');
			setElememtHTML('', 'msgPrice');
			setElememtHTML(tr_attention + ' ' + tr_min_days, 'msgContainer')

			MM_changeProp('msgFrom','','style.display','block','SPAN');
			MM_changeProp('msgTo','','style.display','block','SPAN');
			MM_changeProp('msgDuration','','style.display','none','SPAN');
			MM_changeProp('msgPrice','','style.display','none','SPAN');

			MM_changeProp('msgContainer','','style.display','block','SPAN');

			MM_changeProp('buttonsEnabled','','style.display','none','DIV');
			MM_changeProp('buttonsDisabled','','style.display','block','DIV');

		}
	} else {
			
			if(diffdays_out[hin.selected]>=0)
				setElememtHTML(text_from, 'msgFrom');
			else
				setElememtHTML('', 'msgFrom');

			if(diffdays_return[rueck.selected]>=0)
				setElememtHTML(text_to, 'msgTo');
			else
				setElememtHTML('', 'msgTo');
			
			setElememtHTML('', 'msgDuration');
			setElememtHTML('', 'msgPrice');
			setElememtHTML('Ihr Flug: Bitte wählen Sie eine Kombination aus Hin- und Rückflug aus.', 'msgContainer')

			MM_changeProp('msgFrom','','style.display','block','SPAN');
			MM_changeProp('msgTo','','style.display','block','SPAN');
			MM_changeProp('msgDuration','','style.display','none','SPAN');
			MM_changeProp('msgPrice','','style.display','none','SPAN');

			MM_changeProp('msgContainer','','style.display','block','SPAN');

			MM_changeProp('buttonsEnabled','','style.display','none','DIV');
			MM_changeProp('buttonsDisabled','','style.display','block','DIV');

	}

}

function reset_list(which) {

	if (which=='rueck') {
		if(rueck.selected>=0) {
			this.resetEntry(rueck.selected_obj, rueck.selected);
			rueck.selected=-1;
			rueck.selected_obj=null;
		}
	}
	if (which=='oben') {
		if(hin.selected>=0) {
			this.resetEntry(hin.selected_obj, hin.selected);
			hin.selected=-1;
		}
		if(rueck.selected>=0) {
			this.resetEntry(rueck.selected_obj, rueck.selected);
			rueck.selected=-1;
			rueck.selected_obj=null;
		}
		document.getElementById("reise_info").innerHTML  = '<table width="100%" border="0"><tr><td class="listHeadBg"><span class="listPreis">&nbsp;</span></td></tr></table>';
	}
	if (which=='auswahl') {
		// alert(auswahl.selected);
		if(auswahl.selected>=0 && auswahl.selected_obj ) {

			this.resetEntry(auswahl.selected_obj, auswahl.selected);
			var tmp_idx = auswahl.selected_obj.id.substring(12,14);
			var id = 'auswahl_oben'+tmp_idx;
			var tmp_obj = document.getElementById(id);
			this.resetEntry(tmp_obj, tmp_idx);
			id = 'auswahl_unten'+tmp_idx;
			tmp_obj = document.getElementById(id);
			this.resetEntry(tmp_obj, tmp_idx);

			auswahl.selected=-1;
			auswahl.selected_obj=null;
		}
	}
}

function do_onmouseover(obj, idx)
{

	this.markEntry(obj, idx, marker_colors['mouseover'], marker_classes['mouseover']);
	if( obj.id.substring(0,7) == 'auswahl' ){
		var id = 'auswahl_oben'+idx;
		var tmp_obj = document.getElementById(id);
		this.markEntry(tmp_obj, idx, marker_colors['mouseover_cart'], marker_classes['mouseover_cart']);
		id = 'auswahl_unten'+idx;
		tmp_obj = document.getElementById(id);
		this.markEntry(tmp_obj, idx, marker_colors['mouseover_cart'], marker_classes['mouseover_cart']);
	}
	return true;
}

function do_onmouseout(obj, idx)
{
	this.resetEntry(obj, idx);
	if( obj.id.substring(0,7) == 'auswahl' ){
		var id = 'auswahl_oben'+idx;
		var tmp_obj = document.getElementById(id);
		this.resetEntry(tmp_obj, idx);
		id = 'auswahl_unten'+idx;
		tmp_obj = document.getElementById(id);
		this.resetEntry(tmp_obj, idx);
	}

	/*
	this.resetEntry(obj, idx, '#ff0000');
	this.simplePointer(obj, idx, '#00ff00');
	*/
	return true;
}


function do_onmousedown(obj, idx)
{
	//alert('hin_radio_'+idx);
	if (this.selected != -1) {
		var selected = this.selected;
		this.selected = -1;
		// alert(this.selected_obj);

		if( obj.id.substring(0,7) == 'auswahl' ){
			// alert(this.selected_obj.id.substring(12,14));
			var tmp_idx = this.selected_obj.id.substring(12,14);
			var id = 'auswahl_oben'+tmp_idx;
			var tmp_obj = document.getElementById(id);
			this.resetEntry(tmp_obj, tmp_idx);
			id = 'auswahl_unten'+tmp_idx;
			tmp_obj = document.getElementById(id);
			this.resetEntry(tmp_obj, tmp_idx);
		}
		this.resetEntry(this.selected_obj, selected);
	}


	//
	this.markEntry(obj, idx, marker_colors['selected'], marker_classes['selected']);
	if( obj.id.substring(0,7) == 'auswahl' ){
		var id = 'auswahl_oben'+idx;
		var tmp_obj = document.getElementById(id);
		this.markEntry(tmp_obj, idx, marker_colors['selected_cart'], marker_classes['selected_cart']);
		id = 'auswahl_unten'+idx;
		tmp_obj = document.getElementById(id);
		this.markEntry(tmp_obj, idx, marker_colors['selected_cart'], marker_classes['selected_cart']);
	}

	//
	this.selected = idx;
	this.selected_obj = obj;
	return true;
}


/* $Id: _kp_functions.js,v 1.12 2003/12/10 11:44:28 cvs Exp $ */


function marker(pre_selected)
{
	this.do_onmouseover = do_onmouseover;
	this.do_onmouseout  = do_onmouseout;
	this.do_onmousedown = do_onmousedown;
	this.markEntry = markEntry;
	this.resetEntry = resetEntry;
	// this.last_marked = -1;
	this.pre_selected = pre_selected;
	this.selected = -1;
	this.selected_obj = null;
}





function markEntry(obj, idx, attr_color, attr_class)
{
	setEntryAttributes(obj, idx, attr_color, attr_class);
}

function resetEntry(obj, idx)
{

	if(!obj)
		return;

	var attr_color;
	var attr_class;

	if (idx == this.selected) {
		attr_color = marker_colors['selected'];
		attr_class = marker_classes['selected'];
		if(obj.id.substring(0,7) == 'auswahl') {
			attr_color = marker_colors['selected_cart'];
			attr_class = marker_classes['selected_cart'];
		}
	} else if (idx == this.pre_selected) {
		attr_color = marker_colors['preselected'];
		attr_class = marker_classes['preselected'];
	} else {
		attr_color = marker_colors['unselected'];
		attr_class = marker_classes['unselected'];

		if(obj.id.substring(0,7) == 'auswahl') {
			attr_color = marker_colors['unselected_cart'];
			attr_class = marker_classes['unselected_cart'];
		}
	}

	setEntryAttributes(obj, idx, attr_color, attr_class);
}

function get_vacancy(step)
{
	document.form1.step.value = step;
	if(popupWin && !popupWin.closed){popupWin.close();}
	document.form1.submit();
}


function setEntryAttributes(theRow, theRowNum, theColor, theClass)
{
	//MM_changeProp('"+targetElement+"Img','','className','pmatrixDivDisabled','DIV');
	//alert(theRow.id+theRowNum+theColor+theClass);
	MM_changeProp(theRow.id,'','className',theClass,'DIV');

	return true;
} // end of the 'setPointer()' function


