﻿// Запомнил сам - скажи другому, что в строчку код - дорога в кому! (с) Aleko

var j = jQuery.noConflict();

j(document).ready(function(){
// цитаты
j('.bbCodeBlock').find('.codeMessage').removeAttr('style')/*.css({overflow:'auto', maxHeight:'300px'})*/.end().find('.bbCodeName').remove().end();
j('.bbQuoteBlock').find('.quoteMessage').removeAttr('style').end().find('.bbQuoteName').removeAttr('style').prepend('<b>Цитата</b>').append(' :').find('.qName').prev('b').remove();
// Выравниваем папика

check(); j(window).resize(function(){  check(); });
function check(){
var h = geth();
if (h > 734){var m = h / 2 - 367 + "px"; j('#wrapper').css('marginTop', m); } else { j('#wrapper').css('marginTop', '0px'); }};
function geth() {return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;}
// Языкастая панелька

if(j.cookie("AdL")) {j(".rus").css("display", "none");j(".eng").css("display", "block");};j("#rus").click(function () {j(".eng").css("display", "none");j(".rus").css("display", "block");j.cookie("AdL", null);});j("#eng").click(function () {j(".rus").css("display", "none");j(".eng").css("display", "block");j.cookie("AdL", { expires: 999 });});

// Белогривые лошадки..

j("#menu img, #events img").hover(function(){ j(this).prev("div").animate({opacity: "show", marginTop: "-105"}, 250); }, function(){ j(this).prev("div").animate({opacity: "hide", marginTop: "-110"}, 250);});

// Калькулон

j(".off").toggle(function(){ j(this).attr("class","on").attr("src","images/bird.png"); }, function(){ j(this).attr("class","off").attr("src","images/birdempty.png"); });j(".off, .on").click(function () {var wmr = 0;j('[class^="on"]').each(function() {wmr += parseInt(j(this).attr('title'));});j('#wmr').html(wmr.toFixed(2) + " wmr");var wmz = wmr/27;j('#wmz').html(wmz.toFixed(2) + " wmz");});

// Меню в портфеле (Мутант слайдера и какой то хреновины экспромтом)

var href = "http://studioad.ru/works/data.txt?date=" + Math.random();j("#data").load(href);j("#up").hover(function() {j("#cont").animate({marginTop: "-" + parseInt(parseInt(j("#cont").height())-parseInt(j("#wrap").height())) + "", marginBottom: "0"}, 5000);j("#up").animate({opacity: 0.5}, 50);}, function() {j("#cont").stop();j("#up").animate({opacity: 1}, 100);});j("#down").hover(function() {j("#cont").animate({marginBottom: "-" + parseInt(parseInt(j("#cont").height())-parseInt(j("#wrap").height())) + "", marginTop: "0"}, 5000);j("#down").animate({opacity: 0.5}, 50);}, function() {j("#cont").stop();j("#down").animate({opacity: 1}, 100);});j("#options").hover(function () {j(this).animate({opacity: 0.5}, 50);},function () {j(this).animate({opacity: 1}, 100);}); j("#options").click(function () {if(j("#iWrap").is(":visible")){j("#iWrap").fadeOut("normal", function(){j("#iOptions").fadeIn("normal");});} else {j("#iOptions").fadeOut("normal", function(){j("#iWrap").fadeIn("normal");});}});j("#opt2").click(function() {j("#opt1, #opt3, #opt4").animate({marginLeft:'30px'}, 400);j("#opt2").animate({marginLeft:'10px'}, 400);j("#cont").animate({marginTop: "0", marginBottom: "0"}, 2000);j(".1").slideDown(2000);j(".2, .3").slideUp(2000, function(){resize()});});j("#opt3").click(function() {j("#opt1, #opt2, #opt4").animate({marginLeft:'30px'}, 400);j("#opt3").animate({marginLeft:'10px'}, 400);j("#cont").animate({marginTop: "0", marginBottom: "0"}, 2000);j(".2").slideDown(2000);j(".1, .3").slideUp(2000, function(){resize()});});j("#opt4").click(function() {j("#opt1, #opt3, #opt2").animate({marginLeft:'30px'}, 400);j("#opt4").animate({marginLeft:'10px'}, 400);j("#cont").animate({marginTop: "0", marginBottom: "0"}, 2000);j(".3").slideDown(2000);j(".2, .1").slideUp(2000, function(){resize()});});j("#opt1").click(function() {j("#opt2, #opt3, #opt4").animate({marginLeft:'30px'}, 400);j("#opt1").animate({marginLeft:'10px'}, 400);j("#cont").animate({marginTop: "0", marginBottom: "0"}, 2000);j(".1, .2, .3").slideDown(2000, function(){resize()});});function resize() {var a = j("#cont").height();if(parseInt(a)<311){j("#up").fadeOut(200);j("#down").fadeOut(200);} else {j("#up").fadeIn(200);j("#down").fadeIn(200);}};j(".point").hover(function() {j(this).css({backgroundColor:"#eeeeee"});}, function() {j(this).css({backgroundColor:""});});j(".point").click(function(){j(".number").css({color:"#dddddd"});j(this).find(".number").css({color:"#99CC00"});var number = j(this).find(".number").text();j("#iOptions").fadeOut("normal", function(){j("#iWrap").fadeOut("normal", function(){var src = j("#data").find("#" + number + "").find("#i").html();var nam = j("#data").find("#" + number + "").find("#n").html();var des = j("#data").find("#" + number + "").find("#d").html();j("#clock").fadeIn(100);j("#iWrap").html('<img id="load" src="' + src + '" alt="' + nam + '"><div class="workName">' + nam + '</div><div class="workDesc">' + des + '</div>').css({visibility:"hidden", display:"block"}).fadeOut(1000, function(){ j("#load").load(function(){j("#clock").fadeOut(100);j("#iWrap").css({visibility:"visible", display:"none"}).fadeIn("normal");});});});});});

}); // JQuery R.I.P. 

// Дальше нимаё

function bookmarkthis(title,url) {
  if (window.sidebar) { // Firefox
     window.sidebar.addPanel(title, url, "");
  } else if (document.all) { // IE
     window.external.AddFavorite(url, title);
  } else if (window.opera && window.print) { // Opera
     var elem = document.createElement('a');
     elem.setAttribute('href',url);
     elem.setAttribute('title',title);
     elem.setAttribute('rel','sidebar');
     elem.click();
  }
}
/* -- -- */