$j(document).ready(function() {
	updateSizeFromCookie();
	$j('.search-date').datepicker();
	$j('.navigation').superfish({ 
        animation: {height:'show'},   // slide-down effect without fade-in 
        delay:     1200               // 1.2 second delay on mouseout 
    }); 

	var small = $j('<a class="small" href="#">A</a>').click(function(){
		//setFontSize('small');
		setActive(this);
		write('small');
		updateSizeFromCookie();
		
	});
	var middle = $j('<a class="middle" href="#">A</a>').click(function(){
		//setFontSize('middle');
		setActive(this);
		write('middle');
		updateSizeFromCookie();
	});
	var large = $j('<a class="large" href="#">A</a>').click(function(){
		//setFontSize('large');
		setActive(this);
		write('large');
		updateSizeFromCookie();
	});
	
	
	small.addClass('active');
	$j('.fontsize').append(small).append(middle).append(large);
	var mysize = $j.cookie('fonzy');
	
	if(mysize)
	{
	$j('.fontsize a.small').removeClass('active');
	$j('.fontsize a.middle').removeClass('active');
	$j('.fontsize a.large').removeClass('active');
	
	$j('.fontsize a.' + mysize).addClass('active');	
	}


	$j(".event_image").click(function () {
	clearAll();
      	$j(".eventlinkBoxTextBox").slideToggle("slow");
    	});
	$j(".citylife_image").click(function () {
	clearAll();
      	$j(".citylifelinkBoxTextBox").slideToggle("slow");
    	});
	$j(".alacarte_image").click(function () {
	clearAll();
      	$j(".alacartelinkBoxTextBox").slideToggle("slow");
    	});
	$j(".shopping_image").click(function () {
	clearAll();
      	$j(".shoppinglinkBoxTextBox").slideToggle("slow");
    	});
	$j(".nightfever_image").click(function () {
	clearAll();
      	$j(".nightfeverlinkBoxTextBox").slideToggle("slow");
    	});
	$j(".film_image").click(function () {
	clearAll();
      	$j(".filmlinkBoxTextBox").slideToggle("slow");
    	});
	$j(".service_image").click(function () {
	clearAll();
      	$j(".servicelinkBoxTextBox").slideToggle("slow");
    	});
	$j(".internet_image").click(function () {
	clearAll();
      	$j(".internetlinkBoxTextBox").slideToggle("slow");
    	});

	
});


function clearAll(){
	$j(".eventlinkBoxTextBox").hide();
	$j(".citylifelinkBoxTextBox").hide();
	$j(".alacartelinkBoxTextBox").hide();
	$j(".shoppinglinkBoxTextBox").hide();
	$j(".nightfeverlinkBoxTextBox").hide();
	$j(".filmlinkBoxTextBox").hide();
	$j(".servicelinkBoxTextBox").hide();
	$j(".internetlinkBoxTextBox").hide();

	}
function setFontSize(size) {
	
	$j('.wrapper').removeClass("small");
	$j('.wrapper').removeClass("middle");
	$j('.wrapper').removeClass("large");
	$j('.wrapper').addClass(size);
	
}

function setActive(obj) {
	$j('.fontsize a').each(function(){
		$j(this).removeClass('active');
	});
	$j(obj).addClass('active');
}




    function write(value) {
	$j.cookie('fonzy', null);
 	var name = 'fonzy';	
	 var date = new Date();
         date.setTime(date.getTime() + (3 * 24 * 60 * 60 * 1000));
         $j.cookie(name, value, { path: '/', expires: date });
	}
 
 
    
    function updateSizeFromCookie() {
        //$('.wrapper').addClass(size);
	var mysize = $j.cookie('fonzy');
	//alert(mysize);
	$j('.wrapper').removeClass("small");
        $j('.wrapper').removeClass("middle");
        $j('.wrapper').removeClass("large");
        $j('.wrapper').addClass(mysize);
	
	$j('.fontsize a').each(function(){
               $j(this).removeClass('active');
        });
	
	
	$j('.fontsize a.' + mysize).addClass('active');
	
	return false;
    }


var active_color = '#999'; // Colour of user provided text
var inactive_color = '#999'; // Colour of default text
 
$j(document).ready(function() {
 
    $j(".terminsuche input.default-value").css("color", inactive_color);
    var default_values = new Array();					   
 
    $j('.terminsuche input[type="text"]').focus(function() {
        if (this.value == this.defaultValue){
	    this.value = '';
            this.style.color = active_color;
	}
	if(this.value != this.defaultValue){
	    this.select(); 
	    this.style.color = active_color;
	}
    });
    $j('.terminsuche input[type="text"]').blur(function() {
        if (this.value == ''){
	    this.value = (this.defaultValue ? this.defaultValue : '');
	    this.style.color = inactive_color;
	}
    });
});



