$(document).ready(function () {
	
	$('body').css({background:'none'});
	$('#chooseImg').css({display:'block'});
	$('#footer').removeClass('nsFooter');
	// BEGIN switch  accessories/products on detail
	if($('#accessoriesListLink').attr('class')=='paLink'){
	var relatedHeight=$('#relatedList').height();
	var accessoriesHeight=relatedHeight+'px';
	$('#accessoriesList').css({height:accessoriesHeight});	
	$('#relatedList').addClass('hideMe');	
	$('#accessoriesListLink').addClass('boldTxt');
	var related=$('#relatedHeadline').html()
	if (related==null){related='';}
	else{related=$('#relatedHeadline').html()+' // '}
	var newHeadline=''+related+''+$('#accessoriesHeadline').html();
	$('#accessoriesHeadline').html('');
	$('#relatedHeadline').remove();
	$('#accessoriesHeadline').html(newHeadline);  
	$('.paLink').click(function() {
			$('.paLink').each(function() {	
			$(this).removeClass('boldTxt');			
			});
			$(this).addClass('boldTxt');
			if($(this).attr('id')=='accessoriesListLink'){
				$('#relatedList').css({display:'none'});
				$('#accessoriesList').css({display:'block'});
				}
			else{
				$('#relatedList').css({display:'block'});
				$('#accessoriesList').css({display:'none'});		
			
				}
				
		  });
	}
		  
	$("#videoItem").click(function() {		
		var path='/media/'+$(this).attr('rel')+'';
	$.fancybox({			    
			'padding'		: 0,					
			'titleShow'	    : false,
	         'overlayColor' : '#FFFFFF',
			'width'		    : 660,
			'height'		: 388,
			'href'			: this.href,
			'hideOnContentClick':false,
			'type'			: 'swf',
			'swf'			: {
			 'wmode'		: 'transparent',
			 'flashvars' : 'film='+path,
			 }
			
		});

	return false;
	
});
$(".showBasketInfo").attr('href','#basketinfo');
$("#basketInfo1").html('<strong>Sie m&ouml;chten diesen Artikel erwerben?</strong>');
$("#basketInfo2").html('Klicken Sie auf "weiter" und Sie werden zu unserem Shop weitergeleitet.');
$("#basketInfo3").html('Klicken Sie auf "zur&uuml;ck" und dieses Fenster wird geschlossen.');
$(".showBasketInfo").fancybox({						
		'hideOnContentClick': false,
		'hideOnOverlayClick': false,
		'overlayOpacity': 0.7,
		'overlayColor':'#FFF',
		'showCloseButton': false
		
	});

	
 // designers.tpl
$(".dynRow").css({display: 'none' }); 
$("a.designername").click(function() {
$("a.designername").each(function() {
			$(this).removeClass('boldTxt');					  
								     });
	$(this).addClass('boldTxt');	
var idNumber='#div'+$(this).attr('id');
$(".dynRow").each(function() {
	$(this).css({display: 'none' });					   
						   });
$(idNumber).css({display: 'block' });

});								   
   // radio buttons - dropdowns
$('input[type="radio"]').ezMark();
$(".selectDropDown").css({ opacity: 0 });
$(".largeDropDown").css({ opacity: 0 });
$("#Land").css({ opacity: 0 });
$("#cntrstate").css({ opacity: 0 });
$("#cntrcity").css({ opacity: 0 });
$('.largeTxt').html($('.largeDropDown :selected').html());
$('.land').html($('.country :selected').html());
$('.international').html($('.internationalDropDown :selected').html());
$('.national').html($('.nationalDropDown :selected').html());
$('.show-text').html($('#cntr :selected').html());	
$('.show-text0').html($('#cntr :selected').html());	
$('.show-text1').html($('#cntrstate :selected').html());
$('.show-text2').html($('#cntrcity :selected').html());

//alert($('#cntr option:selected').html())
	

	
	 $("#productSearchString").autocomplete(data,{    
  }).result(function(event, item, formatted) {
      $(this).parents().find('form:first').submit();
  }); 
	 
	 $(".blomusTip").qtip({   
	   position: {
		  target: 'mouse',
          adjust: { mouse: true,x:0,y:0 },
		  corner: {
			 //target: 'topMiddle',
			 tooltip: 'bottomMiddle'
		  },		 
		   },
		   style: {width: 118},
		   delay: 0,
	}); 
	 
	 $("a.hiddenGalleryItem").fancybox({
	'titleShow'	: true,
	'overlayColor' 		: '#FFFFFF'
	
}); 
	
	// entferne Punktrahmen um Links 	
	$('a').each(function() {
		  this.onfocus = function() {
		  this.blur();
		  };
	});
	// setze untere Navigation auf 0 
	$('#navigationContentInner').hide();	
	$('#leftTabs').css({'display':'block'});
	$('#leftTabsContainer').css({'display':'block'});
	$('#leftTabContent').css({'display':'block'});	
	$('#leftTabNew').animate({width:'hide'},0);
	//$('#leftTabFinder').animate({width:'hide'},0);
	$('#leftTabFinderFirst').animate({width:'hide'},0);
	$('#leftTabFinderSecond').animate({width:'hide'},0);
	$('#leftTabFinderThird').animate({width:'hide'},0);
	$('#leftTabWishlist').animate({width:'hide'},0);
	// funktionen zum rein/rausfahren deklarieren
	var config = {    
		 over: showmenu, // function = onMouseOver callback (REQUIRED)    
		 timeout: 50,// number = milliseconds delay before onMouseOut
		 interval: 50,// number = milliseconds delay before onMouseOver
		 out: hidemenu // function = onMouseOut callback (REQUIRED)    
	};
	
	// aufruf zum rein/rausfahren mit Delay
	$("#footer").hoverIntent( config );									 
	$('#aNew').click(function() {
		$('#newsFrame').html('');
		$('#leftTabFinderFirst .closeThis').css({'display':'block'});
		$(this).toggleClass('aNewAktiv'+language);
		$('#aWishlist').removeClass('aWishlistAktiv'+language);
		$('#aFinder').removeClass('aFinderAktiv'+language);
		$('#leftTabNew').css({'z-index':'4'});
		$('#leftTabFinder').css({'z-index':'2'});
		$('#leftTabWishlist').css({'z-index':'2'});
		if($('#leftTabFinder').css('display')=='block'){
			$('#leftTabFinderFirst').animate({width:'hide'},300);
		$('#leftTabFinderSecond').animate({width:'hide'},300);
		$('#leftTabFinderThird').animate({width:'hide'},300);
			$('#leftTabFinder').animate({width:'hide'},500);
			}
		if($('#leftTabWishlist').css('display')=='block'){$('#leftTabWishlist').animate({width:'hide'},1);}
		 $('#leftTabNew').animate({width:'toggle'}, 500, function() {
		// Animation complete.	
		loadAjax($('#newsFrame'),'index','a=new');
		
	  });
		
	});// END $('#aNew').click
	$('#leftTabNew .closeThis a').click(function() {
		$('#aNew').removeClass('aNewAktiv'+language);	
		$('#newsFrame').html('');														  
		$('#leftTabNew').animate({width:'hide'},400); 
	});	
	$('#leftTabWishlist .closeThis a').click(function() {
		$('#aWishlist').removeClass('aWishlistAktiv'+language);	
		$("#wishListFrame").html('');
		   $('#dealerTab').css({'display':'none'});
		$('#leftTabWishlist').animate({width:'hide'},400); 
	});							
	$('#leftTabFinderFirst .closeThis a').click(function() {
	$('#aFinder').removeClass('aFinderAktiv'+language);												 
		showHideFinder(); // rein-raus produktfinder
		 
	});
	$('#leftTabFinderSecond .closeThis a').click(function() {
	$('#aFinder').removeClass('aFinderAktiv'+language);												 
		showHideFinder(); // rein-raus produktfinder
	});
	$('#leftTabFinderThird .closeThis a').click(function() {
		$('#aFinder').removeClass('aFinderAktiv'+language);												 
		showHideFinder(); // rein-raus produktfinder											 
	});
	$('#leftTabFinderFirstNav a').click(function() {
			$('#leftTabFinderFirstNav a').each(function() {
				$(this).removeClass('linkactive');						
				});	//each		 
			$('#leftTabFinderFirst .closeThis').css({'display':'none'});									 
			if($('#leftTabFinderThird').css('display')=='block'){ $('#leftTabFinderThird').animate({width:'hide'},300, function() { $('#leftTabFinderSecond .closeThis').css({'display':'block'});});}									 
			$('#leftTabFinderSecondNavInner').html('');									 
			var fparam=	$(this).parent().attr('class');	
			$(this).addClass('linkactive');	
			$('#leftTabFinderSecond').animate({width:'show'},400, function() {	
				loadAjax($('#leftTabFinderSecondNavInner'),'index','a=range&finder=1&r='+fparam)
			});
		});
	
	$('#aFinder').click(function() {
								
		$('#leftTabFinderFirstNav a').each(function() {
								$(this).removeClass('linkactive');						
											});	//each						 
		$(this).toggleClass('aFinderAktiv'+language);
		$('#leftTabFinderFirst .closeThis').css({'display':'block'});	
		$('#aWishlist').removeClass('aWishlistAktiv'+language);
		$('#aNew').removeClass('aNewAktiv'+language);
		 $('#leftTabNew').css({'z-index':'2'});
		$('#leftTabFinder').css({'z-index':'4'});
		$('#leftTabWishlist').css({'z-index':'2'});
		if($('#leftTabNew').css('display')=='block'){$('#leftTabNew').animate({width:'hide'},1);}
		if($('#leftTabWishlist').css('display')=='block'){$('#leftTabWishlist').animate({width:'hide'},1);}	
		showHideFinder(); // rein-raus produktfinder
		 
	}); // END $('#aFinder').click	
	 
	$('#aWishlist').click(function() {
		$('#dealerTab').css({'display':'none'});
		$('#leftTabFinderFirst .closeThis').css({'display':'block'});	
		$("#wishListFrame").html('');	
		$(this).toggleClass('aWishlistAktiv'+language);
		$('#aFinder').removeClass('aFinderAktiv'+language);
		$('#aNew').removeClass('aNewAktiv'+language);
		$('#leftTabNew').css({'z-index':'2'});
		$('#leftTabFinder').css({'z-index':'2'});
		$('#leftTabWishlist').css({'z-index':'4'});
		if($('#leftTabNew').css('display')=='block'){$('#leftTabNew').hide();}
		if($('#leftTabFinder').css('display')=='block'){
		$('#leftTabFinderFirst').hide();
		$('#leftTabFinderSecond').hide();
		$('#leftTabFinderThird').hide();
			$('#leftTabFinder').hide();
			}
	$('#leftTabWishlist').animate({width:'toggle'}, 400, function() { 
	if($("#leftTabWishlist").css('display')=='block'){
		loadAjax($('#wishListFrame'),'index','a=wishlist')
		}	
	//	 
	  });	
	}); // END $('#aWishlist').click	
	var screenWidth= $(window).width();
	var newsFrameWidth= screenWidth-180;
	var screenheight= $(window).height();
	var wishFrameWidth= screenWidth-383;	
	$('#wishListFrame').css({'width': ''+wishFrameWidth+'px'});
	$('#newsFrame').css({'width': ''+newsFrameWidth+'px'});
	$('#finderFrame').css({'width': ''+newsFrameWidth-290+'px'});
	$('#leftTabFinderThird').css({'paddingRight': '50px'});
	if(screenheight<630){
		$('#leftTabs').css({'position': 'absolute'});
		$('#container').css(($.browser.msie && $.browser.version < 7 ? '' : 'min-') + 'height', '630px');
		}
		else{
		$('#leftTabs').css({'position': 'fixed'});
		}
		

}); //end document ready
function doWishlistLink(theLink){	
	window.location.href=theLink;
							
	}
