$(document).ready(function(){
//!User Profile
$('a[href*="/index/8"]').click(function(){
return hs.htmlExpand(this, { objectType: 'iframe',width:618, headingText: 'Персональная страница', wrapperClassName: 'titlebar' } );
return false;
});
//!Favicons links
$('div.commcontent a.link').each(function(){ 
if($(this).find('img').length==0 && this.href.indexOf('mailto')!=0){ 
var regexp = /(?:7z|aac|ani|asf|asp|aspx|avi|bat|bmp|bsp|bz2|bz3|cab|cfg|cfm|chm|css|cur|dem|djvu|dll|doc|docx|exe|f4v|flac|flv|fon|gif|ico|iflv|inf|info|ini|iso|jpe|jpeg|jpg|js|key|log|lst|m3u|map|mdf|mds|mid|midi|mov|mp3|mp4|mpeg|mpeg4|mpg|ogg|pdf|pk3|pls|png|ppt|pptx|psd|rad|rar|res|rmf|rss|rtf|so|swf|tar|tga|tiff|torrent|ttf|txt|vmf|vmt|vtf|wad|wav|wma|wmv|xls|xlsb|xml|zip)$/;
$(this).before(regexp.test(this.href) ? '<img style="width:16px;height:16px;vertical-align:middle;" src="/img/filetype/' + this.href.match(regexp)[0] + '.png"> ' : 
'<img style="width:16px;height:16px;vertical-align:middle;" src="http://www.google.com/s2/favicons?domain=' + this.host + '"> ');
}
});
//!Show Hide ChatBOX
var chatbox = $.cookie('chatbox'),cbox = $("#chatbox"),showcbox = $("#achat");
if (chatbox == 'check') {
cbox.show(0);
showcbox.toggle(function () {
cbox.hide("fast");
$.cookie('chatbox', 'uncheck', {expires: 365, path: '/'});
},
function () {
cbox.show("fast");
$.cookie('chatbox', 'check', {expires: 365, path: '/'});
});
} else {
showcbox.toggle(function () {
cbox.show("fast");
$.cookie('chatbox', 'check', {expires: 365, path: '/'});
},
function () {
cbox.hide("fast");
$.cookie('chatbox', 'uncheck', {expires: 365, path: '/'});
});
};
//!Scrolling
$("a.go[href*=#]")
.click(function() {
var duration=1000;
var easing="swing";
var newHash=this.hash;
var target=$(this.hash).offset().top;
var oldLocation=window.location.href.replace(window.location.hash, '');
var newLocation=this;
if(oldLocation+newHash==newLocation){
$('html:not(:animated),body:not(:animated)')
.animate({ scrollTop: target }, duration, easing, function() {
window.location.href=newLocation;
});
return false;
}
});
//!TopTABS
//When page loads...
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active ID content
return false;
});
//!CookiesBlocks
var navi = $.cookie('navi'),elem = $("#navi"),elem2 = $("#shownavi");
var inforum = $.cookie('inforum'),elem3 = $("#inforum"),elem4 = $("#showinforum");
var votes = $.cookie('votes'),elem5 = $("#votes"),elem6 = $("#showvotes");
var cloud = $.cookie('cloud'),elem7 = $("#cloud"),elem8 = $("#showcloud");
var stats = $.cookie('stats'),elem9 = $("#stats"),elem10 = $("#showstats");
if (navi == 'check') {
elem.slideUp("slow");
elem2.toggle(function () {
elem.slideDown("fast");
$.cookie('navi', 'uncheck', {expires: 365, path: '/'});
},
function () {
elem.slideUp("fast");
$.cookie('navi', 'check', {expires: 365, path: '/'});
});
} else {
elem2.toggle(function () {
elem.slideUp("fast");
$.cookie('navi', 'check', {expires: 365, path: '/'});
},
function () {
elem.slideDown("fast");
$.cookie('navi', 'uncheck', {expires: 365, path: '/'});
});
};
if (inforum == 'check') {
elem3.slideUp("slow");
elem4.toggle(function () {
elem3.slideDown("fast");
$.cookie('inforum', 'uncheck', {expires: 365, path: '/'});
},
function () {
elem3.slideUp("fast");
$.cookie('inforum', 'check', {expires: 365, path: '/'});
});
} else {
elem4.toggle(function () {
elem3.slideUp("fast");
$.cookie('inforum', 'check', {expires: 365, path: '/'});
},
function () {
elem3.slideDown("fast");
$.cookie('inforum', 'uncheck', {expires: 365, path: '/'});
});
};
if (votes == 'check') {
elem5.slideUp("slow");
elem6.toggle(function () {
elem5.slideDown("fast");
$.cookie('votes', 'uncheck', {expires: 365, path: '/'});
},
function () {
elem5.slideUp("fast");
$.cookie('votes', 'check', {expires: 365, path: '/'});
});
} else {
elem6.toggle(function () {
elem5.slideUp("fast");
$.cookie('votes', 'check', {expires: 365, path: '/'});
},
function () {
elem5.slideDown("fast");
$.cookie('votes', 'uncheck', {expires: 365, path: '/'});
});
};
if (cloud == 'check') {
elem7.slideUp("slow");
elem8.toggle(function () {
elem7.slideDown("fast");
$.cookie('cloud', 'uncheck', {expires: 365, path: '/'});
},
function () {
elem7.slideUp("fast");
$.cookie('cloud', 'check', {expires: 365, path: '/'});
});
} else {
elem8.toggle(function () {
elem7.slideUp("fast");
$.cookie('cloud', 'check', {expires: 365, path: '/'});
},
function () {
elem7.slideDown("fast");
$.cookie('cloud', 'uncheck', {expires: 365, path: '/'});
});
};
if (stats == 'check') {
elem9.slideUp("slow");
elem10.toggle(function () {
elem9.slideDown("fast");
$.cookie('stats', 'uncheck', {expires: 365, path: '/'});
},
function () {
elem9.slideUp("fast");
$.cookie('stats', 'check', {expires: 365, path: '/'});
});
} else {
elem10.toggle(function () {
elem9.slideUp("fast");
$.cookie('stats', 'check', {expires: 365, path: '/'});
},
function () {
elem9.slideDown("fast");
$.cookie('stats', 'uncheck', {expires: 365, path: '/'});
});
};
});

