$(document).ready(function(){
	$("#slideshow").cycle();
	$("#da-link").click(function(){
		$("#detail-callback,#detail-garantie,#detail-leasing,#detail-empfehlen,#detail-service").hide();
		$("#detail-anfrage").toggle();
		return false;
	});
	$("#dc-link").click(function(){
		$("#detail-anfrage,#detail-garantie,#detail-leasing,#detail-empfehlen,#detail-service").hide();
		$("#detail-callback").toggle();
		return false;
	});
	$("#dg-link").click(function(){
		$("#detail-anfrage,#detail-callback,#detail-leasing,#detail-empfehlen,#detail-service").hide();
		$("#detail-garantie").toggle();
		return false;
	});
	$("#dl-link").click(function(){
		$("#detail-anfrage,#detail-callback,#detail-garantie,#detail-empfehlen,#detail-service").hide();
		$("#detail-leasing").toggle();
		return false;
	});
	$("#de-link").click(function(){
		$("#detail-anfrage,#detail-callback,#detail-garantie,#detail-leasing,#detail-service").hide();
		$("#detail-empfehlen").toggle();
		return false;
	});
	$("#ds-link").click(function(){
		$("#detail-anfrage,#detail-callback,#detail-garantie,#detail-leasing,#detail-empfehlen").hide();
		$("#detail-service").toggle();
		return false;
	});
	$("#detail-anfrage input,#detail-callback input,#detail-leasing input,#detail-empfehlen input").click(function(){
		if($(this).val().substr(0,3)=="Ihr") {
			$(this).val("");
		}
	});
	$("#detail-anfrage textarea,#detail-callback textarea,#detail-leasing textarea,#detail-empfehlen textarea").click(function(){
		if($(this).html().substr(0,3)=="Ihr") {
			$(this).html("");
		}
	});
	/*$("#detail-anfrage").submit(function(){
		alert("Ihre Anfrage wurde gesendet. Vielen Dank.");
		return false;
	});
	$("#detail-callback").submit(function(){
		alert("Ihre Anfrage wurde gesendet. Vielen Dank.");
		return false;
	});
	$("#detail-leasing").submit(function(){
		alert("Ihre Anfrage wurde gesendet. Vielen Dank.");
		return false;
	});
	$("#detail-empfehlen").submit(function(){
		alert("Ihre Anfrage wurde gesendet. Vielen Dank.");
		return false;
	});*/
	$("#sword").autocomplete('/ajaxsearch.php');
	$(".help").tooltip({
		delay:0,
		showURL:false
	});
	$(".gl_thumb img").tooltip({
		delay:0,
		showURL:false,
		opacity:1,
		bodyHandler:function(){
			src = this.src.replace(/thumbs/, "thumbs_preview");
			return $("<img/>").attr("src",src);
		}
	});
	$("#us-reg-privat").click(function(){
		if($(this).attr("checked")){
			$("#us-reg-company").val("").attr('disabled',true);
			$('#ustnr-info').hide();
		} else {
			$("#us-reg-company").val("").attr('disabled',false);
		}
	});
	$("#us-reg-company").keyup(function(){
		if($("#us-reg-company").val() == "") {
			$('#ustnr-info').hide();
		} else {
			$('#ustnr-info').show();
		}
	});
});
