// JavaScript Document // CLIENT javascripts //kopuva pora4kata function BuyOrder (order, callback) { $.ajax({ type: "POST", url: "/php/action.php", data:{ act: "BuyOrder", order: order }, success: function(res){ callback (res); } }); } function privileged(){ var d; }; function init () { //premesteni ot base //pokazvane na dialoga za redaktirane na profil $("#profile-redact") . click(function(){ $("#folio") . css ("opacity", "0.3") . fadeIn(); $("#profile-dlg") . fadeIn(); }); //logout $("#top-right-box") . find("#logout") . click(function(){ $.ajax({ type: "POST", url: "/php/action.php", data:{ act:"login", type:"logout" }, success: function(r){ document.location = r; } }); }); //pokazvane na stari pora4ki $("#profile-dlg") . find('h6') . click(function(){ $("#profile-dlg") . find('h6') . removeClass('selected'); $(this) . addClass('selected'); var tab = $(this) . attr('name'); switch(tab){ case 'edit': $("#profile-dlg") . find('.middle_ord') . hide(); $("#profile-dlg") . find('.middle') . show(); $('#editit') . show(); break; case 'history': $("#profile-dlg") . find('.middle') . hide(); $('#editit') . hide(); $.ajax({ type: "POST", url: "/php/action.php", data: { act: "get", type: "history", id: $("#profile-dlg") . find('input[name=id]') . val() }, success: function(res){ $("#profile-dlg") . find('.middle_ord') . html(''); $("#profile-dlg") . find('.middle_ord') . append(res); } }); $("#profile-dlg") . find('.middle_ord') . show(); break; case 'current': $("#profile-dlg") . find('.middle') . hide(); $('#editit') . hide(); $.ajax({ type: "POST", url: "/php/action.php", data: { act: "get", type: "current", id: $("#profile-dlg") . find('input[name=id]') . val() }, success: function(res){ $("#profile-dlg") . find('.middle_ord') . html(''); $("#profile-dlg") . find('.middle_ord') . append(res); } }); $("#profile-dlg") . find('.middle_ord') . show(); break; } }); //redakciq na profil $("#profile-dlg") . find("#editit") . click(function(){ var sizes = (($("#profile-dlg") . find ("input[name=gender_dialog]") . val() == 'hmc_women') ? $("#profile-dlg") . find ("input[name=size_woman]") . val() : $("#profile-dlg") . find ("input[name=size_man]") . val()); if($("#profile-dlg") . find("#chkbox") . hasClass('checkbox')) subs = 1; else subs = 0; Phone = $("#profile-dlg") . find ("input[name=tel]") . val(); if($("#profile-dlg") . find ("input[name=pass_cng]") . val() == $("#profile-dlg") . find ("input[name=pass_cng_1]") . val()) { if(!phoneregexp.test(Phone)){ $("#profile-dlg") . find(".message") . html('Невалиден телефон!'); $("#profile-dlg") . find(".message") . fadeIn(); $("#profile-dlg") . find("input[name=tel]") . addClass ("input_error"); } else { $.ajax ({ type: "POST", url: "/php/action.php", data:{ act:"edit", type:"user", id: $("#profile-dlg") . find ("input[name=id]") . val(), password: $("#profile-dlg") . find ("input[name=pass_cng]") . val(), email: $("#profile-dlg") . find ("input[name=email]") . val(), name: $("#profile-dlg") . find ("input[name=name]") . val(), gender: $("#profile-dlg") . find ("input[name=gender_dialog]") . val(), shoe_size: sizes, phone: $("#profile-dlg") . find ("input[name=tel]") . val(), address: $("#profile-dlg") . find ("input[name=addr]") . val(), city: $("#profile-dlg") . find ("input[name=city]") . val(), country: $("#profile-dlg") . find ("input[name=country]") . val(), postcode: $("#profile-dlg") . find ("input[name=pcode]") . val(), subscribed: subs }, success: function(r){ if(r == '1') { $("#profile-dlg") . fadeOut(); $("#message-dlg") . children() . html("

Промените са направени успешно!

"); $("#folio") . css ("opacity", "0.3") . fadeIn(); $("#message-dlg") . fadeIn(); var t = setTimeout("$('#message-dlg') . fadeOut();$('#folio') . fadeOut();document.location.reload(true);",2000); } else if(r == '2'){ $("#profile-dlg") . fadeOut(); $("#message-dlg") . children() . html("Благодаря ви! Вие се регистрирахте успешно в www.krachun.com. На посоченият от Вас email ще получите линк за активация на акаунта Ви."); $("#folio") . css ("opacity", "0.3") . fadeIn(); $("#message-dlg") . fadeIn(); var t = setTimeout("$('#message-dlg') . fadeOut();$('#folio') . fadeOut();document.location.reload(true);",6000); } else { $("#profile-dlg") . find(".message") . html('Възникна неизвестна грешка! Моля пробвайте след 15 минути.'); $("#profile-dlg") . find(".message") . fadeIn(); } } }); } } else { $("#profile-dlg") . find(".message") . html('Паролите не съвпадат!'); $("#profile-dlg") . find(".message") . fadeIn(); $("#profile-dlg") . find("input[name=pass]") . addClass ("input_error"); $("#profile-dlg") . find("input[name=pass1]") . addClass ("input_error"); } }); //radio buton na metod na plashtane $(".paymentmethodun, .paymentmethod") . click(function(){ $(this). parent (). children () . addClass('paymentmethodun') . removeClass('paymentmethod'); $(this) . removeClass('paymentmethodun') . addClass('paymentmethod'); }); }