var selected = '';
var currentCheckboxValues = '';
jQuery(document).ready(function(){
	/*
		wird für die PRODUKT-USER-SUCHE benötigt!!!
	*/
	jQuery('#jq-delDATE_abAbreise').click( function(){ jQuery('#abAbreisedatum').attr('value', ''); } ); 
	jQuery('#jq-delDATE_bisAbreise').click( function(){ jQuery('#bisAbreisedatum').attr('value', ''); } ); 

	//
	jQuery('#searchBox_btn_Kontinent_EUROPA').show();
	jQuery('#Boxbtn_Kontinent_EUROPA').show();

	//	-> wozu?
	jQuery(".button").click(function(){
		jQuery(".button").removeClass('marked');
		jQuery(this).addClass('marked');
		jQuery(".mainForm").hide();
		jQuery('#Box'+jQuery(this).attr('id')).show();
	});
	
	jQuery(".buttonKONTINENT").click(function(){
		jQuery(".buttonKONTINENT").removeClass('marked');
		jQuery(this).addClass('marked');
		jQuery(".KONTINENT").hide();
		jQuery('#Box'+jQuery(this).attr('id')).show();
	});
	jQuery(".searchBox_buttonKONTINENT").click(function(){
		jQuery(".searchBox_buttonKONTINENT").removeClass('marked');
		jQuery(this).addClass('marked');
		jQuery(".searchBox_KONTINENT").hide();
		jQuery('#searchBox_'+jQuery(this).attr('id')).show();
	});

	jQuery(".buttonSelector").click(function(){
	    //jQuery('.selectorBG').show();
		jQuery(".selector").hide();
		selected = jQuery(this).attr('id');
		jQuery('#Selector'+selected).show();
	    jQuery('#Selector'+selected+' input[type=checkbox]').live('click',function() {
            currentCheckboxValues = '';
			jQuery('#Selector'+selected+' input[type=checkbox]').each(function(){
		        var currentCheckboxValue = jQuery(this).val();
		        if (jQuery(this).attr('checked')) {
                    if (currentCheckboxValues!='') currentCheckboxValues+=', ';
					if( selected=='Laender'){
						currentCheckboxValues+=laenderArr[currentCheckboxValue];
					} else if(selected=='Arten'){
						currentCheckboxValues+=tagsArr[currentCheckboxValue];
					} else {
						currentCheckboxValues+=currentCheckboxValue;
					}
				}
			});
			jQuery('input[id='+selected+']').val(currentCheckboxValues);
			jQuery('textarea[id='+selected+']').val(currentCheckboxValues);
//			jQuery('input[name='+selected+']').val(currentCheckboxValues);
//			jQuery('textarea[name='+selected+']').val(currentCheckboxValues);
		});
	});
	
	jQuery(".buttonSelectorSearchBox").click(function(){
	    //jQuery('.selectorBG').show();
		jQuery(".selector").hide();
		selected = jQuery(this).attr('id');
//		jQuery('#Selector'+selected).show();
	    jQuery('#Selector'+selected+' input[type=checkbox]').live('click',function() {
            currentCheckboxValues = '';
			jQuery('#Selector'+selected+' input[type=checkbox]').each(function(){
		        var currentCheckboxValue = jQuery(this).val();
		        if (jQuery(this).attr('checked')) {
                    if (currentCheckboxValues!='') currentCheckboxValues+=', ';
					if( selected=='BoxLaender'){
						currentCheckboxValues+=laenderArr[currentCheckboxValue];
					} else if(selected=='BoxArten'){
						currentCheckboxValues+=tagsArr[currentCheckboxValue];
					} else {
						currentCheckboxValues+=currentCheckboxValue;
					}
				}
			});
			jQuery('input[id='+selected+']').val(currentCheckboxValues);
			jQuery('textarea[id='+selected+']').val(currentCheckboxValues);
//			jQuery('input[name='+selected+']').val(currentCheckboxValues);
//			jQuery('textarea[name='+selected+']').val(currentCheckboxValues);
		});
		jQuery.unblockUI;
		jQuery.blockUI({
			message: jQuery('#Selector'+selected),
			showOverlay: true,
		    fadeIn: 0, 
		    fadeOut: 0,
			css: {
				border: 'none', 
				width: '630px',
				cursor: 'auto',
				left: '25%',
				top: '200px' 
			},
			overlayCSS: {
				opacity: 0.2,
				backgroundColor: '#fff', 
				cursor: 'auto'
			}
		});
		jQuery('.blockOverlay').click( function(){ jQuery.unblockUI({ fadeOut:0 }) }); 
	});
	/*
		CLOSE-BUTTONS
	*/
	jQuery('.buttonSelectorCloseBox').click( function(){ jQuery.unblockUI( { fadeOut:0 } ); });
	jQuery(".buttonSelectorClose").click(function(){
		jQuery(".selector").hide();
//		jQuery(".selectorBG").hide();
	});
});
