var Excursion = {	activeId	: null,		getVacation		: function(id, displaySummary)	{		jQuery('div#excursion_vacation_wrapper').css({display: 'block'});		jQuery('div#excursion_vacation_wrapper div#excursion_vacation_overview').html('<img src="/img/ajax_loader_big_round.gif" />');		jQuery.post('/ajax_server.php?action=excursion',	  	{ 	  		ond: 'get_excursion_list_by_vacid',		  	id: id,		  	displaySummary : displaySummary		},	  	function(data){	  		if (data) {           	  			var objectData = eval('(' + data + ')');	  			jQuery('td#excursion_vacation_name_value').html("Uw keuze: " + objectData.title);	  			jQuery('div#excursion_vacation_wrapper div#excursion_vacation_overview').html(objectData.data);	  			location.hash = '#' + id;	  			return false;	  		};	  	});	},			saveTemp		: function(obj, comparedId)	{	 	jQuery.post('/ajax_server.php?action=excursion',	  	{ 	  		ond: 'check_excursion_tmp',	  		checked: obj.checked,	  		vacationId: location.hash.replace(/^\#(\d+)$/, '$1'),		  	id: comparedId		},	  	function(data){	  		if (data) {	  			var objectData = eval('(' + data + ')');	  			if (objectData.ok == false) {					obj.checked = false;  					jQuery(obj.parentNode.nextSibling.firstChild).before('<div class="excursion_choice_warning">Het niet mogelijk twee excursies in (deels)hetzelfde tijdsbestek te volgen</div>');					jQuery('div.excursion_choice_warning').blink(100); 					setTimeout(function() {						jQuery('div.excursion_choice_warning').remove();					}, 2000);				}	  			return false;	  		};	  	});	},		getAlternativeOptions	: function(obj, comparedId)	{		// hide all the windows first		jQuery('div.excursion_choice_warning').remove();		jQuery(document).bind('click', function(event) {			event = event || window.event; // IE sucks			if (!(event.target.nodeName.match(/^input|a|button$/i))) {				try {					jQuery('div.excursion_choice_warning').remove();				} catch (error) {				}			}			});		jQuery(obj.parentNode.nextSibling.firstChild).before('<div class="excursion_choice_warning"><img src="/img/ajax-loader.gif" /></div>');		this.activeId = comparedId;			 	jQuery.post('/ajax_server.php?action=excursion',	  	{ 	  		ond: 'get_alternative',	  		checked: obj.checked,		  	id: comparedId		}, function(data){	  		if (data) {				jQuery('div.excursion_choice_warning').html(data);	  			return false;	  		};	  	});	},		getAlternativeOptionsByDate	: function(obj, dateId)	{		// hide all the windows first		jQuery('div.excursion_choice_warning').remove();		jQuery(document).bind('click', function(event) {			event = event || window.event; // IE sucks			if (!(event.target.nodeName.match(/^input|a|button$/i))) {				try {					jQuery('div.excursion_choice_warning').remove();				} catch (error) {				}			}			});		this.activeId = -1;		jQuery(obj).before('<div class="excursion_choice_warning"><img src="/img/ajax-loader.gif" /></div>');	 	jQuery.post('/ajax_server.php?action=excursion',	  	{ 	  		ond: 'get_alternative_by_date',	  		dateId: dateId		}, function(data){	  		if (data) {				jQuery('div.excursion_choice_warning').html(data);	  			return false;	  		};	  	});	},		setAlternativeOptions	: function(name, title, price, oldPrice, time, oldTime)	{		if (oldTime != time)			alert('Let op: u heeft een excursie uitgekozen met een afwijkende tijd');       		// hide the window		jQuery('div.excursion_choice_warning').remove();		if (this.activeId != -1) {			// set the checkbox values			jQuery('input.option_' +  this.activeId).attr({'id':name, 'class': 'option_'+name, 'value':name}).bind('click', function() {			  	Excursion.getAlternativeOptions(this, name); 				return false;			});			// set the text			jQuery('a.option_text_' +  this.activeId).attr({'href': '/excursies/stap?action=getInformation&keepThis=true&height=525&width=800&id=' + name.replace(/^\d+_(\d+)$/, '$1')});			jQuery('a.option_text_' +  this.activeId).text(title).bind('click', function() {			  	tb_show(title, this.href, 'not_hideable_by_outbox'); 				return false;			});			// set the price			jQuery('td.option_price_' +  this.activeId).text(price);			// calculate the total price			var currentTotalPrice = parseFloat(jQuery('span#total_amount_id').text());			currentTotalPrice -= parseFloat(oldPrice);			currentTotalPrice += parseFloat(price.replace(/[^0-9]+/,''));			jQuery('span#total_amount_id').text(currentTotalPrice.toFixed(2));			// set the time			jQuery('td.option_time_' +  this.activeId).text(time);			// change all the class names			jQuery('a.option_text_' +  this.activeId).attr({"class":'option_text_' +  name});			jQuery('td.option_time_' +  this.activeId).attr({"class":'option_time_' +  name});			jQuery('td.option_price_' +  this.activeId).attr({"class":'option_price_' +  name});						// hide the price summary text			jQuery('tr.extra_info_costst_excursion').hide();		}			},		print					: function()	{		var aElement = document.createElement('a');	  		aElement.className = 'thickbox';	  		aElement.href = '/excursies/stap?action=print&keepThis=true&TB_iframe=true&height=500&width=650';		tb_show("Uitprinten", aElement.href, 'not_hideable_by_outbox'); 		return false;	},			delInHouseTraveler		: function(travelerId, obj)	{		var p = obj.parentNode;		jQuery(obj.parentNode).html('<img src="/img/ajax-loader.gif" />');		jQuery.post('/ajax_server.php?action=excursion',	  	{ 	  		ond: 'delete_together_in_house_rel',		  	travelerId: travelerId		}, function(data){	  		if (data) {				if (data == 'ok') {					jQuery(p).remove();					} else {				 	jQuery(p).html('Er is een fout opgetreden bij het verwijderen van deze relatie.');				}	  			return false;	  		};	  	});		return false;	},		setAltExcurions		: function(name, tableWrapperId)	{		var selectedIds = [];		var unselectedIds = [];		jQuery(tableWrapperId + ' input[@type=checkbox][@checked]').each(function() {		   	selectedIds.push(this.id);			});		jQuery(tableWrapperId + ' input[@type=checkbox]').each(function() {			if (!this.checked)		   		unselectedIds.push(this.id);			});		if (selectedIds.length < 1) {			jQuery('div#excursion_choices_warning').blink(); 			return false;		}		if (selectedIds.length > 0 || unselectedIds.length > 0) {			// save     			jQuery.post('/ajax_server.php?action=excursion',		  	{ 		  		ond: 'saveRelExcursionTravelerStore',			  	selectedIds: selectedIds.join('~'),			  	unSelectedIds : unselectedIds.join('~')			}, function(data){		  		if (data) {							// close screen					jQuery('div.excursion_choice_warning').remove();					// lets selected excursion appears					if (selectedIds.length > 0) {						jQuery(selectedIds).each(function(it, el) {							jQuery('tr#tr_excursion_option_' + el).show();							jQuery('tr#tr_excursion_option_' + el + ' input[@type=checkbox]').attr('checked', true);						});					}					// hide some					if (unselectedIds.length > 0) {						jQuery(unselectedIds).each(function(it, el) {							jQuery('tr#tr_excursion_option_' + el).hide(); 							jQuery('tr#tr_excursion_option_' + el + ' input[@type=checkbox]').attr('checked', false);						});					}    					// hide the price summary text					jQuery('tr.extra_info_costst_excursion').hide();				}			});		}		return false;	}}
