var MARKET_SECTION_PATH = 'production'; function showDialogWindow(width,height) { //alert(width+':'+height); $("
", { "class": "blackass", id: "blackass" }).appendTo('body'); $("", { "class": "dialog_window", id: "dialog" }).appendTo('#blackass'); $('#dialog').css("width",width); $('#dialog').css("height",height); $('#dialog').addClass('dialog_window_loading'); } $(document).ready(function(){ $('#blackass').live('click',function(e) { if(e.target != this) return; $('#dialog').fadeOut('fast',function(){ $('#blackass').fadeOut('fast',function(){ $('#blackass').remove(); }) }); //$(this).fadeOut('fast').remove(); }); /** * Showing teasers block */ var teaserElArr = $('.teaser_block'); teaserElArr.each(function(i,teaserEl){ //alert(i+": "+$(teaserEl).attr("count")); $(teaserEl).load("/index.php?section=teaser&act=teaser_ajax&subact=get_teaser_block&count="+$(teaserEl).attr("count"),function(){ $(teaserEl).append("Как разместить здесь тизер?"); }); }); var teaserElArr = $('.teaser_top_block'); teaserElArr.each(function(i,teaserEl){ //alert(i+": "+$(teaserEl).attr("count")); $(teaserEl).load("/index.php?section=teaser&act=teaser_ajax&subact=get_teaser_top_block&count="+$(teaserEl).attr("count"),function(){ $(teaserEl).append("Как разместить здесь тизер?"); }); }); // Top teasers var teaserElArr = $('.teaser_top'); teaserElArr.each(function(i,teaserEl){ //alert(i+": "+$(teaserEl).attr("count")); $(teaserEl).load("/index.php?section=teaser&act=teaser_ajax&subact=get_teaser_top&top_pos="+$(teaserEl).attr("teaser_top_pos")); }); /** * end of teasers block */ $(".market_link2more_sections").click(function(){ $(this).parent().addClass('ajax_standby'); $(this).parent().load("/index.php?section="+MARKET_SECTION_PATH+"&act=market_ajax&subact=market_load_sections&otrasl_not_id=" + $(this).attr('otrasl_not_id') + "&parent_section_id="+$(this).attr('otrasl_parent_id'),function(){ $(this).removeClass('ajax_standby'); }); return false; }); /** * Autocommplete data_producer field */ $('#market_form_producer_select').change(function(){ $('#data_producer').val($(this).val()); }); $('#data_producer').keyup(function(event){ if (event.keyCode=='40' && $('#data_producer_autocomplete').css('display')=='block') $('#data_producer_autocomplete').focus(); var cur_el = $(this); cur_val = $(this).val(); var arr = new Array("ООО ","ЗАО ","ОАО ","ИП ","<",">","\"","`","'"); var disabled=false; $.each(arr,function(i,data){ if (cur_val.indexOf(data)>=0) { $('#data_producer_error').html("Не указывайте форму собственности или кавычки!"); $(cur_el).parent("form").find("input:last-child").attr("disabled",true); disabled=true; } }); if (!disabled) { $('#data_producer_error').html(""); $(cur_el).parent("form").find("input:last-child").attr("disabled",false); if (cur_val.length>1) { $.ajaxSetup({ scriptCharset: "utf-8" , contentType: "application/x-www-form-urlencoded; charset=utf-8", cache: false}); $.get("/index.php?section=production&act=market_ajax&subact=market_get_brands_options",{ keyword:cur_val },function(data) { if (data.length>0) { //alert(data); $('#data_producer_autocomplete').html(data); $('#data_producer_autocomplete').slideDown('fast'); } else { $('#data_producer_autocomplete').html(''); $('#data_producer_autocomplete').slideUp('fast'); } }); } } }); $('#data_producer').focus(function(){ $(this).attr('focused','true'); }); $('#data_producer').blur(function(){ $(this).attr('focused','false'); }); $('#data_producer_autocomplete').click(function(){ //alert($(this).val()); $('#data_producer').val($(this).val()); $('#data_producer_autocomplete').slideUp('fast'); }); $('#data_producer_autocomplete').blur(function(){ if ($('#data_producer').attr('focused') == 'false') $(this).slideUp(); }); $('#data_producer_autocomplete').keypress(function(event){ if (event.keyCode == '13' || event.keyCode == '9') { $('#data_producer').val($(this).val()); $(this).slideUp('fast'); } }); /** * endof: Autocommplete data_producer field */ $('.checkRequired').submit(function(){ var reqarr = $(this).find(".required"); var error = false; tinyMCE.triggerSave(); var data_text = $('#data_text').val(); data_text = data_text.trim(); if (data_text == '[p] [/p]') $('#data_text').val(''); reqarr.each(function(i,req) { //alert($(req).attr('name')+" : "+$(req).val()); if (!$(req).val() || $(req).val() == '0') { $(req).css({border:'1px red solid'}); error = true; } else { $(req).css({border:'1px #aaa solid'}); } }); if (error) { $(this).find("#form_check_msg").html("Заполните обязательные поля"); return false; } }); $('#market_mass_update_form').submit(function(){ //alert($('input:radio[name=mu_action]:checked').val()); if ( !$('input:radio[name=mu_action]:checked').val() ) { $('#mass_update_form_msg').html('Выберите действие'); return false; } if ( !$('.data_item_checkbox:checked').val() ) { $('#mass_update_form_msg').html('Выберите хотябы одну запись'); return false; } }); $('input:radio[name=mu_action]').change(function(){ $('#mass_update_form_msg').html(''); }); $('.market_list_mine_mass_price_input').change(function(){ $('#data_id_'+$(this).attr('data_id')).attr("checked","checked"); }); $('.tender_invalid2valid_link').click(function(){ $(this).removeClass('tender_invalid2valid_link'); $(this).addClass('tender_turned2valid_link'); $(this).load("/index.php?section=tenders&act=tender_ajax&subact=tender_validate&tender_id="+$(this).attr('tender_id'),function(){ //$(this).parent().parent("div").fadeOut('slow'); }); }); $('#tenders_validate_all_on_page').click(function(){ if ( confirm('Утвердить все тендеры на странице?') ) { $('.tender_invalid2valid_link').each(function(i,obj) { //$('#tenders_validate_all_on_page').append(i+" : "+$(obj).attr('tender_id')+"