/* --------------------------------------------------
|	=Druckdarstellung
 -------------------------------------------------- */

$(document).ready(function(){
	var printlink = jQuery('<a rel="alternate" href="#">Druckansicht</a>');
	printlink.appendTo($('#printswitch'));
	$('#printswitch a').click(function(){
		switchStyles();
		return false;
	});   
});

function switchStyles(){
	var printLink = $('#printswitch a');
	var print = (jQuery(printLink).text()=='Zurück zur Monitoransicht');
	jQuery(printLink).html(print ? 'Druckansicht' : 'Zurück zur Monitoransicht');

	$('link[@rel*=style]').each(function(i){
		if (this.getAttribute('media') == 'screen'){
			this.disabled=!print;
		}

		if (this.getAttribute('media') == 'print'){
			this.setAttribute('media', 'screen, print');
		} else if (this.getAttribute('media') == 'screen, print'){
			this.setAttribute('media', 'print');
		}
	});
}

// alternative notation von $(document).ready(function(){
jQuery(function(){
	if ("#livesearch"){
		jQuery("#livesearch").suggest(
			"/suche/livesearch.php",
			{ 
				onSelect: function() {},
				resultsID: 'trefferliste',
				resultsARIALive: 'assertive'
			}
		);
	}
});
