app_root='/';c_check_delay=2000;c_progressupdate_delay=1000;$(document).ready(function(){function initTab(){$.post(app_root+'dataprocessor/',{data_type:'get_data_id',ajax:'false'},function(new_id){if(new_id)window.name=new_id;else alert('can not generate tab ID. Backend returned value: '+new_id)})}function refreshSaved(){$.post(app_root+'dataprocessor/',{data_type:'get_saved',tab_id:window.name,ajax:'true'},function(data){if(data)$('#SavedValues').html(data)})}function updateProgress(){if(!$('#CaptionAvailable').hasClass('processing')){if(timerid_progress!=0)clearTimeout(timerid_progress);return}$.post(app_root+'dataprocessor/',{data_type:'get_progress',tab_id:window.name,ajax:'true'},function(data){if(data&&(data!=0))$('#Result').html(data);else if(timerid_progress!=0)clearTimeout(timerid_progress);return})}if(!window.name)initTab();refreshSaved();var timerid=0;var timerid_progress=0;function checkDomains(){if($('#CaptionAvailable').hasClass('processing'))return;$('#Result').html('');$('#Result').addClass('processing');$('#CaptionAvailable').addClass('processing');timerid_progress=setInterval(updateProgress,c_progressupdate_delay);$.post(app_root+'dataprocessor/',{data_type:'domains',wordsets:[$('#List1').val(),$('#List2').val(),$('#List3').val()],zones:sZones,tab_id:window.name,ajax:'true'},function(data){$('#Result').removeClass('processing');$('#CaptionAvailable').removeClass('processing');if(timerid_progress!=0)clearTimeout(timerid_progress);if(timerid!=0)clearTimeout(timerid);timerid_progress=0;timerid=0;$('#Result').html(data)})}var sZones='';$('#Zones input:checkbox').each(function(){var sThisVal=(this.checked?$(this).val():'');sZones+=(sZones==""?sThisVal:" "+sThisVal)});$('#ShowOptions').toggle(function(){$('#Options').slideToggle()},function(){$('#Options').slideToggle()});$('.list').change(function(event){var ctrl=$(event.target);if(ctrl.val()>0){$.post(app_root+'dataprocessor/',{data_type:'list_words',data_id:ctrl.val(),ajax:'true'},function(data){$('.in_list',ctrl.parent()).val(data);checkDomains()})}else{$('.in_list',ctrl.parent()).val('');checkDomains()}});$('#Zones input:checkbox').click(function(event){sZones='';$('#Zones input:checkbox').each(function(){var sThisVal=(this.checked?$(this).val():'');if(sThisVal!='')sZones+=(sZones==''?sThisVal:" "+sThisVal)});checkDomains()});$('.in_list').keyup(function(event){if(timerid!=0)clearTimeout(timerid);timerid=setTimeout(function(){checkDomains()},2000)});$('#Result  i').live('mouseenter',function(){$(this).addClass('hover')});$('#Result  i').live('mouseleave',function(){$(this).removeClass('hover')});$('#Result i').live('click',function(event){$.post(app_root+'dataprocessor/',{data_type:'save_domain',tab_id:window.name,domain:$(this).text(),ajax:'true'},function(data){if(data=='success'){refreshSaved();$(event.target).fadeOut()}})});$('.save_zone').live('click',function(event){container=$(event.target).parent().parent();$.post(app_root+'dataprocessor/',{data_type:'save_domains',tab_id:window.name,domains:$('.domains',container).text(),ajax:'true'},function(data){if(data=='success'){refreshSaved();$('.domains i',container).fadeOut()}})});$('#SavedValues  i .right em').live('mouseenter',function(){$(this).parents('i').addClass('marked_delete')});$('#SavedValues  i .right em').live('mouseleave',function(){$(this).parents('i').removeClass('marked_delete')});$('#SavedValues  i .right a').live('mouseenter',function(){$(this).parents('i').addClass('marked_buy')});$('#SavedValues  i .right a').live('mouseleave',function(){$(this).parents('i').removeClass('marked_buy')});$('#SavedValues  i .right em').live('click',function(event){$.post(app_root+'dataprocessor/',{data_type:'delete_saved',tab_id:window.name,domain:$(this).parents('i').children('.domain').text(),ajax:'true'},function(data){if(data=='success')$(event.target).parents('i').fadeOut();else{}})});$('#BtnClearsaved').click(function(event){$.post(app_root+'dataprocessor/',{data_type:'clear_saved',tab_id:window.name,ajax:'true'},function(data){$('#SavedValues').html(data)})});$('#SaveCtrl select').change(function(event){var ctrl=$(event.target);$.post(app_root+'dataprocessor/',{data_type:'set_registrar',new_registrar:ctrl.val(),tab_id:window.name,ajax:'true'},function(data){})})});
