//most of these are so intellisense works correctly if (typeof ews == "undefined") var ews = {}; ews.PhotoGalleryBlock = {}; ews.PhotoGalleryBlock.SwitchModes = function (mode) { if (mode == "DynamicFolder") { ews.PhotoGalleryBlock.DynamicFolder.show(); ews.PhotoGalleryBlock.Static.hide(); } else { ews.PhotoGalleryBlock.Static.show(); ews.PhotoGalleryBlock.DynamicFolder.hide(); } } ews.PhotoGalleryBlock.Init = function() { $('.ews_phg a').lightBox({ imageBtnClose: "/Blocks/PhotoGalleryBlock/jQuery.lightBox/images/lightbox-btn-close.gif", imageBtnDownload: "/Blocks/PhotoGalleryBlock/jQuery.lightBox/images/lightbox-btn-download.gif", imageBtnPrev: "/Blocks/PhotoGalleryBlock/jQuery.lightBox/images/lightbox-btn-prev.gif", imageBtnNext: "/Blocks/PhotoGalleryBlock/jQuery.lightBox/images/lightbox-btn-next.gif", imageLoading: "/Blocks/PhotoGalleryBlock/jQuery.lightBox/images/lightbox-ico-loading.gif", imageBlank: "/Blocks/PhotoGalleryBlock/jQuery.lightBox/images/lightbox-blank.gif" }); }; ews.PhotoGalleryBlock.MoveImageUp = function () { if (ews.PhotoGalleryBlock.Images[0].selectedIndex == 0) return; var oTempImages = new Array(); var oSelected = ews.PhotoGalleryBlock.Images[0].options[ews.PhotoGalleryBlock.Images[0].selectedIndex]; for (var i = 0; i < ews.PhotoGalleryBlock.Images[0].options.length; i++) { oTempImages[oTempImages.length] = ews.PhotoGalleryBlock.Images[0].options[i]; } ews.PhotoGalleryBlock.Images[0].options.length = 0; for (var i = 0; i < oTempImages.length; i++) { if (oTempImages[i+1] == oSelected) { ews.PhotoGalleryBlock.Images[0].options[ews.PhotoGalleryBlock.Images[0].options.length] = oSelected; } if (oTempImages[i] != oSelected) { ews.PhotoGalleryBlock.Images[0].options[ews.PhotoGalleryBlock.Images[0].options.length] = oTempImages[i]; } } } ews.PhotoGalleryBlock.MoveImageDown = function () { if (ews.PhotoGalleryBlock.Images[0].selectedIndex == ews.PhotoGalleryBlock.Images[0].length - 1) return; var oTempImages = new Array(); var oSelected = ews.PhotoGalleryBlock.Images[0].options[ews.PhotoGalleryBlock.Images[0].selectedIndex]; for (var i = 0; i < ews.PhotoGalleryBlock.Images[0].options.length; i++) { oTempImages[oTempImages.length] = ews.PhotoGalleryBlock.Images[0].options[i]; } ews.PhotoGalleryBlock.Images[0].options.length = 0; var AddOnNext = false; for (var i = 0; i < oTempImages.length; i++) { if (oTempImages[i] == oSelected) { AddOnNext = true; } else { ews.PhotoGalleryBlock.Images[0].options[ews.PhotoGalleryBlock.Images[0].options.length] = oTempImages[i]; if (AddOnNext) { ews.PhotoGalleryBlock.Images[0].options[ews.PhotoGalleryBlock.Images[0].options.length] = oSelected; AddOnNext = false; } } } if (AddOnNext) { ews.PhotoGalleryBlock.Images[0].options[ews.PhotoGalleryBlock.Images[0].options.length] = oSelected; AddOnNext = false; } } ews.PhotoGalleryBlock.ChooseUrl = function() { var eChooseFolder = $("#ews_phg_pickstorage"); ews.UrlSelector.Show(eChooseFolder.find(".ews_urlselector").attr("id")); ews.Editor.ShowInLitebox(eChooseFolder[0].id); ews.Editor.ResizeLitebox(); } ews.PhotoGalleryBlock.CancelUrlSelect = function() { var eChooseFolder = $("#ews_phg_pickstorage"); ews.Editor.HideLitebox(eChooseFolder[0].id); } ews.PhotoGalleryBlock.SetUrlText = function(name, arg) { if (ews.PhotoGalleryBlock.Type[0].value == "Static") { var eChooseFolder = $("#ews_phg_pickstorage"); ews.Editor.HideLitebox(eChooseFolder[0].id); ews.PhotoGalleryBlock.AddImage(ews.UrlSelector.GetSelectedValue(),ews.UrlSelector.GetSelectedID()); } else { var eChooseFolder = $("#ews_phg_pickstorage"); ews.Editor.HideLitebox(eChooseFolder[0].id); $("input[id$=wFileLocation]")[0].value = ews.UrlSelector.GetSelectedValue(); $("input[id$=wFileID]")[0].value = ews.UrlSelector.GetSelectedID(); ews.PhotoGalleryBlock.Postback($("input[id$=wFileID]")[0].id, ews.UrlSelector.GetSelectedID()); } } ews.PhotoGalleryBlock.AddImage = function (ImageUrl, ImageID) { var oNewOption = new Option(ImageUrl, ImageID); ews.PhotoGalleryBlock.Images[0].options[ews.PhotoGalleryBlock.Images[0].length] = oNewOption; } ews.PhotoGalleryBlock.RemoveImage = function () { var i; for (i = ews.PhotoGalleryBlock.Images[0].length - 1; i>=0; i--) { if (ews.PhotoGalleryBlock.Images[0].options[i].selected) { ews.PhotoGalleryBlock.Images[0].remove(i); } } } ews.PhotoGalleryBlock.Postback = function() { $('.ews_photogalleryblock_images').each(function(){ $(".ews_photogalleryblock_images option").attr("selected","selected"); }); } ews.PhotoGalleryBlock.MaxImageSize = function(MaxSize) { } $(document).ready(function() { //loaded ews.PhotoGalleryBlock.DynamicFolder = $('.ews_photogalleryblock_dynamicfolder'); ews.PhotoGalleryBlock.Static = $('.ews_photogalleryblock_static'); ews.PhotoGalleryBlock.Images = $('.ews_photogalleryblock_images'); ews.PhotoGalleryBlock.Type = $('select[SimpleName=wGalleryType]'); ews.PhotoGalleryBlock.PostbackImages = $('#wControlBarImages'); ews.PhotoGalleryBlock.SquareImages = $('.ews_photogalleryblock_squareimages'); ews.PhotoGalleryBlock.Init(); ews.PhotoGalleryBlock.SwitchModes(ews.PhotoGalleryBlock.Type.val()); }); if (typeof Sys != "undefined" && Sys && Sys.Application) { Sys.Application.notifyScriptLoaded(); }