var stopLoadWork=0;
jQuery.fn.margin = function() {
var marginTop = this.outerHeight(true) - this.outerHeight();
var marginLeft = this.outerWidth(true) - this.outerWidth();
return {
top: marginTop,
left: marginLeft
}
};
$(document).ready(
function(){
$('.cstop').click(function(){
return false;
});
var hasSlide=0;
$('.scroll-next').click(function(e){
$container=$(this).parent().find('.album-photos');
total_blocks=$container.width()/228;
currentAlbumBlock=(-parseInt($container.margin().left)/228)+2;
if(total_blocks==currentAlbumBlock) $(this).hide();
if(!hasSlide){
items=$(this).parent().find('.album-photos div:nth-child('+(currentAlbumBlock)+')').find('a').length;
if((currentAlbumBlock+1)<=total_blocks){
next_items=$(this).parent().find('.album-photos div:nth-child('+(currentAlbumBlock+1)+')').find('a').length;
$.ajax({
type: "POST",
url: "/ajax/getAlbumWorks.php",
data: "album_id="+$container.attr('album_id')+"&offset="+(currentAlbumBlock*6)+'&cover_id='+$container.attr('cover_id'),
cache: false,
success: function(data){
$.getScript("/js/jquery.actions.js.php");
$container.append(data);
}
});
}
hasSlide=1;
$container.parent().parent().find('.album-pages span').html(items+(currentAlbumBlock-1)*6);
margin_left=parseInt($container.margin().left)-228;
$container.animate({
marginLeft: margin_left+'px'
},1000,function(){
hasSlide=0;
$(this).parent().parent().find('.scroll-prev').show();
});
}
e.stopImmediatePropagation();
return false;
});
$('.scroll-prev').click(function(e){
if(!hasSlide){
hasSlide=1;
$container=$(this).parent().find('.album-photos');
currentAlbumBlock=(-parseInt($container.margin().left)/228)+1;
$container.parent().parent().find('.album-pages span').html((currentAlbumBlock-1)*6);
margin_left=parseInt($container.margin().left)+228;
margin_left=margin_left>0 ? 0 : margin_left;
if(!margin_left) $(this).hide();
$container.animate({
marginLeft: margin_left+'px'
},1000,function(){
hasSlide=0;
$(this).parent().parent().find('.scroll-next').show();
});
}
e.stopImmediatePropagation();
return false;
});
$(".subtitle").click(function(){
$(this).parent().find(".hider").toggle('fast');
return false;
});
$("#newalbum").keypress(function(event) {
if ( event.which == 13 ) {
reg_new_album($('#newalbum').val());
}
});
$('input[placeholder], textarea[placeholder]').placeholder();
$('a[rel^=#]').click(function() {
var popID = $(this).attr('rel').substr(1);
var popWidth = $(this).attr('width') ? $(this).attr('width') : 400;
var fade = $(this).attr('fade') ? 0 : 1;
$('#' + popID).fadeIn('fast').css({ 'width': Number( popWidth ) }); //.effect("shake", { times:1 },100);
$('#' + popID).prepend('
')
var add_height=0;
if(popID=='popup-google' || popID=='http-uploader') add_height=180;
var popMargTop = ($('#' + popID).height() + 80 + add_height) / 2;
var popMargLeft = ($('#' + popID).width() + 80) / 2;
$('#' + popID).css({
'margin-top' : -popMargTop,
'margin-left' : -popMargLeft
});
fade=($.browser.msie && $.browser.version<8) ? 0 : fade;
if(fade){
$('body').append('