/* doResize */
	function doResize(){
		var myWidth = 0, myHeight = 0;
		if ( typeof( window.innerWidth ) == 'number' ) {
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		} else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		} else if ( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}
		if (myHeight > 700){
			$('a.news').css({'height':'300px'});
			$('img.csc-news-icon').css({'display':'block'});
		}
	};
/* is Value in searchfield */
	function isSearchValue(){
		if($('input#searchTopsword').attr('value')==''){
			$('input#searchTopreset_button').css({'background-position':'right top'});
		}else{
			$('input#searchTopreset_button').css({'background-position':'right bottom'});
		}
	};
$(document).ready(function(){
	/* resize News */
		doResize();
	/* for jSuggest */
		isSearchValue();
		$('input#searchTopsword')
			.attr({'autocomplete':'off'})
			.jSuggest({
				minchar:2,
				ajax:{
					dataKeyId:'sword',
					dataKeyPrefix:'',
					dataKeySuffix:'',
					url:'fileadmin/inc.jSuggest.php',
					data:{},
					type:'post',
					dataType:'script',
					success:function(){
						return suggest;
					}
				},
				select:function(elem, val){
					$('#searchTop').submit();
				}
			})
			.bind('keyup',function(){
				isSearchValue();
			});
		$('input#searchTopreset_button').bind('click',function(event){
			$('input#searchTopsword').attr({'value':''});
			isSearchValue();
			$('#searchTopsword').focus();
			event.preventDefault();
		});
	/* t3x.jSlide image-content rebuild */
		$('div.ttc-image:first')
				.each(function(){
					var data = Array();
					$('#'+$(this).attr('id')+' .content img').each(function(){
						var img={
							src:$(this).attr('src'),
							'alt':$(this).attr('alt'),
							'title':$(this).attr('title')
						};
						data.push(img);
					});
					$('#'+$(this).attr('id')+' .content')
						.jSlide({
							play:true,
							time:8,
							loop:false,
							control:'auto',
							caption:'alt',
							count:true,
							thumbs:false,
							style:{'image-width':492,'image-height':369,'control-width':36,'control-height':50,'control-align':'center','control-bottom':30,'info-height':30},
							data:data
						})
						.css({'padding-bottom':'0px'});
				});
		$('div.ttc-image:not(:first)')
				.each(function(){
					var data = Array();
					$('#'+$(this).attr('id')+' .content img').each(function(){
						var img={
							src:$(this).attr('src'),
							alt:$(this).attr('alt'),
							title:$(this).attr('title')
						};
						data.push(img);
					});
					$('#'+$(this).attr('id')+' .content')
						.jSlide({
							play:false,
							time:8,
							loop:false,
							control:'auto',
							caption:'alt',
							count:true,
							thumbs:false,
							style:{'image-width':492,'image-height':369,'control-width':36,'control-height':50,'control-align':'center','control-bottom':30,'info-height':30},
							data:data
						})
						.css({'padding-bottom':'0px'});
				});
		if($('#GMap2').length){
			var latlng = new GLatLng(50.8497122,12.0781299);
			var marker = new GMarker(latlng);
			var map = new GMap2(document.getElementById('GMap2'));

			map.setCenter(latlng, 14);
			map.setUIToDefault();
			GEvent.addListener(
				marker,
				'click',
				function(){
					marker.openInfoWindowHtml('<span style="color:#666666"><strong>Motorsportpark Walter Günther</strong><br />MTC Gera e.V. im AvD<br />Zoitzbergstraße<br>07551 Gera</span>');
				}
			);
			map.addOverlay(marker);
		}
});
