/* * nyroModal - jQuery Plugin * http://nyromodal.nyrodev.com * * Copyright (c) 2010 Cedric Nirousset (nyrodev.com) * Licensed under the MIT license * * $Date: 2010-02-23 (Tue, 23 Feb 2010) $ * $version: 1.6.2 */ jQuery(function($) { // ------------------------------------------------------- // Private Variables // ------------------------------------------------------- var userAgent = navigator.userAgent.toLowerCase(); var browserVersion = (userAgent.match(/.+(?:rv|webkit|khtml|opera|msie)[\/: ]([\d.]+)/ ) || [0,'0'])[1]; var isIE6 = (/msie/.test(userAgent) && !/opera/.test(userAgent) && parseInt(browserVersion) < 7 && (!window.XMLHttpRequest || typeof(XMLHttpRequest) === 'function')); var body = $('body'); var currentSettings; var callingSettings; var shouldResize = false; var gallery = {}; // To know if the fix for the Issue 10 should be applied (or has been applied) var fixFF = false; // Used for retrieve the content from an hidden div var contentElt; var contentEltLast; // Contains info about nyroModal state and all div references var modal = { started: false, ready: false, dataReady: false, anim: false, animContent: false, loadingShown: false, transition: false, resizing: false, closing: false, error: false, blocker: null, blockerVars: null, full: null, bg: null, loading: null, tmp: null, content: null, wrapper: null, contentWrapper: null, scripts: new Array(), scriptsShown: new Array() }; // Indicate of the height or the width was resized, to reinit the currentsettings related to null var resized = { width: false, height: false, windowResizing: false }; var initSettingsSize = { width: null, height: null, windowResizing: true }; var windowResizeTimeout; // ------------------------------------------------------- // Public function // ------------------------------------------------------- // jQuery extension function. A paramater object could be used to overwrite the default settings $.fn.nyroModal = function(settings) { if (!this) return false; return this.each(function() { var me = $(this); if (this.nodeName.toLowerCase() == 'form') { me .unbind('submit.nyroModal') .bind('submit.nyroModal', function(e) { if(e.isDefaultPrevented()) return false; if (me.data('nyroModalprocessing')) return true; if (this.enctype == 'multipart/form-data') { processModal($.extend(settings, { from: this })); return true; } e.preventDefault(); processModal($.extend(settings, { from: this })); return false; }); } else { me .unbind('click.nyroModal') .bind('click.nyroModal', function(e) { if(e.isDefaultPrevented()) return false; e.preventDefault(); processModal($.extend(settings, { from: this })); return false; }); } }); }; // jQuery extension function to call manually the modal. A paramater object could be used to overwrite the default settings $.fn.nyroModalManual = function(settings) { if (!this.length) processModal(settings); return this.each(function(){ processModal($.extend(settings, { from: this })); }); }; $.nyroModalManual = function(settings) { processModal(settings); }; // Update the current settings // object settings // string deep1 first key where overwrite the settings // string deep2 second key where overwrite the settings $.nyroModalSettings = function(settings, deep1, deep2) { setCurrentSettings(settings, deep1, deep2); if (!deep1 && modal.started) { if (modal.bg && settings.bgColor) currentSettings.updateBgColor(modal, currentSettings, function(){}); if (modal.contentWrapper && settings.title) setTitle(); if (!modal.error && (settings.windowResizing || (!modal.resizing && (('width' in settings && settings.width == currentSettings.width) || ('height' in settings && settings.height == currentSettings.height))))) { modal.resizing = true; if (modal.contentWrapper) calculateSize(true); if (modal.contentWrapper && modal.contentWrapper.is(':visible') && !modal.animContent) { if (fixFF) modal.content.css({position: ''}); currentSettings.resize(modal, currentSettings, function() { currentSettings.windowResizing = false; modal.resizing = false; if (fixFF) modal.content.css({position: 'fixed'}); if ($.isFunction(currentSettings.endResize)) currentSettings.endResize(modal, currentSettings); }); } } } }; // Remove the modal function $.nyroModalRemove = function() { removeModal(); }; // Go to the next image for a gallery // return false if nothing was done $.nyroModalNext = function() { var link = getGalleryLink(1); if (link) return link.nyroModalManual(getCurrentSettingsNew()); return false; }; // Go to the previous image for a gallery // return false if nothing was done $.nyroModalPrev = function() { var link = getGalleryLink(-1); if (link) return link.nyroModalManual(getCurrentSettingsNew()); return false; }; // ------------------------------------------------------- // Default Settings // ------------------------------------------------------- $.fn.nyroModal.settings = { debug: false, // Show the debug in the background blocker: false, // Element which will be blocked by the modal windowResize: true, // indicates if the modal should resize when the window is resized modal: false, // Esc key or click backgrdound enabling or not type: '', // nyroModal type (form, formData, iframe, image, etc...) forceType: null, // Used to force the type from: '', // Dom object where the call come from hash: '', // Eventual hash in the url processHandler: null, // Handler just before the real process selIndicator: 'nyroModalSel', // Value added when a form or Ajax is sent with a filter content formIndicator: 'nyroModal', // Value added when a form is sent content: null, // Raw content if type content is used bgColor: '#000000', // Background color ajax: {}, // Ajax option (url, data, type, success will be overwritten for a form, url and success only for an ajax call) swf: { // Swf player options if swf type is used. wmode: 'transparent' }, width: null, // default Width If null, will be calculate automatically height: null, // default Height If null, will be calculate automatically minWidth: 400, // Minimum width minHeight: 300, // Minimum height resizable: true, // Indicate if the content is resizable. Will be set to false for swf autoSizable: true, // Indicate if the content is auto sizable. If not, the min size will be used padding: 25, // padding for the max modal size regexImg: '[^\.]\.(jpg|jpeg|png|tiff|gif|bmp)\s*$', // Regex to find images addImageDivTitle: false, // Indicate if the div title should be inserted defaultImgAlt: 'Image', // Default alt attribute for the images setWidthImgTitle: true, // Set the width to the image title ltr: true, // Left to Right by default. Put to false for Hebrew or Right to Left language gallery: null, // Gallery name if provided galleryLinks: 'PrevNext', // Use .nyroModalPrev and .nyroModalNext to set the navigation link galleryCounts: galleryCounts, // Callback to show the gallery count galleryLoop: false, // Indicate if the gallery should loop zIndexStart: 100, cssOpt: { // Default CSS option for the nyroModal Div. Some will be overwritten or updated when using IE6 bg: { position: 'absolute', overflow: 'hidden', top: 0, left: 0, height: '100%', width: '100%' }, wrapper: { position: 'absolute', top: '50%', left: '50%' }, wrapper2: { }, content: { }, loading: { position: 'absolute', top: '50%', left: '50%', marginTop: '-50px', marginLeft: '-50px' } }, wrap: { // Wrapper div used to style the modal regarding the content type div: '
', ajax: '
', form: '
', formData: '
', image: '
', swf: '
', iframe: '
', iframeForm: '
', manual: '
' }, closeButton: 'Close', // Adding automaticly as the first child of #nyroModalWrapper title: null, // Modal title titleFromIframe: true, // When using iframe in the same domain, try to get the title from it openSelector: '.nyroModal', // selector for open a new modal. will be used to parse automaticly at page loading closeSelector: '.nyroModalClose', // selector to close the modal contentLoading: 'Cancel', // Loading div content errorClass: 'error', // CSS Error class added to the loading div in case of error contentError: 'The requested content cannot be loaded.
Please try again later.
Close', // Content placed in the loading div in case of error handleError: null, // Callback in case of error showBackground: showBackground, // Show background animation function hideBackground: hideBackground, // Hide background animation function endFillContent: null, // Will be called after filling and wraping the content, before parsing closeSelector and openSelector and showing the content showContent: showContent, // Show content animation function endShowContent: null, // Will be called once the content is shown beforeHideContent: null, // Will be called just before the modal closing hideContent: hideContent, // Hide content animation function showTransition: showTransition, // Show the transition animation (a modal is already shown and a new one is requested) hideTransition: hideTransition, // Hide the transition animation to show the content showLoading: showLoading, // show loading animation function hideLoading: hideLoading, // hide loading animation function resize: resize, // Resize animation function endResize: null, // Will be called one the content is resized updateBgColor: updateBgColor, // Change background color animation function endRemove: null // Will be called once the modal is totally gone }; // ------------------------------------------------------- // Private function // ------------------------------------------------------- // Main function function processModal(settings) { if (modal.loadingShown || modal.transition || modal.anim) return; debug('processModal'); modal.started = true; callingSettings = $.extend(true, settings); setDefaultCurrentSettings(settings); if (!modal.full) modal.blockerVars = modal.blocker = null; modal.error = false; modal.closing = false; modal.dataReady = false; modal.scripts = new Array(); modal.scriptsShown = new Array(); currentSettings.type = fileType(); if (currentSettings.forceType) { if (!currentSettings.content) currentSettings.from = true; currentSettings.type = currentSettings.forceType; currentSettings.forceType = null; } if ($.isFunction(currentSettings.processHandler)) currentSettings.processHandler(currentSettings); var from = currentSettings.from; var url = currentSettings.url; initSettingsSize.width = currentSettings.width; initSettingsSize.height = currentSettings.height; if (currentSettings.type == 'swf') { // Swf is transforming as a raw content setCurrentSettings({overflow: 'visible'}, 'cssOpt', 'content'); currentSettings.content = ''; var tmp = ''; $.each(currentSettings.swf, function(name, val) { currentSettings.content+= ''; tmp+= ' '+name+'="'+val+'"'; }); currentSettings.content+= ''; } if (from) { var jFrom = $(from).blur(); if (currentSettings.type == 'form') { var data = $(from).serializeArray(); data.push({name: currentSettings.formIndicator, value: 1}); if (currentSettings.selector) data.push({name: currentSettings.selIndicator, value: currentSettings.selector.substring(1)}); showModal(); $.ajax($.extend({}, currentSettings.ajax, { url: url, data: data, type: jFrom.attr('method') ? jFrom.attr('method') : 'get', success: ajaxLoaded, error: loadingError })); debug('Form Ajax Load: '+jFrom.attr('action')); } else if (currentSettings.type == 'formData') { // Form with data. We're using a hidden iframe initModal(); jFrom.attr('target', 'nyroModalIframe'); jFrom.attr('action', url); jFrom.prepend(''); if (currentSettings.selector) jFrom.prepend(''); modal.tmp.html(''); $('iframe', modal.tmp) .css({ width: currentSettings.width, height: currentSettings.height }) .error(loadingError) .load(formDataLoaded); debug('Form Data Load: '+jFrom.attr('action')); showModal(); showContentOrLoading(); } else if (currentSettings.type == 'image') { debug('Image Load: '+url); var title = jFrom.attr('title') || currentSettings.defaultImgAlt; initModal(); modal.tmp.html('').find('img').attr('alt', title); modal.tmp.css({lineHeight: 0}); $('img', modal.tmp) .error(loadingError) .load(function() { debug('Image Loaded: '+this.src); $(this).unbind('load'); var w = modal.tmp.width(); var h = modal.tmp.height(); modal.tmp.css({lineHeight: ''}); resized.width = w; resized.height = h; setCurrentSettings({ width: w, height: h, imgWidth: w, imgHeight: h }); initSettingsSize.width = w; initSettingsSize.height = h; setCurrentSettings({overflow: 'visible'}, 'cssOpt', 'content'); modal.dataReady = true; if (modal.loadingShown || modal.transition) showContentOrLoading(); }) .attr('src', url); showModal(); } else if (currentSettings.type == 'iframeForm') { initModal(); modal.tmp.html(''); debug('Iframe Form Load: '+url); $('iframe', modal.tmp).eq(0) .css({ width: '100%', height: $.support.boxModel? '99%' : '100%' }) .load(iframeLoaded); modal.dataReady = true; showModal(); } else if (currentSettings.type == 'iframe') { initModal(); modal.tmp.html(''); debug('Iframe Load: '+url); $('iframe', modal.tmp).eq(0) .css({ width: '100%', height: $.support.boxModel? '99%' : '100%' }) .load(iframeLoaded); modal.dataReady = true; showModal(); } else if (currentSettings.type) { // Could be every other kind of type or a dom selector debug('Content: '+currentSettings.type); initModal(); modal.tmp.html(currentSettings.content); var w = modal.tmp.width(); var h = modal.tmp.height(); var div = $(currentSettings.type); if (div.length) { setCurrentSettings({type: 'div'}); w = div.width(); h = div.height(); if (contentElt) contentEltLast = contentElt; contentElt = div; modal.tmp.append(div.contents()); } initSettingsSize.width = w; initSettingsSize.height = h; setCurrentSettings({ width: w, height: h }); if (modal.tmp.html()) modal.dataReady = true; else loadingError(); if (!modal.ready) showModal(); else endHideContent(); } else { debug('Ajax Load: '+url); setCurrentSettings({type: 'ajax'}); var data = currentSettings.ajax.data || {}; if (currentSettings.selector) { if (typeof data == "string") { data+= '&'+currentSettings.selIndicator+'='+currentSettings.selector.substring(1); } else { data[currentSettings.selIndicator] = currentSettings.selector.substring(1); } } showModal(); $.ajax($.extend(true, currentSettings.ajax, { url: url, success: ajaxLoaded, error: loadingError, data: data })); } } else if (currentSettings.content) { // Raw content not from a DOM element debug('Content: '+currentSettings.type); setCurrentSettings({type: 'manual'}); initModal(); modal.tmp.html($('
').html(currentSettings.content).contents()); if (modal.tmp.html()) modal.dataReady = true; else loadingError(); showModal(); } else { // What should we show here? nothing happen } } // Update the current settings // object settings // string deep1 first key where overwrite the settings // string deep2 second key where overwrite the settings function setDefaultCurrentSettings(settings) { debug('setDefaultCurrentSettings'); currentSettings = $.extend(true, {}, $.fn.nyroModal.settings, settings); setMargin(); } function setCurrentSettings(settings, deep1, deep2) { if (modal.started) { if (deep1 && deep2) { $.extend(true, currentSettings[deep1][deep2], settings); } else if (deep1) { $.extend(true, currentSettings[deep1], settings); } else { if (modal.animContent) { if ('width' in settings) { if (!modal.resizing) { settings.setWidth = settings.width; shouldResize = true; } delete settings['width']; } if ('height' in settings) { if (!modal.resizing) { settings.setHeight = settings.height; shouldResize = true; } delete settings['height']; } } $.extend(true, currentSettings, settings); } } else { if (deep1 && deep2) { $.extend(true, $.fn.nyroModal.settings[deep1][deep2], settings); } else if (deep1) { $.extend(true, $.fn.nyroModal.settings[deep1], settings); } else { $.extend(true, $.fn.nyroModal.settings, settings); } } } // Set the margin for postionning the element. Useful for IE6 function setMarginScroll() { if (isIE6 && !modal.blocker) { if (document.documentElement) { currentSettings.marginScrollLeft = document.documentElement.scrollLeft; currentSettings.marginScrollTop = document.documentElement.scrollTop; } else { currentSettings.marginScrollLeft = document.body.scrollLeft; currentSettings.marginScrollTop = document.body.scrollTop; } } else { currentSettings.marginScrollLeft = 0; currentSettings.marginScrollTop = 0; } } // Set the margin for the content function setMargin() { setMarginScroll(); currentSettings.marginLeft = -(currentSettings.width+currentSettings.borderW)/2; currentSettings.marginTop = -(currentSettings.height+currentSettings.borderH)/2; if (!modal.blocker) { currentSettings.marginLeft+= currentSettings.marginScrollLeft; currentSettings.marginTop+= currentSettings.marginScrollTop; } } // Set the margin for the current loading function setMarginLoading() { setMarginScroll(); var outer = getOuter(modal.loading); currentSettings.marginTopLoading = -(modal.loading.height() + outer.h.border + outer.h.padding)/2; currentSettings.marginLeftLoading = -(modal.loading.width() + outer.w.border + outer.w.padding)/2; if (!modal.blocker) { currentSettings.marginLeftLoading+= currentSettings.marginScrollLeft; currentSettings.marginTopLoading+= currentSettings.marginScrollTop; } } // Set the modal Title function setTitle() { var title = $('h1#nyroModalTitle', modal.contentWrapper); if (title.length) title.text(currentSettings.title); else modal.contentWrapper.prepend('

'+currentSettings.title+'

'); } // Init the nyroModal div by settings the CSS elements and hide needed elements function initModal() { debug('initModal'); if (!modal.full) { if (currentSettings.debug) setCurrentSettings({color: 'white'}, 'cssOpt', 'bg'); var full = { zIndex: currentSettings.zIndexStart, position: 'fixed', top: 0, left: 0, width: '100%', height: '100%' }; var contain = body; var iframeHideIE = ''; if (currentSettings.blocker) { modal.blocker = contain = $(currentSettings.blocker); var pos = modal.blocker.offset(); var w = modal.blocker.outerWidth(); var h = modal.blocker.outerHeight(); if (isIE6) { setCurrentSettings({ height: '100%', width: '100%', top: 0, left: 0 }, 'cssOpt', 'bg'); } modal.blockerVars = { top: pos.top, left: pos.left, width: w, height: h }; var plusTop = (/msie/.test(userAgent) ?0:getCurCSS(body.get(0), 'borderTopWidth')); var plusLeft = (/msie/.test(userAgent) ?0:getCurCSS(body.get(0), 'borderLeftWidth')); full = { position: 'absolute', top: pos.top + plusTop, left: pos.left + plusLeft, width: w, height: h }; } else if (isIE6) { body.css({ marginLeft: 0, marginRight: 0 }); var w = body.width(); var h = $(window).height()+'px'; if ($(window).height() >= body.outerHeight()) { h = body.outerHeight()+'px'; } else w+= 20; w += 'px'; body.css({ width: w, height: h, position: 'static', overflow: 'hidden' }); $('html').css({overflow: 'hidden'}); setCurrentSettings({ cssOpt: { bg: { position: 'absolute', zIndex: currentSettings.zIndexStart+1, height: '110%', width: '110%', top: currentSettings.marginScrollTop+'px', left: currentSettings.marginScrollLeft+'px' }, wrapper: { zIndex: currentSettings.zIndexStart+2 }, loading: { zIndex: currentSettings.zIndexStart+3 } } }); iframeHideIE = $('') .css($.extend({}, currentSettings.cssOpt.bg, { opacity: 0, zIndex: 50, border: 'none' })); } contain.append($('
').hide()); modal.full = $('#nyroModalFull') .css(full) .show(); modal.bg = $('#nyroModalBg') .css($.extend({ backgroundColor: currentSettings.bgColor }, currentSettings.cssOpt.bg)) .before(iframeHideIE); modal.bg.bind('click.nyroModal', clickBg); modal.loading = $('#nyroModalLoading') .css(currentSettings.cssOpt.loading) .hide(); modal.contentWrapper = $('#nyroModalWrapper') .css(currentSettings.cssOpt.wrapper) .hide(); modal.content = $('#nyroModalContent'); modal.tmp = $('#nyrModalTmp').hide(); // To stop the mousewheel if the the plugin is available if ($.isFunction($.fn.mousewheel)) { modal.content.mousewheel(function(e, d) { var elt = modal.content.get(0); if ((d > 0 && elt.scrollTop == 0) || (d < 0 && elt.scrollHeight - elt.scrollTop == elt.clientHeight)) { e.preventDefault(); e.stopPropagation(); } }); } $(document).bind('keydown.nyroModal', keyHandler); modal.content.css({width: 'auto', height: 'auto'}); modal.contentWrapper.css({width: 'auto', height: 'auto'}); if (!currentSettings.blocker && currentSettings.windowResize) { $(window).bind('resize.nyroModal', function() { window.clearTimeout(windowResizeTimeout); windowResizeTimeout = window.setTimeout(windowResizeHandler, 200); }); } } } function windowResizeHandler() { $.nyroModalSettings(initSettingsSize); } // Show the modal (ie: the background and then the loading if needed or the content directly) function showModal() { debug('showModal'); if (!modal.ready) { initModal(); modal.anim = true; currentSettings.showBackground(modal, currentSettings, endBackground); } else { modal.anim = true; modal.transition = true; currentSettings.showTransition(modal, currentSettings, function(){endHideContent();modal.anim=false;showContentOrLoading();}); } } // Called when user click on background function clickBg(e) { if (!currentSettings.modal) removeModal(); } // Used for the escape key or the arrow in the gallery type function keyHandler(e) { if (e.keyCode == 27) { if (!currentSettings.modal) removeModal(); } else if (currentSettings.gallery && modal.ready && modal.dataReady && !modal.anim && !modal.transition) { if (e.keyCode == 39 || e.keyCode == 40) { e.preventDefault(); $.nyroModalNext(); return false; } else if (e.keyCode == 37 || e.keyCode == 38) { e.preventDefault(); $.nyroModalPrev(); return false; } } } // Determine the filetype regarding the link DOM element function fileType() { var from = currentSettings.from; var url; if (from && from.nodeName) { var jFrom = $(from); url = jFrom.attr(from.nodeName.toLowerCase() == 'form' ? 'action' : 'href'); if (!url) url = location.href.substring(window.location.host.length+7); currentSettings.url = url; if (jFrom.attr('rev') == 'modal') currentSettings.modal = true; currentSettings.title = jFrom.attr('title'); if (from && from.rel && from.rel.toLowerCase() != 'nofollow') { var indexSpace = from.rel.indexOf(' '); currentSettings.gallery = indexSpace > 0 ? from.rel.substr(0, indexSpace) : from.rel; } var imgType = imageType(url, from); if (imgType) return imgType; if (isSwf(url)) return 'swf'; var iframe = false; if (from.target && from.target.toLowerCase() == '_blank' || (from.hostname && from.hostname.replace(/:\d*$/,'') != window.location.hostname.replace(/:\d*$/,''))) { iframe = true; } if (from.nodeName.toLowerCase() == 'form') { if (iframe) return 'iframeForm'; setCurrentSettings(extractUrlSel(url)); if (jFrom.attr('enctype') == 'multipart/form-data') return 'formData'; return 'form'; } if (iframe) return 'iframe'; } else { url = currentSettings.url; if (!currentSettings.content) currentSettings.from = true; if (!url) return null; if (isSwf(url)) return 'swf'; var reg1 = new RegExp("^http://|https://", "g"); if (url.match(reg1)) return 'iframe'; } var imgType = imageType(url, from); if (imgType) return imgType; var tmp = extractUrlSel(url); setCurrentSettings(tmp); if (!tmp.url) return tmp.selector; } function imageType(url, from) { var image = new RegExp(currentSettings.regexImg, 'i'); if (image.test(url)) { return 'image'; } } function isSwf(url) { var swf = new RegExp('[^\.]\.(swf)\s*$', 'i'); return swf.test(url); } function extractUrlSel(url) { var ret = { url: null, selector: null }; if (url) { var hash = getHash(url); var hashLoc = getHash(window.location.href); var curLoc = window.location.href.substring(0, window.location.href.length - hashLoc.length); var req = url.substring(0, url.length - hash.length); if (req == curLoc || req == $('base').attr('href')) { ret.selector = hash; } else { ret.url = req; ret.selector = hash; } } return ret; } // Called when the content cannot be loaded or tiemout reached function loadingError() { debug('loadingError'); modal.error = true; if (!modal.ready) return; if ($.isFunction(currentSettings.handleError)) currentSettings.handleError(modal, currentSettings); modal.loading .addClass(currentSettings.errorClass) .html(currentSettings.contentError); $(currentSettings.closeSelector, modal.loading) .unbind('click.nyroModal') .bind('click.nyroModal', removeModal); setMarginLoading(); modal.loading .css({ marginTop: currentSettings.marginTopLoading+'px', marginLeft: currentSettings.marginLeftLoading+'px' }); } // Put the content from modal.tmp to modal.content function fillContent() { debug('fillContent'); if (!modal.tmp.html()) return; modal.content.html(modal.tmp.contents()); modal.tmp.empty(); wrapContent(); if (currentSettings.type == 'iframeForm') { $(currentSettings.from) .attr('target', 'nyroModalIframe') .data('nyroModalprocessing', 1) .submit() .attr('target', '_blank') .removeData('nyroModalprocessing'); } if (!currentSettings.modal) modal.wrapper.prepend(currentSettings.closeButton); if ($.isFunction(currentSettings.endFillContent)) currentSettings.endFillContent(modal, currentSettings); modal.content.append(modal.scripts); $(currentSettings.closeSelector, modal.contentWrapper) .unbind('click.nyroModal') .bind('click.nyroModal', removeModal); $(currentSettings.openSelector, modal.contentWrapper).nyroModal(getCurrentSettingsNew()); } // Get the current settings to be used in new links function getCurrentSettingsNew() { return callingSettings; var currentSettingsNew = $.extend(true, {}, currentSettings); if (resized.width) currentSettingsNew.width = null; else currentSettingsNew.width = initSettingsSize.width; if (resized.height) currentSettingsNew.height = null; else currentSettingsNew.height = initSettingsSize.height; currentSettingsNew.cssOpt.content.overflow = 'auto'; return currentSettingsNew; } // Wrap the content and update the modal size if needed function wrapContent() { debug('wrapContent'); var wrap = $(currentSettings.wrap[currentSettings.type]); modal.content.append(wrap.children().remove()); modal.contentWrapper.wrapInner(wrap); if (currentSettings.gallery) { // Set the action for the next and prev button (or remove them) modal.content.append(currentSettings.galleryLinks); gallery.links = $('[rel="'+currentSettings.gallery+'"], [rel^="'+currentSettings.gallery+' "]'); gallery.index = gallery.links.index(currentSettings.from); if (currentSettings.galleryCounts && $.isFunction(currentSettings.galleryCounts)) currentSettings.galleryCounts(gallery.index + 1, gallery.links.length, modal, currentSettings); var currentSettingsNew = getCurrentSettingsNew(); var linkPrev = getGalleryLink(-1); if (linkPrev) { var prev = $('.nyroModalPrev', modal.contentWrapper) .attr('href', linkPrev.attr('href')) .click(function(e) { e.preventDefault(); $.nyroModalPrev(); return false; }); if (isIE6 && currentSettings.type == 'swf') { prev.before($('').css({ position: prev.css('position'), top: prev.css('top'), left: prev.css('left'), width: prev.width(), height: prev.height(), opacity: 0, border: 'none' })); } } else { $('.nyroModalPrev', modal.contentWrapper).remove(); } var linkNext = getGalleryLink(1); if (linkNext) { var next = $('.nyroModalNext', modal.contentWrapper) .attr('href', linkNext.attr('href')) .click(function(e) { e.preventDefault(); $.nyroModalNext(); return false; }); if (isIE6 && currentSettings.type == 'swf') { next.before($('') .css($.extend({}, { position: next.css('position'), top: next.css('top'), left: next.css('left'), width: next.width(), height: next.height(), opacity: 0, border: 'none' }))); } } else { $('.nyroModalNext', modal.contentWrapper).remove(); } } calculateSize(); } function getGalleryLink(dir) { if (currentSettings.gallery) { if (!currentSettings.ltr) dir *= -1; var index = gallery.index + dir; if (index >= 0 && index < gallery.links.length) return gallery.links.eq(index); else if (currentSettings.galleryLoop) { if (index < 0) return gallery.links.eq(gallery.links.length-1); else return gallery.links.eq(0); } } return false; } // Calculate the size for the contentWrapper function calculateSize(resizing) { debug('calculateSize'); modal.wrapper = modal.contentWrapper.children('div:first'); resized.width = false; resized.height = false; if (false && !currentSettings.windowResizing) { initSettingsSize.width = currentSettings.width; initSettingsSize.height = currentSettings.height; } if (currentSettings.autoSizable && (!currentSettings.width || !currentSettings.height)) { modal.contentWrapper .css({ opacity: 0, width: 'auto', height: 'auto' }) .show(); var tmp = { width: 'auto', height: 'auto' }; if (currentSettings.width) { tmp.width = currentSettings.width; } else if (currentSettings.type == 'iframe') { tmp.width = currentSettings.minWidth; } if (currentSettings.height) { tmp.height = currentSettings.height; } else if (currentSettings.type == 'iframe') { tmp.height = currentSettings.minHeight; } modal.content.css(tmp); if (!currentSettings.width) { currentSettings.width = modal.content.outerWidth(true); resized.width = true; } if (!currentSettings.height) { currentSettings.height = modal.content.outerHeight(true); resized.height = true; } modal.contentWrapper.css({opacity: 1}); if (!resizing) modal.contentWrapper.hide(); } if (currentSettings.type != 'image' && currentSettings.type != 'swf') { currentSettings.width = Math.max(currentSettings.width, currentSettings.minWidth); currentSettings.height = Math.max(currentSettings.height, currentSettings.minHeight); } var outerWrapper = getOuter(modal.contentWrapper); var outerWrapper2 = getOuter(modal.wrapper); var outerContent = getOuter(modal.content); var tmp = { content: { width: currentSettings.width, height: currentSettings.height }, wrapper2: { width: currentSettings.width + outerContent.w.total, height: currentSettings.height + outerContent.h.total }, wrapper: { width: currentSettings.width + outerContent.w.total + outerWrapper2.w.total, height: currentSettings.height + outerContent.h.total + outerWrapper2.h.total } }; if (currentSettings.resizable) { var maxHeight = modal.blockerVars? modal.blockerVars.height : $(window).height() - outerWrapper.h.border - (tmp.wrapper.height - currentSettings.height); var maxWidth = modal.blockerVars? modal.blockerVars.width : $(window).width() - outerWrapper.w.border - (tmp.wrapper.width - currentSettings.width); maxHeight-= currentSettings.padding*2; maxWidth-= currentSettings.padding*2; if (tmp.content.height > maxHeight || tmp.content.width > maxWidth) { // We're gonna resize the modal as it will goes outside the view port if (currentSettings.type == 'image' || currentSettings.type == 'swf') { // An image is resized proportionnaly var useW = currentSettings.imgWidth?currentSettings.imgWidth : currentSettings.width; var useH = currentSettings.imgHeight?currentSettings.imgHeight : currentSettings.height; var diffW = tmp.content.width - useW; var diffH = tmp.content.height - useH; if (diffH < 0) diffH = 0; if (diffW < 0) diffW = 0; var calcH = maxHeight - diffH; var calcW = maxWidth - diffW; var ratio = Math.min(calcH/useH, calcW/useW); calcW = Math.floor(useW*ratio); calcH = Math.floor(useH*ratio); tmp.content.height = calcH + diffH; tmp.content.width = calcW + diffW; } else { // For an HTML content, we simply decrease the size tmp.content.height = Math.min(tmp.content.height, maxHeight); tmp.content.width = Math.min(tmp.content.width, maxWidth); } tmp.wrapper2 = { width: tmp.content.width + outerContent.w.total, height: tmp.content.height + outerContent.h.total }; tmp.wrapper = { width: tmp.content.width + outerContent.w.total + outerWrapper2.w.total, height: tmp.content.height + outerContent.h.total + outerWrapper2.h.total }; } } if (currentSettings.type == 'swf') { $('object, embed', modal.content) .attr('width', tmp.content.width) .attr('height', tmp.content.height); } else if (currentSettings.type == 'image') { $('img', modal.content).css({ width: tmp.content.width, height: tmp.content.height }); } modal.content.css($.extend({}, tmp.content, currentSettings.cssOpt.content)); modal.wrapper.css($.extend({}, tmp.wrapper2, currentSettings.cssOpt.wrapper2)); if (!resizing) modal.contentWrapper.css($.extend({}, tmp.wrapper, currentSettings.cssOpt.wrapper)); if (currentSettings.type == 'image' && currentSettings.addImageDivTitle) { // Adding the title for the image $('img', modal.content).removeAttr('alt'); var divTitle = $('div', modal.content); if (currentSettings.title != currentSettings.defaultImgAlt && currentSettings.title) { if (divTitle.length == 0) { divTitle = $('
'+currentSettings.title+'
'); modal.content.append(divTitle); } if (currentSettings.setWidthImgTitle) { var outerDivTitle = getOuter(divTitle); divTitle.css({width: (tmp.content.width + outerContent.w.padding - outerDivTitle.w.total)+'px'}); } } else if (divTitle.length = 0) { divTitle.remove(); } } if (currentSettings.title) setTitle(); tmp.wrapper.borderW = outerWrapper.w.border; tmp.wrapper.borderH = outerWrapper.h.border; setCurrentSettings(tmp.wrapper); setMargin(); } function removeModal(e) { debug('removeModal'); if (e) e.preventDefault(); if (modal.full && modal.ready) { $(document).unbind('keydown.nyroModal'); if (!currentSettings.blocker) $(window).unbind('resize.nyroModal'); modal.ready = false; modal.anim = true; modal.closing = true; if (modal.loadingShown || modal.transition) { currentSettings.hideLoading(modal, currentSettings, function() { modal.loading.hide(); modal.loadingShown = false; modal.transition = false; currentSettings.hideBackground(modal, currentSettings, endRemove); }); } else { if (fixFF) modal.content.css({position: ''}); // Fix Issue #10, remove the attribute modal.wrapper.css({overflow: 'hidden'}); // Used to fix a visual issue when hiding modal.content.css({overflow: 'hidden'}); // Used to fix a visual issue when hiding $('iframe', modal.content).hide(); // Fix issue 359 if ($.isFunction(currentSettings.beforeHideContent)) { currentSettings.beforeHideContent(modal, currentSettings, function() { currentSettings.hideContent(modal, currentSettings, function() { endHideContent(); currentSettings.hideBackground(modal, currentSettings, endRemove); }); }); } else { currentSettings.hideContent(modal, currentSettings, function() { endHideContent(); currentSettings.hideBackground(modal, currentSettings, endRemove); }); } } } if (e) return false; } function showContentOrLoading() { debug('showContentOrLoading'); if (modal.ready && !modal.anim) { if (modal.dataReady) { if (modal.tmp.html()) { modal.anim = true; if (modal.transition) { fillContent(); modal.animContent = true; currentSettings.hideTransition(modal, currentSettings, function() { modal.loading.hide(); modal.transition = false; modal.loadingShown = false; endShowContent(); }); } else { currentSettings.hideLoading(modal, currentSettings, function() { modal.loading.hide(); modal.loadingShown = false; fillContent(); setMarginLoading(); setMargin(); modal.animContent = true; currentSettings.showContent(modal, currentSettings, endShowContent); }); } } } else if (!modal.loadingShown && !modal.transition) { modal.anim = true; modal.loadingShown = true; if (modal.error) loadingError(); else modal.loading.html(currentSettings.contentLoading); $(currentSettings.closeSelector, modal.loading) .unbind('click.nyroModal') .bind('click.nyroModal', removeModal); setMarginLoading(); currentSettings.showLoading(modal, currentSettings, function(){modal.anim=false;showContentOrLoading();}); } } } // ------------------------------------------------------- // Private Data Loaded callback // ------------------------------------------------------- function ajaxLoaded(data) { debug('AjaxLoaded: '+this.url); if (currentSettings.selector) { var tmp = {}; var i = 0; // Looking for script to store them data = data .replace(/\r\n/gi,'nyroModalLN') .replace(//gi, function(x) { tmp[i] = x; return ''; }); data = $('
'+data+'
').find(currentSettings.selector).html() .replace(/
"}else{aL=true}}else{if(aK.player=="inline"){aG=ab.exec(aK.content);if(aG){aM=ad(aG[1]);if(aM){aK.content=aM.innerHTML}else{aL=true}}else{aL=true}}else{if(aK.player=="swf"||aK.player=="flv"){K=(aK.options&&aK.options.flashVersion)||Q.options.flashVersion;if(Q.flash&&!Q.flash.hasFlashPlayerVersion(K)){aK.width=310;aK.height=177}}}}if(aL){Q.gallery.splice(aJ,1);if(aJ0?aJ-1:aJ}}--aJ}}}function aq(K){if(!Q.options.enableKeys){return}(K?F:M)(document,"keydown",an)}function an(aG){if(aG.metaKey||aG.shiftKey||aG.altKey||aG.ctrlKey){return}var S=v(aG),K;switch(S){case 81:case 88:case 27:K=Q.close;break;case 37:K=Q.previous;break;case 39:K=Q.next;break;case 32:K=typeof ap=="number"?Q.pause:Q.play;break}if(K){n(aG);K()}}function c(aK){aq(false);var aJ=Q.getCurrent();var aG=(aJ.player=="inline"?"html":aJ.player);if(typeof Q[aG]!="function"){throw"unknown player "+aG}if(aK){Q.player.remove();Q.revertOptions();Q.applyOptions(aJ.options||{})}Q.player=new Q[aG](aJ,Q.playerId);if(Q.gallery.length>1){var aH=Q.gallery[Q.current+1]||Q.gallery[0];if(aH.player=="img"){var S=new Image();S.src=aH.content}var aI=Q.gallery[Q.current-1]||Q.gallery[Q.gallery.length-1];if(aI.player=="img"){var K=new Image();K.src=aI.content}}Q.skin.onLoad(aK,W)}function W(){if(!A){return}if(typeof Q.player.ready!="undefined"){var K=setInterval(function(){if(A){if(Q.player.ready){clearInterval(K);K=null;Q.skin.onReady(e)}}else{clearInterval(K);K=null}},10)}else{Q.skin.onReady(e)}}function e(){if(!A){return}Q.player.append(Q.skin.body,Q.dimensions);Q.skin.onShow(I)}function I(){if(!A){return}if(Q.player.onLoad){Q.player.onLoad()}Q.options.onFinish(Q.getCurrent());if(!Q.isPaused()){Q.play()}aq(true)}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(S,aG){var K=this.length>>>0;aG=aG||0;if(aG<0){aG+=K}for(;aG-1;Q.plugins={fla:w.indexOf("Shockwave Flash")>-1,qt:w.indexOf("QuickTime")>-1,wmp:!ai&&w.indexOf("Windows Media")>-1,f4m:ai}}else{var p=function(K){var S;try{S=new ActiveXObject(K)}catch(aG){}return !!S};Q.plugins={fla:p("ShockwaveFlash.ShockwaveFlash"),qt:p("QuickTime.QuickTime"),wmp:p("wmplayer.ocx"),f4m:false}}var X=/^(light|shadow)box/i,am="shadowboxCacheKey",b=1;Q.cache={};Q.select=function(S){var aG=[];if(!S){var K;aF(document.getElementsByTagName("a"),function(aJ,aK){K=aK.getAttribute("rel");if(K&&X.test(K)){aG.push(aK)}})}else{var aI=S.length;if(aI){if(typeof S=="string"){if(Q.find){aG=Q.find(S)}}else{if(aI==2&&typeof S[0]=="string"&&S[1].nodeType){if(Q.find){aG=Q.find(S[0],S[1])}}else{for(var aH=0;aH+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,aQ=0,aS=Object.prototype.toString,aK=false,aJ=true;[0,0].sort(function(){aJ=false;return 0});var aG=function(a1,aW,a4,a5){a4=a4||[];var a7=aW=aW||document;if(aW.nodeType!==1&&aW.nodeType!==9){return[]}if(!a1||typeof a1!=="string"){return a4}var a2=[],aY,a9,bc,aX,a0=true,aZ=aH(aW),a6=a1;while((aP.exec(""),aY=aP.exec(a6))!==null){a6=aY[3];a2.push(aY[1]);if(aY[2]){aX=aY[3];break}}if(a2.length>1&&aL.exec(a1)){if(a2.length===2&&aM.relative[a2[0]]){a9=aT(a2[0]+a2[1],aW)}else{a9=aM.relative[a2[0]]?[aW]:aG(a2.shift(),aW);while(a2.length){a1=a2.shift();if(aM.relative[a1]){a1+=a2.shift()}a9=aT(a1,a9)}}}else{if(!a5&&a2.length>1&&aW.nodeType===9&&!aZ&&aM.match.ID.test(a2[0])&&!aM.match.ID.test(a2[a2.length-1])){var a8=aG.find(a2.shift(),aW,aZ);aW=a8.expr?aG.filter(a8.expr,a8.set)[0]:a8.set[0]}if(aW){var a8=a5?{expr:a2.pop(),set:aO(a5)}:aG.find(a2.pop(),a2.length===1&&(a2[0]==="~"||a2[0]==="+")&&aW.parentNode?aW.parentNode:aW,aZ);a9=a8.expr?aG.filter(a8.expr,a8.set):a8.set;if(a2.length>0){bc=aO(a9)}else{a0=false}while(a2.length){var bb=a2.pop(),ba=bb;if(!aM.relative[bb]){bb=""}else{ba=a2.pop()}if(ba==null){ba=aW}aM.relative[bb](bc,ba,aZ)}}else{bc=a2=[]}}if(!bc){bc=a9}if(!bc){throw"Syntax error, unrecognized expression: "+(bb||a1)}if(aS.call(bc)==="[object Array]"){if(!a0){a4.push.apply(a4,bc)}else{if(aW&&aW.nodeType===1){for(var a3=0;bc[a3]!=null;a3++){if(bc[a3]&&(bc[a3]===true||bc[a3].nodeType===1&&aN(aW,bc[a3]))){a4.push(a9[a3])}}}else{for(var a3=0;bc[a3]!=null;a3++){if(bc[a3]&&bc[a3].nodeType===1){a4.push(a9[a3])}}}}}else{aO(bc,a4)}if(aX){aG(aX,a7,a4,a5);aG.uniqueSort(a4)}return a4};aG.uniqueSort=function(aX){if(aR){aK=aJ;aX.sort(aR);if(aK){for(var aW=1;aW":function(a2,aX){var a0=typeof aX==="string";if(a0&&!/\W/.test(aX)){aX=aX.toLowerCase();for(var aY=0,aW=a2.length;aY=0)){if(!aY){aW.push(a1)}}else{if(aY){aX[a0]=false}}}}return false},ID:function(aW){return aW[1].replace(/\\/g,"")},TAG:function(aX,aW){return aX[1].toLowerCase()},CHILD:function(aW){if(aW[1]==="nth"){var aX=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(aW[2]==="even"&&"2n"||aW[2]==="odd"&&"2n+1"||!/\D/.test(aW[2])&&"0n+"+aW[2]||aW[2]);aW[2]=(aX[1]+(aX[2]||1))-0;aW[3]=aX[3]-0}aW[0]=aQ++;return aW},ATTR:function(a0,aX,aY,aW,a1,a2){var aZ=a0[1].replace(/\\/g,"");if(!a2&&aM.attrMap[aZ]){a0[1]=aM.attrMap[aZ]}if(a0[2]==="~="){a0[4]=" "+a0[4]+" "}return a0},PSEUDO:function(a0,aX,aY,aW,a1){if(a0[1]==="not"){if((aP.exec(a0[3])||"").length>1||/^\w/.test(a0[3])){a0[3]=aG(a0[3],null,null,aX)}else{var aZ=aG.filter(a0[3],aX,aY,true^a1);if(!aY){aW.push.apply(aW,aZ)}return false}}else{if(aM.match.POS.test(a0[0])||aM.match.CHILD.test(a0[0])){return true}}return a0},POS:function(aW){aW.unshift(true);return aW}},filters:{enabled:function(aW){return aW.disabled===false&&aW.type!=="hidden"},disabled:function(aW){return aW.disabled===true},checked:function(aW){return aW.checked===true},selected:function(aW){aW.parentNode.selectedIndex;return aW.selected===true},parent:function(aW){return !!aW.firstChild},empty:function(aW){return !aW.firstChild},has:function(aY,aX,aW){return !!aG(aW[3],aY).length},header:function(aW){return/h\d/i.test(aW.nodeName)},text:function(aW){return"text"===aW.type},radio:function(aW){return"radio"===aW.type},checkbox:function(aW){return"checkbox"===aW.type},file:function(aW){return"file"===aW.type},password:function(aW){return"password"===aW.type},submit:function(aW){return"submit"===aW.type},image:function(aW){return"image"===aW.type},reset:function(aW){return"reset"===aW.type},button:function(aW){return"button"===aW.type||aW.nodeName.toLowerCase()==="button"},input:function(aW){return/input|select|textarea|button/i.test(aW.nodeName)}},setFilters:{first:function(aX,aW){return aW===0},last:function(aY,aX,aW,aZ){return aX===aZ.length-1},even:function(aX,aW){return aW%2===0},odd:function(aX,aW){return aW%2===1},lt:function(aY,aX,aW){return aXaW[3]-0},nth:function(aY,aX,aW){return aW[3]-0===aX},eq:function(aY,aX,aW){return aW[3]-0===aX}},filter:{PSEUDO:function(a2,aY,aZ,a3){var aX=aY[1],a0=aM.filters[aX];if(a0){return a0(a2,aZ,aY,a3)}else{if(aX==="contains"){return(a2.textContent||a2.innerText||S([a2])||"").indexOf(aY[3])>=0}else{if(aX==="not"){var a1=aY[3];for(var aZ=0,aW=a1.length;aZ=0)}}},ID:function(aX,aW){return aX.nodeType===1&&aX.getAttribute("id")===aW},TAG:function(aX,aW){return(aW==="*"&&aX.nodeType===1)||aX.nodeName.toLowerCase()===aW},CLASS:function(aX,aW){return(" "+(aX.className||aX.getAttribute("class"))+" ").indexOf(aW)>-1},ATTR:function(a1,aZ){var aY=aZ[1],aW=aM.attrHandle[aY]?aM.attrHandle[aY](a1):a1[aY]!=null?a1[aY]:a1.getAttribute(aY),a2=aW+"",a0=aZ[2],aX=aZ[4];return aW==null?a0==="!=":a0==="="?a2===aX:a0==="*="?a2.indexOf(aX)>=0:a0==="~="?(" "+a2+" ").indexOf(aX)>=0:!aX?a2&&aW!==false:a0==="!="?a2!==aX:a0==="^="?a2.indexOf(aX)===0:a0==="$="?a2.substr(a2.length-aX.length)===aX:a0==="|="?a2===aX||a2.substr(0,aX.length+1)===aX+"-":false},POS:function(a0,aX,aY,a1){var aW=aX[2],aZ=aM.setFilters[aW];if(aZ){return aZ(a0,aY,aX,a1)}}}};var aL=aM.match.POS;for(var aI in aM.match){aM.match[aI]=new RegExp(aM.match[aI].source+/(?![^\[]*\])(?![^\(]*\))/.source);aM.leftMatch[aI]=new RegExp(/(^(?:.|\r|\n)*?)/.source+aM.match[aI].source)}var aO=function(aX,aW){aX=Array.prototype.slice.call(aX,0);if(aW){aW.push.apply(aW,aX);return aW}return aX};try{Array.prototype.slice.call(document.documentElement.childNodes,0)}catch(aV){aO=function(a0,aZ){var aX=aZ||[];if(aS.call(a0)==="[object Array]"){Array.prototype.push.apply(aX,a0)}else{if(typeof a0.length==="number"){for(var aY=0,aW=a0.length;aY";var aW=document.documentElement;aW.insertBefore(aX,aW.firstChild);if(document.getElementById(aY)){aM.find.ID=function(a0,a1,a2){if(typeof a1.getElementById!=="undefined"&&!a2){var aZ=a1.getElementById(a0[1]);return aZ?aZ.id===a0[1]||typeof aZ.getAttributeNode!=="undefined"&&aZ.getAttributeNode("id").nodeValue===a0[1]?[aZ]:k:[]}};aM.filter.ID=function(a1,aZ){var a0=typeof a1.getAttributeNode!=="undefined"&&a1.getAttributeNode("id");return a1.nodeType===1&&a0&&a0.nodeValue===aZ}}aW.removeChild(aX);aW=aX=null})();(function(){var aW=document.createElement("div");aW.appendChild(document.createComment(""));if(aW.getElementsByTagName("*").length>0){aM.find.TAG=function(aX,a1){var a0=a1.getElementsByTagName(aX[1]);if(aX[1]==="*"){var aZ=[];for(var aY=0;a0[aY];aY++){if(a0[aY].nodeType===1){aZ.push(a0[aY])}}a0=aZ}return a0}}aW.innerHTML="";if(aW.firstChild&&typeof aW.firstChild.getAttribute!=="undefined"&&aW.firstChild.getAttribute("href")!=="#"){aM.attrHandle.href=function(aX){return aX.getAttribute("href",2)}}aW=null})();if(document.querySelectorAll){(function(){var aW=aG,aY=document.createElement("div");aY.innerHTML="

";if(aY.querySelectorAll&&aY.querySelectorAll(".TEST").length===0){return}aG=function(a2,a1,aZ,a0){a1=a1||document;if(!a0&&a1.nodeType===9&&!aH(a1)){try{return aO(a1.querySelectorAll(a2),aZ)}catch(a3){}}return aW(a2,a1,aZ,a0)};for(var aX in aW){aG[aX]=aW[aX]}aY=null})()}(function(){var aW=document.createElement("div");aW.innerHTML="
";if(!aW.getElementsByClassName||aW.getElementsByClassName("e").length===0){return}aW.lastChild.className="e";if(aW.getElementsByClassName("e").length===1){return}aM.order.splice(1,0,"CLASS");aM.find.CLASS=function(aX,aY,aZ){if(typeof aY.getElementsByClassName!=="undefined"&&!aZ){return aY.getElementsByClassName(aX[1])}};aW=null})();function K(aX,a2,a1,a5,a3,a4){for(var aZ=0,aY=a5.length;aZ0){a0=aW;break}}}aW=aW[aX]}a5[aZ]=a0}}}var aN=document.compareDocumentPosition?function(aX,aW){return aX.compareDocumentPosition(aW)&16}:function(aX,aW){return aX!==aW&&(aX.contains?aX.contains(aW):true)};var aH=function(aW){var aX=(aW?aW.ownerDocument||aW:0).documentElement;return aX?aX.nodeName!=="HTML":false};var aT=function(aW,a3){var aZ=[],a0="",a1,aY=a3.nodeType?[a3]:a3;while((a1=aM.match.PSEUDO.exec(aW))){a0+=a1[0];aW=aW.replace(aM.match.PSEUDO,"")}aW=aM.relative[aW]?aW+"*":aW;for(var a2=0,aX=aY.length;a2{1} browser plugin to view this content.',shared:'You must install both the {1} and {3} browser plugins to view this content.',either:'You must install either the {1} or the {3} browser plugin to view this content.'}};var D,at="sb-drag-proxy",E,j,ag;function ax(){E={x:0,y:0,startX:null,startY:null}}function aA(){var K=Q.dimensions;aC(j.style,{height:K.innerHeight+"px",width:K.innerWidth+"px"})}function O(){ax();var K=["position:absolute","cursor:"+(Q.isGecko?"-moz-grab":"move"),"background-color:"+(Q.isIE?"#fff;filter:alpha(opacity=0)":"transparent")].join(";");Q.appendHTML(Q.skin.body,'
');j=ad(at);aA();F(j,"mousedown",L)}function B(){if(j){M(j,"mousedown",L);C(j);j=null}ag=null}function L(S){n(S);var K=V(S);E.startX=K[0];E.startY=K[1];ag=ad(Q.player.id);F(document,"mousemove",H);F(document,"mouseup",i);if(Q.isGecko){j.style.cursor="-moz-grabbing"}}function H(aI){var K=Q.player,aJ=Q.dimensions,aH=V(aI);var aG=aH[0]-E.startX;E.startX+=aG;E.x=Math.max(Math.min(0,E.x+aG),aJ.innerWidth-K.width);var S=aH[1]-E.startY;E.startY+=S;E.y=Math.max(Math.min(0,E.y+S),aJ.innerHeight-K.height);aC(ag.style,{left:E.x+"px",top:E.y+"px"})}function i(){M(document,"mousemove",H);M(document,"mouseup",i);if(Q.isGecko){j.style.cursor="-moz-grab"}}Q.img=function(S,aG){this.obj=S;this.id=aG;this.ready=false;var K=this;D=new Image();D.onload=function(){K.height=S.height?parseInt(S.height,10):D.height;K.width=S.width?parseInt(S.width,10):D.width;K.ready=true;D.onload=null;D=null};D.src=S.content};Q.img.ext=["bmp","gif","jpg","jpeg","png"];Q.img.prototype={append:function(S,aI){var aG=document.createElement("img");aG.id=this.id;aG.src=this.obj.content;aG.style.position="absolute";var K,aH;if(aI.oversized&&Q.options.handleOversize=="resize"){K=aI.innerHeight;aH=aI.innerWidth}else{K=this.height;aH=this.width}aG.setAttribute("height",K);aG.setAttribute("width",aH);S.appendChild(aG)},remove:function(){var K=ad(this.id);if(K){C(K)}B();if(D){D.onload=null;D=null}},onLoad:function(){var K=Q.dimensions;if(K.oversized&&Q.options.handleOversize=="drag"){O()}},onWindowResize:function(){var aH=Q.dimensions;switch(Q.options.handleOversize){case"resize":var K=ad(this.id);K.height=aH.innerHeight;K.width=aH.innerWidth;break;case"drag":if(ag){var aG=parseInt(Q.getStyle(ag,"top")),S=parseInt(Q.getStyle(ag,"left"));if(aG+this.height=aJ){clearInterval(S);S=null;aM(aG,aN);if(aR){aR()}}else{aM(aG,aO+aK((aI-aH)/aL)*aP)}},10)}function aB(){aa.style.height=Q.getWindowSize("Height")+"px";aa.style.width=Q.getWindowSize("Width")+"px"}function aE(){aa.style.top=document.documentElement.scrollTop+"px";aa.style.left=document.documentElement.scrollLeft+"px"}function ay(K){if(K){aF(Y,function(S,aG){aG[0].style.visibility=aG[1]||""})}else{Y=[];aF(Q.options.troubleElements,function(aG,S){aF(document.getElementsByTagName(S),function(aH,aI){Y.push([aI,aI.style.visibility]);aI.style.visibility="hidden"})})}}function r(aG,K){var S=ad("sb-nav-"+aG);if(S){S.style.display=K?"":"none"}}function ah(K,aJ){var aI=ad("sb-loading"),aG=Q.getCurrent().player,aH=(aG=="img"||aG=="html");if(K){Q.setOpacity(aI,0);aI.style.display="block";var S=function(){Q.clearOpacity(aI);if(aJ){aJ()}};if(aH){N(aI,"opacity",1,Q.options.fadeDuration,S)}else{S()}}else{var S=function(){aI.style.display="none";Q.clearOpacity(aI);if(aJ){aJ()}};if(aH){N(aI,"opacity",0,Q.options.fadeDuration,S)}else{S()}}}function t(aO){var aJ=Q.getCurrent();ad("sb-title-inner").innerHTML=aJ.title||"";var aP,aL,S,aQ,aM;if(Q.options.displayNav){aP=true;var aN=Q.gallery.length;if(aN>1){if(Q.options.continuous){aL=aM=true}else{aL=(aN-1)>Q.current;aM=Q.current>0}}if(Q.options.slideshowDelay>0&&Q.hasNext()){aQ=!Q.isPaused();S=!aQ}}else{aP=aL=S=aQ=aM=false}r("close",aP);r("next",aL);r("play",S);r("pause",aQ);r("previous",aM);var K="";if(Q.options.displayCounter&&Q.gallery.length>1){var aN=Q.gallery.length;if(Q.options.counterType=="skip"){var aI=0,aH=aN,aG=parseInt(Q.options.counterLimit)||0;if(aG2){var aK=Math.floor(aG/2);aI=Q.current-aK;if(aI<0){aI+=aN}aH=Q.current+(aG-aK);if(aH>aN){aH-=aN}}while(aI!=aH){if(aI==aN){aI=0}K+='"}}else{K=[Q.current+1,Q.lang.of,aN].join(" ")}}ad("sb-counter").innerHTML=K;aO()}function U(aH){var K=ad("sb-title-inner"),aG=ad("sb-info-inner"),S=0.35;K.style.visibility=aG.style.visibility="";if(K.innerHTML!=""){N(K,"marginTop",0,S)}N(aG,"marginTop",0,S,aH)}function av(aG,aM){var aK=ad("sb-title"),K=ad("sb-info"),aH=aK.offsetHeight,aI=K.offsetHeight,aJ=ad("sb-title-inner"),aL=ad("sb-info-inner"),S=(aG?0.35:0);N(aJ,"marginTop",aH,S);N(aL,"marginTop",aI*-1,S,function(){aJ.style.visibility=aL.style.visibility="hidden";aM()})}function ac(K,aH,S,aJ){var aI=ad("sb-wrapper-inner"),aG=(S?Q.options.resizeDuration:0);N(Z,"top",aH,aG);N(aI,"height",K,aG,aJ)}function ar(K,aH,S,aI){var aG=(S?Q.options.resizeDuration:0);N(Z,"left",aH,aG);N(Z,"width",K,aG,aI)}function ak(aM,aG){var aI=ad("sb-body-inner"),aM=parseInt(aM),aG=parseInt(aG),S=Z.offsetHeight-aI.offsetHeight,K=Z.offsetWidth-aI.offsetWidth,aK=ae.offsetHeight,aL=ae.offsetWidth,aJ=parseInt(Q.options.viewportPadding)||20,aH=(Q.player&&Q.options.handleOversize!="drag");return Q.setDimensions(aM,aG,aK,aL,S,K,aJ,aH)}var T={};T.markup='';T.options={animSequence:"sync",counterLimit:10,counterType:"default",displayCounter:true,displayNav:true,fadeDuration:0.35,initialHeight:160,initialWidth:320,modal:false,overlayColor:"#000",overlayOpacity:0.5,resizeDuration:0.35,showOverlay:true,troubleElements:["select","object","embed","canvas"]};T.init=function(){Q.appendHTML(document.body,s(T.markup,Q.lang));T.body=ad("sb-body-inner");aa=ad("sb-container");ae=ad("sb-overlay");Z=ad("sb-wrapper");if(!x){aa.style.position="absolute"}if(!h){var aG,K,S=/url\("(.*\.png)"\)/;aF(q,function(aI,aJ){aG=ad(aJ);if(aG){K=Q.getStyle(aG,"backgroundImage").match(S);if(K){aG.style.backgroundImage="none";aG.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,src="+K[1]+",sizingMethod=scale);"}}})}var aH;F(au,"resize",function(){if(aH){clearTimeout(aH);aH=null}if(A){aH=setTimeout(T.onWindowResize,10)}})};T.onOpen=function(K,aG){m=false;aa.style.display="block";aB();var S=ak(Q.options.initialHeight,Q.options.initialWidth);ac(S.innerHeight,S.top);ar(S.width,S.left);if(Q.options.showOverlay){ae.style.backgroundColor=Q.options.overlayColor;Q.setOpacity(ae,0);if(!Q.options.modal){F(ae,"click",Q.close)}ao=true}if(!x){aE();F(au,"scroll",aE)}ay();aa.style.visibility="visible";if(ao){N(ae,"opacity",Q.options.overlayOpacity,Q.options.fadeDuration,aG)}else{aG()}};T.onLoad=function(S,K){ah(true);while(T.body.firstChild){C(T.body.firstChild)}av(S,function(){if(!A){return}if(!S){Z.style.visibility="visible"}t(K)})};T.onReady=function(aH){if(!A){return}var S=Q.player,aG=ak(S.height,S.width);var K=function(){U(aH)};switch(Q.options.animSequence){case"hw":ac(aG.innerHeight,aG.top,true,function(){ar(aG.width,aG.left,true,K)});break;case"wh":ar(aG.width,aG.left,true,function(){ac(aG.innerHeight,aG.top,true,K)});break;default:ar(aG.width,aG.left,true);ac(aG.innerHeight,aG.top,true,K)}};T.onShow=function(K){ah(false,K);m=true};T.onClose=function(){if(!x){M(au,"scroll",aE)}M(ae,"click",Q.close);Z.style.visibility="hidden";var K=function(){aa.style.visibility="hidden";aa.style.display="none";ay(true)};if(ao){N(ae,"opacity",0,Q.options.fadeDuration,K)}else{K()}};T.onPlay=function(){r("play",false);r("pause",true)};T.onPause=function(){r("pause",false);r("play",true)};T.onWindowResize=function(){if(!m){return}aB();var K=Q.player,S=ak(K.height,K.width);ar(S.width,S.left);ac(S.innerHeight,S.top);if(K.onWindowResize){K.onWindowResize()}};Q.skin=T;au.Shadowbox=Q})(window); // JavaScript Document TCALightBox_init(); function TCALightBox_init() { //if (window.Event) { // document.captureEvents(Event.MOUSEMOVE); //} document.onmousemove = TCALightBox_getXY; TCALightBox_ready = true; } var cursor; var TCALightBox_ready = false; var TCALightBox_open = false; function TCALightBox_getXY(e) { e = e || window.event; cursor = {x:0, y:0}; if (e.pageX || e.pageY) { cursor.x = e.pageX; cursor.y = e.pageY; } else { cursor.x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft; cursor.y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop; } } function TCALightBox_createBG() { var divIdName = 'TCALightBox_bg'; if(!top.document.getElementById(divIdName)) { var newdiv = document.createElement('div'); newdiv.setAttribute('id',divIdName); newdiv.setAttribute('class','TCALightBox_bg'); newdiv.style.backgroundColor = "#000000"; newdiv.style.left="0px"; newdiv.style.top="0px"; newdiv.style.right="0px"; newdiv.style.bottom="0px"; newdiv.style.position="fixed"; newdiv.style.filter = 'alpha(opacity=0)'; newdiv.style.opacity = '.0'; addEvent(newdiv, "click", TCALightBox_close); top.document.body.appendChild(newdiv); } } function TCALightBox_createFG(opts) { var divIdName = 'TCALightBox_fg'; if(!top.document.getElementById(divIdName)) { var newdiv = document.createElement('div'); top.document.body.appendChild(newdiv); }else{ var newdiv = document.getElementById(divIdName); } TCALightBox_setClasses(); newdiv.setAttribute('id',divIdName); newdiv.style.left=(cursor['x']-5)+"px"; newdiv.style.top=(cursor['y']-5)+"px"; newdiv.style.width="10px"; newdiv.style.height="10px"; newdiv.style.visibility="visible"; newdiv.style.filter = 'alpha(opacity=0)'; newdiv.style.opacity = '.0'; newdiv.innerHTML = opts['content']; } function TCALightBox_setClasses() { if(!top.document.getElementById('TCALightBox_fg')) { setTimeout(TCALightBox_setClasses,1); }else{ if(TCALightBox_opts['loading']){ $('#TCALightBox_fg').addClass('TCALightBox_fg'); $('#TCALightBox_fg').addClass('TCALightBox_loading'); }else{ $('#TCALightBox_fg').addClass('TCALightBox_fg'); } } } function TCALightBox_createClose(opts) { var divIdName = 'TCALightBox_close'; if(!top.document.getElementById(divIdName)) { var newdiv = document.createElement('div'); document.getElementById('TCALightBox_fg').appendChild(newdiv); }else{ var newdiv = document.getElementById(divIdName); } newdiv.setAttribute('id',divIdName); $('#TCALightBox_close').addClass('TCALightBox_close'); if(!document.all){ //test for IE newdiv.style.visibility="visible"; newdiv.style.filter = 'alpha(opacity=0)'; newdiv.style.opacity = '.0'; addEvent(newdiv, "mouseover", TCALightBox_closeOver); addEvent(newdiv, "mouseout", TCALightBox_closeOut); TCA_transition({'obj': 'TCALightBox_close', 'speed':1, 'attr':'opacity', 'goal':50}); } addEvent(newdiv, "click", TCALightBox_close); } function TCALightBox_closeOver() { if(TCALightBox_open) TCA_transition({'obj': 'TCALightBox_close', 'speed':5, 'attr':'opacity', 'goal':100}); } function TCALightBox_closeOut() { if(TCALightBox_open) TCA_transition({'obj': 'TCALightBox_close', 'speed':5, 'attr':'opacity', 'goal':50}); } function TCALightBox_doneLoading() { var newdiv = document.getElementById('TCALightBox_fg'); $('#TCALightBox_fg').removeClass('TCALightBox_loading'); if(typeof TCALightBox_opts['openCallback'] == 'function') { TCALightBox_opts['openCallback'](); } } function TCALightBox_close() { TCALightBox_open = false; TCA_transition({'obj': 'TCALightBox_bg', 'speed':TCALightBox_opts['closeSpeed'], 'attr':'opacity', 'goal':0}); TCA_transition({'obj': 'TCALightBox_fg', 'speed':TCALightBox_opts['closeSpeed'], 'attr':'opacity', 'goal':0}); TCA_transition({'obj': 'TCALightBox_close', 'speed':TCALightBox_opts['closeSpeed'], 'attr':'opacity', 'goal':0}); if(TCALightBox_opts['returnContent']!= undefined) { document.getElementById(TCALightBox_opts['div']).innerHTML = TCALightBox_opts['returnContent']; } if(typeof TCALightBox_opts['closeCallback'] == 'function') { TCALightBox_opts['closeCallback'](); } } var TCALightBox_opts; function TCALightBox_resize_timeout() { setTimeout(TCALightBox_resize_do,10); } function TCALightBox_resize_do() { if(TCALightBox_open) TCALightBox_resize(TCALightBox_opts); } function TCALightBox_resize(opts) { var width; var height; maxWidth = getWinWidth()-200; maxHeight = getWinHeight()-200; if(opts['width']!==undefined) width = opts['width']; else width = maxWidth; if(opts['height']!==undefined) height = opts['height']; else height = maxHeight; if(width>maxWidth) width = maxWidth; if(height>maxHeight) height = maxHeight; if(opts['min-width']!==undefined && widthopts['max-width']) width = opts['min-width']; if(opts['max-height']!==undefined && height>opts['max-height']) height = opts['max-height']; var top = (getWinHeight() -height)/2; var left = (getWinWidth() - width)/2; if(top<0) top = 0; if(left<0) left = 0; var speed = 8; TCA_transition({'obj': 'TCALightBox_bg', 'speed':TCALightBox_opts['openSpeed'], 'attr':'opacity', 'goal':50}); TCA_transition({'obj': 'TCALightBox_fg', 'speed':TCALightBox_opts['openSpeed'], 'attr':'opacity', 'goal':100}); TCA_transition({'obj': 'TCALightBox_fg', 'speed':speed, 'attr':'top', 'goal':top}); TCA_transition({'obj': 'TCALightBox_fg', 'speed':speed, 'attr':'left', 'goal':left}); TCA_transition({'obj': 'TCALightBox_fg', 'speed':speed, 'attr':'height', 'goal':height}); TCA_transition({'obj': 'TCALightBox_fg', 'speed':speed, 'attr':'width', 'goal':width}); } //accepts width, height, min-width, min-height, max-width, max-height,iframe(as a url), closeCallback, openCallback function TCALightBox(opts) { if(opts['openSpeed']==undefined) { opts['openSpeed']=1; } if(opts['closeSpeed']==undefined) { opts['closeSpeed']=5; } if(opts===false) opts = TCALightBox_opts; else TCALightBox_opts = opts; TCALightBox_open = true; if(cursor!==undefined && cursor['x']!==undefined) { if(opts['iframe']!==undefined) { opts['content'] = ''; opts['loading'] = 1; } if(opts['div']!==undefined) { if(opts['div'].substring(0, 4) =="http") { opts['content'] ='
'; loadPageIntoDiv(opts['div'],'TCALightBox_fgi',null,TCALightBox_doneLoading); opts['loading'] = 1; }else{ if(document.getElementById(opts['div'])) { opts['content'] = '
'+document.getElementById(opts['div']).innerHTML+'
'; opts['returnContent'] = document.getElementById(opts['div']).innerHTML; document.getElementById(opts['div']).innerHTML = ''; } opts['loading'] = 0; } } TCALightBox_createBG(); TCALightBox_createFG(opts); setTimeout(function(){TCALightBox_createClose();},500); TCALightBox_resize(opts); addEvent(window, "resize", TCALightBox_resize_timeout) ; }else{ setTimeout(function(){TCALightBox(false)},100); } } /* SWFObject v2.2 is released under the MIT License */ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;abhttp://www.bin-co.com/ * The resulting array will be... * array['guid']['value'] = "http://www.bin-co.com/"; * array['guid']['attribute_isPermaLink'] = "true"; * * If 0, the value will be inside the tag but the attribute will be outside - like this... * For the same XML String the resulting array will be... * array['guid'] = "http://www.bin-co.com/"; * array['attribute_guid_isPermaLink'] = "true"; */ if(xmlDoc.nodeName && xmlDoc.nodeName.charAt(0) != "#") { if(xmlDoc.childNodes.length > 1) { //If its a parent arr = new Object; parent = xmlDoc.nodeName; } } var value = xmlDoc.nodeValue; if(xmlDoc.parentNode && xmlDoc.parentNode.nodeName && value) { if(not_whitespace.test(value)) {//If its a child arr = new Object; arr[xmlDoc.parentNode.nodeName] = value; } } if(xmlDoc.childNodes != undefined && xmlDoc.childNodes.length) { if(xmlDoc.childNodes.length == 1) { //Just one item in this tag. arr = xml2array(xmlDoc.childNodes[0],parent_count); //:RECURSION: } else { //If there is more than one childNodes, go thru them one by one and get their results. var index = 0; var arr = new Array(); for(var i=0; i2) break;//We just need to know wether it is a single value array or not } if(assoc && arr_count == 1) { //alert("a"); // alert(dump(arr)); //alert("b"); if(arr[key]) { //If another element exists with the same tag name before, // put it in a numeric array. //Find out how many time this parent made its appearance if(!parent_count || !parent_count[key]) { parent_count[key] = 0; var temp_arr = arr[key]; arr[key] = new Object; arr[key][0] = temp_arr; } parent_count[key]++; arr[key][parent_count[key]] = temp[key]; //Members of of a numeric array } else { parent_count[key] = 0; arr[key] = temp[key]; if(xmlDoc.childNodes[i].attributes && xmlDoc.childNodes[i].attributes.length) { for(var j=0; j \"" + value + "\"\n"; } } } else { //Stings/Chars/Numbers etc. dumped_text = "===>"+arr+"<===("+typeof(arr)+")"; } return dumped_text; } //depricated function parseXML(url) { try //Internet Explorer { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); } catch(e) { try //Firefox, Mozilla, Opera, etc. { xmlDoc=document.implementation.createDocument("","",null); } catch(e) { alert(e.message); return; } } xmlDoc.async=false; xmlDoc.load(url); alert(xmlDoc.responseText); //return xml2array(xmlDoc); //document.getElementById("to").innerHTML=xmlDoc.getElementsByTagName("to")[0].childNodes[0].nodeValue; //document.getElementById("from").innerHTML=xmlDoc.getElementsByTagName("from")[0].childNodes[0].nodeValue; //document.getElementById("message").innerHTML=xmlDoc.getElementsByTagName("body")[0].childNodes[0].nodeValue; } function createObject() { var request_type; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ request_type = new ActiveXObject("Microsoft.XMLHTTP"); }else{ request_type = new XMLHttpRequest(); } return request_type; } var http = createObject(); var loadPageIntoDivId; var loadPageIntoDivCallback; function loadPageIntoDiv(page,divId,formFields,callback) { loadPageIntoDivId = divId; http.open('POST', page,true); http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); http.onreadystatechange = loadPageIntoDivReply; loadPageIntoDivCallback = callback; if(null!=formFields && isArray(formFields)) { var query = ""; var i=0; for(var obj in formFields) { formElem = document.getElementById(formFields[obj]); if(formElem!=null) { if(i!=0) query = query + "&"; query = query + formFields[obj]+"="+formElem.value; i++; } } http.send(query); }else{ http.send(null); } } function loadPageIntoDivReply() { if(http.readyState == 4){ var response = http.responseText; if(response!=""){ div = document.getElementById(loadPageIntoDivId); if(div!=null) div.innerHTML = response; } else { } setTimeout(loadPageIntoDivCallback,0); } } //depricated? function loadPage(url) { try //Internet Explorer { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); } catch(e) { try //Firefox, Mozilla, Opera, etc. { xmlDoc=document.implementation.createDocument("","",null); } catch(e) { alert(e.message); return; } } xmlDoc.async=true; xmlDoc.load(url); return xmlDoc.nodeValue; //document.getElementById("to").innerHTML=xmlDoc.getElementsByTagName("to")[0].childNodes[0].nodeValue; //document.getElementById("from").innerHTML=xmlDoc.getElementsByTagName("from")[0].childNodes[0].nodeValue; //document.getElementById("message").innerHTML=xmlDoc.getElementsByTagName("body")[0].childNodes[0].nodeValue; } function insertObjAtCursor(insert,field) { masterInsert(field,"["+insert+"]",false,"[/"+insert+"]"); } function insertObjAtCursorPop(insert,field,query,text) { ret = prompt(text); masterInsert(field,"["+insert+" "+query+"='"+ret+"']",false,"[/"+insert+"]"); } function insertObjAtCursorPop2(insert,field,query,text) { ret = prompt(text); masterInsert(field,"["+insert+"]",ret,"[/"+insert+"]"); } function insertAtCursor(insert,field) { masterInsert(field,"",insert,""); } function masterInsert(field,start,mid,end) { myField = document.getElementById(field); if(myField.type=="hidden") { myField.value=mid; }else{ //IE support if (document.selection) { myField.focus(); sel = document.selection.createRange(); if(mid===false) sel.text = start+sel.text+end; else sel.text = start+mid+end; } //Mozilla/Firefox/Netscape 7+ support else if (myField.selectionStart || myField.selectionStart == '0') { var startPos = myField.selectionStart; var endPos = myField.selectionEnd; if(mid===false) myField.value = myField.value.substring(0, startPos)+ start+ myField.value.substring(startPos, endPos) +end+ myField.value.substring(endPos, myField.value.length); else myField.value = myField.value.substring(0, startPos)+ start+ mid +end+ myField.value.substring(endPos, myField.value.length); } else { if(mid===false) myField.value += start+end; else myField.value += start+mid+end; } } } function popupWindow(url,name,height,width) { var newwindow; newwindow=window.open(url,name,'status=0,toolbar=0,directories=0,scrollbars=0,height='+height+',width='+width); if (window.focus) {newwindow.focus()} } function getFile(pURL) { if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc xmlhttp=new XMLHttpRequest(); xmlhttp.onreadystatechange=reloadPage; xmlhttp.open("GET", pURL, true); xmlhttp.send(null); } else if (window.ActiveXObject) { //IE xmlhttp=new ActiveXObject('Microsoft.XMLHTTP'); if (xmlhttp) { xmlhttp.onreadystatechange=reloadPage; xmlhttp.open('GET', pURL, true); xmlhttp.send(); } } } function reloadPage() { if (xmlhttp.readyState==4) { if (xmlhttp.status==200) { //alert(xmlhttp.responseText); window.location.reload() } } } var addEvent; if (document.addEventListener) { addEvent = function(element, type, handler) { element.addEventListener(type, handler, null); } } else if (document.attachEvent) { addEvent = function(element, type, handler) { element.attachEvent("on" + type, handler); } } else { addEvent = new Function; // not supported } var floatBoxWindows = new Array; function lightBox(interiorPage){ lightBoxC(interiorPage,500,500,20,2); } function lightBoxC(interiorPage,width,height,barHeight,border){ //fade if(!top.document.getElementById("floatBox_background")) { var newdiv = document.createElement('div'); var divIdName = 'floatBox_background'; newdiv.setAttribute('id',divIdName); newdiv.setAttribute('class','floatBox_background'); newdiv.style.backgroundColor = "#000000"; newdiv.style.width=getWinWidth()+"px"; newdiv.style.height=getWinHeight()+"px"; newdiv.style.position="fixed"; newdiv.style.left="0px"; newdiv.style.top="0px"; newdiv.style.filter = 'alpha(opacity=0)'; newdiv.style.opacity = '.0'; newdiv.innerHTML = ''; addEvent(newdiv, "click", closeFloatBox) ; addEvent(window, "scroll", closeFloatBox) ; addEvent(window, "resize", closeFloatBox) ; top.document.body.appendChild(newdiv); fadeIn(divIdName,0,75,microtime(),2); } uid = uniqid(); var newdiv = top.document.createElement('div'); top.floatBoxWindows.push(newdiv); var divIdName = 'floatBox_foreground'+top.floatBoxWindows.length; newdiv.setAttribute('id',divIdName); newdiv.setAttribute('class','floatBox_foreground'); //newdiv.style.backgroundColor = "#FFFFFF"; newdiv.style.width="0px"; newdiv.style.height=(height+barHeight)+"px"; newdiv.style.position="fixed"; newdiv.style.overflow="hidden"; newdiv.style.border="solid "+border+"px #000"; newdiv.style.left=((getWinWidth())/2)+"px"; newdiv.style.top=((getWinHeight()-(height+barHeight))/2-border)+"px"; //newdiv.style.filter = 'alpha(opacity=0)'; //newdiv.style.opacity = '.0'; newdiv.innerHTML = ''; top.document.body.appendChild(newdiv); var floatBox_content = top.document.createElement('div'); var floatBox_contentName = 'floatBox_content'+top.floatBoxWindows.length; floatBox_content.setAttribute('id',floatBox_contentName); floatBox_content.setAttribute('class','floatBox_content'); //floatBox_content.style.backgroundColor = "#FFFFFF"; //floatBox_content.style.width=width+"px"; //floatBox_content.style.height=(height+barHeight)+"px"; floatBox_content.style.position="relative"; floatBox_content.style.overflow="hidden"; // floatBox_content.style.left="100px"; //floatBox_content.style.top="0px"; // loadPageIntoDiv("plugins/postData/popImage.php",floatBox_contentName); floatBox_content.innerHTML = ""; if(barHeight>0) { floatBox_content.innerHTML += '
'; } floatBox_content.innerHTML += ''; newdiv.appendChild(floatBox_content); var ifrm = top.document.getElementById("floatBox_contentFrm"+top.floatBoxWindows.length); if(ifrm!=null) { addEvent(ifrm, "load", showiframe) ; } fadeIn(divIdName,0,100,microtime(),.5); scrollOpen(divIdName,0,width,microtime(),.5,floatBox_contentName); } function showiframe() { var ifrm = top.document.getElementById("floatBox_contentFrm"+top.floatBoxWindows.length); ifrm.style.visibility="visible"; } function closeFloatBox() { div = top.document.getElementById("floatBox_background"); if(div!=null) top.document.body.removeChild(div); for(i=0;i 1) perc = 1; trans = (endZ -startZ) * perc + startZ; if((trans > endZ && startZ < endZ) || (trans < endZ && startZ > endZ)) trans = endZ; div.style.filter = 'alpha(opacity='+trans+')'; div.style.opacity = trans/100; /*if(trans>0) { div.style.visibility = "visible"; }else{ div.style.visibility = "hidden"; }*/ if(trans!=endZ) { setTimeout("fadeIn('"+id+"',0,0,0,0)",10); } } } var fadeList = Array(); function fade(id,speed,end) { // if(!in_array(Array(id,speed,end),fadeList)) // { fadeList[id] = Array(id,speed,end,1); // } registerDaemon("fadeDaemon()"); } function fadeDaemon() { for ( var fade in fadeList ) { if(fadeList[fade][3]) { if(currentFades[fadeList[fade][0]]==null) currentFades[fadeList[fade][0]] = 0; var direction = 0; if(fadeList[fade][2]>currentFades[fadeList[fade][0]]) { currentFades[fadeList[fade][0]] += (fadeList[fade][1])*cycleTime; direction=1; } else { currentFades[fadeList[fade][0]] -= (fadeList[fade][1])*cycleTime; } if((currentFades[fadeList[fade][0]] > fadeList[fade][2] && direction==1) || (currentFades[fadeList[fade][0]] < fadeList[fade][2] && direction==0)) currentFades[fadeList[fade][0]] = fadeList[fade][2]; var obj = document.getElementById(fadeList[fade][0]); if(obj!=undefined) { currentFades[fadeList[fade][0]] = Number(currentFades[fadeList[fade][0]]); if(currentFades[fadeList[fade][0]]>0) obj.style.visibility = "visible"; else obj.style.visibility = "hidden"; if(fadeList[fade][0]!=undefined && currentFades[fadeList[fade][0]]!=undefined) { obj.style.filter = 'alpha(opacity='+currentFades[fadeList[fade][0]]+')'; obj.style.opacity = currentFades[fadeList[fade][0]]/100; } } if(currentFades[fadeList[fade][0]] == fadeList[fade][2]) { fadeList[fade][3] = 0; delete(fadeList[fade]); } } } if(arrayCount(fadeList)==0) unregisterDaemon("fadeDaemon()"); } function unregisterDaemon(functionName) { delete(daemon_functionNames[functionName]); } function registerDaemon(functionName) { daemon_functionNames[functionName] = functionName; if(daemon_nowTime ==false || microtime() > daemon_nowTime +10) { //daemon_lastTime = microtime(); loopDaemons(); } } var daemon_functionNames= Array(); var cycleTime = false; var daemon_lastTime = false; var daemon_nowTime = false; function loopDaemons() { daemon_nowTime = microtime(); if(daemon_lastTime !=false) { cycleTime = daemon_nowTime - daemon_lastTime; } daemon_lastTime = daemon_nowTime; if(cycleTime!=false) { for(var name in daemon_functionNames) { if(name!='indexOf') setTimeout(name,0); } } if(arrayCount(daemon_functionNames)>0) { setTimeout("loopDaemons()",20); }else{ daemon_lastTime = false; daemon_nowTime = false; cycleTime = false; } } function scrollOpen(id,startZ,endZ,startTime,totalTime,id2) { div = top.document.getElementById(id); if(div!=null) { if(startZ===false) { startZ = parseInt(div.style.width); } //startTime + totalTime - microtime(); perc = (microtime() - startTime)/totalTime; if(perc > 1) perc = 1; newWidth = (endZ -startZ) * perc + startZ; if((newWidth > endZ && startZ < endZ) || (newWidth < endZ && startZ > endZ)) newWidth = endZ; div.style.width = newWidth+"px"; div.style.left=((getWinWidth()-newWidth)/2)+"px"; if(newWidth!=endZ) setTimeout("scrollOpen('"+id+"',"+startZ+","+endZ+","+startTime+","+totalTime+",'"+id2+"')",10); if(newWidth==endZ && endZ==0) { top.document.body.removeChild(div); } interior = top.document.getElementById(id2); if(interior!=null) { if(endZ>startZ) interior.style.left = ((newWidth/2) - (endZ/2)) +"px"; else interior.style.left = ((newWidth/2) - (startZ/2)) +"px"; } } } function getWinWidth() { if (top.window.innerWidth) { theWidth=top.window.innerWidth; } else if (top.document.documentElement && top.document.documentElement.clientWidth) { theWidth=top.document.documentElement.clientWidth; } else if (top.document.body) { theWidth=top.document.body.clientWidth; } return theWidth; } function getWinHeight() { if (top.window.innerHeight) { theHeight=top.window.innerHeight; } else if (top.document.documentElement && top.document.documentElement.clientHeight) { theHeight=top.document.documentElement.clientHeight; } else if (top.document.body) { theHeight=top.document.body.clientHeight; } return theHeight; } function microtime() { var now = new Date().getTime()/1000; return now; } function isArray(obj) { if (obj.constructor.toString().indexOf("Array") == -1) return false; else return true; } function popQuery(question,url) { var answer = confirm(question); if (answer) { window.location=url; }else{ } } function uniqid() { var newDate = new Date; return newDate.getTime(); } function in_array (needle, haystack, argStrict) { // Checks if the given value exists in the array // // version: 911.718 // discuss at: http://phpjs.org/functions/in_array // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + improved by: vlado houba // + input by: Billy // + bugfixed by: Brett Zamir (http://brett-zamir.me) // * example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']); // * returns 1: true // * example 2: in_array('vlado', {0: 'Kevin', vlado: 'van', 1: 'Zonneveld'}); // * returns 2: false // * example 3: in_array(1, ['1', '2', '3']); // * returns 3: true // * example 3: in_array(1, ['1', '2', '3'], false); // * returns 3: true // * example 4: in_array(1, ['1', '2', '3'], true); // * returns 4: false var key = '', strict = !!argStrict; if (strict) { for (key in haystack) { if (haystack[key] === needle) { return true; } } } else { for (key in haystack) { if (haystack[key] == needle) { return true; } } } return false; } function arrayCount(array) { var i=0; for ( var ar in array ) { i++; } return i; } function fontSmoothResize (objID,width,height) { if (objID && width && height) { setSWFDimensions(objID+'f',width,height); //alert(width+" "+height); if(width>2 && height>2) { var html = document.getElementById(objID+"h"); var parent = document.getElementById(objID); parent.removeChild(html); } } } function setSWFDimensions (objID,width,height) { if (objID && width && height) { var parent = document.getElementById(objID); var hObj = document.getElementById(objID+'h'); if (hObj) { hObj.setAttribute('visibility','hidden'); hObj.setAttribute('width',0); hObj.setAttribute('height',0); hObj.style.visibility = 'hidden'; hObj.style.width = 0; hObj.style.height = 0; parent.removeChild(hObj); } var fObj = document.getElementById(objID+'f'); var fEmb = document.getElementById(objID+'f'+'-embed'); if (fObj && fObj.style) { fObj.setAttribute('width',width); fObj.setAttribute('height',height); fObj.style.width = width; fObj.style.height = height; } if (fEmb != null) { fEmb.width = width; fEmb.height = height; if (fEmb.style) { fEmb.style.width = width; fEmb.style.height = height; } } } } var slidesArray0 = new Array(); var slidesArray1 = new Array(); var slidesArray2 = new Array(); var slidesArray3 = new Array(); var slidesArray4 = new Array(); var slideStartH = new Array(); var slideStartW = new Array(); var slideIsOpenArray = new Array(); // MDD-NEW var onSlideOpenBeginFn = new Array(); // MDD-NEW var onSlideOpenEndFn = new Array(); // MDD-NEW var onSlideCloseBeginFn = new Array(); // MDD-NEW var onSlideCloseEndFn = new Array(); // MDD-NEW var onSlideFn = new Array(); // MDD-NEW var txtFocus = false; function registerTextFields() { var inputs = document.getElementsByTagName('input'); for(var i = 0; i < inputs.length; i++) { var elem = inputs[i]; if(elem.type == 'text' || elem.type == 'password' || elem.type == 'textarea') { elem.onfocus = function() { txtFocus = true; } elem.onblur = function() { txtFocus = false; } } } } function slideIsOpen(name) { return slideIsOpenArray[name]; } function onSlideOpenBegin(name,fn) { if('undefined'!==typeof(fn)) onSlideOpenBeginFn[name]=fn; } function onSlideOpenEnd(name,fn) { if('undefined'!==typeof(fn)) onSlideOpenEndFn[name]=fn; } function onSlideCloseBegin(name,fn) { if('undefined'!==typeof(fn)) onSlideCloseBeginFn[name]=fn; } function onSlideCloseEnd(name,fn) { if('undefined'!==typeof(fn)) onSlideCloseEndFn[name]=fn; } function onSlide(name,fn) { if('undefined'!==typeof(fn)) onSlideFn[name]=fn; } function alertAll(name) { mdd(onSlideOpenBeginFn[name]+' '+onSlideOpenEndFn[name]+' '+onSlideCloseBeginFn[name]+' '+onSlideCloseEndFn[name]); } function slideOpen(name,align) { slidesArray0[name] = name; slidesArray1[name] = 1; slidesArray2[name] = align; slidesArray3[name] = 6; slidesArray4[name] = 1; slideIsOpenArray[name] = true; if(onSlideOpenBeginFn[name]) onSlideOpenBeginFn[name](); //MDD-NEW registerDaemon("slideDaemon()"); } function slideCloseDelay(name,align,delay) { slidesArray4[name] = 0; setTimeout('slideCloseDelay2("'+name+'","'+align+'")',delay); } function slideCloseDelay2(name,align) { if(!txtFocus && slidesArray4[name] == 0){ slidesArray0[name] = name; slidesArray1[name] = 0; slidesArray2[name] = align; slidesArray3[name] = 6; registerDaemon("slideDaemon()"); } } function slideClose(name,align) { if(!txtFocus){ slidesArray0[name] = name; slidesArray1[name] = 0; slidesArray2[name] = align; slidesArray3[name] = 6; if(onSlideCloseBeginFn[name]) onSlideCloseBeginFn[name](); // MDD-NEW registerDaemon("slideDaemon()"); } } function slideAlternate(name,align) { if(slidesArray1[name]) slideClose(name,align); else slideOpen(name,align); } function slideDaemon() { //console.log(cycleTime); for(var slide in slidesArray0) { var speed = slidesArray3[slide]; //var minH = 0; var outer = document.getElementById(slide+"Outer"); if(outer!=null) { var inner = document.getElementById(slide+"Inner"); if(slideStartH[slide] == null) slideStartH[slide] = parseInt(outer.offsetHeight); var minH = slideStartH[slide]; if(slideStartW[slide] == null) slideStartW[slide] = parseInt(outer.offsetWidth); var minW = slideStartW[slide]; var currentH = parseInt(outer.offsetHeight); var diffX=0, diffY = 0; maxH = parseInt(inner.offsetHeight); if(slidesArray1[slide]) { var change = ((maxH - currentH)) * (cycleTime*speed); if(change<1) change = 1; var newH = currentH+change; if(newH >maxH) { newH = maxH; } else diffY = change; }else{ var change = ((currentH - minH)) * (cycleTime*speed); if(change<1) change = 1; var newH = currentH-change; if(newH maxW) { newW = maxW; } else diffX = change; }else{ var change = ((currentW - minW)) * (cycleTime*speed); if(change<1) change = 1; var newW = currentW-change; if(newW 0 || diffY>0) && newH==maxH && newW==maxW) { if(onSlideOpenEndFn[slide]) onSlideOpenEndFn[slide](); } // --MDD-NEW] } } /*if(slidesArray0.length==0) { unregisterDaemon("slideDaemon()"); }*/ } var TCA_transitions = new Array(); function TCA_transition(opts) { if(opts['speed'] == undefined || opts['speed'] <=0 ) opts['speed'] = 8; TCA_transitions[opts['obj']+opts['attr']] = opts; registerDaemon("TCA_transition_daemon()"); } function TCA_transition_daemon() { for (var trans in TCA_transitions ) { if(TCA_transitions[trans]['obj']!=undefined) var obj = document.getElementById(TCA_transitions[trans]['obj']); else var obj = TCA_transitions[trans]['rawobj']; if(obj!=undefined) { switch(TCA_transitions[trans]['attr']) { case 'opacity': var currentVal = Number(parseFloat(obj.style['opacity'])*100); break; default: var currentVal = Number(parseInt(obj.style[TCA_transitions[trans]['attr']])); break; } if(isNaN(currentVal)) currentVal = 0; var goalVal = TCA_transitions[trans]['goal']; var change = TCA_transitions[trans]['speed'] * cycleTime*(goalVal-currentVal); if(change>0 && change<1) change = 1; if(change<0 && change>-1) change = -1; var newVal = currentVal + change; if(newVal < goalVal+1 && newVal > goalVal-1) newVal = goalVal; if((change>0 && newVal > goalVal) || (change<0 && newVal < goalVal)) newVal = goalVal; switch(TCA_transitions[trans]['attr']) { case 'opacity': obj.style.filter = 'alpha(opacity='+newVal+')'; obj.style.opacity = newVal/100; if(newVal>0) obj.style.visibility = "visible"; else obj.style.visibility = "hidden"; break; default: obj.style[TCA_transitions[trans]['attr']]=newVal+"px"; break; } if(newVal == goalVal) { if(typeof TCA_transitions[trans]['callback'] == 'function') { TCA_transitions[trans]['callback'](); } delete(TCA_transitions[trans]); } }else{ delete(TCA_transitions[trans]); } } if(arrayCount(TCA_transitions)==0) unregisterDaemon("TCA_transition_daemon()"); } function makeHttpRequest(url, callback_function, return_xml) { var http_request, response, i; var activex_ids = [ 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP' ]; if (window.XMLHttpRequest) { // Mozilla, Safari, IE7+... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { // IE6 and older for (i = 0; i < activex_ids.length; i++) { try { http_request = new ActiveXObject(activex_ids[i]); } catch (e) {} } } if (!http_request) { alert('Unfortunately your browser does not support this feature.'); return false; } http_request.onreadystatechange = function() { if (http_request.readyState !== 4) { // not ready yet return; } if (http_request.status !== 200) { // ready, but not OK // alert('There was a problem with the request.(Code: ' + http_request.status + ')'); return; } if (return_xml) { response = http_request.responseXML; } else { response = http_request.responseText; } // invoke the callback if(typeof callback_function == 'function') { callback_function(response); } }; http_request.open('GET', url, true); http_request.send(null); } function userData_signin(email,password) { makeHttpRequest("plugins/userData/signin.php?email="+email+"&password="+password,userData_signinResponse); } function userData_signinResponse(resp) { if(resp==1) { window.location = window.location; }else{ alert("incorrect email or password"); } } function userData_signout() { makeHttpRequest("plugins/userData/signout.php",userData_signoutResponse); } function userData_signoutResponse(resp) { window.location = window.location; } function getRadio(radio) { for (i=0;i=cartPlace) { slideOpen('cartItm'+i,'n'); } else slideClose('cartItm'+i,'n'); } moveCart(0); } function moveCartToEnd() { maxCartItems = document.getElementById("cartCount").innerHTML; cartPlace = maxCartItems; for(var i=1;i<=maxCartItems;i++) { if(i>=cartPlace) { slideOpen('cartItm'+i,'n'); } else slideClose('cartItm'+i,'n'); } moveCart(0); } function moveCart(dir) { maxCartItems = parseInt(document.getElementById("cartCount").innerHTML); cartPlace = parseInt(cartPlace); dir = parseInt(dir); if(dir!=0) { if(cartPlace+dir>0 && cartPlace+dir<=maxCartItems) { cartPlace+=dir; for(var i=1;i<=maxCartItems;i++) { if(i>=cartPlace) { slideOpen('cartItm'+i,'n'); } else slideClose('cartItm'+i,'n'); } } } if(cartPlace<=1) { fade("cartLeft",100,0); }else{ fade("cartLeft",100,100); } if(cartPlace>=maxCartItems) { fade("cartRight",100,0); }else{ fade("cartRight",100,100); } } function writeCart(data) { var cart=null; if(data!='') { cart = xmlStr2array(data); var returnData = ""; var k=0, j=0; if(cart && cart["contents"]) { for(var i in cart["contents"]) { k++; } for(var i in cart["contents"]) { j++; var t= cart["contents"][i]["data"]; if(!t) continue; height = 0; if(j==k) height="120"; returnData +="
"+cart["contents"][i]["data"]["desc"]+"
#"+cart["contents"][i]["UID"]+"

"; //alert(dump(cart[i])); // slideStartH["cartItm"+j] = 0; } } if(k==0) { returnData='




Cart empty.
'; } maxCartItems = j; cartPlace = j; //moveCart(0); total = cart['contents']['total']; returnData += '
'; document.getElementById("cartInnerContents").innerHTML = returnData; $('#cart-count').html( total + ' Items' ); if(cartPlace<=1) { fade("cartLeft",100,0); }else{ fade("cartLeft",100,100); } if(cartPlace>=maxCartItems) { fade("cartRight",100,0); }else{ fade("cartRight",100,100); } } return cart; } function writeWish(data) { var cart=null; if(data!='') { cart = xmlStr2array(data); var returnData = ""; var k=0, j=0; if(cart) { for(var i in cart["contents"]) { k++; } for(var i in cart["contents"]) { j++; height = 0; if(j==k) height="120"; returnData +="
"+cart["contents"][i]["data"]["desc"]+"
#"+cart["contents"][i]["UID"]+"
"; //alert(dump(cart[i])); // slideStartH["cartItm"+j] = 0; } } if(k==0) { returnData='




Cart empty.
'; } maxCartItems = j; cartPlace = j; //moveCart(0); document.getElementById("cartInnerContents").innerHTML = returnData; if(cartPlace<=1) { fade("cartLeft",100,0); }else{ fade("cartLeft",100,100); } if(cartPlace>=maxCartItems) { fade("cartRight",100,0); }else{ fade("cartRight",100,100); } } return cart; } function lightBox(interiorPage, width, height, useBorder){ useBorder = typeof(useBorder) != 'undefined' ? useBorder : true; // var width=600; // var height=500; var barHeight=20; var border=0; //fade if(!top.document.getElementById("floatBox_background")) { var newdiv = document.createElement('div'); var divIdName = 'floatBox_background'; newdiv.setAttribute('id',divIdName); newdiv.setAttribute('class','floatBox_background'); newdiv.style.backgroundColor = "#000000"; newdiv.style.width=getWinWidth()+"px"; newdiv.style.height=getWinHeight()+"px"; newdiv.style.position="absolute"; newdiv.style.left="0px"; newdiv.style.top="0px"; newdiv.style.filter = 'alpha(opacity=0)'; newdiv.style.opacity = '.0'; newdiv.innerHTML = ''; newdiv.style.zIndex = 222; addEvent(newdiv, "click", closeFloatBox) ; // addEvent(window, "scroll", closeFloatBox) ; addEvent(window, "resize", closeFloatBox) ; top.document.body.appendChild(newdiv); fadeIn(divIdName,0,75,microtime(),2); } uid = uniqid(); var newdiv = top.document.createElement('div'); top.floatBoxWindows.push(newdiv); var divIdName = 'floatBox_foreground'+top.floatBoxWindows.length; newdiv.setAttribute('id',divIdName); newdiv.setAttribute('class','floatBox_foreground'); newdiv.style.backgroundColor = "#FFFFFF"; newdiv.style.width="0px"; newdiv.style.height=(height+barHeight)+"px"; newdiv.style.position="absolute"; newdiv.style.overflow="hidden"; if(useBorder) newdiv.style.border="solid 16px #edf4f8";/*#e6f8e8";*/ /*edf4f8";*/ else newdiv.style.border="0px"; newdiv.style.left=((getWinWidth())/2)+"px"; newdiv.style.top=((getWinHeight()-(height+barHeight))/2-border)+"px"; newdiv.style.filter = 'alpha(opacity=0)'; newdiv.style.opacity = '.0'; newdiv.style.zIndex = 222; newdiv.innerHTML = ''; top.document.body.appendChild(newdiv); var floatBox_content = top.document.createElement('div'); var floatBox_contentName = 'floatBox_content'+top.floatBoxWindows.length; floatBox_content.setAttribute('id',floatBox_contentName); floatBox_content.setAttribute('class','floatBox_content'); floatBox_content.style.backgroundColor = "#FFFFFF"; floatBox_content.style.width=width+"px"; floatBox_content.style.height=(height+barHeight)+"px"; floatBox_content.style.position="relative"; floatBox_content.style.overflow="hidden"; // floatBox_content.style.left="100px"; floatBox_content.style.top="0px"; newdiv.style.zIndex = 222; // loadPageIntoDiv("plugins/postData/popImage.php",floatBox_contentName); floatBox_content.innerHTML = '
'; newdiv.appendChild(floatBox_content); var ifrm = top.document.getElementById("floatBox_contentFrm"+top.floatBoxWindows.length); if(ifrm!=null) { addEvent(ifrm, "load", showiframe) ; } fadeIn(divIdName,0,100,microtime(),.5); scrollOpen(divIdName,0,width,microtime(),.5,floatBox_contentName); } function MT_lightBox(interiorPage) { var width=600; var height=500; var barHeight=20; var border=0; lightBox(interiorPage, width, height); } function openWishList() { lightBox('wishbox.php',300,600); } /* Product */ function prSelect(id) { if(id=="details") var unId = "reviews"; else var unId = "details"; var sel = document.getElementById(unId+"Tab"); sel.className = "prTab2"; var sel = document.getElementById(id+"Tab"); sel.className = "prTab1"; var sel = document.getElementById(unId); sel.className = "hidden"; var sel = document.getElementById(id); sel.className = "prCopy"; } function init() { pic= new Image(100,100); pic.src="/images/myCart_over.png"; } function validateForm(form) { errorMsg = []; errorMsg[0] = "Please fill out the highlighted field(s) and try again"; errorMsg[1] = "You have entered too many characters in the highlighted field"; errors = []; for(i in errorMsg) errors.push(0); // if(typeof(MAXCHAR)==='undefined' || MAXCHAR===null) // alert('function validateForm() requires MAXCHAR to be set.'); if(typeof(form)==='string') form = $('#'+form); var inputs = form.find('.req'); var limited = form.find('.limit'); var errordiv = form.find('div.error'); var totalErrors = 0; if(totalErrors===0) { inputs.each( function(i, el) { if(el.value.length < 1 || el.value == el.initValue) { $(el).addClass('error'); totalErrors++; errors[0]++; } else { $(el).removeClass('error'); } }); } if(totalErrors===0) { limited.each( function(i, el) { if(el.value.length > el.charLimit) { $(el).addClass('error'); totalErrors++; errors[1]++; } else { $(el).removeClass('error'); } }); } if(totalErrors===0) { errordiv.fadeOut(); errordiv.html(''); return true; } else { var m="Something's wrong, please try again."; if(errors[0]) { field = 'fields'; if(errors[0]==1) field = 'field'; m = 'Please fill out the highlighted '+field+' and try again.'; } else if(errors[1]) { field = 'fields'; if(errors[1]==1) field = 'field'; m = "You have entered too many characters in this field"; } errordiv.html(m); errordiv.fadeIn(); return false; } } function registerDefault(obj,str) { obj.each ( function(i, el) { el.initValue = str; $(el).focus( function() { if(el.value==el.initValue) { el.value=''; $(el).removeClass('grayed'); } }); $(el).blur( function() { if(el.value=='') { el.value=el.initValue; $(el).addClass('grayed'); } }); if(el.value=='') el.value=el.initValue; if(el.value==el.initValue) $(el).addClass('grayed'); }); } function split_filename(name) { var ix = name.lastIndexOf('.'); var len = name.length; return [name.substr(0,ix), name.substr(ix+1,len-ix-1)]; } var MAXCHAR = null; function init_character_limit(inputclassstr, noticeclassstr, num) { MAXCHAR = num; inputs = $(inputclassstr); inputs.each( function(i,field) { var notice = $(field).parent().find(noticeclassstr).eq(0); notice.html(num + ' character limit'); fn = function() { var len; field.dirty = true; if((len = field.value.length) < MAXCHAR) { notice.html('characters remaining: ' + (MAXCHAR-len)); } else { notice.html('character limit exceeded!'); field.value = field.value.substring(0,num); } } $(field).keyup( fn ); $(field).keydown( fn ); $(field).focus( function() { notice.fadeIn(); }); $(field).blur( function() { if(this.value.length==0 || this.value==this.initValue) notice.hide(); }); field.charLimit = num; }); } function init_img_hover() { $('img.over').each( function() { this.original = this.src; }); $('img.over').hover( function(e) { pieces = split_filename(this.original); this.src = pieces[0] + '-OVER.' + pieces[1]; }, function(e) { this.src = this.original; } ); } function init_expander_arrows() { $('img.expander').each( function() { this.expanded = false;}); $('img.expander').click( function() { if(this.expanded) { this.original = "/images/arrow-right.png"; this.src = "/images/arrow-right-OVER.png"; this.expanded = false; } else { this.original = "/images/arrow-down.png" this.src = "/images/arrow-down-OVER.png"; this.expanded = true; } }); } var cartDiv, cartPosDiv, cartOffset, cartIsOpen=true; function adjust_cart_dropdown() { cartIsOpen = slideIsOpen('cart'); // alert(cartIsOpen) if(!cartIsOpen) cartDiv.css( defaultCss ); else { windowTop = $(window).scrollTop(); if(windowTop > cartOffset.top) { cartDiv.css( { position: 'fixed', top: 0, left: cartOffset.left } ); } else cartDiv.css( defaultCss ); } } // function mto(col) { $('body').css({background: col}); } function init_cart_dropdown_adjustment() { cartDiv = $('#cartWrapper'); cartPosDiv = $('#cartPosition'); cartOffset = cartPosDiv.offset(); defaultCss = { position: 'relative', top: 0, left: 0, right: 0 }; $(window).scroll( adjust_cart_dropdown ); $(window).resize( function() { cartOffset = cartPosDiv.offset(); adjust_cart_dropdown(); // alert(cartOffset.left); }); // onSlideCloseEnd('cart', adjust_cart_dropdown); onSlideOpenBegin('cart', adjust_cart_dropdown); /* onSlideOpenBegin('cart', function() { mto('cyan'); } ); onSlideOpenEnd('cart', function() { mto('magenta'); } ); onSlideCloseBegin('cart', function() { mto('yellow'); } ); onSlideCloseEnd('cart', function() { mto('black'); } ); */ } function argdefault(val, def) { if('undefined'===typeof(val)) return def; else return val; } function initGMap(id) { // var latlng = new google.maps.LatLng(-34.397, 150.644); if('undefined'===typeof(id)) id = 'map-canvas'; var opt = { zoom: 8, // center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById(id), opt); return map; } // JavaScript Document function eCom_add_to_cart(UID,callback) { var quant = ""; var wrap = ""; if(document.product.quantity!=undefined) quant = "&quantity="+document.product.quantity.value; if(document.product.giftWrap!=undefined) wrap = "&wrap="+document.product.giftWrap.value; makeHttpRequest("/plugins/eCom/add_to_cart.php?UID="+UID+quant+wrap,callback); } function eCom_add_to_wish(UID,callback) { makeHttpRequest("/plugins/eCom/add_to_wish.php?UID="+UID,callback); } function ecom_remove_from_cart(UID,callback) { makeHttpRequest("/plugins/eCom/remove_from_cart.php?UID="+UID,callback); }