$(document).ready(function(){
$('.tabs').tabs();
$("form.editorV").live("submit", function(){
var _id=$(this).attr("id");
$("#"+_id+" button").button('loading');
$.ajax({
type: 'POST',
action: "http://payservice.uz/admin.php?cont=vauch",
url: "http://payservice.uz/admin.php?cont=vauch",
dataType: 'html',
async: true,
timeout: 15000,
data: {
ajax: 'update_vaucher',
cat: ($("#"+_id+" .catterc").is(':checked')?$("#"+_id+" .catterc").val():$("#"+_id+" .catter option:selected").attr("value")),
id: $("#"+_id+" input[name=vauchid]").val(),
pin: $("#"+_id+" textarea[name=pin]").val(),
numinal: $("#"+_id+" input[name=numinal]").val(),
usd: $("#"+_id+" input[name=usd]").val(),
descr: $("#"+_id+" textarea[name=descr]").val(),
status: $("#"+_id+" select[name=status]").val(),
date: $("#"+_id+" input[name=date]").val()
},
success: function(data){
$("#"+_id+" button").button('complete');
$("#"+_id+" input[name=cat]").val(($("#"+_id+" input[name=cat]").is(':checked')?$("#"+_id+" input[name=cat]").val():$("#"+_id+" select[name=cat] option:selected").attr("value")));
$("#"+_id+" .cata").text(($("#"+_id+" input[name=cat]").is(':checked')?$("#"+_id+" input[name=cat]").val():$("#"+_id+" select[name=cat] option:selected").attr("value")));
}
});
return false;
});
$(".modal").on("hidden",function(){
var _idsM=$(this).attr("id");
$("#"+_idsM+" button").button('reset');
$("input[name=cat]").attr({"checked":"checked"});
});
$("select[name=cat] option:first").attr({"selected":"selected"});
$(".modal").on("show", function(){
var mID=$(this).attr("id");
$('#'+mID+" .catterc").live("click", function(){
if($('#'+mID+" .catterc").is(":checked")){
$('#'+mID+" .catter").attr({"disabled":"disabled"});
}else{
$('#'+mID+" .catter").removeAttr("disabled");
}
});
});
});