$(document).ready(function() {
	var slideShowTime = 6000;
	slideShowTimeFade = 4000;
	contactForm();
        /*var actualURL = document.URL;
        actualURL.search(/aktuelles.html/);
        if (actualURL.search(/aktuelles.html/)!=-1) {
            $(".news-catmenu news-catmenu-NO:first-child").addClass("news-catmenu-ACT");
           
        }
        */
	if (parseInt($('#eyecatcher IMG').size()) >= 2) {
                $("#eyecatcher IMG").css({opacity:0.0});
		$('#eyecatcher IMG:first-child').addClass("active").css({opacity:1});
		setInterval( "slideSwitch()",  slideShowTime);
	}

        if(parseInt($("#showroom-left-content .csc-textpic-imagecolumn li img").size()) >=2) {
            $("#showroom-left-content .csc-textpic-imagecolumn img").css({opacity:0.0});
            $("#showroom-left-content .csc-textpic-imagecolumn li:first-child").addClass("active");
            $("#showroom-left-content .csc-textpic-imagecolumn .active img").css({opacity:1});
            if (jQuery.browser.msie && parseInt(jQuery.browser.version)) {
               //$("#showroom-left-content .csc-textpic-imagecolumn .active img").css({width:"550px" });
            }
            setInterval( "categorySwitch()",  slideShowTime);
            
        }
});
function slideSwitch() {
	
    var $active = $('#eyecatcher IMG.active');
	$active.next().length == 0 ? $next = $('#eyecatcher IMG:first-child'): $next = $active.next();
	$active.addClass('last-active');
	$next.css({opacity : 0.0}).addClass('active').animate({opacity: 1.0},slideShowTimeFade, function () {
		$active.removeClass('active last-active');
	});
    
}
function categorySwitch() {
    
    var $active = $("#showroom-left-content .csc-textpic-imagecolumn li.active");
	$active.next().length == 0 ? $next = $('#showroom-left-content .csc-textpic .csc-textpic-imagecolumn li:first-child'): $next = $active.next();
	$active.addClass('last-active');
        $next.children("img").css({opacity : 0.0}).parent().addClass('active').children("img").animate({opacity: 1.0},slideShowTimeFade, function () {
		$active.removeClass('active last-active');
	});

}


function contactForm() {
	$("#content-top #mailform").parent().hide();
	$("#content-top #mailform").parent().before("<a href='#' id='contact-link'>Kontaktieren Sie uns</a>");
	$("#contact-link").toggle(	function () {
											$("#contact-link").text("Schließen");
											//$("#content-bottom").css({marginTop: "-10px"});
											$("#content-bottom").animate({marginTop: "+=70"});
											}, 
									function () {
												$("#contact-link").text("Kontaktieren Sie uns");
												$("#content-bottom").animate({marginTop: "-=70"});
												}
									);
	$("#contact-link").click(function () {
		$("#mailform").parent().slideToggle("slow"); 
		this.blur();
		return false;
	});
}