$(document).ready( function() {

	
$('#tfCallbackForm label').hide();
	// init
	
	cbName = $('#cb_name');
	cbPhone = $('#cb_phone');
	cbWish = $('.cb_wish');
	
	
	
	
	/*cbName.blur().css('opacity', 0.5);
	cbPhone.blur().css('opacity', 0.5);
	cbWish.blur().css('opacity', 0.5);*/
	
	
	defName = cbName.parent().prev().text();
	defPhone = cbPhone.parent().prev().text();
	defWish = cbWish.parent().prev().text();
	
	if(cbName.val() == '')cbName.val(defName);
	if(cbPhone.val() == '')cbPhone.val(defPhone);
	if(cbWish.val() == '')cbWish.val(defWish);
	
	cbSubmit = $('#cb_submit');
	/*
	cbSubmit.css('opacity', 0.7);*/
	
	/*
	cbWish.height(14).width(175-cbSubmit.width()-5);
	*/
	
	cbName.focus(function(){
		
		/*$(this).css('opacity', 1);*/
		
		/*$(this).parent().attr('class', 'on');*/
		
		if($(this).val() == defName)$(this).val('');
		cbWish.height(16);
		
	}).blur(function(){
		
		/*$(this).css('opacity', 0.5);*/
		
		if($(this).val() == '')$(this).val(defName);//.parent().attr('class', '');
		/*else $(this).parent().removeAttr('class');*/
		
	});
	
	cbPhone.focus(function(){
		
		/*$(this).css('opacity', 1);*/
		
	/*	$(this).parent().attr('class', 'on');*/
		
		if($(this).val() == defPhone)$(this).val('');
		
		cbWish.height(16);

		
	}).blur(function(){
		
		/*$(this).css('opacity', 0.5);*/
		
		if($(this).val() == '')$(this).val(defPhone);//.parent().attr('class', '');
/*		else $(this).parent().removeAttr('class');*/
		
	});
	
	cbWish.focus(function(){
		
		/*$(this).css('opacity', 1);*/
		
		/*$('.idbSsb').css('margin-top', 50);
		*/
		/*$(this).parent().attr('class', 'on');*/
		$(this).height(80);
		
		if($(this).val() == defWish)$(this).val('');
		
	}).blur(function(){
		
		/*$(this).css('opacity', 0.5);*/
		
				
		/*$('.idbSsb').css('margin-top', 0);*/
		
		if($(this).val() == '')$(this).val(defWish);//.parent().attr('class', '');
	/*	else $(this).parent().removeAttr('class');*/
		
	});
	
	
	$("#tfCallbackForm").submit( function() {

cbWish.height(16);
		
		
		if(cbName.val() == defName || cbPhone.val() == defPhone || cbWish.val() == defWish){
			
	cbName.blur();
	cbPhone.blur();
	cbWish.blur();
	
		
		if(cbName.val() == defName)cbName.parent().addClass('err') 
		else cbName.parent().removeClass('err');
		if(cbPhone.val() == defPhone)cbPhone.parent().addClass('err');
		else cbPhone.parent().removeClass('err'); 
		if(cbWish.val() == defWish)cbWish.parent().addClass('err')
		else cbWish.parent().removeClass('err')
		
		
		
			
			alert('Bitte füllen Sie alle Felder aus. / Please fill out the whole form.')
			
			//$('.callback h2').text($('.callback h2.err').text());
			
			if(cbName.val() == '')cbName.val(defName);
			if(cbPhone.val() == '')cbPhone.val(defPhone);
			if(cbWish.val() == '')cbWish.val(defWish);
			
			if(cbName.val() == defName)cbName.focus();
			else if(cbPhone.val() == defPhone)cbPhone.focus();
			else if(cbWish.val() == defWish)cbWish.focus();
			
			return false;
			
		}else{
			return true;
			
		}
		
	});
	
	cbName.height(13);
	cbPhone.height(13);

	cbWish.height(16);
	
	


});