$(document).ready(function() {
    $('input[type="text"],input[type="password"]').addClass("idleField");

    $('input[type="text"],input[type="password"]').focus(function() {
        $(this).removeClass("idleField").addClass("focusField");

        if(this.value != this.defaultValue){
            this.select();
        }
    });
    $('input[type="text"],input[type="password"]').blur(function() {
        $(this).removeClass("focusField").addClass("idleField");
        if ($.trim(this.value == '')){
            this.value = (this.defaultValue ? this.defaultValue : '');
        }
    });
    $("a.fancybox").fancybox();

    $(".tbl-option").css("display","none");
    $(".tbl-radio:checked ~ .tbl-option").css("display","inline-table");
    //$("input[@name='domain']").change(
    $(".tbl-radio").click(
        function()
        {
            if ($(this).val()){
                // if ($("input[@name='domain']:checked").val()){
                $(".tbl-option").css("display","none");
                $(".tbl-radio:checked ~ .tbl-option").css("display","inline-table");
            }else

                $(this).blur();
        }
        );



    //domain =  $("input[@name='newDomainName']").val();
    $(".ADSLSpeed option").show();
    user = $(".ADSLaccount option:selected").text() ;
    speed = user.split("@");
    if (speed[1].indexOf("m") != -1){
            newspeed = speed[1].split("m");
            speed[1] = newspeed[0] * 1024;
        }

    $(".ADSLSpeed option[value='" + speed[1] + "']").hide();

    $(".ADSLaccount").click( function () {
        $(".ADSLSpeed option").show();
        user =   $(".ADSLaccount option:selected").text() ;
        speed = user.split("@");
            if (speed[1].indexOf("m") != -1){
            newspeed = speed[1].split("m");
            speed[1] = newspeed[0] * 1024;
        }
        $(".ADSLSpeed option[value='" + speed[1] + "']").hide();
        $(".ADSLSpeed option[value='0']").attr("selected","selected");
    });



    //=============
    $(".BizType").change( function () {
        selected = $(".BizType option:selected").val() ;
        if (selected == 99){
            $(".OtherType").show();
        }else{
            $(".OtherType").hide();
        }
    });
    selected = $(".BizType option:selected").val() ;
    if (selected == 99){
        $(".OtherType").show();
    }else{
        $(".OtherType").hide();
    }

    //=============
    $(".BizType").click( function () {
        selected = $(".BizType option:selected").val() ;
        if (selected == 99){
            $(".OtherType").show();
        }else{
            $(".OtherType").hide();
        }
    });
    selected = $(".BizType option:selected").val() ;
    if (selected == 99){
        $(".OtherType").show();
    }else{
        $(".OtherType").hide();
    }

    $(".City").change( function () {
        selected = $(".City option:selected").val() ;
        if (selected == 99){
            $(".OtherCity").show();
        }else{
            $(".OtherCity").hide();
        }
    });
    selected = $(".City option:selected").val() ;
    if (selected == 99){
        $(".OtherCity").show();
    }else{
        $(".OtherCity").hide();
    }

    $(".City").click( function () {
        selected = $(".City option:selected").val() ;
        if (selected == 99){
            $(".OtherCity").show();
        }else{
            $(".OtherCity").hide();
        }
    });
    selected = $(".City option:selected").val() ;
    if (selected == 99){
        $(".OtherCity").show();
    }else{
        $(".OtherCity").hide();
    }




});