size_w_big=0; size_h_big=0; function gallery_abspos_small(obj,size_w,size_h) { $(document).ready(function() { gallery_a2bspos_small(obj,size_w,size_h);}); return true; } function gallery_get_big(obj, url, upload_url, id, w, h, size,w1,h1,_size_w_big,_size_h_big) { size_w_big=_size_w_big; size_h_big=_size_h_big; $('#gallery_big_photo_'+id+' img').animate({opacity: 0}, 100, function() { $('#gallery_big_photo_'+id).html(""); /*$('#gallery_big_img_'+id+' div').css({'left':50,'top':50});*/ $('#gallery_big_img_'+id+' div img').attr('src',"/files/images/upload/"+upload_url); $('#gallery_big_img_img_'+id).attr('src',"/files/images/preview/"+w1+"x"+h1+"_"+url); $('#gallery_big_photo_'+id+' img').animate({opacity: 1}, 100);}); } function gallery_get_z_big(id,width,height,over_width,over_height) { close_all(id); w_big=size_w_big; if(size_w_big==0) w_big=over_width; if(w_big/width>1.2) { $('#gallery_big_img_'+id+' div.over').css('display','block').find('div.loop').css('display:block'); } $('#gallery_big_img_'+id+' div.over').css({'left':'5px','top':'5px'}).find('img').css('margin','0'); $('#gallery_big_img_'+id) //.css({'margin-top':'-'+height/4+'px','margin-left':'-'+width/4+'px'}) .css({'margin-top':'-'+height/4+'px','left':(screen.width-width)/2+'px'}) .animate({'width': width+'px', opacity:1}, 200, function() { }); } function gallery_get_z_hide(id) { $('#gallery_big_img_'+id+' div.over').css('display','none'); /*$('#gallery_big_img_'+id).animate({ width: 0, 'margin-top':0 }, 100, function() { $(this).css('display','none'); }); */ $('#gallery_big_img_'+id).fadeOut(200, function() { $(this).css({'display':'none','opacity':0}); }); } function close_all(oid) { $('.gallery_get_z_hide').each(function (index,obj) { var id = $(obj).parent().attr('id'); id=id.split('gallery_big_img_'); id=id[1]; if(oid!=id) { gallery_get_z_hide(id); } }); } function start_gallery() { $('div.over').hover(function() { $(this).find('div.loop').toggle(); }); $('.gallery_big_photo img').animate({opacity: 1}, 1); $('.gallery_big_img').animate({opacity: 0}, 1); $('.gallery_preview img').animate({opacity: 0}, 1); close_all(); var a = $('.over').length; if(a>0) { if($.browser.msie) { $('.over').draggable({containment:'parent', grid: [10, 10], drag:function(event, ui) { mv(ui); }}); } else { $('.over').draggable({containment:'parent', drag:function(event, ui) { mv(ui); }}); } } $('div.pre_gallery').css({'display':'none','visibility':'visible'}).show(); } $(document).ready(function() { start_gallery(); }); function gallery_a2bspos_small(obj,size_w,size_h) { var w=obj.offsetWidth; var h=obj.offsetHeight; var h_n=h; var w_n=w; if (w > size_w) { h_n = h*(size_w/w); w_n = size_w; } if(h_n==null) { h_n=h; } if (h_n > size_h) { w_n = w*(size_h/h); h_n = size_h; } obj.style.height = h_n+'px'; obj.style.width = w_n+'px'; obj.style.top = (size_h-h_n)/2+'px'; obj.style.visibility='visible'; $(obj).animate({opacity: 1}, 200); } function mv(ui) { var left=107*(ui.position.left)/($('.ui-draggable-dragging img').parent().parent().children('img').width()-107)-7; var k =(($('.ui-draggable-dragging img').width())/($('.ui-draggable-dragging img').parent().parent().children('img').width())); var w=((ui.position.left)*k); //$('body').append(ui.position.left+' '+ui.position.top+' '+k+' '+k2+' '+$('.ui-draggable-dragging img').width()+' '+$('.ui-draggable-dragging img').parent().parent().children('img').width()+'
'); var top=107*(ui.position.top)/($('.ui-draggable-dragging img').parent().parent().children('img').height()-107)-3; var k2 =(($('.ui-draggable-dragging img').height())/($('.ui-draggable-dragging img').parent().parent().children('img').height())); var h=((ui.position.top)*k2); //$('#debug2').html($('.ui-draggable-dragging img').parent().parent().children('img').width()+'::'+$('.ui-draggable-dragging img').width()+'::'+(ui.position.left)+'::'+(left)); $('.ui-draggable-dragging img').css({"margin-top":0-(h-top+top*k2),"margin-left":0-(w-left+left*k) }); } $("head").append(""); css = $("head").children(":last"); css.attr({ rel: "stylesheet", type: "text/css", href: "/gallery/skin/gallery.css" });