jQuery.noConflict();

function closeAllNav() {
	jQuery(".submenu1").slideUp('fast');
	jQuery(".submenu2").slideUp('fast');
	jQuery(".submenu3").slideUp('fast');
	jQuery(".submenu4").slideUp('fast');
	jQuery(".submenu5").slideUp('fast');
	jQuery(".submenu6").slideUp('fast');
//jQuery(actDDmenu).addClass('active');
//  if(actDDmenu) {
//	jQuery(actDDmenu + ' IMG.marrow').fadeIn('fast');
//  }
}

jQuery(document).ready(function(){    

var actDDmenu = jQuery('.submenuCur').parent().parent().parent().attr('class');
if(actDDmenu) {
	actDDmenu = '.menu' + actDDmenu.substr(7,1);
	jQuery(actDDmenu + ' IMG.marrow').fadeIn('fast');
}

	jQuery(".mainmenu").mouseleave(function(){ 
		closeAllNav();
		jQuery("#topNav div").removeClass('active');
		jQuery(".mainmenu").animate({height: '52'}, 500);
		jQuery("#topNav .marrow").fadeOut('fast');
		if(actDDmenu) {
		  jQuery(actDDmenu + ' IMG.marrow').fadeIn('fast');
		}
	}); 
	jQuery(".mainmenu").mouseenter(function(){ 
		jQuery(".mainmenu").animate({height: '138'}, 500);
	});
	jQuery("#topNav div").mouseenter(function(){
		closeAllNav();
		var itemCLASS = '.' + jQuery(this).attr('class');
		var itemID = jQuery(this).attr('class');
        itemID = itemID.substr(itemID.length-1, 1);
        jQuery("#topNav div").removeClass('active');
        jQuery(itemCLASS).addClass('active');
        jQuery("#topNav .marrow").fadeOut('fast');
        jQuery(itemCLASS + " .marrow").fadeIn('fast');
        jQuery("#submenu .submenu" + itemID).slideDown('slow');
	});
	
    jQuery(".loginarrow").click(function(event){
        event.preventDefault();
        if (jQuery(".loginarrow").css("background-image") == 'url("http://q-ergo.dcn.de/fileadmin/filestore-qergo/res-qergo/images/larrow.png")' || jQuery(".loginarrow").css("background-image") == 'url(http://q-ergo.dcn.de/fileadmin/filestore-qergo/res-qergo/images/larrow.png)')
            jQuery(".loginarrow").css("background-image", "url(/fileadmin/filestore-qergo/res-qergo/images/larrowactive.png)");
        else
            jQuery(".loginarrow").css("background-image", "url(/fileadmin/filestore-qergo/res-qergo/images/larrow.png)");
        jQuery(".loginactive").slideToggle("slow");    
    });
    jQuery(".headmenu .last a").click(function(event){
        event.preventDefault();
        if (jQuery(".loginarrow").css("background-image") == 'url("http://q-ergo.dcn.de/fileadmin/filestore-qergo/res-qergo/images/larrow.png")' || jQuery(".loginarrow").css("background-image") == 'url(http://q-ergo.dcn.de/fileadmin/filestore-qergo/res-qergo/images/larrow.png)')
            jQuery(".loginarrow").css("background-image", "url(/fileadmin/filestore-qergo/res-qergo/images/larrowactive.png)");
        else
            jQuery(".loginarrow").css("background-image", "url(/fileadmin/filestore-qergo/res-qergo/images/larrow.png)");
        jQuery(".loginactive").slideToggle("slow");    
    });
    jQuery(".langtextimg a").click(function(event){
        event.preventDefault();
        if (jQuery(".langarrow").attr('src') == "fileadmin/filestore-qergo/res-qergo/images/langarrow.png")
            jQuery(".langarrow").attr('src', "fileadmin/filestore-qergo/res-qergo/images/langarrowactive.png");
        else if (jQuery(".langarrow").attr('src') == "fileadmin/filestore-qergo/res-qergo/images/langarrowactive.png")
            jQuery(".langarrow").attr('src', "fileadmin/filestore-qergo/res-qergo/images/langarrow.png");
        jQuery(".langactive").slideToggle("slow");    
    });
    jQuery(".idt1").click(function(event){
        event.preventDefault();
        //jQuery(this).parent().parent().parent().find('.dtcoltext2').slideToggle("slow");
        //jQuery(this).parent().parent().parent().find('.idtfull1').slideToggle("slow");  
        jQuery('.dtcoltext2').slideToggle("slow");
        jQuery('.idtfull1').slideToggle("slow");   
    });
    jQuery(".scrollboximg").click(function(event){
        event.preventDefault();
        if (jQuery(this).find('img').attr('src') == "fileadmin/filestore-qergo/res-qergo/images/dtarrow.png")
            jQuery(this).find('img').attr('src', "fileadmin/filestore-qergo/res-qergo/images/dtarrowup.png");
        else if (jQuery(this).find('img').attr('src') == "fileadmin/filestore-qergo/res-qergo/images/dtarrowup.png")
            jQuery(this).find('img').attr('src', "fileadmin/filestore-qergo/res-qergo/images/dtarrow.png");
        jQuery(this).parent().parent().find('.scrollboxtext').slideToggle("slow");
        if (jQuery(this).parent().hasClass('active'))
            jQuery(this).parent().removeClass("active");
        else
            jQuery(this).parent().addClass("active");  
    });
    jQuery(".headscrollimg a").eq(0).click(function(event){
        event.preventDefault();
        if (jQuery(this).parent().find(".headarrow").attr('src') == "fileadmin/filestore-qergo/res-qergo/images/headarrow.png")
            jQuery(this).parent().find(".headarrow").attr('src', "fileadmin/filestore-qergo/res-qergo/images/headarrowactive.png");
        else if (jQuery(this).parent().find(".headarrow").attr('src') == "fileadmin/filestore-qergo/res-qergo/images/headarrowactive.png")
            jQuery(this).parent().find(".headarrow").attr('src', "fileadmin/filestore-qergo/res-qergo/images/headarrow.png");
        jQuery(this).parent().parent().find(".scrollheaduptext").slideToggle("fast");  
    });
    jQuery(".headscrollimg a").eq(1).click(function(event){
        event.preventDefault();
        if (jQuery(this).parent().find(".headarrow").attr('src') == "fileadmin/filestore-qergo/res-qergo/images/headarrow.png")
            jQuery(this).parent().find(".headarrow").attr('src', "fileadmin/filestore-qergo/res-qergo/images/headarrowactive.png");
        else if (jQuery(this).parent().find(".headarrow").attr('src') == "fileadmin/filestore-qergo/res-qergo/images/headarrowactive.png")
            jQuery(this).parent().find(".headarrow").attr('src', "fileadmin/filestore-qergo/res-qergo/images/headarrow.png");
        jQuery(this).parent().parent().find(".scrollheaduptext").slideToggle("fast");  
        setTimeout('window.scroll(0,document.body.scrollHeight);',800);
    });
    jQuery(".flogos").mouseover(function(){
        jQuery(".flmenu").show();    
    }).mouseout(function(){
        jQuery(".flmenu").hide();
    });
    jQuery(".flogos1").mouseover(function(){
        jQuery(".flmenu1").show();    
    }).mouseout(function(){
        jQuery(".flmenu1").hide();
    });
    //new js code
    jQuery(".ddlink a").click(function(event){
        event.preventDefault();
        jQuery('.branchedditems').slideToggle("slow");  
    });
    jQuery(".ddlinkber a").click(function(event){
        event.preventDefault();
        jQuery('.berdditems').slideToggle("slow");  
    });
    jQuery(".ddlinkbet a").click(function(event){
        event.preventDefault();
        jQuery('.betdditems').slideToggle("slow");  
    });
    jQuery(".dditemrow a").click(function(event){
        event.preventDefault();
        var theclass = jQuery(this).attr("class");
        if (jQuery(this).find('img').attr('src') == "fileadmin/filestore-qergo/res-qergo/images/ddplus.png")
            jQuery(this).find('img').attr('src', "fileadmin/filestore-qergo/res-qergo/images/ddminus.png");
        else if (jQuery(this).find('img').attr('src') == "fileadmin/filestore-qergo/res-qergo/images/ddminus.png")
            jQuery(this).find('img').attr('src', "fileadmin/filestore-qergo/res-qergo/images/ddplus.png");
        jQuery('.dwnTbl').find('.' + theclass).slideToggle("slow");  
    });
    
    jQuery(".dwnTbl button").click(function(event){
        event.preventDefault();
        jQuery("#c154 .scsmallholder").hide("fast");
        jQuery('.scsmallbody .scbody').each(function(index) {
            jQuery(this).hide("fast");    
        });
        jQuery('.berater .scheader').hide("fast");
    });
    jQuery(".dwnTbl button").click(function(event){
        event.preventDefault();
        jQuery('.scsmallbody .scbody').each(function(index) {
            var cobject = jQuery(this);
            jQuery('.b1content div').each(function(index) {
                if (jQuery(this).css("display") == "block" && cobject.hasClass(jQuery(this).attr("class"))) {
                    jQuery("#c154 .scsmallholder").show("fast");
                    cobject.show("slow");   
                    jQuery('.berater .scheader').show("fast");    
                }
            });
            jQuery('.b2content div').each(function(index) {
                if (jQuery(this).css("display") == "block" && cobject.hasClass(jQuery(this).attr("class"))) {
                    jQuery("#c154 .scsmallholder").show("fast");
                    cobject.show("slow");  
                    jQuery('.berater .scheader').show("fast"); 
                }     
            });
            jQuery('.b3content div').each(function(index) {
                if (jQuery(this).css("display") == "block" && cobject.hasClass(jQuery(this).attr("class"))) {
                    jQuery("#c154 .scsmallholder").show("fast");
                    cobject.show("slow");     
                    jQuery('.berater .scheader').show("fast");   
                }
            });
        });

    });
    jQuery(".bersubmit").click(function(event){
        event.preventDefault();
        jQuery("#c154 .scsmallholder").hide("fast");
        jQuery('.scsmallbody .scbody').each(function(index) {
            jQuery(this).hide("fast");    
        });
        jQuery('.berater .scheader').hide("fast");
        jQuery('.scsmallbody .scbody').each(function(index) {
            var cobject = jQuery(this);
            if (cobject.hasClass(jQuery('.searchdivber .searchtext').val())) {
                jQuery("#c154 .scsmallholder").show("fast");
                cobject.show("slow");     
                jQuery('.berater .scheader').show("fast");    
            }  
        });
    });
    jQuery(".scbmap area").click(function(event){
        event.preventDefault();
        jQuery("#c154 .scsmallholder").hide("fast");
        jQuery('.scsmallbody .scbody').each(function(index) {
            jQuery(this).hide("fast");    
        });
        var theclass = jQuery(this).attr("class");
        
        jQuery('.berater .scsmallbody div').each(function(index) {
            if (jQuery(this).attr("id") == theclass) {
                jQuery("#c154 .scsmallholder").show("fast");
                jQuery(this).find(".scbody").show("fast");
                jQuery(this).parent().find(".scheader").show("fast");
            }   
        });
    });
});  

