window.addEvent('domready', function () {
	
	links = $$('li.tabs a');
	var tabs = 0;
	links.each(function(index, item){ tabs = tabs + 1; });
	if( tabs > 1 ){
		tab = new Carousel({
			container: 'slidehorizontal',
			scroll: 1,
			circular: false,
			current: 0,
			mode: 'horizontal',
			onChange: function (index) {
				links.each(function (el, off) {
					el[off == index ? 'addClass' : 'removeClass']('selected')
				})
			},
		});
		links.each(function (el, index) {
			el.addEvent('click', function (e) {
				e.stop();
				tab.move(index);
			});
		});
	}
	
	var search = $('s');
	if( $type(search) != false ){
		search.addEvent('focus',function(){
			if(search.get('value') == "suchen ..."){
				search.set('value','');
			}
		})
		search.addEvent('blur',function(){
			if(search.get('value') == ""){
				search.set('value','suchen ...');
			}
		})
	}
	
	var searchSubmit = $('sSubmit');
	if( $type(searchSubmit) != false ){
		searchSubmit.addEvent('click',function(){
			if(search.get('value') == "suchen ..."){
				search.set('value','');
			}
		})
	}
});


function setCookie( name, value, expires, path, domain, secure ){
    var today = new Date();
    today.setTime( today.getTime() );
    if ( expires ){
        expires = expires * 1000 * 60 * 60 * 24;
    }
    var expires_date = new Date( today.getTime() + (expires) );
    document.cookie = name + "=" + value +
    ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
    ( ( path ) ? ";path=" + path : "" ) +
    ( ( domain ) ? ";domain=" + domain : "" ) +
    ( ( secure ) ? ";secure" : "" );
}
