$(function() {
	//Wird der "Senden"-Button geklickt...
	$(".button").click(function() {

		var selectedLang = $('#ghost').attr('innerHTML');
    	var contentArray = new Array();
    	var dataString = '';
    	
    	//Teste alle Eingaben und haenge sie an den dataString(Nachname, Vorname, Firma, Telefon, E-Mail)
    	for(var i = 0; i < 5; i++) {
    		$('#text_input_'+i).css({'color' : '#000000'});
    		contentArray[i] = $('#text_input_'+i).val();
    		if(selectedLang == 'de') {
    			if ((contentArray[i] == '' || contentArray[i] == 'Bitte ausfüllen!') && '#text_input_'+i != '#text_input_2') {
    				$('#text_input_'+i).css({'color' : '#EC1C24'});
    				$('#text_input_'+i).attr('value', 'Bitte ausfüllen!');
    				$('#text_input_'+i).focus(function() {
    					$('#text_input_'+i).css({'color' : '#000000'});
    					if($('#text_input_'+i).attr('value') == 'Bitte ausfüllen!') {
    						$('#text_input_'+i).attr('value', '');
    					}
    				});
    				return false;
    			}else {
    				//Daten fuer den Request zusammenpacken
    				dataString += 'text_input_'+ i +'='+ contentArray[i] +'&';
    			}
    		}else {
    			if ((contentArray[i] == '' || contentArray[i] == 'Fill in please!') && '#text_input_'+i != '#text_input_2') {
    				$('#text_input_'+i).css({'color' : '#EC1C24'});
    				$('#text_input_'+i).attr('value', 'Fill in please!');
    				$('#text_input_'+i).focus(function() {
    					$('#text_input_'+i).css({'color' : '#000000'});
    					if($('#text_input_'+i).attr('value') == 'Fill in please!') {
    						$('#text_input_'+i).attr('value', '');
    					}
    				});
    				
    				return false;
    			}else {
    				//Daten fuer den Request zusammenpacken
    				dataString += 'text_input_'+ i +'='+ contentArray[i] +'&';
    			}
    		}
    	}
    	//Fuehrung
    	$('#select_tour option:selected').each(function(){
    		dataString += 'text_input_5='+ $(this).text() +'&';
    	});
    	//Gruppengroesse
    	$('#select_group_size option:selected').each(function() {
    		dataString += 'text_input_6='+ $(this).text() +'&';
    	});
    	//Datum
    	if($('#date_selection').attr('innerHTML') == '__.__.____') {
    		if(selectedLang == 'de') {
    			$('#send_response').attr('innerHTML', 'Bitte wählen Sie ein Datum aus!');
    		}else {
    			$('#send_response').attr('innerHTML', 'Select date please!');
    		}
    		return false;
    	}else {
    		dataString += 'text_input_7='+ $('#date_selection').attr('innerHTML');
    	}
    		
    	//Sende den Request
    	setRequest('book',dataString); 
	});
});

/**
 * Behandelt den MouseOverEvents
 * @param id String  Id des ueberfahrenen Menuepunktes
 */
function sendOnMouseOver(id) {
	$('#'+id).css({'background-color' : '#BB0000'});
}

/**
 * Behandelt den MouseOutEvent
 * @param id String  Id des verlassenen Menuepunktes
 */
function sendOnMouseOut(id) {
	$('#'+id).css({'background-color' : '#EC1C24'});
}
