﻿



$().ready(function() {

    //    var options = {
    //        success: handleResponse,
    //        dataType: 'json',
    //        beforeSubmit: blockPage
    //    };

    //    $('#form-signup').ajaxForm(options);

    $("#member_countryid").bind("change", onCountryChanged);
    $("#member_selecthost").bind("change", onHostChanged);
    
    if ($("#member_countryid").val() == "1") {

        $("#txt_cityname").hide();
        $("#member_cityid_div").show();
        $("#member_cityDiv").show();

    }
    else {

        $("#txt_cityname").show();
        $("#member_cityDiv").hide();
        $("#member_cityid_div").hide();
    }

    //clearForm("#form-signup");

});

var clearForm = function(selector) {

    $("ul.highlight").removeClass("error");
    $("#errorholder").html("");

    $("input[type='text'],input[type='password']", selector).each(function() {

        $(this).val("");

    });

    $("select", selector).each(function() {

        this.selectedIndex = 0;

    });

    $("input[type='checkbox'],input[type='radio']", selector).each(function() {

        $(this).attr("checked", false);

    });

    $(".checkbox").removeClass("checked");

    $("#member_selecthost").val("0");
    $("#select_host").show();
    $("#text_host").hide();

    $("#captcha-holder").html("");

}



var onCountryChanged = function() {

    if ($(this).val() == "1") {

        $("#txt_cityname").hide();
        $("#member_cityid_div").show();
        $("#member_cityDiv").show();

    }
    else {

        $("#txt_cityname").show();
        $("#member_cityDiv").hide();
        $("#member_cityid_div").hide();
    }

}

var onHostChanged = function() {

    if ($(this).val() == "-") {

        $("#select_host").hide();
        $("#text_host").show();

    }
    else {

        $("#select_host").show();
        $("#text_host").hide();
    }

}
