/* ----------------------------------------  LOGO Slider ---------------------------------------------------------- */
//Rollover Logo
 $(document).ready(function(){
 $("img.vw").hover(
function() {
	stop_logo_slider();
	logoschalter = "off";
	 $(this).stop().animate({"opacity": "0"}, "slow");
},
function() {
	logoschalter = "on";
     $(this).stop().animate({"opacity": "1"}, "slow");
});
 
});

 $(document).ready(function(){
 $("img.audi").hover(
function() {
	stop_logo_slider();
	logoschalter = "off";
     $(this).stop().animate({"opacity": "0"}, "slow");
},
function() {
	logoschalter = "on";
     $(this).stop().animate({"opacity": "1"}, "slow");
});
 
});

 $(document).ready(function(){
 $("img.vwnfz").hover(
function() {
	stop_logo_slider();
	logoschalter = "off";
     $(this).stop().animate({"opacity": "0"}, "slow");
},
function() {
	logoschalter = "on";
     $(this).stop().animate({"opacity": "1"}, "slow");
});
 
});

 $(document).ready(function(){
 $("img.skoda").hover(
function() {
	stop_logo_slider();
	logoschalter = "off";
     $(this).stop().animate({"opacity": "0"}, "slow");
},
function() {
	logoschalter = "on";
     $(this).stop().animate({"opacity": "1"}, "slow");
});
 
});

 $(document).ready(function(){
 $("img.porsche").hover(
function() {
	stop_logo_slider();
	logoschalter = "off";
     $(this).stop().animate({"opacity": "0"}, "slow");
},
function() {
	logoschalter = "on";
     $(this).stop().animate({"opacity": "1"}, "slow");
});
 
});

 $(document).ready(function(){
 $("img.ford").hover(
function() {
	stop_logo_slider();
	logoschalter = "off";
     $(this).stop().animate({"opacity": "0"}, "slow");
},
function() {
	logoschalter = "on";
     $(this).stop().animate({"opacity": "1"}, "slow");
});
 
});

 $(document).ready(function(){
 $("img.volvo").hover(
function() {
    stop_logo_slider();
	logoschalter = "off";
     $(this).stop().animate({"opacity": "0"}, "slow");
},
function() {
	logoschalter = "on";
     $(this).stop().animate({"opacity": "1"}, "slow");
});
 
});

 $(document).ready(function(){
 $("img.kia").hover(
function() {
	stop_logo_slider();
	logoschalter = "off";
     $(this).stop().animate({"opacity": "0"}, "slow");
},
function() {
	logoschalter = "on";
     $(this).stop().animate({"opacity": "1"}, "slow");
});
 
});

 $(document).ready(function(){
 $("img.fordnfz").hover(
function() {
	stop_logo_slider();
	logoschalter = "off";
     $(this).stop().animate({"opacity": "0"}, "slow");
},
function() {
	logoschalter = "on";
     $(this).stop().animate({"opacity": "1"}, "slow");
});
 
});

function stop_logo_slider()
{
	 $("div#con_logoblock").stop();
	 $('#s3slider').stop();
	 $(".tooltipbox a img:first-child").css("opacity","1");
}

/* $(document).ready(function(){
 $("img.img1").hover(
function() {
 $(this).stop().animate({"opacity": "0"}, "slow");
},
function() {
 $(this).stop().animate({"opacity": "1"}, "slow");
});
 
});*/

