/*
 * Common jQuery Events
 */

// Effekt, ausser bei IE  
var showHide="";

// Timer
var autoplayinterval=4500;
var firstOpendMultiAccordion=0;
var lightBoxFix=0; // set to zero for variable window position

function isOldIE() {
	var browserVersion = navigator.appVersion.toLowerCase();
	var isIE8 = (browserVersion.search(/msie 8/) != -1);
	return jQuery.browser.msie && !isIE8 && parseInt(jQuery.browser.version) < 7;
}

// Top Layer (stati: 0=start, -1=busy animation, 1=menu1activ, ...
var statusMenu=0;
function refreshTransparent() {
	if (isOldIE()) {
		if(typeof(jQuery().ifixpng) == "function") jQuery(".transparent").ifixpng();
	}
}

// Formulare im iFrame
function initiframecontainer(gourl) {
	var xheight=isOldIE() ? 1200:600
	jQuery('#lightbox-nav-btnaPrev, #lightbox-nav-btnaNext').hide();
	jQuery("#quickform-overlay").show();
	jQuery("#lightbox-container-image-container").html('<iframe  src="'+gourl+'" frameborder="0"  marginwidth="0"  marginheigth="0" margintop="0"  marginLeft="0" width="530" height="'+xheight+'"  name="iframequickform" id="iframequickform"></iframe>');
	jQuery('#lightbox-container-image-box').height(xheight+50+73); /* war 50 */
	jQuery('#lightbox-container-image-box, #lightbox-bottom').width(570);
	jQuery('#lightbox-loading').hide();
	jQuery('#lightbox-bottom').show();
	window.setTimeout("jQuery('#lightbox-loading').hide();",1000);
	return false;
}

function initiframecontainerex(gourl, ww, hh,thistit) {
	var xheight=isOldIE() ? hh*2:hh
	jQuery('#lightbox-nav-btnaPrev, #lightbox-nav-btnaNext').hide();
	if(jQuery('#lbtitel').length==0) {
	   jQuery('.lboxlogo').after('<div id="lbtitel" style="text-align: left; position:relative;left:110px;top:55px;font-weight:bold;font-size:14px;">'+thistit+'</div>');
    }
    else {
        jQuery('#lbtitel').text(thistit);
    }
	jQuery("#quickform-overlay").show();
	jQuery("#lightbox-container-image-container").html('<iframe  src="'+gourl+'" frameborder="0"  marginwidth="0"  marginheigth="0" margintop="0"  marginLeft="0" width="' + ww + '" height="' + xheight + '"  name="iframequickform" id="iframequickform"></iframe>');
	jQuery('#lightbox-container-image-box').height(xheight+50+73);
	jQuery('#lightbox-container-image-box, #lightbox-bottom').width(ww+40);
	jQuery('#lightbox-loading').hide();
	jQuery('#lightbox-bottom').show();
	window.setTimeout("jQuery('#lightbox-loading').hide();",1000);
	return false;
}

// Formulare im iFrame
function initiframecontainernews(gourl) {
	if(isOldIE()) {
		window.open(gourl,"popup","height=600,width=800,scrollbars=auto");
		jQuery("#lightbox-top-close").click();
	} else {
		var xheight=600;
		jQuery('#lightbox-nav-btnaPrev, #lightbox-nav-btnaNext').hide();
		jQuery("#quickform-overlay").show();
		jQuery("#lightbox-container-image-container").html('<iframe  src="'+gourl+'" frameborder="0"  marginwidth="0"  marginheigth="0" margintop="0"  marginLeft="0" width="800" height="'+xheight+'"  name="iframequickform" id="iframequickform"></iframe>');
		jQuery('#lightbox-container-image-box').height(xheight+50+73); /* war 50 */
		jQuery('#lightbox-container-image-box, #lightbox-bottom').width(840);
		jQuery('#lightbox-loading').hide();
		jQuery('#lightbox-bottom').show();
		window.setTimeout("jQuery('#lightbox-loading').hide();",1000);
		return false;
	} // if
}


function closeiframecontainer() {
	jQuery("#lightbox-top-close").click();
	return false;
}

function menuActionEnterPlain() {
	if(-1 == statusMenu) return jQuery;
	jQuery(".menulayer, .menulayertxt").hide();
	statusMenu=2;
}

//multiaccordion - alle oeffnen / schliessen
var notactoggle=false;
function toggleall() {  
	if(toggleall.arguments.length > 2) {
		var t=jQuery("#"+toggleall.arguments[0]).text();
		tneu=(t==toggleall.arguments[1]) ? toggleall.arguments[2]:toggleall.arguments[1];
		jQuery("#"+toggleall.arguments[0]).text(tneu);
	}
	notactoggle=(!notactoggle);
	for(i=0; i<jQuery(jQuery("#multiaccordion").find("h3")).length; i++) {
		jQuery(jQuery("#multiaccordion").find("h3")[i]).toggleClass("ui-accordion-header-active",notactoggle)
			.toggleClass("ui-state-active",notactoggle).toggleClass("ui-state-default",!notactoggle).toggleClass("ui-corner-bottom",!notactoggle)
			.find("> .ui-icon").toggleClass("ui-icon-triangle-1-e",notactoggle).toggleClass("ui-icon-triangle-1-s",!notactoggle)
			.end().next().toggleClass("ui-accordion-content-active").toggle(notactoggle);
	}
}

