$(document).ready(function() {

	$(".color").click(function(){
		$(".color").prev("input").removeAttr("checked");
		$(this).prev("input").attr("checked", "checked");
	});

    $(".color1").click(function(){
		$(".input1").attr("disabled", "disabled");
		$(".input1").addClass("disabled");
		$(".input1").attr("value", "");
		$(this).parent().find(".input1").removeAttr("disabled");
		$(this).parent().find(".input1").removeClass("disabled");
	});

    $(".color2").click(function(){
		$(".color2").parent().find(".input1").attr("disabled", "disabled");
		$(".color2").parent().find(".input1").addClass("disabled");
		$(this).parent().find(".input1").removeAttr("disabled");
		$(this).parent().find(".input1").removeClass("disabled");

	});

    $("#nostik").click(function(){
        if ($(this).attr("checked")==true)
			{
                $(".input1").attr("readonly", "readonly");
		        $(".input1").attr("value", "");
			}
		else
			{
				$(".input1").removeAttr("readonly");
			}
	});

    $(".radio").click(function(){
    	//$(".radio_text").css("border", "solid 1px #f00");
        if ($(this).attr("checked")==true)
			{
				$(".radio_text").find("input").attr("disabled", "disabled");
				$(".radio_text").css("display", "none");
				radio_text_id=$(this).attr("id")+"_text";
                //$("#test").html(radio_text_id);
				$("#"+radio_text_id).find("input").removeAttr("disabled");
				$("#"+radio_text_id).css("display", "block");
			}
		else
			{
				//$("#test").attr("value", $(this).attr("id"));
			}
	});


    $(".but1").click(function(){

        id=$(this).attr("id");

		//alert($(this).parent().find(".color3").attr("checked"));

        if ($(this).parent().find(".color3").attr("checked")==true)
			{
                $("."+id).css("display", "none");
				$("."+id).find("input").attr("disabled", "disabled");
				$(this).parent().find(".color3").removeAttr("checked")

			}
		else
			{
				$(this).parent().find(".color3").attr("checked", "true");
                $("."+id).css("display", "block");
                $("."+id).find("input").removeAttr("disabled");
				$("#iv0").removeAttr("checked");
			}

	});

    $(".color3").click(function(){

    	id="d"+$(this).attr("id");
    	if ($(this).attr("checked")==true)
			{
                $("."+id).css("display", "block");
				$("."+id).find("input").removeAttr("disabled");
				if ($(this).attr("id")!="iv0") {$("#iv0").removeAttr("checked");};
			}
		else
			{
                $("."+id).css("display", "none");
				$("."+id).find("input").attr("disabled", "disabled");
			}
	});



    $("#iv0").click(function(){

    	if ($(this).attr("checked")==true)
			{
				$(".color3").removeAttr("checked");
				$("#iv0").attr("checked", "checked");
				$(".color3").parent().find(".input").attr("disabled", "disabled");
				$(".color3").parent().find(".div").css("display", "none");


			}
	});

    $(".checkbox1").click(function(){



        if ($(this).attr("checked")==true)
			{
				$(".input1").attr("disabled", "disabled");
				$(".input1").attr("value", "");
				$(".input1").addClass("disabled");
			}
		else
			{
				$(".input1").removeAttr("disabled");
				$(".input1").removeClass("disabled");
			}



	});

    $(".checkbox2").click(function(){
        if ($(this).attr("checked")==true)
			{
				$(this).parent().find(".input1").removeAttr("disabled");
				$(this).parent().find(".input1").removeClass("disabled");
				$(".checkbox3").attr("checked", "");
			}
		else
			{
                $(this).parent().find(".input1").attr("disabled", "disabled");
				$(this).parent().find(".input1").attr("value", "");
				$(this).parent().find(".input1").addClass("disabled");
			}
	});

    $(".color4").click(function(){

        if ($(this).parent().find(".checkbox2").attr("checked")==true)
			{
                $(this).parent().find(".checkbox2").attr("checked", "");
                $(this).parent().find(".input1").attr("disabled", "disabled");
				$(this).parent().find(".input1").attr("value", "");
				$(this).parent().find(".input1").addClass("disabled");

			}
		else
			{
				$(this).parent().find(".checkbox2").attr("checked", "checked");
                $(this).parent().find(".input1").removeAttr("disabled");
				$(this).parent().find(".input1").removeClass("disabled");
				$(".checkbox3").attr("checked", "");

			}
	});

    $(".checkbox3").click(function(){
        if ($(this).attr("checked")==true)
			{
				$(".checkbox2").attr("checked", "");
                $(".input1").attr("disabled", "disabled");
				$(".input1").attr("value", "");
				$(".input1").addClass("disabled");
			}
		else
			{
				$(".checkbox2").attr("checked", "checked");
                $(".input1").removeAttr("disabled");
				$(".input1").removeClass("disabled");
			}
	});


    $(".color5").click(function(){

        if ($(this).parent().find(".checkbox3").attr("checked")==true)
			{
                $(".checkbox3").attr("checked", "");
                $(".checkbox2").attr("checked", "checked");
                $(".input1").removeAttr("disabled");
				$(".input1").removeClass("disabled");
			}
		else
			{
				$(".checkbox3").attr("checked", "checked");
                $(".checkbox2").attr("checked", "");
                $(".input1").attr("disabled", "disabled");
				$(".input1").attr("value", "");
				$(".input1").addClass("disabled");

			}
	});












});