// <!--

/*
$(document).ready(function(){

});
*/

$(document).ready(function(){
  jQuery("div.news .mini_link a").hover(
    function() { jQuery(this).toggleClass("hover"); },
    function() { jQuery(this).toggleClass("hover"); }
  )
  jQuery("div.news .item:first").css("border-top", "none");
  
  function share_links(j_href, j_title) {
    function replace(search, replace, subject){
      var ra = replace instanceof Array,
        sa = subject instanceof Array,
        l = (search = [].concat(search)).length,
        replace = [].concat(replace),
        i = (subject = [].concat(subject)).length;
      while(j = 0, i--)
        while(subject[i] = subject[i].split(search[j]).join(ra ? replace[j] || "" : replace[0]), ++j < l);
      return sa ? subject : subject[0];
    }
    j_title = replace("\"", "&quot;", j_title);
    j_sharing_text = "<div class='share_icon' style='display: block;'>\n";
    j_sharing_text += '<a href="http://www.liveinternet.ru/journal_post.php?action=n_add&amp;cnurl='+j_href+'&amp;cntitle='+j_title+'%27" target="_blank" rel="nofollow"><img src="images/icon/blog_ico_22.gif" alt="Запомнить эту страницу на LiveInternet.ru" title="Запомнить эту страницу на LiveInternet.ru" border="0" height="18" width="18"></a>\n';
    j_sharing_text += '<a href="http://memori.ru/link/?sm=1&amp;u_data[url]='+j_href+'&amp;u_data[name]=%D0%9C%D0%BE%D1%81%D0%BA%D0%B2%D0%B0%20%D0%BF%D1%80%D0%BE%D1%89%D0%B0%D0%B5%D1%82%D1%81%D1%8F%20%D1%81%20%D0%B6%D0%B5%D1%80%D1%82%D0%B2%D0%B0%D0%BC%D0%B8%20%D1%82%D0%B5%D1%80%D0%B0%D0%BA%D1%82%D0%BE%D0%B2" target="_blank" rel="nofollow"><img src="images/icon/blog_ico_1.gif" alt="Запомнить эту страницу на memori.ru" title="Запомнить эту страницу на memori.ru" border="0" height="18" width="18"></a>\n';
    j_sharing_text += '<a href="http://moemesto.ru/post.php?url='+j_href+'&amp;title='+j_title+'" target="_blank" rel="nofollow"><img src="images/icon/blog_ico_2.gif" alt="Запомнить эту страницу на memori.ru" title="Запомнить эту страницу на moemesto.ru" border="0" height="18" width="18"></a>\n';
    j_sharing_text += '<a href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk='+j_href+'&amp;title='+j_title+'" target="_blank" rel="nofollow"><img src="images/icon/blog_ico_5.gif" alt="Запомнить эту страницу на google.com" title="Запомнить эту страницу на google.com" border="0" height="18" width="18"></a>\n';
    j_sharing_text += '<a href="http://news2.ru/add_story.php?url='+j_href+'&amp;title='+j_title+'" target="_blank" rel="nofollow"><img src="images/icon/blog_ico_8.gif" alt="Запомнить эту страницу на news2.ru" title="Запомнить эту страницу на news2.ru" border="0" height="18" width="18"></a>\n';
	
	j_sharing_text += '<a href="http://smi2.ru/add/?url='+j_href+'&amp;title='+j_title+'" target="_blank" rel="nofollow"><img src="images/icon/blog_ico_10.gif" alt="Запомнить эту страницу на smi2.ru" title="Запомнить эту страницу на smi2.ru" border="0" height="18" width="18"></a>\n';
    <!--j_sharing_text += '<a href="http://smi2.ru/add/?url='+j_href+'&amp;title='+j_title+'" target="_blank" rel="nofollow"><img src="images/icon/blog_ico_10.gif" alt="Запомнить эту страницу на smi2.ru" title="Запомнить эту страницу на smi2.ru" border="0" height="18" width="18"></a>\n';-->
    //j_sharing_text += '<a href="http://twitter.com/home?status=%D0%9C%D0%BE%D1%81%D0%BA%D0%B2%D0%B0+%D0%BF%D1%80%D0%BE%D1%89%D0%B0%D0%B5%D1%82%D1%81%D1%8F+%D1%81+%D0%B6%D0%B5%D1%80%D1%82%D0%B2%D0%B0%D0%BC%D0%B8+%D1%82%D0%B5%D1%80%D0%B0%D0%BA%D1%82%D0%BE%D0%B2+http%3A%2F%2Fvesti.ru%2Ft%3F350588" target="_blank" rel="nofollow"><img src="images/icon/blog_ico_11.gif" alt="Запомнить эту страницу на twitter.com" title="Запомнить эту страницу на twitter.com" border="0" height="18" width="18"></a>\n';
    j_sharing_text += '<a href="http://zakladki.yandex.ru/userarea/links/addfromfav.asp?bAddLink_x=1&amp;lurl='+j_href+'&amp;lname='+j_title+'" target="_blank" rel="nofollow"><img src="images/icon/blog_ico_12.gif" alt="Запомнить эту страницу на zakladki.yandex.ru" title="Запомнить эту страницу на zakladki.yandex.ru" border="0" height="18" width="18"></a>\n';
    j_sharing_text += '<a href="http://toodoo.ru/digest/discuss?dig_url='+j_href+'&amp;comment='+j_title+'" target="_blank" rel="nofollow"><img src="images/icon/blog_ico_16.gif" alt="Запомнить эту страницу на toodoo.ru" title="Запомнить эту страницу на toodoo.ru" border="0" height="18" width="18"></a>\n';
<!--	j_sharing_text += '<a href="http://www.facebook.com/share.php?u=http://www.tassovka.ru&t='+j_title+'" target="_blank" rel="nofollow"><img src="images/icon/ico_01.gif" border="0" height="16" width="16"/></a>\n';-->
   j_sharing_text += '<a href="http://wd.sharethis.com/api/sharer.php?destination=facebook&url='+j_href+'&title='+j_title+'&publisher=754492c7-0d67-4aae-8694-6b663018c9fc&fpc=false&sessionID=1270198484469.34714&source=button" target="_blank" rel="nofollow"><img src="images/icon/ico_01.gif" border="0" height="16" width="16"/></a>\n';
<!--	 j_sharing_text += '<a href="http://twitter.com/home?status='+j_href+'&title='+j_title+'http://http://www.tassovka.ru/" target="_blank" rel="nofollow"><img src="images/icon/ico_02.gif" border="0" height="16" width="16"/></a>\n';-->
    j_sharing_text += '<a href="http://twitter.com/home?status='+j_title+'www.tassovka.ru/" target="_blank" rel="nofollow"><img src="images/icon/ico_02.gif" border="0" height="16" width="16"/></a>\n';
	
    j_sharing_text += '<a href="http://wd.sharethis.com/api/sharer.php?destination=digg&url='+j_href+'&title='+j_title+'&publisher=754492c7-0d67-4aae-8694-6b663018c9fc&fpc=false&sessionID=1270198885519.21313&source=button" target="_blank" rel="nofollow"><img src="images/icon/ico_03.gif" border="0" height="16" width="16"/></a>\n';
    j_sharing_text += '<a href="http://wd.sharethis.com/api/sharer.php?destination=delicious&url='+j_href+'&title='+j_title+'0%D0%B9%D1%82%20%D0%BA%D0%BE%D1%80%D0%BE%D1%82%D0%BA%D0%B8%D1%85%20%D1%81%D0%BE%D0%BE%D0%B1%D1%89%D0%B5%D0%BD%D0%B8%D0%B9&publisher=754492c7-0d67-4aae-8694-6b663018c9fc&fpc=false&sessionID=1270199291209.34833&source=button" target="_blank" rel="nofollow"><img src="images/icon/ico_04.gif" border="0" height="16" width="16"/></a>\n';
    j_sharing_text += '<a href="http://wd.sharethis.com/api/sharer.php?destination=myspace&url='+j_href+'&title='+j_title+'0%D0%B9%D1%82%20%D0%BA%D0%BE%D1%80%D0%BE%D1%82%D0%BA%D0%B8%D1%85%20%D1%81%D0%BE%D0%BE%D0%B1%D1%89%D0%B5%D0%BD%D0%B8%D0%B9&publisher=754492c7-0d67-4aae-8694-6b663018c9fc&fpc=false&sessionID=1270199291209.34833&source=button" target="_blank" rel="nofollow"><img src="images/icon/ico_05.gif" border="0" height="16" width="16"/></a>\n';
    j_sharing_text += '<a href="http://wd.sharethis.com/api/sharer.php?destination=stumbleupon&url='+j_href+'&title='+j_title+'0%D0%B9%D1%82%20%D0%BA%D0%BE%D1%80%D0%BE%D1%82%D0%BA%D0%B8%D1%85%20%D1%81%D0%BE%D0%BE%D0%B1%D1%89%D0%B5%D0%BD%D0%B8%D0%B9&publisher=754492c7-0d67-4aae-8694-6b663018c9fc&fpc=false&sessionID=1270199291209.34833&source=button" target="_blank" rel="nofollow"><img src="images/icon/ico_06.gif" border="0" height="16" width="16"/></a>\n';
    j_sharing_text += '<a href="http://wd.sharethis.com/api/sharer.php?destination=linkedin&url='+j_href+'&title='+j_title+'0%D0%B9%D1%82%20%D0%BA%D0%BE%D1%80%D0%BE%D1%82%D0%BA%D0%B8%D1%85%20%D1%81%D0%BE%D0%BE%D0%B1%D1%89%D0%B5%D0%BD%D0%B8%D0%B9&publisher=754492c7-0d67-4aae-8694-6b663018c9fc&fpc=false&sessionID=1270199291209.34833&source=button" target="_blank" rel="nofollow"><img src="images/icon/ico_07.gif" border="0" height="16" width="16"/></a>\n';
    j_sharing_text += '</div>\n';
    return j_sharing_text;
  }
  
  jQuery(":not(.ilink_1)").click(function() {
    jQuery("div.mini_link .share_icon").hide();
  })
  
  jQuery("div.mini_link .ilink_1").click(function() {
    jQuery("div.mini_link .share_icon").hide();
    j_title = jQuery(this).parent().parent().next().text();
    j_href = document.location.href;
    j_share = share_links(j_href,j_title);
    if (jQuery(this).parent().find("div.share_icon").length) {
      jQuery(this).parent().find("div.share_icon").show();
    } else {
      jQuery(this).parent().append(j_share);
    }
    return false;
  })
});

