jQuery("document").ready(function(){ jQuery("a.page-numbers").click(function(e){ return ngg_ajax_navigation(e, this); }); jQuery("a.prev").click(function(e){ return ngg_ajax_navigation(e, this); }); jQuery("a.next").click(function(e){ return ngg_ajax_navigation(e, this); }); jQuery("a.ngg-browser-next").click(function(e){ return ngg_ajax_browser_navigation(e, this); }); jQuery("a.ngg-browser-prev").click(function(e){ return ngg_ajax_browser_navigation(e, this); }); }); function ngg_ajax_navigation(e, obj){ var pageNumber=0; if(jQuery(obj).hasClass("page-numbers")){ pageNumber=jQuery(obj).contents()[0].data; }else if(jQuery(obj).hasClass("prev")){ pageNumber=jQuery(obj).attr("id").substr(9); }else if(jQuery(obj).hasClass("next")){ pageNumber=jQuery(obj).attr("id").substr(9); } var currentNode=obj.parentNode; while (null!=currentNode.parentNode&&!jQuery.nodeName(currentNode.parentNode, "body")&&"ngg-gallery-"!=jQuery(currentNode.parentNode).attr("id").substring(0, 12)){ currentNode=currentNode.parentNode; } if(jQuery(currentNode.parentNode).attr("id")){ var gallery=jQuery(currentNode.parentNode); var payload=gallery.attr("id").substring(12); var separatorPosition=parseInt(payload.indexOf("-")); var galleryId=payload.substr(0, separatorPosition); var postId=payload.substr(separatorPosition + 1); if((galleryId.length==0)||(postId.length==0)){ return true; } ngg_show_loading(e); jQuery.get(ngg_ajax.callback, {p: postId, galleryid: galleryId, nggpage: pageNumber, type: "gallery"}, function (data, textStatus){ gallery.children().remove(); gallery.replaceWith(data); jQuery("document").ready(function(){ jQuery("a.page-numbers").unbind("click"); jQuery("a.prev").unbind("click"); jQuery("a.next").unbind("click"); shutterReloaded.init('sh'); jQuery("a.page-numbers").click(function(e){ return ngg_ajax_navigation(e, this); }); jQuery("a.prev").click(function(e){ return ngg_ajax_navigation(e, this); }); jQuery("a.next").click(function(e){ return ngg_ajax_navigation(e, this); }); ngg_remove_loading(); }); }); return false; } return true; }; function ngg_ajax_browser_navigation(e, obj){ if("ngg-prev-"==jQuery(obj).attr("id").substr(0, 9)||"ngg-next-"==jQuery(obj).attr("id").substr(0, 9)){ var imageNumber=jQuery(obj).attr("id").substr(9); var currentNode=obj; while (null!=currentNode.parentNode&&!jQuery.nodeName(currentNode.parentNode, "body")&&!jQuery(currentNode.parentNode).hasClass("ngg-imagebrowser")){ currentNode=currentNode.parentNode; } if(jQuery(currentNode.parentNode).hasClass("ngg-imagebrowser")){ var gallery=jQuery(currentNode.parentNode); var payload=gallery.attr("id").substring(17); var separatorPosition=parseInt(payload.indexOf("-")); var galleryId=payload.substr(0, separatorPosition); var postId=payload.substr(separatorPosition + 1); if((galleryId.length==0)||(postId.length==0)){ return true; } ngg_show_loading(e); jQuery.get(ngg_ajax.callback, {p: postId, galleryid: galleryId, pid: imageNumber, type: "browser"}, function (data, textStatus){ gallery.children().remove(); gallery.replaceWith(data); jQuery("document").ready(function(){ jQuery("a.ngg-browser-next").unbind("click"); jQuery("a.ngg-browser-prev").unbind("click"); shutterReloaded.init('sh'); jQuery("a.ngg-browser-next").click(function(e){ return ngg_ajax_browser_navigation(e, this); }); jQuery("a.ngg-browser-prev").click(function(e){ return ngg_ajax_browser_navigation(e, this); }); ngg_remove_loading(); }); }); return false; }} return true; } var loadingImage; function ngg_show_loading(obj){ loadingImage=jQuery(document.createElement("img")).attr("src", ngg_ajax.path + "images/ajax-loader.gif").attr("alt", ngg_ajax.loading); jQuery("body").append(loadingImage); jQuery(loadingImage).css({ position: "absolute", top: (obj.pageY + 15) + "px", left: (obj.pageX + 15) + "px" }); jQuery(document).mousemove(function(e){ loadingImage.css({ top: (e.pageY + 15) + "px", left: (e.pageX + 15) + "px" }); }); } function ngg_remove_loading(){ jQuery(document).unbind("mousemove"); jQuery(loadingImage).remove(); }; var Spoiler={ timer: 0, setOption: function(options){ var newOptions=Object.extend(options||{}, arguments[1]||{}); return newOptions; }, _start: function(){ jQuery('a.spoiler-tgl').each(function(i){ var el=jQuery('#'+jQuery(this).attr('id').replace('_tgl', '')); var opt=jQuery(this).attr('rev').split('||'); this.onclick=function(){Spoiler.plugin(el, jQuery(this), opt); return false;}; if(el.css('display')!='none'){ Spoiler.plugin(el, jQuery(this), opt); }}); }, start: function(){ jQuery('a.spoiler-tgl').each(function(i){ var tglr=jQuery(this); var el=tglr.parent('p:first').next('div.spoiler-body:first'); if(!el.length) return; var opt=tglr.attr('rev').split('||'); tglr.click(function(){ Spoiler.plugin(el, jQuery(this), opt); return false; }).focus(function(){this.blur()}); if(el.css('display')!='none'){ tglr.toggleClass("collapsed"); el.hide(); }}); }, showhide: function(el){ if(el.css('display')!='none') el.css('display', 'none'); else el.css('display', ''); }, Simple: function(el){ this.showhide(el); }, Appear: function(el, dur){ el.fadeIn(dur); }, Fade: function(el, dur){ el.fadeOut(dur); }, SlideDown: function(el, dur){ el.slideDown(dur); }, SlideUp: function(el, dur){ el.slideUp(dur); }, BlindDown: function(el, dur){ el.css({marginTop:-el.outerHeight()}).show().wrap('
'). animate({marginTop:'0'}, dur, function(){ jQuery(this).css({marginTop:''}).parent('.spoiler_outer_box').before(this).remove(); }); }, BlindUp: function(el, dur){ el.wrap('
'). animate({marginTop: -el.outerHeight()}, dur, function(){ jQuery(this).hide().css({marginTop:''}).parent('.spoiler_outer_box').before(this).remove(); }); }, PhaseIn: function(el, dur){ el.animate({height: "show", opacity: "show"}, dur); }, PhaseOut: function(el, dur){ el.animate({height: "hide", opacity: "hide"}, dur); }, PAIR: { 'slide': ['SlideDown','SlideUp'], 'blind': ['BlindDown','BlindUp'], 'appear': ['Appear','Fade'], 'phase': ['PhaseIn','PhaseOut'], 'simple': ['Simple','Simple'], 'apblind': ['Appear','BlindUp'] }, toggle: function(el, effect, dur){ if(!dur) dur='normal'; if(dur < 0) dur=dur * 1000; if(dur < 10) dur=dur * 100; if(dur > 700) dur='slow'; if(dur < 200) dur='fast'; effect=(effect||'appear').toLowerCase(); Spoiler[(el.css('display')!='none')?Spoiler.PAIR[effect][1]:Spoiler.PAIR[effect][0]](el, dur||400); }, Collapse: function(el, effect, me, dur){ Spoiler.toggle(el, effect, dur); jQuery(me).toggleClass("collapsed"); }, plugin: function(el, tid, opt){ if(el.css('display')!='none'){ tid.html(opt[1]); }else{ tid.html(opt[2]); } tid.toggleClass("collapsed"); Spoiler.toggle(el, opt[0], parseInt(opt[3])); }}; jQuery(document).ready(function(){ Spoiler.start(); }); function wpcc_ajax_calculate(id){ var wpcc_plugin_url=jQuery('#wpcc_form_url').val(); var sirialize_form='form.wpcc_form_'+id; jQuery(".wpcc_result_"+id).html(''); jQuery.post(wpcc_plugin_url+"action/wpcc_result.php", jQuery(sirialize_form).serialize(), function(html){ jQuery(".wpcc_result_block_"+id).html(html); }); return false; } function wpcc_ajax_mail(id){ var wpcc_plugin_url=jQuery('#wpcc_form_url').val(); var sirialize_form='form.wpcc_mail_form_'+id; jQuery(".wpcc_mail_info_"+id).show().html(''); jQuery.post(wpcc_plugin_url+"action/wpcc_mail_send.php", jQuery(sirialize_form).serialize(), function(html){ if(html!=''){ var wpcc_obj=eval("(" + html + ")"); if(wpcc_obj.error=='0'){ jQuery(".wpcc_mail_"+id).hide(); jQuery(".wpcc_mail_info_"+id).html(wpcc_obj.success); }else{ jQuery(".wpcc_mail_info_"+id).html(wpcc_obj.error); }} }); return false; };