﻿function AppendAdvert(p)
{
    $('.alert').remove();
    if(p==true)
    {
        if ($('#message').val() == "")
        {
            alert("Необходимо заполнить все поля");
            return;
        }

        elite.egservice.AppendAdvert($('#acity').val(), $('#email').val(), $('#username').val(), $('#message').val(), function (result) {
            $('#advert').hide();
            alert(result);
        });
        $("#advert td input, textarea").val("");
    }
    if (p == false) { $('#advert').hide(); $("div .adv").show(); }
    if (p == null) {  $('#advert').show(); $("div .adv").hide(); }
}

function ReadAdvert(e)
{
    var comment=$(e).parents(".item").children(".comment");
    if(comment.css("display")=="none"){comment.show();}else{comment.hide();}
}

function stations() {
    var city = $("#ctl00_ContentMain_cityid").val();
    var st = $("#ctl00_ContentMain_ugid").val();
    if (isNaN(st)) {st=0}
    elite.egservice.GetUStations(city, st, function(result) { $("#ug").html(result); });
}

function homeInit() {
    $(document).ready(function () {
        $.ajax({ url: "/services/egservice.asmx/GetHomeAnkets", success: function (data) { $('#dir1').html(data); } });
        $.ajax({ url: "/services/egservice.asmx/GetHomeVip", success: function (data) { $('#vip').html(data); } });
    });
}

$(document).ready(
  function () {
      $("i").each(function () {
          //$(this).replaceWith("<a class='" + $(this).attr("class") + "'" + " href='http://www.elite-dosug.com" + $(this).attr("title") + "'>" + $(this).text() + "</a>");
          $(this).replaceWith("<a class='" + $(this).attr("class") + "'" + " href='http://" + document.domain + $(this).attr("title") + "'>" + $(this).html() + "</a>");
      });
  }
);