// Foto einfaden

 $(document).ready(function() {
        var hide = false;
         $(".vwfade").hover(function(){
            if (hide) clearTimeout(hide);
             $("#vwfade").fadeIn();
        }, function() {
            hide = setTimeout(function() { $("#vwfade").fadeOut("slow");}, 250);
        });
         $("#vwfade").hover(function(){
            if (hide) clearTimeout(hide);
        }, function() {
            hide = setTimeout(function() { $("#vwfade").fadeOut("slow");}, 250);
        });
		 $("span.tooltip_vw").hover(function(){
            logoschalter = "off";
			 $(".tooltipbox a img.vw").stop().css("opacity","0");
			if (hide) clearTimeout(hide);
        }, function() {
			logoschalter = "on";
			 $(".tooltipbox a img.vw").stop().css("opacity","1");
            hide = setTimeout(function() { $("#vwfade").fadeOut("slow");}, 250);
        });

    });

 $(document).ready(function() {
        var hide = false;
         $(".audifade").hover(function(){
            if (hide) clearTimeout(hide);
             $("#audifade").fadeIn();
        }, function() {
            hide = setTimeout(function() { $("#audifade").fadeOut("slow");}, 250);
        });
         $("#audifade").hover(function(){
            if (hide) clearTimeout(hide);
        }, function() {
            hide = setTimeout(function() { $("#audifade").fadeOut("slow");}, 250);
        });
		 $("span.tooltip_audi").hover(function(){
            logoschalter = "off";
			 $(".tooltipbox a img.audi").stop().css("opacity","0");
			if (hide) clearTimeout(hide);
        }, function() {
			logoschalter = "on";
			 $(".tooltipbox a img.audi").stop().css("opacity","1");
            hide = setTimeout(function() { $("#audifade").fadeOut("slow");}, 250);
        });
    });
 $(document).ready(function() {
        var hide = false;
         $(".nfzfade").hover(function(){
            if (hide) clearTimeout(hide);
             $("#nfzfade").fadeIn();
        }, function() {
            hide = setTimeout(function() { $("#nfzfade").fadeOut("slow");}, 250);
        });
         $("#nfzfade").hover(function(){
            if (hide) clearTimeout(hide);
        }, function() {
            hide = setTimeout(function() { $("#nfzfade").fadeOut("slow");}, 250);
        });
		 $("span.tooltip_vwnfz").hover(function(){
            logoschalter = "off";
			 $(".tooltipbox a img.vwnfz").stop().css("opacity","0");
			if (hide) clearTimeout(hide);
        }, function() {
			logoschalter = "on";
			 $(".tooltipbox a img.vwnfz").stop().css("opacity","1");
            hide = setTimeout(function() { $("#nfzfade").fadeOut("slow");}, 250);
        });
    });

 $(document).ready(function() {
        var hide = false;
         $(".skodafade").hover(function(){
            if (hide) clearTimeout(hide);
             $("#skodafade").fadeIn();
        }, function() {
            hide = setTimeout(function() { $("#skodafade").fadeOut("slow");}, 250);
        });
         $("#skodafade").hover(function(){
            if (hide) clearTimeout(hide);
        }, function() {
            hide = setTimeout(function() { $("#skodafade").fadeOut("slow");}, 250);
        });
		 $("span.tooltip_skoda").hover(function(){
            logoschalter = "off";
			 $(".tooltipbox a img.skoda").stop().css("opacity","0");
			if (hide) clearTimeout(hide);
        }, function() {
			logoschalter = "on";
			 $(".tooltipbox a img.skoda").stop().css("opacity","1");
            hide = setTimeout(function() { $("#skodafade").fadeOut("slow");}, 250);
        });
    });
 $(document).ready(function() {
        var hide = false;
         $(".porschefade").hover(function(){
            if (hide) clearTimeout(hide);
             $("#porschefade").fadeIn();
        }, function() {
            hide = setTimeout(function() { $("#porschefade").fadeOut("slow");}, 250);
        });
         $("#porschefade").hover(function(){
            if (hide) clearTimeout(hide);
        }, function() {
            hide = setTimeout(function() { $("#porschefade").fadeOut("slow");}, 250);
        });
		 $("span.tooltip_porsche").hover(function(){
            logoschalter = "off";
			 $(".tooltipbox a img.porsche").stop().css("opacity","0");
			if (hide) clearTimeout(hide);
        }, function() {
			logoschalter = "on";
			 $(".tooltipbox a img.porsche").stop().css("opacity","1");
            hide = setTimeout(function() { $("#porschefade").fadeOut("slow");}, 250);
        });
    });

 $(document).ready(function() {
        var hide = false;
         $(".fordfade").hover(function(){
            if (hide) clearTimeout(hide);
             $("#fordfade").fadeIn();
        }, function() {
            hide = setTimeout(function() { $("#fordfade").fadeOut("slow");}, 250);
        });
         $("#fordfade").hover(function(){
            if (hide) clearTimeout(hide);
        }, function() {
            hide = setTimeout(function() { $("#fordfade").fadeOut("slow");}, 250);
        });
		 $("span.tooltip_ford").hover(function(){
            logoschalter = "off";
			$(".tooltipbox a img.ford").stop().css("opacity","0");
			if (hide) clearTimeout(hide);
        }, function() {
			logoschalter = "on";
			$(".tooltipbox a img.ford").stop().css("opacity","1");
            hide = setTimeout(function() {$("#fordfade").fadeOut("slow");}, 250);
        });
		$("span.tooltip_toefiford").hover(function(){
            logoschalter = "off";
			$(".tooltipbox a img.ford").stop().css("opacity","0");
			if (hide) clearTimeout(hide);
        }, function() {
			logoschalter = "on";
			$(".tooltipbox a img.ford").stop().css("opacity","1");
            hide = setTimeout(function() {$("#fordfade").fadeOut("slow");}, 250);
        });
    });
