function registerValidate(id){
    postDatas = '';
    postDatas+= id;
    $('.js-hatalar').remove();
    postDatas = $(postDatas);
    ret = 0;
    for(index=0;index<postDatas.length;index++){
        var v=postDatas[index];

        var child = document.createElement('div');
        child.className = 'js-hatalar';
        err="<span class=\"input-error\">"+v.getAttribute('data-err')+"</span>";
        child.innerHTML = err;
        if(v.getAttribute('data-requery')=='true') {
            if (!v.value) {
                if(border){

                    $(v).attr('style', 'border:1px solid #ff1232 !important');
                }else{
                    v.after(child);
                }
                console.log(v);
                //v.addClass('error-text');
                ret = 1;
            }else{
                console.log("uzunluk :" + v.getAttribute('data-length') + " - "+v.value.length);
                if (v.getAttribute('data-length') && v.getAttribute('data-length')!=v.value.length) {
                    err="<span class=\"input-error\">Girdiğiniz değer " +v.getAttribute('data-length')+ " karakter olmalıdır!</span>";
                    child.innerHTML = err;
                    if(border){
                        $(v).attr('style', 'border:1px solid #ff1232 !important');
                    }else{
                        v.after(child);
                    }
                    ret = 1;
                    /*
                     var regex = /[0-9]|\./;
                     if( !regex.test(key) ) {
                     v.value = v.value.replace(/[^0-9]/g,"");
                     }
                     */
                    console.log(v);
                }
                console.log("Name:"+v.getAttribute('name'));
                if (v.getAttribute('name')=='shipping_address[email]'){

                    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
                    if (!filter.test(v.value)) {
                        console.log("Name:"+v.getAttribute('name'));
                        err="<span class=\"input-error\">Geçersiz mail adresi girdiniz!</span>";
                        child.innerHTML = err;
                        if(border){
                            $(v).attr('style', 'border:1px solid #ff1232 !important');
                        }else{
                            v.after(child);
                        }
                        ret = 1;
                        console.log(v);
                    }

                }
            }
        }
    }
    if (ret){
        $('html, body').animate({ scrollTop: $('#room-type').offset().top }, 'slow');
        return false;
    }else {
        return true;
    }
}

$(document).on("change, keypress", "#cart_form input, #cart_form select", function(e){

    if($(this).data('type') && $(this).data('type')=='number'){
        //console.log("event:"+event.charCode);
        //var regex = /[0-9]|\./;
        if( event.charCode >= 48 && event.charCode <= 57 ) {
            return true;
        }else{
            return false;
        }
    }
    console.log('DATA : '+$(this).data('type'));
    if($(this).data('type')=='select'){
        count = $(this).find('option:selected');
        conut = count.val();
    }else {
        count = $(this).val();
    }

    if(count) {
        if(border){
            $(this).css({'border':'none'});
        }else{
            $(this).next().remove();
        }
    }
});

