$(document).ready(function (e) {
	
	// projektübersicht dropbox in ie6
	function ie6dropboxHover(e) {
    	$(this).children('div').toggleClass('hover');
	}


	// ie < 7.0 kann kein :hover
	if ($.browser.msie && $.browser.version < '7') {

	    function ie6navigation(e) {
			if (this.hovering) {
			    this.className = this.wasClass;
				this.hovering = false;
				$(this).removeClass('hover');
			} else {
			    this.className = this.wasClass + 'hover';
				this.hovering = true;
				$(this).addClass('hover');
			}
		}
				
	    function ie6buttonHover(e) {
	    	var that = this;
			$(this.className.split(' ')).each(function (i, item) {
				$(that.parentNode).toggleClass(item);
			});
	    	$(this).toggleClass('hover');
		}
		
		$('ul#Navigation > li').bind('mouseover', ie6navigation).bind('mouseout', ie6navigation).each(function (i, item) {
			this.wasClass = /(null|eins|zwei|drei|vier|fuenf|sechs)/.exec(this.className)[1];
			this.wasClass = this.wasClass + ' ' + this.wasClass;
			this.high = ('' + this.className).indexOf('high') > -1 ? 'high' : '';
	        this.wasClass = 'ie6' + this.high + ' ' + this.wasClass + this.high;
	        $(this).attr('className', this.wasClass);
		});
		
		$('div.dropbox').bind('mouseover', ie6dropboxHover).bind('mouseout', ie6dropboxHover);
$('div.dropboxhaupt').bind('mouseover', ie6dropboxHover).bind('mouseout', ie6dropboxHover);
		$('input.buttonGo').bind('mouseover', ie6buttonHover).bind('mouseout', ie6buttonHover);
	}
	
	
	// dropbox projektuebersicht in opera
	if ($.browser.opera) {
		$('div.dropbox').bind('mouseover', ie6dropboxHover).bind('mouseout', ie6dropboxHover);
	}
	
	
	// print-links
	$('*.fn-print').click(function (e) {
		e.preventDefault && e.preventDefault();
		e.returnValue = false;
		self.print();
		return false;
	});
	
	
	// pop-links
	var mini;
	$('a.fn-pop').click(function (e) {
		mini=window.open(this.href,'Pop','toolbar=0,location=0,directories=0,status=0,menubar=1,menubar=yes, scrollbars=1,resizable=1,copyhistory=0,height=560,width=616,top=0,left=0');
		mini.focus();
		return false;
	});	
	// popup-links
	$('a.fn-popup').click(function (e) {
		mini=window.open(this.href,'popup','toolbar=1,location=0,status=0,menubar=0,resizable=yes,scrollbars=1,height=750,width=690,top=0,left=0');
		mini.focus();
		return false;
	});	
	// popup2-links
	$('a.fn-zoom, a.fn-popup2').click(function (e) {
		mini=window.open(this.href,'popup2','toolbar=1,location=1,status=1,menubar=1,resizable=yes,scrollbars=1,top=0,left=0');
		mini.focus();
		return false;
	});
	
	
	// selects mit surfto zum option-value
	$('select.fn-surfto').change(function (e) {
		if (this.value) {
			location = this.value;
		}
	});
	
	
	// safari3 läuft, css-änderungen nötig
	if ($.browser.safari && $.browser.version > '2') {
		$('#typo').addClass('safari3');
	}
	
	// projektuebersicht dropbox: auswahl übernehmen
	$('div.dropbox a').click(function (e) {
		$(this).parents('div.dropbox').find('*.fn-current').html($(this).text());
	});
	
});