function ui_popup_close() {
  function __do_close(doc) {
    var j_pw = jQuery("#popup_window", doc);
    var j_pw_title = jQuery("#div_pw_title", doc);
    var j_pw_frame = jQuery("#frame_pw", doc);
    
    j_pw_title.html("&nbsp;")
    j_pw_frame.attr("src", "about:blank");
    j_pw.attr("class", "nop");

    return false;
  }
  __do_close(window.top.document);
}

$(document).ready(function(){
  var j_pw = jQuery("#popup_window");
  var j_pw_title = jQuery("#div_pw_title");
  var j_pw_frame = jQuery("#frame_pw");

  function open_popup(j_this, attr) {
    var p_classes = j_this.attr("class").split(' ');

    var p_type = "type_1";
    for (var index = 0; index < p_classes.length; index++) {
        var p_class = p_classes[index];
        if (p_class.indexOf("size_")==0) {
          j_size = p_class.substr(5);
          j_size = j_size.split('x');
          j_x = parseInt(j_size[0],10);
          j_y = parseInt(j_size[1],10);
          jQuery("#popup_window .center .body iframe").css("width", j_x).css("height", j_y);
          jQuery("#popup_window .center .body").css("width", j_x).css("height", j_y);
          jQuery("#popup_window .center").css("width", j_x+20).css("height",j_y+50);
        }
    }

    var p_href = j_this.attr(attr);
    j_pw_title.html(j_this.attr("title"))
    j_pw.attr("class", "act " + p_type);
      if ($.browser.msie && $.browser.version == 6) {
        var __fix_popup_position_ie6 = function() {
          scroll_position = jQuery("html").scrollTop();
          html_height = jQuery("html").height() - 4;
          jQuery("#popup_window").css("top", scroll_position).css("height", html_height);
          window.setTimeout(__fix_popup_position_ie6, 100);
        }
        window.setTimeout(__fix_popup_position_ie6, 100);
      }
    if (p_href.indexOf("?") > 0) {
      j_pw_frame.attr("src", p_href+"&type="+p_type);
    } else {
      j_pw_frame.attr("src", p_href+"?type="+p_type);
    }
    return false;
  };

  jQuery("a.popup").click(function() {
    open_popup(jQuery(this), "href");
    return false;
  })
  
  jQuery("#a_pw_close")
    .bind("click", ui_popup_close)
    .hover(
      function(){
        jQuery(this).addClass("close_popup_act");
      },
      function() {
        jQuery(this).removeClass("close_popup_act");
      }
    );
});

// -->