$(document).ready(function() {
        var hide = false;
        $(".volvofade").hover(function(){
            if (hide) clearTimeout(hide);
            $("#volvofade").fadeIn();
        }, function() {
            hide = setTimeout(function() {$("#volvofade").fadeOut("slow");}, 250);
        });
        $("#volvofade").hover(function(){
            if (hide) clearTimeout(hide);
        }, function() {
            hide = setTimeout(function() {$("#volvofade").fadeOut("slow");}, 250);
        });
		$("span.tooltip_volvo").hover(function(){
            logoschalter = "off";
			$(".tooltipbox a img.volvo").stop().css("opacity","0");
			if (hide) clearTimeout(hide);
        }, function() {
			logoschalter = "on";
			$(".tooltipbox a img.volvo").stop().css("opacity","1");
            hide = setTimeout(function() {$("#volvofade").fadeOut("slow");}, 250);
        });
		$("span.tooltip_toefivolvo").hover(function(){
            logoschalter = "off";
			$(".tooltipbox a img.volvo").stop().css("opacity","0");
			if (hide) clearTimeout(hide);
        }, function() {
			logoschalter = "on";
			$(".tooltipbox a img.volvo").stop().css("opacity","1");
            hide = setTimeout(function() {$("#volvofade").fadeOut("slow");}, 250);
        });
    });

$(document).ready(function() {
        var hide = false;
        $(".kiafade").hover(function(){
            if (hide) clearTimeout(hide);
            $("#kiafade").fadeIn();
        }, function() {
            hide = setTimeout(function() {$("#kiafade").fadeOut("slow");}, 250);
        });
        $("#kiafade").hover(function(){
            if (hide) clearTimeout(hide);
        }, function() {
            hide = setTimeout(function() {$("#kiafade").fadeOut("slow");}, 250);
        });
		$("span.tooltip_kia").hover(function(){
            logoschalter = "off";
			$(".tooltipbox a img.kia").stop().css("opacity","0");
			if (hide) clearTimeout(hide);
        }, function() {
			logoschalter = "on";
			$(".tooltipbox a img.kia").stop().css("opacity","1");
            hide = setTimeout(function() {$("#kiafade").fadeOut("slow");}, 250);
        });
		$("span.tooltip_toefikia").hover(function(){
            logoschalter = "off";
			$(".tooltipbox a img.kia").stop().css("opacity","0");
			if (hide) clearTimeout(hide);
        }, function() {
			logoschalter = "on";
			$(".tooltipbox a img.kia").stop().css("opacity","1");
            hide = setTimeout(function() {$("#kiafade").fadeOut("slow");}, 250);
        });
    });

