$(function() {

	try {
		window.setTimeout( function() {	
			$('#mobilfunkratgeber_links').hide().css('position', 'absolute');

			$('#mobilfunkratgeber').click(function() {
				$('#mobilfunkratgeber_links').css('top', $('#mobilfunkratgeber').position().top + 19);
				$('#mobilfunkratgeber_links').slideToggle('fast');
			});
		}, 10 );
	}
	catch (e) {
	}

	try {
		if ( $('#header_search_input').addSuggest ) {
			$('body').append('<div id="header_search_suggestions_outer" align="center"><div style="width:790px"><div id="header_search_suggestions"></div></div></div>');
			$('#header_search_input').addSuggest(
			{
				ajaxMethod:'Shop_SearchSuggest::getSuggestions',
				loadImageOffset:[4,4],
				container:$('#header_search_suggestions')
			} );
		}
	}
	catch (e) {
		alert(e);
	}

	try {

		_pageDescriptionScrollTimer = 0;

		$('#page_info').mouseout(function(){
			window.clearInterval(_pageDescriptionScrollTimer);
		});

		$('#page_info').mousemove(function(event){
			window.clearInterval(_pageDescriptionScrollTimer);
			var speedup = Math.pow( ( event.pageY - $(this).position().top - $(this).height() / 2 ) / ($(this).height() / 2) * 1.2, 11 );
			if ( Math.floor( speedup ) != 0 ) {
				var div = $('#page_description');
				_pageDescriptionScrollTimer = window.setInterval(function(){
					div.scrollTop( div.scrollTop() + speedup );
				}, 10);
			}
		});
	}
	catch (e)
	{
	}

	// Umfrage als Popunder aufrufen
	try
	{
		if ( document.getElementById( 'survey_link' ) )
		{
			if ( !document.cookie.match(/survey_opened/) )
			{
				var wnd = null;
				var survey_popup_options = 'width=700,height=550,scrollbars=yes,status=yes,toolbar=no';
				var survey_link = $('#survey_link');

				if ( survey_link.attr('href') != 'undefined' )
				{
					// Bei Klick auf den Feedback-Link das Popunder nach vorn holen oder öffnen
					survey_link.click( function()
					{
						wnd = window.open($(this).attr('href'),'survey',survey_popup_options);
						wnd.focus();
						return false;
					} );

					// Cookie setzen, damit die Umfrage nur 1x angezeigt wird
					document.cookie = "survey_opened=" + escape(survey_link.attr('href'));
					wnd = window.open(survey_link.attr('href'),'survey',survey_popup_options);
					wnd.blur();
				}
			}
		}
	}
	catch (e) {}

});

