jQuery(document).ready(function($){ 
	$(document).pngFix();
	$('.status_1').easyTooltip({useElement: 'message_status_1'});
	$('.status_2').easyTooltip({useElement: 'message_status_2'});
	$('.status_3').easyTooltip({useElement: 'message_status_3'});
	$('.status_4').easyTooltip({useElement: 'message_status_4'});
	
	//Hide (Collapse) the toggle containers on load
	$(".toggle_container").hide(); 
	$("#ja").hide();
	$("#nein").hide();
	$(".scanner_noag").hide();

	//Switch the "Open" and "Close" state per click
	$("p.trigger").toggle(function(){
		$(this).addClass("active");
		}, function () {
		$(this).removeClass("active");
	});

	//Slide up and down on click
	$("p.trigger").click(function(){
		$(this).next(".toggle_container").slideToggle("slow");
	});

	if($("#restauration_inp_ja").is(':checked')) {
		$("#nein").hide();
		$("#ja").show();
	}

	if($("#restauration_inp_nein").is(':checked')) {
		$("#ja").hide();
		$("#nein").show();
	}

	if($("#sendpicture").is(':checked')) {
		$("#reklamation_pictures").show();
	} else {
		$("#reklamation_pictures").hide();
	}

	$("#restauration_inp_ja").click(function() {
		if($("#restauration_inp_ja").is(':checked')) {
			$("#nein").hide("slow");
			$("#ja").show("slow");
		}
	});

	$("#restauration_inp_nein").click(function() {
		if($("#restauration_inp_nein").is(':checked')) {
			$("#ja").hide("slow");
			$("#nein").show("slow");
		}
	});

	$("#sendpicture").click(function() {
		if($("#sendpicture").is(':checked')) {
			$("#reklamation_pictures").show("slow");
		} else {
			$("#reklamation_pictures").hide("slow");
		}
	});
	$("#sendmodel").click(function() {
		if($("#sendmodel").is(':checked')) {
			$("#send_model").show("slow");
		} else {
			$("#send_model").hide("slow");
		}
	});
	/*
	$("#scanner_ag_inp").click(function() {
		if($("#scanner_ag_inp").is(':checked')) {
			$("#scanner_noag").hide("slow");
			$("#scanner_ag").show("slow");
		}
	});
	$("#scanner_noag_inp").click(function() {
		if($("#scanner_noag_inp").is(':checked')) {
			$("#scanner_ag").hide("slow");
			$("#scanner_noag").show("slow");
		}
	});	
	*/
	$.viewMap = {
     	'0' : $('.scanner_ag'),
    	'1' : $('.scanner_noag'),
    	'2' : $('.scanner_noag'),
    	'3' : $('.scanner_noag')
   	};  
   	
	$("#tx-srfeuserregister-pi1-tx_inetfeuser_scanner_manufacturer option:selected").each(function () {
                $.viewMap[$(this).val()].show('fast');
    });
   	

	$('#tx-srfeuserregister-pi1-tx_inetfeuser_scanner_manufacturer').change(function() {
		// hide all
		$.each($.viewMap, function() { this.hide(); });
		// show current
		$.viewMap[$(this).val()].show('fast');
	});
});

Shadowbox.init({
 handleOversize: "drag",
 displayNav: true,
 handleUnsupported: "remove",
 autoplayMovies: true,
 autoDimensions: true,
 language: "de",
 players: ["img",'html', 'iframe']
});