/* 4449 Bytes following*/
var TopStoryBox = Class.create();
TopStoryBox.prototype = {
    initialize : function(intervall,fade){
    	this.intervall = intervall;
    	this.fade = fade;
    	this.last = 0;
    },
    init : function (i ) {
		var t = this;
		new Array(0,1,2,3).each(function (item) {
			t.reset(item);
			}
		);
	},
	stop : function () {
		this.o.stop();
	},
	start : function (){
		this.o.stop();
		this.perodicalUpdater(this.last);
	},
	reset : function (i) {
		$('tsb_button_'+i).setStyle({background: 'url("/modules/topstorybox/inactive.png") no-repeat'});
		$('tsb_rotation_'+i).setStyle({display: 'none',clear: 'both'});
	},
	highlight : function(i,fade) {
		$('tsb_button_'+i).setStyle({background: 'url("/modules/topstorybox/active.png") #FFFFFF no-repeat'});
		$('tsb_rotation_'+i).setStyle({display: 'inline',clear: 'both'});
		if ( true == fade) {
			new Effect.Opacity('tsb_img_'+i,{from: 0.2, to: 1, duration: this.fade});
		}
	},
	swap : function(i) {
		this.stop();
		this.init(i);
		this.highlight(i,false);
	},
	perodicalUpdater : function ( start ) {
		var i = start ? start : 0;
		var t=this;
		this.o = new PeriodicalExecuter(
			function () {
				t.init();
				t.highlight(i,true);
				if (i < 3) {i = i+1;} else {i = 0;}
				t.last = i;
			}
		, t.intervall);
	}
}
function favoriten() {
if ( navigator.appName != 'Microsoft Internet Explorer' )
{ window.sidebar.addPanel("ad-hoc-news.de","http://www.ad-hoc-news.de/",""); }
else { window.external.AddFavorite("http://www.ad-hoc-news.de/","ad-hoc-news.de"); } }

var homepage = "http://www.ad-hoc-news.de/";

function startseite (){    
    document.body.style.behavior='url(#default#homepage)';
    document.body.setHomePage( homepage );
}

var Clock = Class.create();
Clock.prototype = {
    initialize: function( iTime,sElement ){
    	this.getTime(iTime);
    	this.sElement = sElement;
    	this.getClock();
    },
	getTime: function(iTime) {
		var oTime = new Date();
		oTime.setTime(iTime * 1000);
		this.iHours = oTime.getHours();
		this.iMinutes = oTime.getMinutes();
		this.iSeconds = oTime.getSeconds();
	},
	getClock: function (  ){
		var sTimeStr = null;
		setTimeout ('oClk.getClock()',1000);
		if (++this.iSeconds>59){
			this.iSeconds=0;
			if (++this.iMinutes>59){
				this.iMinutes=0;
				if (++this.iHours>23)this.iHours=0;
			}
		}
		sTimeStr = ((this.iHours < 10) ? '0' : '')+this.iHours;
		sTimeStr += ((this.iMinutes < 10) ? ':0' : ':') + this.iMinutes;
		sTimeStr += ((this.iSeconds < 10) ? ':0' : ':') + this.iSeconds;
		$(this.sElement).update( sTimeStr);
		return null;
	}
}
var BreadSearchHead = Class.create();
BreadSearchHead.prototype = {
    initialize: function(options){
        this.options = options ? options : {};

    },
    initInput: function (element) {
		$(this.options.form ).setAttribute('autocomplete','off');
		$(this.options.varname ).writeAttribute('autocomplete','off');
    },
    toggleSearch: function (element) {
		this.swapInputHint();
		if (element == 'web') {
			$('bsh_search_stock').setStyle({display:'none'});
			$('bsh_search_news').setStyle({display:'none'});
		} else
		if (element == 'stock'){
			$('bsh_search_stock').setStyle({display:'block'});
			$('bsh_search_news').setStyle({display:'none'});
		} else
		if (element == 'news'){
			$('bsh_search_stock').setStyle({display:'none'});
			$('bsh_search_news').setStyle({display:'block'});
		}
	},
	swapInputHint: function () {
    	if ($('ac_q')) {
    		$('ac_q').remove();
		}
		var temp = this;
		Event.observe(
			this.options.varname,
			'focus',
			function(event) {
				if ( $(temp.options.varname).value == temp.options.sHint) {
					$(temp.options.varname).value='';
				}
				$(temp.options.varname).addClassName('ac_field');
			}
		);
		Event.observe(
			this.options.varname,
			'blur',
			function(event) {
				if ( $(temp.options.varname).value == temp.options.sHint) {
					$(temp.options.varname).value=temp.options.sHint;
				}
				$(temp.options.varname).removeClassName('ac_field');
			}
		);
	},
	autoComplete: function (){
		this.swapInputHint();
		this.json = new AutoComplete(this.options.varname,this.options);

	} ,
	observeSubmit: function () {
		var temp = this;
		Event.observe(
			this.options.form,
			'submit',
			function(event) {
				$(temp.options.varname).submit();
			}
		);
	}
}
