$(document).ready(function(){
//!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: '/'});
});
};
//!Replace imgs
$("img[src='http://s15.ucoz.net/img/fr/eb.gif']").attr('src', 'http://www.hl2dmu.ru/img/cppics/penc.png').removeAttr("width").removeAttr("height");
$("img[src='http://s15.ucoz.net/img/fr/db.gif']").attr('src', 'http://www.hl2dmu.ru/img/cppics/del.png').removeAttr("width").removeAttr("height").css("margin-left","4px");
//!User Profile
$('a[href*="/index/8"]').click(function(){
return hs.htmlExpand(this, { objectType: 'iframe',width:618, headingText: 'Персональная страница', wrapperClassName: 'titlebar' } );
return false;
});
//!Favicons links
$('a.link,a.entryAttach').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 + '"> ');
}
});
//!Spoiler
$('input.uSpoilerButton').removeAttr('onclick').click(function () {
this.value = this.value.replace(/\[.\]/, '[' + ($(this).parent().parent().hasClass('uSpoilerClosed') ? '-' : '+') + ']');
$(this).parent().parent().attr('class', $(this).parent().parent().attr('class') == 'uSpoilerClosed' ? 'uSpoilerOpened': 'uSpoilerClosed'), $(this).parent().next().toggle("fast");
});
//!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;
}
});
});