function ajaxFilterMV() {
	var data = {};
	jQuery("#ffilter input[type='hidden']").each(function(i) {
		var k = jQuery(this).attr('name');
		var v = jQuery(this).val();
		data[k] = v;
//						alert('text ' + k + '=' + v);
	});
	jQuery("#ffilter select").each(function(i) {
		var k = jQuery(this).attr('name');
		var v = jQuery(this).val();
		data[k] = v;
//						alert('select ' + k + '=' + v);
	});
	jQuery("#ffilter :checked").each(function(i) {
		var k = jQuery(this).attr('name');
		var v = 1;
		data[k] = v;
//						alert('checked ' + k + '=' + v);
	});
	var x = jQuery.post("/php/modelgroupsmenu/v3_filter_modelversion_ajax.php", data, function(cbdata) {
		jQuery("#mvfajax").html(cbdata);
		jQuery("#ffilter select").bind("change", function() {
			ajaxFilterMV();
			return false;
		});
	}, "html");
}


// Start onReady usw.  
jQuery.noConflict();


function readyforall() {
	 if(typeof(jQuery().ifixpng) == "function") jQuery.ifixpng('/js/pixel.gif');

	if(jQuery.browser.msie) showHide='';

	var accordionAnim='slide';
	if(isOldIE()) accordionAnim=false;

	// Accordion
	var accOpts = {
		header: "h3",
		autoHeight: false,
		collapsible: true,
		active: false
	}; // accOpts
	if(jQuery("#accordion").accordion) {
	jQuery("#accordion").accordion(accOpts);
	jQuery("#accordion.datatable").accordion('option', 'change', function(ev,ui) {
			var newTab = jQuery(ui.newContent).parent().attr("id");
			if(newTab) {
				jQuery("#" + newTab + " img[title]").attr('src', function(arr) { return jQuery(this).attr('title'); }).removeAttr('title');
				printParams.acsgroup_id = newTab.substr(3);
				var sTmp = jQuery.param(printParams);
				t=jQuery("#printPDF").attr("href");
				printurl=(t.indexOf("pdf_acc_car")>0) ?'/php/print/pdf_acc_car.php?':'/php/print/pdf_acc_mc.php?';
				
				jQuery("#printPDF").attr('href', printurl + sTmp);
				jQuery.scrollTo("#"+newTab+"Group");
				jQuery.scrollTo("#mvinfo");
				jQuery("#printPDF").show();
			} else {
				jQuery("#printPDF").hide();
			  jQuery.scrollTo("#mvinfo");
			} // if
		});
	jQuery("#accordion").accordion('option', 'animated', accordionAnim);
}

	// Multiaccordion
	jQuery("#multiaccordion").addClass("ui-accordion ui-widget ui-helper-reset")
		.find("h3")
			.addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom")
			.prepend('<span class="ui-icon ui-icon-triangle-1-e"/>')
			.click(function() {
			    if(accordionAnim) 
				jQuery(this).toggleClass("ui-accordion-header-active").toggleClass("ui-state-active")
					.toggleClass("ui-state-default").toggleClass("ui-corner-bottom")
				.find("> .ui-icon").toggleClass("ui-icon-triangle-1-e").toggleClass("ui-icon-triangle-1-s")
				.end().next().toggleClass("ui-accordion-content-active").slideToggle("fast");
                else
                jQuery(this).toggleClass("ui-accordion-header-active").toggleClass("ui-state-active")
				.toggleClass("ui-state-default").toggleClass("ui-corner-bottom")
				.find("> .ui-icon").toggleClass("ui-icon-triangle-1-e").toggleClass("ui-icon-triangle-1-s")
				.end().next().toggleClass("ui-accordion-content-active").toggle();

				return false;
			})
			.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").hide();

// first opened multiaccordion
   if(jQuery("#multiaccordion").find("h3")[firstOpendMultiAccordion])
	jQuery(jQuery("#multiaccordion").find("h3")[firstOpendMultiAccordion]).toggleClass("ui-accordion-header-active").toggleClass("ui-state-active")
		.toggleClass("ui-state-default").toggleClass("ui-corner-bottom")
		.find("> .ui-icon").toggleClass("ui-icon-triangle-1-e").toggleClass("ui-icon-triangle-1-s")
		.end().next().toggleClass("ui-accordion-content-active").toggle();


// first opened accordion
//	jQuery(jQuery("#accordion").find("h3")[0]).toggleClass("ui-state-default").find(">.ui-icon").end().next().toggleClass("ui-accordion-content-active").toggle();

            
//                jQuery("#multiaccordion").accordion('option', 'collapsible', true);
//                jQuery("#multiaccordion").accordion('option', 'animated', accordionAnim);

				// Tabs

if(jQuery('#tabs').tabs) {
				 jQuery('#tabs').tabs();
}

				// Bereich
				jQuery('#topselect a').mouseenter(function() {
					jQuery("#menulayersuche").hide();
					jQuery("#suche").show();
  			        jQuery("#topselect").hide();
  		    	    if (isOldIE()) {
					  jQuery("#topselectactiv").show();
  		    	    } else {
					  jQuery("#topselectactiv").slideDown("fast");
				    }
                    
				});
				jQuery("#topselectactiv").mouseleave(function() {
			        jQuery("#topselect").show();
  		    	    if (isOldIE()) {
					  jQuery(this).hide();
  		    	    } else {
					  jQuery(this).slideUp("fast");
				   }
				});
				jQuery('#topselectclose').mouseenter(function() {
  			        jQuery("#topselect").show();
  		    	    if (isOldIE()) {
					  jQuery("#topselectactiv").hide();
  		    	    } else {
					  jQuery("#topselectactiv").slideUp("fast");
				    }
				});

				// Lightbox
if(jQuery('a[rel="lightbox"], form[rel="lightbox"]').lightBox) {				
				jQuery('a[rel="lightbox"], form[rel="lightbox"]').lightBox();
}				

jQuery("a.view3d").click(function() {
	var adr=jQuery(this).attr('href');
	var params=jQuery(this).attr('rev');
	var w=790;
	var h=500;
	var tmp=params.match(/width=(\d+)/);
	if(tmp) {
		w=parseInt(tmp[1]);
	} // if
	var tmp=params.match(/height=(\d+)/);
	if(tmp) {
		h=parseInt(tmp[1]);
	} // if

	jQuery('#lightbox-nav-btnaPrev, #lightbox-nav-btnaNext').hide();
	jQuery("#quickform-overlay").show();
	jQuery("#lightbox-container-image-container").html('<iframe  src="'+adr+'" frameborder="0"  marginwidth="0" marginheigth="0" margintop="0"  marginLeft="0" width="'+w+'" height="'+h+'" name="iframequickform" id="iframequickform" style="overflow: hidden"></iframe>');
	jQuery('#lightbox-container-image-box').height(h+50+73);
	jQuery('#lightbox-container-image-box, #lightbox-bottom').width(w+40);
	jQuery('#lightbox-loading').hide();
	jQuery('#lightbox-bottom').show();
});

jQuery("a.energylabel").click(function() {
	var adr=jQuery(this).attr('rev');
	var w=420;
	var h=535;

	jQuery('#lightbox-nav-btnaPrev, #lightbox-nav-btnaNext').hide();
	jQuery("#quickform-overlay").show();
	jQuery("#lightbox-container-image-container").html('<iframe  src="'+adr+'" frameborder="0"  marginwidth="0" marginheigth="0" margintop="0"  marginLeft="0" width="'+w+'" height="'+h+'" name="iframequickform" id="iframequickform" style="overflow: hidden"></iframe>');
	jQuery('#lightbox-container-image-box').height(h+50+73);
	jQuery('#lightbox-container-image-box, #lightbox-bottom').width(w+40);
	jQuery('#lightbox-loading').hide();
	jQuery('#lightbox-bottom').show();
});

jQuery("a.vlbox").click(function() {
	var vurl=jQuery(this).attr('href');
	var rev=jQuery(this).attr('rev');
	var thistit=jQuery(this).attr('title');
	var aRev=rev.split("|");
	var video=aRev[0];
	var img=aRev[1];
	var w=parseInt(aRev[2]);
	var h=parseInt(aRev[3]);
	var c=aRev[4];
	var adr=vurl + '?v=' + video + '&p=' + img + '&w=' + w + '&h=' + h + '&c=' + c;

	initiframecontainerex(adr, w, h,thistit);

	return false;
});


if(jQuery("div.contimgsmall.autoplay,div.contimg.autoplay ").everyTime) 
jQuery("div.contimgsmall.autoplay,div.contimg.autoplay ").everyTime(autoplayinterval, function() {
	var img=jQuery(this).find("img");
	var aAnker=jQuery(this).find("a");
	var current=img.attr("rel");
	if(undefined == current) {
		img.attr("src", aAnker[1]);
		img.attr("rel", 1);
	} else {
		current++;
		if(current >= aAnker.length) current=0;
		img.attr("src", aAnker[current]);
		img.attr("rel", current);
	} // if
});

				// ContentImage change
				jQuery('div.contimg a').click(function() {
					var adr=jQuery(this).attr('href');
					var div=jQuery(this).closest('div.contimg');
					div.find('li').removeClass('active');
					jQuery(this).closest('li').addClass('active');
					div.children('img').attr('src',adr);
					return false;
				});

				jQuery('div.contimg a.dcsdownload').click(function() {
					var adr=jQuery(this).attr('href');
					window.open(adr);
				    return false;
				});



				// ContentImageSmall change
				jQuery('div.contimgsmall a').click(function() {
					var adr=jQuery(this).attr('href');
					var div=jQuery(this).closest('div.contimgsmall');
					div.find('li').removeClass('active');
					jQuery(this).closest('li').addClass('active');
					div.children('img').attr('src',adr);
					return false;
				});

				// JavaScript WindowPopup
				jQuery('a.jump').click(function() {
				    jQuery("#tabs").hide();
				    jQuery("#onemodell").hide();
					var adr=jQuery(this).attr('rel');
					top.location.href=adr;
					return false;
				});
				jQuery('a.jswindow').click(function() {
					var adr=jQuery(this).attr('href');
					var wsize=jQuery(this).attr('rel');
					var fenster=window.open(adr, 'popup', wsize);
					fenster.focus();
					return false;
				});

				jQuery('div.farbe').mouseenter(function() {
					jQuery(this).addClass('active');
					var txt=jQuery(this).attr('title');
					jQuery('#farbetxt').html(txt);
				});
				jQuery('div.farbe').mouseleave(function() {
					jQuery(this).removeClass('active');
					jQuery('#farbetxt').html('&nbsp;');
				});
				jQuery('div.farbe').click(function() {
					var txt=jQuery(this).attr('title');
					var img=jQuery(this).text();
					jQuery("#colorlupeimg").addClass("notvisible");
					if(img.indexOf("|")) {
					    imgarr=img.split("|");
					    img1=imgarr[0];
					    img2=imgarr[1];
					    jQuery("#colorlupe").attr('href',img2);
					    jQuery("#colorlupeimg").removeClass("notvisible");
				    } else {
				        img1=img;
				    }
					jQuery('div.farbe').removeClass('shown');
					jQuery('img.polster').removeClass('shown');
					jQuery(this).addClass('shown');
					jQuery('#farbeselected').html(txt);
					jQuery('#mvimage').attr('src', img1);
				});
				jQuery('body.area_car div.farbe').click(function() {
					var idx=jQuery(this).attr('id').substr(3);
					txt=jQuery('#allpolster').html();
					txtneu="";
					for(i=0;i<(colorpolster[idx]).length;i++) {
					 txtneu+="<img  class=\"polster\" src=\""+colorpolster[idx][i][0]+"\" alt=\""+colorpolster[idx][i][2]+"\" rel=\""+colorpolster[idx][i][1]+"\" title=\""+colorpolster[idx][i][2]+"\" />\n";
					}
					jQuery('#allpolster').html(txtneu);
				});
				jQuery('img.polster').live('mouseover',function() {
					jQuery(this).addClass('active');
					var txt=jQuery(this).attr('title');
					jQuery('#polstertxt').text(txt);
				});
				jQuery('img.polster').live('mouseout',function() {
					jQuery(this).removeClass('active');
					jQuery('#polstertxt').html('&nbsp;');
				});
				jQuery('img.polster').live('click',function() {
					var img=jQuery(this).attr('rel');
					var txt=jQuery(this).attr('title');
					jQuery('#mvimage').attr('src', img);
					jQuery('#farbeselected').html(txt);
					jQuery('div.farbe').removeClass('shown');
					jQuery(this).addClass('shown');
				});


				// Suche
				jQuery('#suche').mouseenter(function() {
					jQuery(".menulayer, .menulayertxt").hide();
					jQuery("#suche").hide();
					srchtxt=jQuery("#suche").text();
					if(!isOldIE())
					 jQuery("#menulayersuche").find('div:first').text(srchtxt);
					jQuery("#formsearchbtn").attr('alt',srchtxt);
					jQuery("#menulayersuche").show();
					jQuery("#psyma_layer").hide();
					jQuery("#words").focus();
				});
				jQuery("#menulayersuche").mouseleave(function() {
				jQuery("#psyma_layer").show();
				jQuery(this).hide();
					jQuery("#suche").show();
				});

				jQuery("#words").click(function() {
					return false;
				});
				jQuery("#FAQwords").click(function() {
					var t = jQuery(this).attr('title');
					var v = jQuery(this).val();
					if(v == t) jQuery(this).val('');
					return false;
				});
				/* FF landet hier bei ENTER und click, IE bei click */
				jQuery("#formsearchbtn").click(function() {
					var words = jQuery('#words').val();
					initiframecontainer("/styles/wait.php");
					jQuery("#formsearchact").find('input:first').val(words);
					jQuery("#formsearchact").submit();
					jQuery("#menulayersuche").hide();
					window.setTimeout('jQuery("#psyma_layer").hide();',100);
					window.setTimeout('jQuery("#psyma_layer").hide();',5000);
				});
				jQuery("#FAQformsearchbtn").click(function() {
					jQuery("#frstring1").hide();
					jQuery("#frstring2").show();
					var words = jQuery('#FAQwords').val();
					initiframecontainer("/styles/wait.php");
					jQuery("#formsearchact").find('input:first').val(words);
					jQuery("#formsearchact").submit();
				});
				jQuery("#FAQrequest").click(function() {
					jQuery("#FAQContact").submit();
				});
				/* IE landet hier bei ENTER */
				jQuery("#formsearch").submit(function() {
					return false;
				});


/* rote Symbole im Quickmenu */
				jQuery('#mqkonfigurator').mouseenter(function() { jQuery('#mqkonfigurator img').attr('src', '/styles/icon/menu_konfigurator_active.gif'); });
				jQuery('#mqkonfigurator').mouseleave(function() { jQuery('#mqkonfigurator img').attr('src', '/styles/icon/menu_konfigurator.gif'); });

				jQuery('#mqdownload').mouseenter(function() { jQuery('#mqdownload img').attr('src', '/styles/icon/menu_download_active.gif'); });
				jQuery('#mqdownload').mouseleave(function() { jQuery('#mqdownload img').attr('src', '/styles/icon/menu_download.gif'); });

				jQuery('#mqbroschueren').mouseenter(function() { jQuery('#mqbroschueren img').attr('src', '/styles/icon/menu_broschueren_active.gif'); });
				jQuery('#mqbroschueren').mouseleave(function() { jQuery('#mqbroschueren img').attr('src', '/styles/icon/menu_broschueren.gif'); });

				jQuery('#mqzubehoer').mouseenter(function() { jQuery('#mqzubehoer img').attr('src', '/styles/icon/menu_zubehoer_active.gif'); });
				jQuery('#mqzubehoer').mouseleave(function() { jQuery('#mqzubehoer img').attr('src', '/styles/icon/menu_zubehoer.gif'); });

				jQuery('#mqprobefahrt').mouseenter(function() { jQuery('#mqprobefahrt img').attr('src', '/styles/icon/menu_probefahrt_active.gif'); });
				jQuery('#mqprobefahrt').mouseleave(function() { jQuery('#mqprobefahrt img').attr('src', '/styles/icon/menu_probefahrt.gif'); });

				jQuery('#mcmqprobefahrt').mouseenter(function() { jQuery('#mcmqprobefahrt img').attr('src', '/styles/icon/menu_mcprobefahrt_active.gif'); });
				jQuery('#mcmqprobefahrt').mouseleave(function() { jQuery('#mcmqprobefahrt img').attr('src', '/styles/icon/menu_mcprobefahrt.gif'); });

				jQuery('#mqvermietung').mouseenter(function() { jQuery('#mqvermietung img').attr('src', '/styles/icon/menu_vermietung_active.gif'); });
				jQuery('#mqvermietung').mouseleave(function() { jQuery('#mqvermietung img').attr('src', '/styles/icon/menu_vermietung.gif'); });

				jQuery('#mqfinanzierung').mouseenter(function() { jQuery('#mqfinanzierung img').attr('src', '/styles/icon/menu_finanzierung_active.gif'); });
				jQuery('#mqfinanzierung').mouseleave(function() { jQuery('#mqfinanzierung img').attr('src', '/styles/icon/menu_finanzierung.gif'); });

				jQuery('#mqemission').mouseenter(function() { jQuery('#mqemission img').attr('src', '/styles/icon/menu_emission_active.gif'); });
				jQuery('#mqemission').mouseleave(function() { jQuery('#mqemission img').attr('src', '/styles/icon/menu_emission.gif'); });

				jQuery('#mqdealerga').mouseenter(function() { jQuery('#mqdealerga img').attr('src', '/styles/icon/menu_garten_active.gif'); });
				jQuery('#mqdealerga').mouseleave(function() { jQuery('#mqdealerga img').attr('src', '/styles/icon/menu_garten.gif'); });

				jQuery('#mqdealerin').mouseenter(function() { jQuery('#mqdealerin img').attr('src', '/styles/icon/menu_industry_active.gif'); });
				jQuery('#mqdealerin').mouseleave(function() { jQuery('#mqdealerin img').attr('src', '/styles/icon/menu_industry.gif'); });

				jQuery('#mqdealerma').mouseenter(function() { jQuery('#mqdealerma img').attr('src', '/styles/icon/menu_marine_active.gif'); });
				jQuery('#mqdealerma').mouseleave(function() { jQuery('#mqdealerma img').attr('src', '/styles/icon/menu_marine.gif'); });


/* rote Pfeile bei MausOver */
				jQuery('a.arrow').mouseenter(function() {
					var img = jQuery(this).prev();
					img.attr('src', '/styles/img/arrow_right_red.gif');
				});
				jQuery('a.arrow').mouseleave(function() {
					var img = jQuery(this).prev();
					img.attr('src', '/styles/img/arrow_right.gif');
				});
				jQuery('a.empty').mouseleave(function() {
					var img = jQuery(this).prev();
					img.attr('src', '/styles/img/arrow_right.gif');
				});

				jQuery('body.area_garten #menu1, body.area_garten #headline li.multi, body.area_ma #menu1, body.area_ma #headline li.multi,body.area_in #menu1, body.area_in #headline li.multi').mouseenter(function() {
					menuActionEnterPE(parseInt((jQuery(this).attr("id")).substr(4)));
				});
				jQuery('#menu1, #headline li.multi').mouseenter(function() {
					menuActionEnter(parseInt((jQuery(this).attr("id")).substr(4)));
				});
				jQuery('#menu1, #headline li.multi').mouseleave(function() {
					menuActionLeave(parseInt((jQuery(this).attr("id")).substr(4)));
				});
				jQuery('#headline .menulayertxt').mouseleave(function() {
					menuActionLeave(parseInt((jQuery(this).attr("id")).substr(9,1)));
				});
				jQuery('#headline .outpixel').mouseenter(function() {
					menuActionLeave(parseInt((jQuery(this).attr("id")).substr(8)));
				});

				jQuery('#headline li.single').mouseenter(function() {
					menuActionEnterPlain();
				});

				jQuery("body.area_garten #headline .ml1 a.full, body.area_ma #headline .ml1 a.full, body.area_in #headline .ml1 a.full").mouseenter(function(event){
					var currentNavID = jQuery(this).attr("rev");
					jQuery('.ml2c, .ml2').hide();
					jQuery("#headline li").removeClass('active');
					jQuery(this).parent('li').addClass('active');
					jQuery('#' + currentNavID).show();
				});
				jQuery("#headline li.multi .nav1 a.empty").mouseenter(function(event){
					jQuery('.nav2a').hide();
					jQuery("#headline li").removeClass('active');
//					jQuery(this).parent('ul').find('li').removeClass('active');
				});

				jQuery("#headline li.multi a.full").mouseenter(function(event){
					var currentNavID = jQuery(this).attr("rel");
					jQuery('.nav2a').hide();
//					jQuery('.nav2a').css('visibility', 'hidden');
					jQuery("#headline li").removeClass('active');
					jQuery(this).parent('li').addClass('active');
					jQuery('#' + currentNavID).show();
//					jQuery('#' + currentNavID).css('visibility', 'visible');
				});
				jQuery("#headline li.multi .nav1 a.empty").mouseenter(function(event){
					jQuery('.nav2a').hide();
					jQuery("#headline li").removeClass('active');
//					jQuery(this).parent('ul').find('li').removeClass('active');
				});

// Probefahrt
jQuery('#pfahrt, #pfahrtMC').click(function() {
	var v = jQuery("input[name=product]:radio:checked").val();
	if(typeof v == "string") {
	    testarr=v.split(",");
	    if(testarr.length==2) { // evtl. Modellversion enthalten: AT Car
	        x=testarr[0].substr(1);
	        y=testarr[1];
	        jQuery("#lmmodel").val("_"+x);
	        jQuery("input[name=product]:radio:checked").val(y);
	    }
	    jQuery("#testdriveform").submit();
	} else {
		jQuery(".formerror").show();
	return false;
	}
});
if(jQuery('#emissionspopup'))
jQuery('#emissionspopup, #mqemission').click(function() {
    showEmissionsPDF();
    //jQuery("body").scrollTo("#breadcrumb");
    // initiframecontainer("/emissions.php");
	return false;
});


// ATV-contact
jQuery('#contactform').click(function() {
	var v = jQuery("select[name=service] option:selected").text();
	if(typeof v == "string" && v.length > 0) {
		jQuery('#contactForm').submit();
	} else {
	    if(nothingval =="no alert") 
	       return true;
		  alert(nothingval);
	}
	return false;
});
// Button contactemail/telefon
jQuery('#cf1').click(function() {
    jQuery('#starmail').show();
    jQuery('#starphone').hide();
});
jQuery('#cf2').click(function() {
    jQuery('#starmail').hide();
    jQuery('#starphone').show();
});


// Hauptmenu
jQuery("#areaselect li,.menulayertxt li,#topselectactiv li").click(function() {
   aAnker=jQuery(this).find("a").attr("href");
   aTarget=jQuery(this).find("a").attr("target");
   if(!aTarget || aTarget.toLowerCase()== "_self")
      document.location.href=aAnker;
});
    



// Webtrends
				jQuery("a.dcsanchor").click(function() {
					var currentTitle = jQuery(this).attr("title");
					if(currentTitle.length==0) {
					  currentTitle = jQuery(this).attr("href");
					  dcsDownloadTrk(currentTitle);
					  return true;
					} else {
					    loc=jQuery(this).attr("href");
					    dcsAnchorTrk(loc, currentTitle,'','1');
					// dcsAnchorTrk(document.location.href, currentTitle,'','1');
					return true;
				       }
				});
				jQuery("a.dcsbanner").click(function() {
					var currentTitle = jQuery(this).attr("title");
					var currentHref=jQuery(this).attr("href");
					if(currentTitle.length==0) {
					  currentTitle = jQuery(this).attr("href");
					  dcsDownloadTrk(currentTitle);
					  return true;
					} else {
					dcsBannerTrk(document.location.href, currentTitle,'','1');
					return true;
				       }
				});

				jQuery("a.dcsdownloadtitle").click(function() {
					var currentTitle = jQuery(this).attr("title");
					if(currentTitle.length==0) {
					  currentTitle = jQuery(this).attr("href");
					}
					dcsDownloadTrk(currentTitle);
					return true;
				});
				jQuery("a.dcsdownload").click(function() {
					var currentTitle = jQuery(this).attr("href");
					dcsDownloadTrk(currentTitle);
					return true;
				});

// Schnellzugriff
				jQuery("#lmSrvcBroc,#toolBoxSrvcBroc").click(function() {
				    anz=jQuery("#orderbrocnum").val();
				    if(anz==0 || !anz) {
				     if(!anz) {
				        return true;
				     }   
				     dest=jQuery("#orderbrocerrorforward").val();
				     document.location.href=dest;
				    } else {
					initiframecontainer("/styles/wait.php");
					jQuery("#brochureform").submit();
					jQuery("#lightbox-secNav-btnCloseImg").hide();
				    }
					return false;
				});
				jQuery("#lmSrvcBrocDown,#toolBoxSrvcBrocDown").click(function() {
					initiframecontainer("/styles/wait.php");
					jQuery("#brochuredownform").submit();
					jQuery("#lightbox-secNav-btnCloseImg").hide();
					return false;
				});
				jQuery("#lmSrvcTest,#toolBoxSrvcTest").click(function() {
					initiframecontainer("/styles/wait.php");
					jQuery("#testdriveform").submit();
					jQuery("#lightbox-secNav-btnCloseImg").hide();
					return false;
				});

				jQuery("a.buttonlightbox,#mqprobefahrtext,#lmSrvcTestExtern,#toolBoxSrvcTestExtern,#lmSrvcBrocExtern,#toolBoxSrvcBrocExtern,#menuBrocExtern,#menuTestExtern,#lmBrocExtern,#lmTestExtern,,#fmBrocExtern,#fmTestExtern,#footerTestExtern").click(function() {
   					var formID = jQuery(this).attr("href");
   					var formtxt = jQuery(this).text();
   					// formtxt="";
					initiframecontainerex(formID,800,600,formtxt);
					return false;
				});



				jQuery("#lmSrvcMcTest,#toolboxSrvcMcTest").click(function() {
				    jQuery("#rentDemoType").val("demo");
					jQuery("#RentDemoForm").submit();
					return false;
				});

				jQuery("#lmSrvcMcRent,#toolboxSrvcMcRent").click(function() {
				    jQuery("#rentDemoType").val("rent");
					jQuery("#RentDemoForm").submit();
					return false;
				});
				jQuery("#lmSrvcMcRent,#toolboxSrvcMcRent").click(function() {
				    jQuery("#rentDemoType").val("rent");
					jQuery("#RentDemoForm").submit();
					return false;
				});
				jQuery("#lmSrvcContact").click(function() {
					jQuery("#contactform").submit();
					return false;
				});


// Generischer Link fuer Popup Kontakt in Lightbox
				jQuery("a.lbcontact").click(function() {
					initiframecontainer("/styles/wait.php");
					var formID = jQuery(this).attr("rev");
					jQuery("#" + formID).submit();
					jQuery("#lightbox-secNav-btnCloseImg").hide();
					return false;
				});
				jQuery("a.newslb, a.popupnews").click(function() {
					var myurl = jQuery(this).attr("href");
					initiframecontainernews(myurl);
					return false;
				});

				jQuery("a.lbdirect").click(function() {
					var myurl = jQuery(this).attr("rev");
					initiframecontainer(myurl);
					return false;
				});

				jQuery("a.lbdirecthref").click(function() {
					var myurl = jQuery(this).attr("href");
					initiframecontainernews(myurl);
					return false;
				});

/* Shop */
				jQuery("a.shopdetails").click(function() {
					var theform = jQuery(this).attr("rev");
					initiframecontainer("/styles/wait.php");
					jQuery("#"+theform).submit();
					return false;
				});

				jQuery("a.faqentry,a.faqintext").click(function() {
					var theform = jQuery(this).attr("href");
					initiframecontainer(theform);
					return false;
				});

				jQuery("a.ebrocblank").click(function() {
					var thebroc = jQuery(this).attr("href");
					window.open(thebroc,"_blank");
					top.closeiframecontainer();
					return false;
				});

				// Zubehoer-Funktionen
				jQuery("#lmMerkzettel").click(function() {
					initiframecontainer("/php/intact/showacsdetail/v3_show_basket.php");
					jQuery("#lightbox-secNav-btnCloseImg").hide();
					return false;
				});
				// Zubehoer-Funktionen MC
				jQuery("#lmMerkzettelMC").click(function() {
					initiframecontainer("/php/intact/showacsdetail/v3_show_basket_mc.php");
					jQuery("#lightbox-secNav-btnCloseImg").hide();
					return false;
				});

				jQuery("a.accdetails").click(function() {
					var theform = jQuery(this).attr("rev");
					var values = eval('(' + theform + ')');
					initiframecontainer("/styles/wait.php");
					jQuery("#formDetails #acc_idDetails").attr('value', values.acc_id);
					jQuery("#formDetails #partnumber").attr('value', values.partnumber);
					jQuery("#formDetails").submit();
					jQuery("#lightbox-secNav-btnCloseImg").hide();
					return false;
				});
				
				jQuery("#mvselectboxform #actualmodell").change(function() {
					jQuery("#whatchanged").val("modell");
					pval=jQuery("#mvselectboxform #actualmodell").val();
					if(isNaN(pval)) {
					    document.location.replace(pval);
				    } else {
					jQuery("#mvselectboxform #model_idx").val(pval);
					jQuery("#mvselectboxform").submit();
				    }
					return false;
				});
				jQuery("#mvselectboxform #gradeselect").change(function() {
					jQuery("#whatchanged").val("grade");
					var tmp = jQuery("#mvselectbox #gradeselect").val();
					jQuery("#mvselectboxform #mv").val(tmp);
					jQuery("#mvselectboxform").submit();
					return false;
				});
				jQuery("#mvselectboxform #mversion").change(function() {
					jQuery("#whatchanged").val("mversion");
					jQuery("#mvselectboxform #mv").val(jQuery("#mvselectbox #mversion").val());
					jQuery("#mvselectboxform").submit();
					return false;
				});
				jQuery("#mvselectboxform #vintagemodell").change(function() {
					jQuery("#mvselectboxform #model_idx").val(jQuery("#mvselectboxform #vintagemodell").val());
					jQuery("#mvselectboxform").submit();
					return false;
				});

// Filter
				jQuery("#ffilter input").live("click", function() {
					ajaxFilterMV();
					return false;
				});
				jQuery("#ffilter select").change(function() {
					ajaxFilterMV();
					return false;
				});
				jQuery("#mvfilter a.afiltermv").live("click", function() {
					var mv=jQuery(this).attr("rev");
					jQuery("#ffilter input[name=mv]").val(mv);
					jQuery("#ffilter").submit();
					return false;
				});


				jQuery("a.accbasket").click(function() {
					var theform = jQuery(this).attr("rev");
					var values = eval('(' + theform + ')');
					initiframecontainer("/styles/wait.php");
					jQuery("#formBasket #acc_idBasket").attr('value', values.acc_id);
					jQuery("#formBasket #description").attr('value', values.partdescription);
					jQuery("#formBasket").submit();
					jQuery("#lightbox-secNav-btnCloseImg").hide();
					return false;
				});
				jQuery("a.overview").click(function() {
					document.location.replace(overviewpath);
					return false;
				});
				jQuery("a.overview1").click(function() {
					document.location.replace(overviewpath1);
					return false;
				});
				jQuery("a.overview2").click(function() {
					document.location.replace(overviewpath2);
					return false;
				});

				var statActive1=true;
				var statActive2=true;
				var statActive3=true;
				jQuery("input#c1").change(function() {
					statActive1 = !statActive1;
					jQuery('#coltopmenu1 ul').toggleClass('berater');
					if(statActive1) {
						jQuery('#coltopmenu1 ul a').unbind('click');
					} else {
						jQuery('#coltopmenu1 ul a').bind('click', function() {return false;});
					}
				});
				jQuery("input#c2").change(function() {
					statActive2 = !statActive2;
					jQuery('#coltopmenu2 ul').toggleClass('berater');
					if(statActive2) {
						jQuery('#coltopmenu2 ul a').unbind('click');
					} else {
						jQuery('#coltopmenu2 ul a').bind('click', function() {return false;});
					}
				});
				jQuery("input#c3").change(function() {
					statActive3 = !statActive3;
					jQuery('#coltopmenu3 ul').toggleClass('berater');
					if(statActive3) {
						jQuery('#coltopmenu3 ul a').unbind('click');
					} else {
						jQuery('#coltopmenu3 ul a').bind('click', function() {return false;});
					}
				});
				jQuery("#lmOnline, #fmOnline").click(function() {
	                var adr=jQuery(this).attr('href');
					var fenster=window.open(adr, 'popup', "width=600,height=700,scrollbars=no");
					fenster.focus();
					return false;
                  });
				jQuery("#JobFormBut").click(function() {
	                var w=610;
	                var h=630;
//       				jQuery.scrollTo("#wrap");
       			
	                jQuery('#lightbox-nav-btnaPrev, #lightbox-nav-btnaNext').hide();
	                jQuery("#quickform-overlay").show();

	                jQuery("#lightbox-container-image-container").html('<iframe  src="/styles/wait.php" scrollbars="yes" frameborder="0"  marginwidth="0" marginheigth="0" margintop="0"  marginLeft="0" width="'+w+'" height="'+h+'" name="iframequickform" id="iframequickform" style="overflow: y-scroll"></iframe>');
	                jQuery('#lightbox-container-image-box').height(h+50+73);
	                jQuery('#lightbox-container-image-box, #lightbox-bottom').width(w+40);
	                jQuery('#lightbox-loading').hide();
	                jQuery('#lightbox-bottom').show();
					jQuery("#JobForm").submit();

                  });
				

// Seitenspezifischer Callback!
				jQuery("#accordion, #multiaccordion, #tabs").show();
				if(emissionspopup==1){
					jQuery('#emissionspopup').click();
			    }
				if(language_id==5 && jQuery("#addthislayer").length==0) {
				    img1=(isOldIE()) ? "/js/pixel.gif":"/styles/img/bg_sidebar_top_addthis.png";
				    jQuery("#sidebar").prepend("<div class=\"teaser\" style=\"background: url("+img1+") top left no-repeat;\"><div class=\"teasercont\"><div class=\"teaserimg\" style=\"padding-left:15px;padding-top:11px;\"><script type=\"text/javascript\">\nvar addthis_config = {'data_track_clickback':true,'ui_language': \"nl\"};\n</script><div id=\"addthislayer\" class=\"addthis_toolbox addthis_default_style\"><a  href=\"http://www.addthis.com/bookmark.php?v=250&amp;username=hondanl\" class=\"addthis_button_compact\">Share</a><span class=\"addthis_separator\">|</span><a class=\"addthis_button_facebook\"></a><a class=\"addthis_button_myspace\"></a><a class=\"addthis_button_google\"></a><a class=\"addthis_button_twitter\"></a><a class=\"addthis_button_email\"></a>\n<script type=\"text/javascript\" src=\"http://s7.addthis.com/js/250/addthis_widget.js#username=hondanl\"></script></div></div><div class=\"teaserbgimg\" style=\"height:20px;padding-top:0px;\" class=\"transparent\">&nbsp;</div></div></div>");
			    }
				if(typeof pageOnReady == "function") pageOnReady();
				if(typeof setTopMenu == "function") setTopMenu();
} // function readyforall