$(document).ready(function() {
        var hide = false;
        $(".fordnfzfade").hover(function(){
            if (hide) clearTimeout(hide);
            $("#fordnfzfade").fadeIn();
        }, function() {
            hide = setTimeout(function() {$("#fordnfzfade").fadeOut("slow");}, 250);
        });
        $("#fordnfzfade").hover(function(){
            if (hide) clearTimeout(hide);
        }, function() {
            hide = setTimeout(function() {$("#fordnfzfade").fadeOut("slow");}, 250);
        });
		$("span.tooltip_fordnfz").hover(function(){
            logoschalter = "off";
			$(".tooltipbox a img.fordnfz").stop().css("opacity","0");
			if (hide) clearTimeout(hide);
        }, function() {
			logoschalter = "on";
			$(".tooltipbox a img.fordnfz").stop().css("opacity","1");
            hide = setTimeout(function() {$("#fordnfzfade").fadeOut("slow");}, 250);
        });
		$("span.tooltip_toefifordnfz").hover(function(){
            logoschalter = "off";
			$(".tooltipbox a img.fordnfz").stop().css("opacity","0");
			if (hide) clearTimeout(hide);
        }, function() {
			logoschalter = "on";
			$(".tooltipbox a img.fordnfz").stop().css("opacity","1");
            hide = setTimeout(function() {$("#fordnfzfade").fadeOut("slow");}, 250);
        });
    });