$(window).resize(function(){
	var screenWidth= $(window).width();
	var newsFrameWidth= screenWidth-180;
	var screenheight= $(window).height();
	var wishFrameWidth= screenWidth-383;
	var wishContainerWidth= $("#wishContainer").width();
	$('#clickContainer').css({'width': ''+screenWidth-35+'px'});
	if(wishFrameWidth<(wishContainerWidth)){
		$('#dealerTab').css({'left':''+(wishFrameWidth+70)+'px'});
		//$('#wishContainerHeadLine').css({'left':'-200px'});
	}
	$('#newsFrame').css({'width': ''+newsFrameWidth+'px'});
	$('#wishListFrame').css({'width': ''+wishFrameWidth+'px'});	
	//$('.searchField').val(''+wishContainerWidth+'---');
    //$('.searchField').val(''+$(window).width()+'-'+document.getElementById('newsFrame').offsetWidth+'');
	 $('#finderFrame').css({'width': ''+newsFrameWidth-290+'px'});
	$('#leftTabFinderThird ').css({'paddingRight': '50px'});
	if(screenheight<630){
		//$('#bottomnavigationshadow').css({'display': 'none'});
		$('#leftTabs').css({'position': 'absolute'});
		$('#container').css(($.browser.msie && $.browser.version < 7 ? '' : 'min-') + 'height', '630px');
	}
	else{
	//$('#bottomnavigationshadow').css({'display': 'block'});	
	$('#leftTabs').css({'position': 'fixed'});
	}
	
	
}); //end resize
function showHideFinder(){ // funktion zum rein/rausfahren des Produktfinders

	if($('#leftTabFinderThird').css('display')=='block'){
	$('#leftTabFinderThird').animate({width:'hide'},400, function() {
	$('#leftTabFinderSecond').animate({width:'hide'},400, function() {
	$('#leftTabFinderSecond .closeThis').css({'display':'block'});															   
	$('#leftTabFinderFirst').animate({width:'hide'},400, function() {
		$('#leftTabFinderFirst .closeThis').css({'display':'block'});														  
		$('#leftTabFinder').animate({width:'hide'},0.5);													  
	 });														  
	 });
	 });
	}//end if
	else if($('#leftTabFinderSecond').css('display')=='block' && $('#leftTabFinderThird').css('display')=='none'){
	
	$('#leftTabFinderSecond').animate({width:'hide'},400, function() {
	$('#leftTabFinderSecond .closeThis').css({'display':'block'});															   
	$('#leftTabFinderFirst').animate({width:'hide'},400, function() {
		$('#leftTabFinderFirst .closeThis').css({'display':'block'});														  
		$('#leftTabFinder').animate({width:'hide'},0.5);													  
	 });														  
	 });
	
	}//end if
	else if($('#leftTabFinderFirst').css('display')=='block' && $('#leftTabFinderSecond').css('display')=='none'){
	
	$('#leftTabFinderSecond .closeThis').css({'display':'block'});															   
	$('#leftTabFinderFirst').animate({width:'hide'},400, function() {
		$('#leftTabFinderFirst .closeThis').css({'display':'block'});														  
		$('#leftTabFinder').animate({width:'hide'},0.5);													  
	 });														  
	
	}//end if
	else{
		$('#leftTabFinder').animate({width:'show'},1, function() {
			$('#leftTabFinderFirst').animate({width:'show'},400);												   
		 });													   
		}
	}// end function
function loadAjax(obj,page,param,w){
	// zeige preloader
	
	obj.html('<table id="ajaxPreloader"><tr><td><img src="/images/layout/ajax-loader.gif" width="66" height="66" ></td></tr></table>');	
	$.ajax({
   type: "POST",	   
   // url: 'inc/'+page+'.php?nav='+param+'',   
   url: '/'+page+'.php?'+param+'',   
   success: function(data) {
		//schreibe Inhalt nach Zeit x und loesche Loader	
		//window.setTimeout(function(){obj.html( data)}, 150);
		
			obj.html( data);
			
		
		
  }
  });
	}// end function
//funktionen fuer hoverintend (Hauptmenue)
function showmenu(){
	$('#navigationContentInner').show(300);
	}
	function hidemenu(){
	$('#navigationContentInner').hide(200);
	}
	

	
