var GB_ANIMATION = true; var print_hide_el = ['.header', '.menu', '.content']; var print_hide_tl_w; var print_hide_tl_h; var print_hide_tl_t; function geocode(address_field, latitude_field, longitude_field, callback) { $.ajax({ type: "GET", url: "index.php?module=_location_geocoding", data: "location=" + $('#' + address_field).val(), timeout: 6000, // 6 sec timeout success: function(msg, textStatus){ if (msg != "false") { var geo = msg; geo = geo.split('|'); $('#' + latitude_field).val(geo[0]); $('#' + longitude_field).val(geo[1]); } else { $('#' + latitude_field).val("0"); $('#' + longitude_field).val("0"); } callback(); }, error: function() { callback(); } }); } function loadRegionalManagerSearch(filter, existing_id) { if (filter==undefined) filter = ""; if (existing_id==undefined) existing_id = ""; $.ajax({ type: 'GET', url: 'index.php?module=_promotion_select_regional_manager', data: "filter=" + filter + "®ional_manager_id=" + existing_id, complete: function(msg){ $('#regional_manager_id_dialog').html(msg.responseText); $('#regional_manager_id_dialog').dialog('open'); } }); } function loadLocalPartnerSearch(filter, existing_id) { if (filter==undefined) filter = ""; if (existing_id==undefined) existing_id = ""; $.ajax({ type: 'GET', url: 'index.php?module=_promotion_select_local_partner', data: "filter=" + filter + "&local_partner_id=" + existing_id, complete: function(msg){ $('#local_partner_id_dialog').html(msg.responseText); $('#local_partner_id_dialog').dialog('open'); } }); } function loadManualAttachments(attachment_id, type) { if (attachment_id == undefined) attachment_id = ""; if (type == undefined) type = ""; $.ajax({ type: 'GET', url: 'index.php?module=_manuals_attach', data: "attachment_id=" + attachment_id + "&attachment_type=" + type, complete: function(msg){ $('#manual_attachments_dialog').html(msg.responseText); $('#manual_attachments_dialog').dialog('open'); } }); } function toggleManualAttachment(manual_id, attachment_id, type) { if (manual_id == undefined) manual_id = ""; if (attachment_id == undefined) attachment_id = ""; if (type == undefined) type = ""; $.ajax({ type: 'GET', url: 'index.php?module=_manuals_attach_save', data: "manual_id=" + manual_id + "&attachment_id=" + attachment_id + "&attachment_type=" + type }); } function loadStocklist(location_id, startdate, enddate) { if (location_id == undefined) location_id = ""; $.ajax({ type: 'GET', url: 'index.php?module=_location_stocklist', data: "location_id=" + location_id + "&startdate=" + startdate + "&enddate=" + enddate, complete: function(msg){ $('#stocklist_dialog').html(msg.responseText); $('#stocklist_dialog').dialog('open'); } }); } function toggleItemStocklist(item_id, location_id) { if (item_id == undefined) item_id = ""; if (location_id == undefined) location_id = ""; $.ajax({ type: 'GET', url: 'index.php?module=_location_stocklist_save', data: "item_id=" + item_id + "&location_id=" + location_id }); } function loadResultsheetAttachments(promotion_id) { if (promotion_id == undefined) promotion_id = ""; $.ajax({ type: 'GET', url: 'index.php?module=_resultsheets_attach', data: "promotion_id=" + promotion_id, complete: function(msg){ $('#resultsheet_attachments_dialog').html(msg.responseText); $('#resultsheet_attachments_dialog').dialog('open'); } }); } function toggleResultsheetAttachment(resultsheet_id, promotion_id) { if (resultsheet_id == undefined) resultsheet_id = ""; if (promotion_id == undefined) promotion_id = ""; $.ajax({ type: 'GET', url: 'index.php?module=_resultsheets_attach_save', data: "resultsheet_id=" + resultsheet_id + "&promotion_id=" + promotion_id }); } function editPhoto(photo_id) { if (photo_id == undefined) photo_id = ""; if (response = prompt("Change the description here:", $("#photo_" + photo_id).attr("title"))) { $.ajax({ type: 'GET', url: 'index.php?module=_location_photos_edit', data: "photo_id=" + photo_id + '&description=' + response, complete: function() { $("#photo_a_" + photo_id).attr("title", response); } }); } void(0); } function deletePhoto(photo_id) { if (photo_id == undefined) photo_id = ""; if (confirm("Are you sure you wish to delete this photo?") && photo_id) { $.ajax({ type: 'GET', url: 'index.php?module=_location_photos_delete', data: "photo_id=" + photo_id, complete: function() { $("#photo_" + photo_id).remove(); } }); } void(0); } function showLoader() { showOverlay(); } function hideLoader(time) { if (time == "undefined") time = 1000; hideOverlay(time); } var timeline; var eventSource; var eventSource2; var eventSource3; function initOverviewTimeline() { showLoader(); eventSource = new Timeline.DefaultEventSource(); eventSource2 = new Timeline.DefaultEventSource(); eventSource3 = new Timeline.DefaultEventSource(); var theme = Timeline.ClassicTheme.create(); theme.event.tape.height = 10; // px theme.event.track.height = theme.event.tape.height + 6; var bandInfos = [ Timeline.createBandInfo({ width: "10%", intervalUnit: Timeline.DateTime.YEAR, intervalPixels: 150 }), Timeline.createBandInfo({ width: "50%", intervalUnit: Timeline.DateTime.MONTH, intervalPixels: 65, theme: theme, eventSource: eventSource, zoomIndex: 3, zoomSteps: new Array( {pixelsPerInterval: 15, unit: Timeline.DateTime.MONTH}, {pixelsPerInterval: 25, unit: Timeline.DateTime.MONTH}, {pixelsPerInterval: 45, unit: Timeline.DateTime.MONTH}, {pixelsPerInterval: 65, unit: Timeline.DateTime.MONTH} ) }),Timeline.createBandInfo({ width: "20%", intervalUnit: Timeline.DateTime.MONTH, intervalPixels: 150, theme: theme, eventSource: eventSource2, zoomIndex: 3, zoomSteps: new Array( {pixelsPerInterval: 25, unit: Timeline.DateTime.MONTH}, {pixelsPerInterval: 50, unit: Timeline.DateTime.MONTH}, {pixelsPerInterval: 100, unit: Timeline.DateTime.MONTH}, {pixelsPerInterval: 150, unit: Timeline.DateTime.MONTH} ) }),Timeline.createBandInfo({ width: "20%", intervalUnit: Timeline.DateTime.MONTH, intervalPixels: 150, theme: theme, eventSource: eventSource3, zoomIndex: 3, zoomSteps: new Array( {pixelsPerInterval: 25, unit: Timeline.DateTime.MONTH}, {pixelsPerInterval: 50, unit: Timeline.DateTime.MONTH}, {pixelsPerInterval: 100, unit: Timeline.DateTime.MONTH}, {pixelsPerInterval: 150, unit: Timeline.DateTime.MONTH} ) }) ]; bandInfos[0].highlight = true; bandInfos[0].showText = false; bandInfos[0].syncWith = 2; bandInfos[1].highlight = true; bandInfos[1].syncWith = 2; bandInfos[2].highlight = true; bandInfos[2].showText = true; bandInfos[3].syncWith = 1; bandInfos[3].highlight = true; bandInfos[3].syncWith = 1; timeline = Timeline.create(document.getElementById("timeline"), bandInfos, Timeline.HORIZONTAL); Timeline.DefaultEventSource.Event.prototype.fillInfoBubble = function(elmt, theme, labeller) { showLoader(); var doc = elmt.ownerDocument; var title = this.getText(); var link = this.getLink(); var description = this.getDescription(); var html = ""; html += "" + title + "
"; html += description + "
"; if (this.getEventID() == 1) { eventSource2.clear(); eventSource3.clear(); var urls = this.getLink(); urls = urls.split('|'); Timeline.loadXML(urls[0], function(xml, url) { eventSource2.loadXML(xml, url); hideLoader(); }); Timeline.loadXML(urls[1], function(xml, url) { eventSource3.loadXML(xml, url); hideLoader(); }); } else if (this.getEventID() == 2) { html += "
View Locations
"; hideLoader(); } else { hideLoader(); } html += "
"; start = new Date(this.getStart()); html += "From: " + start.toDateString() + "
"; end = new Date(this.getEnd()); html += "To: " + end.toDateString() + ""; $(elmt).html(html); }; } function initTimeline() { showLoader(); eventSource = new Timeline.DefaultEventSource(); var themeSmall = Timeline.ClassicTheme.create(); var theme = Timeline.ClassicTheme.create(); theme.event.tape.height =10; // px theme.event.track.height = theme.event.tape.height + 6; var bandInfos = [ Timeline.createBandInfo({ width: "100%", intervalUnit: Timeline.DateTime.MONTH, intervalPixels: 40, theme: theme, eventSource: eventSource, zoomIndex: 5, zoomSteps: new Array( {pixelsPerInterval: 35, unit: Timeline.DateTime.DAY}, {pixelsPerInterval: 420, unit: Timeline.DateTime.MONTH}, {pixelsPerInterval: 240, unit: Timeline.DateTime.MONTH}, {pixelsPerInterval: 120, unit: Timeline.DateTime.MONTH}, {pixelsPerInterval: 80, unit: Timeline.DateTime.MONTH}, {pixelsPerInterval: 40, unit: Timeline.DateTime.MONTH} ) }) ]; bandInfos[0].highlight = false; timeline = Timeline.create(document.getElementById("timeline"), bandInfos, Timeline.HORIZONTAL); Timeline.DefaultEventSource.Event.prototype.fillInfoBubble = function(elmt, theme, labeller) { var doc = elmt.ownerDocument; var title = this.getText(); var link = this.getLink(); var description = this.getDescription(); var html = ""; html += "" + title + "
"; html += description + "
"; if (this.getEventID() == 1) { if (link != null) { html += "
View Promotions
"; } } else if (this.getEventID() == 2) { html += "
View Locations
"; } else if (this.getEventID() == 3) { html += "
Location information
"; } hideLoader(); html += "
"; start = new Date(this.getStart()); html += "From: " + start.toDateString() + "
"; end = new Date(this.getEnd()); html += "To: " + end.toDateString() + ""; $(elmt).html(html); }; timelineInitiated = true; } function loadTimelineXML(url, callback) { //ie6 hack (phase out) setTimeout(function() { Timeline.loadXML(url, callback); },0); } function displayPromotionArchive() { $(".archived_promotions").toggle(); } function showOverlay() { $("#overlay").width($(window).width()).height($(document).height()).show(); } function hideOverlay(time) { $("#overlay").hide(); } function printTimeline() { print_hide_tl_w = $('#timeline').width(); print_hide_tl_h = $('#timeline').height(); print_hide_tl_t = $('#timeline-band-1').css("top"); $('#timeline').is('div') && $('table').hide(); $('#timeline').width("1000px").height( "500px"); $('#timeline-band-0').css("top", "0"); $('.timeline-event-tape').each(function() { var img = $('') .css("width", $(this).css("width")) .css("height", $(this).css("height")) .css("top", $(this).css("top")) .css("left", $(this).css("left")) .css("position", "absolute"); $(this).after(img); $(this).hide(); }); $('') .dialog({ autoOpen: true, buttons: { 'Print': function() { window.print(); }, 'Close': function() { restoreAfterPrint(); } }, modal: true, overlay: { opacity: 0.5, background: 'black' }, width: "250px", height: "90px", title: 'Printing' }); } function restoreAfterPrint() { $('#timeline').width(print_hide_tl_w + 'px').height(print_hide_tl_h + 'px'); $('#timeline-band-0').css("top", print_hide_tl_t); $('table').show(); $("#print_dialog").dialog("destroy").remove(); $('.print-event-tape').remove(); $('.timeline-event-tape').show(); } var google_map = []; var google_map_overlay = []; function google_map_init(id, glatlng, zoomlevel) { if (GBrowserIsCompatible() && document.getElementById(id ? id : "map_canvas")) { google_map[id] = new GMap2(document.getElementById(id ? id : "map_canvas")); google_map[id].setCenter(glatlng ? glatlng : new GLatLng(52.74, 5.68), zoomlevel ? zoomlevel : 3); } } function google_map_add(lat, long, descr, id, glatlng, zoomlevel) { var min = [34.8859, -14.7656]; var max = [66.7919, 33.7500] if (google_map[id] == null) { google_map_init(id, glatlng, zoomlevel); setTimeout('google_map_add('+lat+','+long+', "'+descr+'", "'+id+'", '+glatlng+', '+zoomlevel+')', 2000); } else if (lat >= min[0] && lat <= max[0] && long >= min[1] && long <= max[1]) { setTimeout(function() { var marker = new GMarker(new GLatLng(lat,long), {title: descr}); google_map[id].addOverlay(marker); GEvent.addListener(marker, "click", function() { var html = descr; marker.openInfoWindowHtml(html); }); }, 100); } } /** * jQuery (PNG Fix) v1.2 * Microsoft Internet Explorer 24bit PNG Fix * * The MIT License * * Copyright (c) 2007 Paul Campbell (pauljamescampbell.co.uk) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * @param Object * @return Array */ (function($) { $.fn.pngfix = function(options) { // Review the Microsoft IE developer library for AlphaImageLoader reference // http://msdn2.microsoft.com/en-us/library/ms532969(VS.85).aspx // ECMA scope fix var elements = this; var settings = $.extend({ imageFixSrc: false, sizingMethod: false }, options); if(!$.browser.msie || ($.browser.msie && $.browser.version >= 7)) { return(elements); } function setFilter(el, path, mode) { var fs = el.attr("filters"); var alpha = "DXImageTransform.Microsoft.AlphaImageLoader"; if (fs[alpha]) { fs[alpha].enabled = true; fs[alpha].src = path; fs[alpha].sizingMethod = mode; } else { el.css("filter", 'progid:' + alpha + '(enabled="true", sizingMethod="' + mode + '", src="' + path + '")'); } } function setDOMElementWidth(el) { if(el.css("width") == "auto" & el.css("height") == "auto") { el.css("width", el.attr("offsetWidth") + "px"); } } return( elements.each(function() { // Scope var el = $(this); if(el.attr("tagName").toUpperCase() == "IMG" && (/\.png/i).test(el.attr("src"))) { if(!settings.imageFixSrc) { // Wrap the in a then apply style/filters, // removing the tag from the final render el.wrap(""); var par = el.parent(); par.css({ height: el.height(), width: el.width(), display: "inline-block" }); setFilter(par, el.attr("src"), "scale"); el.remove(); } else if((/\.gif/i).test(settings.imageFixSrc)) { // Replace the current image with a transparent GIF // and apply the filter to the background of the // tag (not the preferred route) setDOMElementWidth(el); setFilter(el, el.attr("src"), "image"); el.attr("src", settings.imageFixSrc); } } else { var bg = new String(el.css("backgroundImage")); var matches = bg.match(/^url\("(.*)"\)$/); if(matches && matches.length) { // Elements with a PNG as a backgroundImage have the // filter applied with a sizing method relevant to the // background repeat type setDOMElementWidth(el); el.css("backgroundImage", "none"); // Restrict scaling methods to valid MSDN defintions (or one custom) var sc = "crop"; if(settings.sizingMethod) { sc = settings.sizingMethod; } setFilter(el, matches[1], sc); // Fix IE peek-a-boo bug for internal links // within that DOM element el.find("a").each(function() { $(this).css("position", "relative"); }); } } }) ); } })(jQuery)/* Greybox Redux * Required: http://jquery.com/ * Written by: John Resig * Based on code by: 4mir Salihefendic (http://amix.dk) * License: LGPL (read more in LGPL.txt) */ var GB_DONE = false; var GB_HEIGHT = 400; var GB_WIDTH = 400; function GB_show(caption, url, height, width) { GB_HEIGHT = height || 400; GB_WIDTH = width || 400; if(!GB_DONE) { $(document.body) .append("
" + "Close window
"); $("#GB_window img").click(GB_hide); $("#GB_overlay").click(GB_hide); $(window).resize(GB_position); GB_DONE = true; } $("#GB_frame").remove(); $("#GB_window").append(""); $("#GB_caption").html(caption); $("#GB_overlay").show(); GB_position(); if(GB_ANIMATION) $("#GB_window").slideDown("slow"); else $("#GB_window").show(); } function GB_hide() { $("#GB_window,#GB_overlay").hide(); } function GB_position() { var de = document.documentElement; var w = self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; $("#GB_window").css({width:GB_WIDTH+"px",height:GB_HEIGHT+"px", left: ((w - GB_WIDTH)/2)+"px" }); $("#GB_frame").css("height",GB_HEIGHT - 32 +"px"); } /** * jQuery lightBox plugin * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/) * and adapted to me for use like a plugin from jQuery. * @name jquery-lightbox-0.5.js * @author Leandro Vieira Pinho - http://leandrovieira.com * @version 0.5 * @date April 11, 2008 * @category jQuery plugin * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com) * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin */ (function($){$.fn.lightBox=function(settings){settings=jQuery.extend({overlayBgColor:'#000',overlayOpacity:0.8,fixedNavigation:false,imageLoading:'media/images/lightbox-ico-loading.gif',imageBtnPrev:'media/images/lightbox-btn-prev.gif',imageBtnNext:'media/images/lightbox-btn-next.gif',imageBtnClose:'media/images/lightbox-btn-close.gif',imageBlank:'media/images/lightbox-blank.gif',containerBorderSize:10,containerResizeSpeed:400,txtImage:'Image',txtOf:'of',keyToClose:'c',keyToPrev:'p',keyToNext:'n',imageArray:[],activeImage:0},settings);var jQueryMatchedObj=this;function _initialize(){_start(this,jQueryMatchedObj);return false;} function _start(objClicked,jQueryMatchedObj){$('embed, object, select').css({'visibility':'hidden'});_set_interface();settings.imageArray.length=0;settings.activeImage=0;if(jQueryMatchedObj.length==1){settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title')));}else{for(var i=0;i
');var arrPageSizes=___getPageSize();$('#jquery-overlay').css({backgroundColor:settings.overlayBgColor,opacity:settings.overlayOpacity,width:arrPageSizes[0],height:arrPageSizes[1]}).fadeIn();var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]}).show();$('#jquery-overlay,#jquery-lightbox').click(function(){_finish();});$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function(){_finish();return false;});$(window).resize(function(){var arrPageSizes=___getPageSize();$('#jquery-overlay').css({width:arrPageSizes[0],height:arrPageSizes[1]});var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]});});} function _set_image_to_view(){$('#lightbox-loading').show();if(settings.fixedNavigation){$('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}else{$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();} var objImagePreloader=new Image();objImagePreloader.onload=function(){$('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);objImagePreloader.onload=function(){};};objImagePreloader.src=settings.imageArray[settings.activeImage][0];};function _resize_container_image_box(intImageWidth,intImageHeight){var intCurrentWidth=$('#lightbox-container-image-box').width();var intCurrentHeight=$('#lightbox-container-image-box').height();var intWidth=(intImageWidth+(settings.containerBorderSize*2));var intHeight=(intImageHeight+(settings.containerBorderSize*2));var intDiffW=intCurrentWidth-intWidth;var intDiffH=intCurrentHeight-intHeight;$('#lightbox-container-image-box').animate({width:intWidth,height:intHeight},settings.containerResizeSpeed,function(){_show_image();});if((intDiffW==0)&&(intDiffH==0)){if($.browser.msie){___pause(250);}else{___pause(100);}} $('#lightbox-container-image-data-box').css({width:intImageWidth});$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({height:intImageHeight+(settings.containerBorderSize*2)});};function _show_image(){$('#lightbox-loading').hide();$('#lightbox-image').fadeIn(function(){_show_image_data();_set_navigation();});_preload_neighbor_images();};function _show_image_data(){$('#lightbox-container-image-data-box').slideDown('fast');$('#lightbox-image-details-caption').hide();if(settings.imageArray[settings.activeImage][1]){$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();} if(settings.imageArray.length>1){$('#lightbox-image-details-currentNumber').html(settings.txtImage+' '+(settings.activeImage+1)+' '+settings.txtOf+' '+settings.imageArray.length).show();}} function _set_navigation(){$('#lightbox-nav').show();$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({'background':'transparent url('+settings.imageBlank+') no-repeat'});if(settings.activeImage!=0){if(settings.fixedNavigation){$('#lightbox-nav-btnPrev').css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnPrev').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}} if(settings.activeImage!=(settings.imageArray.length-1)){if(settings.fixedNavigation){$('#lightbox-nav-btnNext').css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnNext').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}} _enable_keyboard_navigation();} function _enable_keyboard_navigation(){$(document).keydown(function(objEvent){_keyboard_action(objEvent);});} function _disable_keyboard_navigation(){$(document).unbind();} function _keyboard_action(objEvent){if(objEvent==null){keycode=event.keyCode;escapeKey=27;}else{keycode=objEvent.keyCode;escapeKey=objEvent.DOM_VK_ESCAPE;} key=String.fromCharCode(keycode).toLowerCase();if((key==settings.keyToClose)||(key=='x')||(keycode==escapeKey)){_finish();} if((key==settings.keyToPrev)||(keycode==37)){if(settings.activeImage!=0){settings.activeImage=settings.activeImage-1;_set_image_to_view();_disable_keyboard_navigation();}} if((key==settings.keyToNext)||(keycode==39)){if(settings.activeImage!=(settings.imageArray.length-1)){settings.activeImage=settings.activeImage+1;_set_image_to_view();_disable_keyboard_navigation();}}} function _preload_neighbor_images(){if((settings.imageArray.length-1)>settings.activeImage){objNext=new Image();objNext.src=settings.imageArray[settings.activeImage+1][0];} if(settings.activeImage>0){objPrev=new Image();objPrev.src=settings.imageArray[settings.activeImage-1][0];}} function _finish(){$('#jquery-lightbox').remove();$('#jquery-overlay').fadeOut(function(){$('#jquery-overlay').remove();});$('embed, object, select').css({'visibility':'visible'});} function ___getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;} var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;} windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;} if(yScroll
' + $(this).attr('title') + '
'); tip.css({position: 'absolute', zIndex: 100000}); $(this).attr('title', ''); $.data(this, 'active.tipsy', tip); } var pos = $.extend({}, $(this).offset(), {width: this.offsetWidth, height: this.offsetHeight}); tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body); var actualWidth = tip[0].offsetWidth, actualHeight = tip[0].offsetHeight; switch (opts.gravity.charAt(0)) { case 'n': tip.css({top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}).addClass('tipsy-north'); break; case 's': tip.css({top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}).addClass('tipsy-south'); break; case 'e': tip.css({top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}).addClass('tipsy-east'); break; case 'w': tip.css({top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}).addClass('tipsy-west'); break; } if (opts.fade) { tip.css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: 1}); } else { tip.css({visibility: 'visible'}); } }, function() { $.data(this, 'cancel.tipsy', false); var self = this; setTimeout(function() { if ($.data(this, 'cancel.tipsy')) return; var tip = $.data(self, 'active.tipsy'); if (opts.fade) { tip.stop().fadeOut(function() { $(this).remove(); }); } else { tip.remove(); } }, 100); }); }; })(jQuery); /* * jQuery selectbox plugin * * Copyright (c) 2007 Sadri Sahraoui (brainfault.com) * Licensed under the GPL license and MIT: * http://www.opensource.org/licenses/GPL-license.php * http://www.opensource.org/licenses/mit-license.php * * The code is inspired from Autocomplete plugin (http://www.dyve.net/jquery/?autocomplete) * * Revision: $Id$ * Version: 0.6 * * Changelog : * Version 0.6 * - Fix IE scrolling problem * Version 0.5 * - separate css style for current selected element and hover element which solve the highlight issue * Version 0.4 * - Fix width when the select is in a hidden div @Pawel Maziarz * - Add a unique id for generated li to avoid conflict with other selects and empty values @Pawel Maziarz */ jQuery.fn.extend({ selectbox: function(options) { return this.each(function() { new jQuery.SelectBox(this, options); }); } }); /* pawel maziarz: work around for ie logging */ if (!window.console) { var console = { log: function(msg) { } } } /* */ jQuery.SelectBox = function(selectobj, options) { var opt = options || {}; opt.inputClass = opt.inputClass || "selectbox"; opt.containerClass = opt.containerClass || "selectbox-wrapper"; opt.hoverClass = opt.hoverClass || "current"; opt.currentClass = opt.selectedClass || "selected" opt.debug = opt.debug || false; var elm_id = selectobj.id; var active = 0; var inFocus = false; var hasfocus = 0; //jquery object for select element var $select = $(selectobj); // jquery container object var $container = setupContainer(opt); //jquery input object var $input = setupInput(opt); // hide select and append newly created elements $select.hide().before($input).before($container); init(); $input .click(function(){ if (!inFocus) { $container.toggle(); } }) .focus(function(){ if ($container.not(':visible')) { inFocus = true; $container.show(); } }) .keydown(function(event) { switch(event.keyCode) { case 38: // up event.preventDefault(); moveSelect(-1); break; case 40: // down event.preventDefault(); moveSelect(1); break; //case 9: // tab case 13: // return event.preventDefault(); // seems not working in mac ! $('li.'+opt.hoverClass).trigger('click'); break; case 27: //escape hideMe(); break; } }) .blur(function() { if ($container.is(':visible') && hasfocus > 0 ) { if(opt.debug) console.log('container visible and has focus') } else { // Workaround for ie scroll - thanks to Bernd Matzner if($.browser.msie || $.browser.safari){ // check for safari too - workaround for webkit if(document.activeElement.getAttribute('id').indexOf('_container')==-1){ hideMe(); } else { $input.focus(); } } else { hideMe(); } } }); function hideMe() { hasfocus = 0; $container.hide(); } function init() { $container.append(getSelectOptions($input.attr('id'))).hide(); var width = $input.css('width'); $container.width(width); } function setupContainer(options) { var container = document.createElement("div"); $container = $(container); $container.attr('id', elm_id+'_container'); $container.addClass(options.containerClass); return $container; } function setupInput(options) { var input = document.createElement("input"); var $input = $(input); $input.attr("id", elm_id+"_input"); $input.attr("type", "text"); $input.addClass(options.inputClass); $input.attr("autocomplete", "off"); $input.attr("readonly", "readonly"); $input.attr("tabIndex", $select.attr("tabindex")); // "I" capital is important for ie return $input; } function moveSelect(step) { var lis = $("li", $container); if (!lis || lis.length == 0) return false; active += step; //loop through list if (active < 0) { active = lis.size(); } else if (active > lis.size()) { active = 0; } scroll(lis, active); lis.removeClass(opt.hoverClass); $(lis[active]).addClass(opt.hoverClass); } function scroll(list, active) { var el = $(list[active]).get(0); var list = $container.get(0); if (el.offsetTop + el.offsetHeight > list.scrollTop + list.clientHeight) { list.scrollTop = el.offsetTop + el.offsetHeight - list.clientHeight; } else if(el.offsetTop < list.scrollTop) { list.scrollTop = el.offsetTop; } } function setCurrent() { var li = $("li."+opt.currentClass, $container).get(0); var ar = (''+li.id).split('_'); var el = ar[ar.length-1]; $select.val(el); $input.val($(li).html()); return true; } // select value function getCurrentSelected() { return $select.val(); } // input value function getCurrentValue() { return $input.val(); } function getSelectOptions(parentid) { var select_options = new Array(); var ul = document.createElement('ul'); $select.children('option').each(function() { var li = document.createElement('li'); li.setAttribute('id', parentid + '_' + $(this).val()); $(li).css('background', 'url(\'' + $(this).attr("rel") + '\') no-repeat center right') li.innerHTML = $(this).html(); if ($(this).is(':selected')) { $input.val($(this).html()); $input.css('background', $(li).css('background') ) $(li).addClass(opt.currentClass); } ul.appendChild(li); $(li) .mouseover(function(event) { hasfocus = 1; if (opt.debug) console.log('over on : '+this.id); jQuery(event.target, $container).addClass(opt.hoverClass); }) .mouseout(function(event) { hasfocus = -1; if (opt.debug) console.log('out on : '+this.id); jQuery(event.target, $container).removeClass(opt.hoverClass); }) .click(function(event) { var fl = $('li.'+opt.hoverClass, $container).get(0); if (opt.debug) console.log('click on :'+this.id); $('li.'+opt.currentClass).removeClass(opt.currentClass); $input.css('background', $(this).css('background') ) $(this).addClass(opt.currentClass); setCurrent(); //$select.change(); $select.get(0).blur(); hideMe(); }); }); return ul; } }; (function($){ $.fn.positionFooter = function(center){ var element = this; var originalPosition = $(element).offset(); var originalTopPosition = originalPosition.top; positionTheFooter(); $(window).bind("resize", function(){ positionTheFooter(); }); function positionTheFooter(){ var elementPosition = $(element).offset(); var elementPaddingTop = $(element).css("padding-top"); var elementPaddingBottom = $(element).css("padding-bottom"); var elementPaddingleft = $(element).css("padding-left"); var elementPaddingRight = $(element).css("padding-right"); var elementHeight = $(element).height(); var elementWidth = $(element).width(); var windowHeight = $(window).height(); var windowWidth = $(window).width(); elementPaddingTop = elementPaddingTop.replace(/px/,""); elementPaddingBottom = elementPaddingBottom.replace(/px/,""); elementPaddingleft = elementPaddingleft.replace(/px/,""); elementPaddingRight = elementPaddingRight.replace(/px/,""); var newPosition = (parseInt(windowHeight) - (parseInt(elementHeight) + (parseInt(elementPaddingTop) + parseInt(elementPaddingBottom)))); var currentPosition = elementPosition.top - (parseInt(elementHeight) + (parseInt(elementPaddingTop) + parseInt(elementPaddingBottom))); if(originalTopPosition < windowHeight){ $(element).css({ "position" : "absolute", "top" : newPosition }); if(center == true){ $(element).css({ "left" : windowWidth / 2 - (((elementWidth + parseInt(elementPaddingleft) + parseInt(elementPaddingRight)) / 2)) }); } } if(newPosition <= originalTopPosition){ $(element).css({ "position" : "absolute", "top" : originalTopPosition }); if(center == true){ $(element).css({ "left" : windowWidth / 2 - (((elementWidth + parseInt(elementPaddingleft) + parseInt(elementPaddingRight)) / 2)) }); } } }; }; })(jQuery);