//---------------------- Colorbox Toefi ------------------------------------------------------------------------------------------- 
 $(document).ready(function() {
 //Examples of how to assign the ColorBox event to elements
                $("a[rel='example1']").colorbox();
                $("a[rel='example2']").colorbox({transition:"fade"});
                $("a[rel='example3']").colorbox({transition:"none", width:"75%", height:"75%"});
                $("a[rel='example4']").colorbox({width:"80%", height:"80%", slideshow:true});
                $(".single").colorbox({}, function(){});
                $(".colorbox").colorbox();
                $(".youtube").colorbox({iframe:true, width:800, height:500});
                $(".iframe").colorbox({width:"80%", height:"80%", iframe:true});
                $(".iframehoch").colorbox({width:"40%", height:"80%", iframe:true});
                $(".inline").colorbox({width:"50%", inline:true, href:"#inline_example1"});
                
 //Example of preserving a JavaScript event for inline calls.
                $("#click").click(function(){ 
                    $('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
                    return false;
                });

// ---------------------- Video Links Youtube ------------------------------------------------------ 
$("ul li#video a").toggle(function(){
        $(this).addClass("active");
        }, function () {
         $(this).removeClass("active");         
	});

  $("ul li#video ul").hide();
  //Slide up and down on click
	$("ul li#video a").click(function(){
        $(this).next("ul li#video ul").slideToggle("slow");
        return false;
        });

//--------------- ASP --------------------------------------------------------------------------- 

// Toefi Gesamt
$('#ajax').html('<img class="load-image" src="fileadmin/templates/pagetemplate/images/ajax-loader.gif" alt="">');
$('#ajax').load('http://www.toefi.de/index.php?id=1794 div.loader', function() {
  $('div.loader').css({ opacity: 0 }).fadeTo(100,1);});

// Ajax Loading VW ASP
function vw_ajax_request(){
  $('#vw-ajax').html('<img class="load-image" src="fileadmin/templates/pagetemplate/images/ajax-loader.gif" alt="">');
  $('#vw-ajax').load('http://www.toefi.de/index.php?id=1874 div.loader', function() {
  $('div.loader').css({ opacity: 0 }).fadeTo(100,1);});}
  
$(vw_ajax_request());

// Ajax Loading Audi ASP
function audi_ajax_request(){
  $('#audi-ajax').html('<img class="load-image" src="fileadmin/templates/pagetemplate/images/ajax-loader.gif" alt="">');
  $('#audi-ajax').load('http://www.toefi.de/index.php?id=1875 div.loader', function() {
  $('div.loader').css({ opacity: 0 }).fadeTo(100,1);});}

$(audi_ajax_request());

// Autohaus Link Gesamt
$('#ajax2').html('<img class="load-image" src="fileadmin/templates/pagetemplate/images/ajax-loader.gif" alt="">');
$('#ajax2').load('http://www.autohauslink.de/index.php?id=1859 div.loader', function() {
  $('div.loader').css({ opacity: 0 }).fadeTo(100,1);});


// Ajax Loading Ford ASP
function ford_ajax_request(){
  $('#ford-ajax').html('<img class="load-image" src="fileadmin/templates/pagetemplate/images/ajax-loader.gif" alt="">');
  $('#ford-ajax').load('http://www.autohauslink.de/index.php?id=1876 div.loader', function() {
  $('div.loader').css({ opacity: 0 }).fadeTo(100,1);});}

$(ford_ajax_request());

//--- Ajax Loader -------------------------
$('div.loader') 
    .livequery(function(){ 
    // use the helper function after dom first load 
    //$('div.loader').css({ opacity: 0 }).fadeTo(1000,1);
    $("ul.aspnav").accordions({   
		accordions:true,
		speed: 500
 });

$("ul.aspnav li ul li ul li").accordions({
		accordions:false,
		speed: 500
	});
    
//Switch the "Open" and "Close" state per click
	$("ul.aspnav p.contactbtn").toggle(function(){
        $(this).addClass("active");
        }, function () {
         $(this).removeClass("active");
	});

  //Slide up and down on click
	$("ul.aspnav p.contactbtn").click(function(){
        $(this).next("div.phonemail").slideToggle("slow");
        return false;
        });      
}); 
  
//--- ASP ohne Ajax Loader ------------------------------------
$("ul.aspnav").accordions({
		accordions:true,
		speed: 500
 });

$("ul.aspnav li ul li ul li").accordions({
		accordions:false,
		speed: 500
	});
  
  //Switch the "Open" and "Close" state per click
	$("ul.aspnav p.contactbtn").toggle(function(){
        $(this).addClass("active");
        }, function () {
         $(this).removeClass("active");
	});

  //Slide up and down on click
	$("ul.aspnav p.contactbtn").click(function(){
        $(this).next("div.phonemail").slideToggle("slow");
        return false;
        });  

 // VW Golf Fix Autodo V.1.0
/*
$("select#marke option:selected").livequery(function(){
var marke = $("select#marke option:selected").val();
//alert(marke);
//alert($("select#marke option:selected").val());
if(marke == "vow"){  
 $("select#modelle option:eq(1)").remove();
 $("<option/>").val("golf").text("Golf").appendTo("select#modelle");
 $('#modelle').sortOptionsByText();
} 

});
*/

$('.boxgrid.slidedown').hover(function(){
					$(".cover", this).stop().animate({top:'-260px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
				});
				//Horizontal Sliding
				$('.boxgrid.slideright').hover(function(){
					$(".cover", this).stop().animate({left:'325px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
				});
				//Diagnal Sliding
				$('.boxgrid.thecombo').hover(function(){
					$(".cover", this).stop().animate({top:'260px', left:'325px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'0px', left:'0px'},{queue:false,duration:300});
				});
				//Partial Sliding (Only show some of background)
				$('.boxgrid.peek').hover(function(){
					$(".cover", this).stop().animate({top:'90px'},{queue:false,duration:500});
				}, function() {
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:500});
				});
				//Full Caption Sliding (Hidden to Visible)
				$('.boxgrid.captionfull').hover(function(){
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:300});
				});
				//Caption Sliding (Partially Hidden to Visible)
				$('.boxgrid.caption').hover(function(){
					$(".cover", this).stop().animate({top:'60px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'135px'},{queue:false,duration:160});
				});
				
				// Mitarbeiterslider
				
				if ($('body').find('#ajax')) {
        $("div.colleft_box.slider").hide().fadeIn(1400);
        $('div.colleft_box.slider .cover').delay(1800).animate({top:'-=20px'},2000 );				
				$("div.colleft_box.slider ").attr('title', 'unser Mitarbeiter stellt sich vor');
				
        } else {
				$('div.colleft_box.slider .cover').animate({top:'-=20px'},2000 );				
				$("div.colleft_box.slider ").attr('title', 'unser Mitarbeiter stellt sich vor');
				};
				
				$('div.colleft_box.slider').hover(function(){
					$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'180px'},{queue:false,duration:300});
				});
				
				
				
        //Caption Kategorie Big Picture
				$('div.boxgrid-full .boxcaption').animate({top:'-=60px'},3000 );





// End document.ready       
}); 
