/** * jQuery.ScrollTo * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * Date: 2/19/2008 * * @projectDescription Easy element scrolling using jQuery. * Tested with jQuery 1.2.1. On FF 2.0.0.11, IE 6, Opera 9.22 and Safari 3 beta. on Windows. * * @author Ariel Flesler * @version 1.3.3 * * @id jQuery.scrollTo * @id jQuery.fn.scrollTo * @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements. * The different options for target are: * - A number position (will be applied to all axes). * - A string position ('44', '100px', '+=90', etc ) will be applied to all axes * - A jQuery/DOM element ( logically, child of the element to scroll ) * - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc ) * - A hash { top:x, left:y }, x and y can be any kind of number/string like above. * @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead. * @param {Object} settings Hash of settings, optional. * @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'. * @option {Number} duration The OVERALL length of the animation. * @option {String} easing The easing method for the animation. * @option {Boolean} margin If true, the margin of the target element will be deducted from the final position. * @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }. * @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes. * @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends. * @option {Function} onAfter Function to be called after the scrolling ends. * @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends. * @return {jQuery} Returns the same jQuery object, for chaining. * * @example $('div').scrollTo( 340 ); * * @example $('div').scrollTo( '+=340px', { axis:'y' } ); * * @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } ); * * @example var second_child = document.getElementById('container').firstChild.nextSibling; * $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){ * alert('scrolled!!'); * }}); * * @example $('div').scrollTo( { top: 300, left:'+=200' }, { offset:-20 } ); * * Notes: * - jQuery.scrollTo will make the whole window scroll, it accepts the same arguments as jQuery.fn.scrollTo. * - If you are interested in animated anchor navigation, check http://jquery.com/plugins/project/LocalScroll. * - The options margin, offset and over are ignored, if the target is not a jQuery object or a DOM element. * - The option 'queue' won't be taken into account, if only 1 axis is given. */ ;(function( $ ){ var $scrollTo = $.scrollTo = function( target, duration, settings ){ $scrollTo.window().scrollTo( target, duration, settings ); }; $scrollTo.defaults = { axis:'y', duration:1 }; //returns the element that needs to be animated to scroll the window $scrollTo.window = function(){ return $( $.browser.safari ? 'body' : 'html' ); }; $.fn.scrollTo = function( target, duration, settings ){ if( typeof duration == 'object' ){ settings = duration; duration = 0; } settings = $.extend( {}, $scrollTo.defaults, settings ); duration = duration || settings.speed || settings.duration;//speed is still recognized for backwards compatibility settings.queue = settings.queue && settings.axis.length > 1;//make sure the settings are given right if( settings.queue ) duration /= 2;//let's keep the overall speed, the same. settings.offset = both( settings.offset ); settings.over = both( settings.over ); return this.each(function(){ var elem = this, $elem = $(elem), t = target, toff, attr = {}, win = $elem.is('html,body'); switch( typeof t ){ case 'number'://will pass the regex case 'string': if( /^([+-]=)?\d+(px)?$/.test(t) ){ t = both( t ); break;//we are done } t = $(t,this);// relative selector, no break! case 'object': if( t.is || t.style )//DOM/jQuery toff = (t = $(t)).offset();//get the real position of the target } $.each( settings.axis.split(''), function( i, axis ){ var Pos = axis == 'x' ? 'Left' : 'Top', pos = Pos.toLowerCase(), key = 'scroll' + Pos, act = elem[key], Dim = axis == 'x' ? 'Width' : 'Height', dim = Dim.toLowerCase(); if( toff ){//jQuery/DOM attr[key] = toff[pos] + ( win ? 0 : act - $elem.offset()[pos] ); if( settings.margin ){//if it's a dom element, reduce the margin attr[key] -= parseInt(t.css('margin'+Pos)) || 0; attr[key] -= parseInt(t.css('border'+Pos+'Width')) || 0; } attr[key] += settings.offset[pos] || 0;//add/deduct the offset if( settings.over[pos] )//scroll to a fraction of its width/height attr[key] += t[dim]() * settings.over[pos]; }else attr[key] = t[pos];//remove the unnecesary 'px' if( /^\d+$/.test(attr[key]) )//number or 'number' attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max(Dim) );//check the limits if( !i && settings.queue ){//queueing each axis is required if( act != attr[key] )//don't waste time animating, if there's no need. animate( settings.onAfterFirst );//intermediate animation delete attr[key];//don't animate this axis again in the next iteration. } }); animate( settings.onAfter ); function animate( callback ){ $elem.animate( attr, duration, settings.easing, callback && function(){ callback.call(this, target); }); }; function max( Dim ){ var el = win ? $.browser.opera ? document.body : document.documentElement : elem; return el['scroll'+Dim] - el['client'+Dim]; }; }); }; function both( val ){ return typeof val == 'object' ? val : { top:val, left:val }; }; })( jQuery );/** * jQuery.LocalScroll * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com * Dual licensed under MIT and GPL. * Date: 3/10/2008 * * @projectDescription Animated scrolling navigation, using anchors. * http://flesler.blogspot.com/2007/10/jquerylocalscroll-10.html * @author Ariel Flesler * @version 1.2.5 * * @id jQuery.fn.localScroll * @param {Object} settings Hash of settings, it is passed in to jQuery.ScrollTo, none is required. * @return {jQuery} Returns the same jQuery object, for chaining. * * @example $('ul.links').localScroll(); * * @example $('ul.links').localScroll({ filter:'.animated', duration:400, axis:'x' }); * * @example $.localScroll({ target:'#pane', axis:'xy', queue:true, event:'mouseover' }); * * Notes: * - The plugin requires jQuery.ScrollTo. * - The hash of settings, is passed to jQuery.ScrollTo, so the settings are valid for that plugin as well. * - jQuery.localScroll can be used if the desired links, are all over the document, it accepts the same settings. * - If the setting 'lazy' is set to true, then the binding will still work for later added anchors. * - The setting 'speed' is deprecated, use 'duration' instead. * - If onBefore returns false, the event is ignored. **/ ;(function( $ ){ var URI = location.href.replace(/#.*/,'');//local url without hash var $localScroll = $.localScroll = function( settings ){ $('body').localScroll( settings ); }; //Many of these defaults, belong to jQuery.ScrollTo, check it's demo for an example of each option. //@see http://www.freewebs.com/flesler/jQuery.ScrollTo/ $localScroll.defaults = {//the defaults are public and can be overriden. duration:1000, //how long to animate. axis:'y',//which of top and left should be modified. event:'click',//on which event to react. stop:true//avoid queuing animations /* lock:false,//ignore events if already animating lazy:false,//if true, links can be added later, and will still work. target:null, //what to scroll (selector or element). Keep it null if want to scroll the whole window. filter:null, //filter some anchors out of the matched elements. hash: false//if true, the hash of the selected link, will appear on the address bar. */ }; //if the URL contains a hash, it will scroll to the pointed element $localScroll.hash = function( settings ){ settings = $.extend( {}, $localScroll.defaults, settings ); settings.hash = false;//can't be true if( location.hash ) setTimeout(function(){ scroll( 0, location, settings ); }, 0 );//better wrapped with a setTimeout }; $.fn.localScroll = function( settings ){ settings = $.extend( {}, $localScroll.defaults, settings ); return ( settings.persistent || settings.lazy ) ? this.bind( settings.event, function( e ){//use event delegation, more links can be added later. var a = $([e.target, e.target.parentNode]).filter(filter)[0];//if a valid link was clicked. a && scroll( e, a, settings );//do scroll. }) : this.find('a')//bind concretely, to each matching link .filter( filter ).bind( settings.event, function(e){ scroll( e, this, settings ); }).end() .end(); function filter(){//is this a link that points to an anchor and passes a possible filter ? href is checked to avoid a bug in FF. return !!this.href && !!this.hash && this.href.replace(this.hash,'') == URI && (!settings.filter || $(this).is( settings.filter )); }; }; function scroll( e, link, settings ){ var id = link.hash.slice(1), elem = document.getElementById(id) || document.getElementsByName(id)[0]; if ( elem ){ e && e.preventDefault(); var $target = $( settings.target || $.scrollTo.window() );//if none specified, then the window. if( settings.lock && $target.is(':animated') || settings.onBefore && settings.onBefore.call(link, e, elem, $target) === false ) return; if( settings.stop ) $target.queue('fx',[]).stop();//remove all its animations $target .scrollTo( elem, settings )//do scroll .trigger('notify.serialScroll',[elem]);//notify serialScroll about this change if( settings.hash ) $target.queue(function(){ location = link.hash; }); } }; })( jQuery );/** * jQuery.serialScroll * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com * Dual licensed under MIT and GPL. * Date: 3/20/2008 * * @projectDescription Animated scrolling of series. * @author Ariel Flesler * @version 1.2.1 * * @id jQuery.serialScroll * @id jQuery.fn.serialScroll * @param {Object} settings Hash of settings, it is passed in to jQuery.ScrollTo, none is required. * @return {jQuery} Returns the same jQuery object, for chaining. * * http://flesler.blogspot.com/2008/02/jqueryserialscroll.html * * Notes: * - The plugin requires jQuery.ScrollTo. * - The hash of settings, is passed to jQuery.ScrollTo, so its settings can be used as well. */ ;(function( $ ){ var $serialScroll = $.serialScroll = function( settings ){ $.scrollTo.window().serialScroll( settings ); }; //Many of these defaults, belong to jQuery.ScrollTo, check it's demo for an example of each option. //@see http://flesler.webs/jQuery.ScrollTo/ $serialScroll.defaults = {//the defaults are public and can be overriden. duration:1000, //how long to animate. axis:'x', //which of top and left should be scrolled event:'click', //on which event to react. start:0, //first element (zero-based index) step:1, //how many elements to scroll on each action lock:true,//ignore events if already animating cycle:true, //cycle endlessly ( constant velocity ) constant:true //use contant speed ? /* navigation:null,//if specified, it's a selector a collection of items to navigate the container target:null, //if specified, it's a selector to the element to be scrolled. interval:0, //it's the number of milliseconds to automatically go to the next lazy:false,//go find the elements each time (allows AJAX or JS content, or reordering) stop:false, //stop any previous animations to avoid queueing force:false,//force the scroll to the first element on start ? jump: false,//if true, when the event is triggered on an element, the pane scrolls to it items:null, //selector to the items (relative to the matched elements) prev:null, //selector to the 'prev' button next:null, //selector to the 'next' button onBefore: function(){}, //function called before scrolling, if it returns false, the event is ignored exclude:0 //exclude the last x elements, so we cannot scroll past the end */ }; $.fn.serialScroll = function( settings ){ settings = $.extend( {}, $serialScroll.defaults, settings ); var event = settings.event, //this one is just to get shorter code when compressed step = settings.step, // idem lazy = settings.lazy;//idem return this.each(function(){ var context = settings.target ? this : document, //if a target is specified, then everything's relative to 'this'. $pane = $(settings.target || this, context),//the element to be scrolled (will carry all the events) pane = $pane[0], //will be reused, save it into a variable items = settings.items, //will hold a lazy list of elements active = settings.start, //active index auto = settings.interval, //boolean, do auto or not nav = settings.navigation, //save it now to make the code shorter timer; //holds the interval id if( !lazy )//if not lazy, go get the items now items = getItems(); if( settings.force ) jump( {}, active );//generate an initial call // Button binding, optionall $(settings.prev||[], context).bind( event, -step, move ); $(settings.next||[], context).bind( event, step, move ); // Custom events bound to the container if( !pane.ssbound )//don't bind more than once $pane .bind('prev.serialScroll', -step, move ) //you can trigger with just 'prev' .bind('next.serialScroll', step, move ) //for example: $(container).trigger('next'); .bind('goto.serialScroll', jump ); //for example: $(container).trigger('goto', [4] ); if( auto ) $pane .bind('start.serialScroll', function(e){ if( !auto ){ clear(); auto = true; next(); } }) .bind('stop.serialScroll', function(){//stop a current animation clear(); auto = false; }); $pane.bind('notify.serialScroll', function(e, elem){//let serialScroll know that the index changed externally var i = index(elem); if( i > -1 ) active = i; }); pane.ssbound = true;//avoid many bindings if( settings.jump )//can't use jump if using lazy items and a non-bubbling event (lazy ? $pane : getItems()).bind( event, function( e ){ jump( e, index(e.target) ); }); if( nav ) nav = $(nav, context).bind(event, function( e ){ e.data = Math.round(getItems().length / nav.length) * nav.index(this); jump( e, this ); }); function move( e ){ e.data += active; jump( e, this ); }; function jump( e, button ){ if( !isNaN(button) ){//initial or special call from the outside $(container).trigger('goto',[index]); e.data = button; button = pane; } var pos = e.data, n, real = e.type, //is a real event triggering ? $items = settings.exclude ? getItems().slice(0,-settings.exclude) : getItems(),//handle a possible exclude limit = $items.length, elem = $items[pos], duration = settings.duration; if( real )//real event object e.preventDefault(); if( auto ){ clear();//clear any possible automatic scrolling. timer = setTimeout( next, settings.interval ); } if( !elem ){ //exceeded the limits n = pos < 0 ? 0 : limit - 1; if( active != n )//we exceeded for the first time pos = n; else if( !settings.cycle )//this is a bad case return; else pos = limit - n - 1;//invert, go to the other side elem = $items[pos]; } if( !elem || real && active == pos || //could happen, save some CPU cycles in vain settings.lock && $pane.is(':animated') || //no animations while busy real && settings.onBefore && //callback returns false ? settings.onBefore.call(button, e, elem, $pane, getItems(), pos) === false ) return; if( settings.stop ) $pane.queue('fx',[]).stop();//remove all its animations if( settings.constant ) duration = Math.abs(duration/step * (active - pos ));//keep constant velocity $pane .scrollTo( elem, duration, settings )//do scroll .trigger('notify.serialScroll',[pos]);//in case serialScroll was called on this elem more than once. }; function next(){//I'll use the namespace to avoid conflicts $pane.trigger('next.serialScroll'); }; function clear(){ clearTimeout(timer); }; function getItems(){ return $( items, pane ); }; function index( elem ){ if( !isNaN(elem) ) return elem;//number var $items = getItems(), i; while(( i = $items.index(elem)) == -1 && elem != pane )//see if it matches or one of its ancestors elem = elem.parentNode; return i; }; }); }; })( jQuery ); eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('h.i[\'1a\']=h.i[\'z\'];h.O(h.i,{y:\'D\',z:9(x,t,b,c,d){6 h.i[h.i.y](x,t,b,c,d)},17:9(x,t,b,c,d){6 c*(t/=d)*t+b},D:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},13:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},X:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},U:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},N:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},M:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},L:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},K:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},J:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},I:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},G:9(x,t,b,c,d){6-c*8.C(t/d*(8.g/2))+c+b},15:9(x,t,b,c,d){6 c*8.n(t/d*(8.g/2))+b},12:9(x,t,b,c,d){6-c/2*(8.C(8.g*t/d)-1)+b},Z:9(x,t,b,c,d){6(t==0)?b:c*8.j(2,10*(t/d-1))+b},Y:9(x,t,b,c,d){6(t==d)?b+c:c*(-8.j(2,-10*t/d)+1)+b},W:9(x,t,b,c,d){e(t==0)6 b;e(t==d)6 b+c;e((t/=d/2)<1)6 c/2*8.j(2,10*(t-1))+b;6 c/2*(-8.j(2,-10*--t)+2)+b},V:9(x,t,b,c,d){6-c*(8.o(1-(t/=d)*t)-1)+b},S:9(x,t,b,c,d){6 c*8.o(1-(t=t/d-1)*t)+b},Q:9(x,t,b,c,d){e((t/=d/2)<1)6-c/2*(8.o(1-t*t)-1)+b;6 c/2*(8.o(1-(t-=2)*t)+1)+b},P:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6-(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b},H:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6 a*8.j(2,-10*t)*8.n((t*d-s)*(2*8.g)/p)+c+b},T:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);e(t<1)6-.5*(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b;6 a*8.j(2,-10*(t-=1))*8.n((t*d-s)*(2*8.g)/p)*.5+c+b},F:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},E:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},16:9(x,t,b,c,d,s){e(s==u)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.B))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.B))+1)*t+s)+2)+b},A:9(x,t,b,c,d){6 c-h.i.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.k)){6 c*(7.q*t*t)+b}m e(t<(2/2.k)){6 c*(7.q*(t-=(1.5/2.k))*t+.k)+b}m e(t<(2.5/2.k)){6 c*(7.q*(t-=(2.14/2.k))*t+.11)+b}m{6 c*(7.q*(t-=(2.18/2.k))*t+.19)+b}},1b:9(x,t,b,c,d){e(t div'); var $container = $('#slider .scrollContainer'); // if false, we'll float all the panels left and fix the width // of the container var horizontal = true; // float the panels left if we're going horizontal if (horizontal) { $panels.css({ 'float' : 'left', 'position' : 'relative' // IE fix to ensure overflow is hidden }); // calculate a new width for the container (so it holds all panels) $container.css('width', $panels[0].offsetWidth * $panels.length); } // collect the scroll object, at the same time apply the hidden overflow // to remove the default scrollbars that will appear var $scroll = $('#slider .scroll').css('overflow', 'hidden'); // apply our left + right buttons // $scroll // .before('') // .after(''); // handle nav selection function selectNav() { $(this) .parents('ul:first') .find('a') .removeClass('selected') .end() .end() .addClass('selected'); /* $('#featureTabsContainer .tab').corner("round top");*/ } $('#slider .navigation').find('a').click(selectNav); // ORIGINAL // go find the navigation link that has this target and select the nav function trigger(data) { var el = $('#slider .navigation').find('a[href$="' + data.id + '"]').get(0); selectNav.call(el); } // END ORIGINAL function trigger(data) { // auto height hack — needs to be first in the function// var div = "#" + data.id; var divHeight = $(div).height()+24; // add 24px to the overall height to ensure all text is displayed - the final height calc was cutting off text $(".scroll").animate ({ height: divHeight }, 500 ); // end// var el = $('#slider .slide_nav').find('a[href$="' + data.id + '"]').get(0); selectNav.call(el); window.location.hash = "_"+data.id ; } if (window.location.hash) { trigger({ id : window.location.hash.substr(2) }); } else { $('ul.navigation a:first').click(); var div = "#slideshows"; var divHeight = $(div).height()+24; // add 24px to the overall height to ensure all text is displayed - the final height calc was cutting off text $(".scroll").animate ({ height: divHeight }, 500 ); } // offset is used to move to *exactly* the right place, since I'm using // padding on my example, I need to subtract the amount of padding to // the offset. Try removing this to get a good idea of the effect var offset = parseInt((horizontal ? $container.css('paddingTop') : $container.css('paddingLeft')) || 0) * -1; var scrollOptions = { target: $scroll, // the element that has the overflow // can be a selector which will be relative to the target items: $panels, navigation: '.navigation a', // selectors are NOT relative to document, i.e. make sure they're unique prev: 'img.left', next: 'img.right', // allow the scroll effect to run both directions axis: 'xy', onAfter: trigger, // our final callback offset: offset, // duration of the sliding effect duration: 500, // easing - can be used with the easing plugin: // http://gsgd.co.uk/sandbox/jquery/easing/ easing: 'swing' }; // apply serialScroll to the slider - we chose this plugin because it // supports// the indexed next and previous scroll along with hooking // in to our navigation. $('#slider').serialScroll(scrollOptions); // now apply localScroll to hook any other arbitrary links to trigger // the effect $.localScroll(scrollOptions); // finally, if the URL has a hash, move the slider in to position, // setting the duration to 1 because I don't want it to scroll in the // very first page load. We don't always need this, but it ensures // the positioning is absolutely spot on when the pages loads. scrollOptions.duration = 1; $.localScroll.hash(scrollOptions); });/*! * jQuery corner plugin: simple corner rounding * Examples and documentation at: http://jquery.malsup.com/corner/ * version 2.00 (04-SEP-2009) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ /** * corner() takes a single string argument: $('#myDiv').corner("effect corners width") * * effect: name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). * corners: one or more of: top, bottom, tr, tl, br, or bl. * by default, all four corners are adorned. * width: width of the effect; in the case of rounded corners this is the radius. * specify this value using the px suffix such as 10px (and yes, it must be pixels). * * @author Dave Methvin (http://methvin.com/jquery/jq-corner.html) * @author Mike Alsup (http://jquery.malsup.com/corner/) */ ;(function($) { var moz = $.browser.mozilla && /gecko/i.test(navigator.userAgent); var webkit = $.browser.safari && $.browser.version >= 3; var expr = !moz && !webkit && (function() { if (! $.browser.msie) return false; var div = document.createElement('div'); try { div.style.setExpression('width','0+0'); } catch(e) { return false; } return true; })(); function sz(el, p) { return parseInt($.css(el,p))||0; }; function hex2(s) { var s = parseInt(s).toString(16); return ( s.length < 2 ) ? '0'+s : s; }; function gpc(node) { for ( ; node && node.nodeName.toLowerCase() != 'html'; node = node.parentNode ) { var v = $.css(node,'backgroundColor'); if (v == 'rgba(0, 0, 0, 0)') continue; // webkit if (v.indexOf('rgb') >= 0) { var rgb = v.match(/\d+/g); return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]); } if ( v && v != 'transparent' ) return v; } return '#ffffff'; }; function getWidth(fx, i, width) { switch(fx) { case 'round': return Math.round(width*(1-Math.cos(Math.asin(i/width)))); case 'cool': return Math.round(width*(1+Math.cos(Math.asin(i/width)))); case 'sharp': return Math.round(width*(1-Math.cos(Math.acos(i/width)))); case 'bite': return Math.round(width*(Math.cos(Math.asin((width-i-1)/width)))); case 'slide': return Math.round(width*(Math.atan2(i,width/i))); case 'jut': return Math.round(width*(Math.atan2(width,(width-i-1)))); case 'curl': return Math.round(width*(Math.atan(i))); case 'tear': return Math.round(width*(Math.cos(i))); case 'wicked': return Math.round(width*(Math.tan(i))); case 'long': return Math.round(width*(Math.sqrt(i))); case 'sculpt': return Math.round(width*(Math.log((width-i-1),width))); case 'dog': return (i&1) ? (i+1) : width; case 'dog2': return (i&2) ? (i+1) : width; case 'dog3': return (i&3) ? (i+1) : width; case 'fray': return (i%2)*width; case 'notch': return width; case 'bevel': return i+1; } }; $.fn.corner = function(o) { // in 1.3+ we can fix mistakes with the ready state if (this.length == 0) { if (!$.isReady && this.selector) { var s = this.selector, c = this.context; $(function() { $(s,c).corner(o); }); } return this; } o = (o||"").toLowerCase(); var keep = /keep/.test(o); // keep borders? var cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]); // corner color var sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]); // strip color var width = parseInt((o.match(/(\d+)px/)||[])[1]) || 10; // corner width var re = /round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/; var fx = ((o.match(re)||['round'])[0]); var edges = { T:0, B:1 }; var opts = { TL: /top|tl/.test(o), TR: /top|tr/.test(o), BL: /bottom|bl/.test(o), BR: /bottom|br/.test(o) }; if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR ) opts = { TL:1, TR:1, BL:1, BR:1 }; // support native rounding if ($.fn.corner.defaults.useNative && fx == 'round' && (moz || webkit)) { if (opts.TL) this.css(moz ? '-moz-border-radius-topleft' : '-webkit-border-top-left-radius', width + 'px'); if (opts.TR) this.css(moz ? '-moz-border-radius-topright' : '-webkit-border-top-right-radius', width + 'px'); if (opts.BL) this.css(moz ? '-moz-border-radius-bottomleft' : '-webkit-border-bottom-left-radius', width + 'px'); if (opts.BR) this.css(moz ? '-moz-border-radius-bottomright' : '-webkit-border-bottom-right-radius', width + 'px'); return this; } var strip = document.createElement('div'); strip.style.overflow = 'hidden'; strip.style.height = '1px'; strip.style.backgroundColor = sc || 'transparent'; strip.style.borderStyle = 'solid'; return this.each(function(index){ var pad = { T: parseInt($.css(this,'paddingTop'))||0, R: parseInt($.css(this,'paddingRight'))||0, B: parseInt($.css(this,'paddingBottom'))||0, L: parseInt($.css(this,'paddingLeft'))||0 }; if (typeof this.style.zoom != undefined) this.style.zoom = 1; // force 'hasLayout' in IE if (!keep) this.style.border = 'none'; strip.style.borderColor = cc || gpc(this.parentNode); var cssHeight = $.curCSS(this, 'height'); for (var j in edges) { var bot = edges[j]; // only add stips if needed if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) { strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none'); var d = document.createElement('div'); $(d).addClass('jquery-corner'); var ds = d.style; bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild); if (bot && cssHeight != 'auto') { if ($.css(this,'position') == 'static') this.style.position = 'relative'; ds.position = 'absolute'; ds.bottom = ds.left = ds.padding = ds.margin = '0'; if (expr) ds.setExpression('width', 'this.parentNode.offsetWidth'); else ds.width = '100%'; } else if (!bot && $.browser.msie) { if ($.css(this,'position') == 'static') this.style.position = 'relative'; ds.position = 'absolute'; ds.top = ds.left = ds.right = ds.padding = ds.margin = '0'; // fix ie6 problem when blocked element has a border width if (expr) { var bw = sz(this,'borderLeftWidth') + sz(this,'borderRightWidth'); ds.setExpression('width', 'this.parentNode.offsetWidth - '+bw+'+ "px"'); } else ds.width = '100%'; } else { ds.position = 'relative'; ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' : (pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px'; } for (var i=0; i < width; i++) { var w = Math.max(0,getWidth(fx,i, width)); var e = strip.cloneNode(false); e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px'; bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild); } } } }); }; $.fn.uncorner = function() { if (moz || webkit) this.css(moz ? '-moz-border-radius' : '-webkit-border-radius', 0); $('div.jquery-corner', this).remove(); return this; }; // allow external control over whether or not native rounding is used $.fn.corner.defaults = { useNative: true }; })(jQuery); (function($){ /* hoverIntent by Brian Cherne */ $.fn.hoverIntent = function(f,g) { // default configuration options var cfg = { sensitivity: 7, interval: 100, timeout: 0 }; // override configuration options with user supplied object cfg = $.extend(cfg, g ? { over: f, out: g } : f ); // instantiate variables // cX, cY = current X and Y position of mouse, updated by mousemove event // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval var cX, cY, pX, pY; // A private function for getting mouse position var track = function(ev) { cX = ev.pageX; cY = ev.pageY; }; // A private function for comparing current and previous mouse position var compare = function(ev,ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); // compare mouse positions to see if they've crossed the threshold if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) { $(ob).unbind("mousemove",track); // set hoverIntent state to true (so mouseOut can be called) ob.hoverIntent_s = 1; return cfg.over.apply(ob,[ev]); } else { // set previous coordinates for next time pX = cX; pY = cY; // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs) ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval ); } }; // A private function for delaying the mouseOut function var delay = function(ev,ob) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); ob.hoverIntent_s = 0; return cfg.out.apply(ob,[ev]); }; // A private function for handling mouse 'hovering' var handleHover = function(e) { // next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget; while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } } if ( p == this ) { return false; } // copy objects to be passed into t (required for event object to be passed in IE) var ev = jQuery.extend({},e); var ob = this; // cancel hoverIntent timer if it exists if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); } // else e.type == "onmouseover" if (e.type == "mouseover") { // set "previous" X and Y position based on initial entry point pX = ev.pageX; pY = ev.pageY; // update "current" X and Y position based on mousemove $(ob).bind("mousemove",track); // start polling interval (self-calling timeout) to compare mouse coordinates over time if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );} // else e.type == "onmouseout" } else { // unbind expensive mousemove event $(ob).unbind("mousemove",track); // if hoverIntent state is true, then call the mouseOut function after the specified delay if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );} } }; // bind the function to the two event listeners return this.mouseover(handleHover).mouseout(handleHover); }; })(jQuery);/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net) * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * * $LastChangedDate: 2007-06-19 20:25:28 -0500 (Tue, 19 Jun 2007) $ * $Rev: 2111 $ * * Version 2.1 */ (function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&parseInt($.browser.version)<=6){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='"); $("#GB_caption").html(caption); $("#GB_overlay").show(); GB_position(); if(GB_ANIMATION) /* $("#GB_window").slideDown("slow");*/ $("#GB_window").css({ height: 0, width: 0 }).animate({ height: GB_HEIGHT, width: GB_WIDTH, opacity: 1 }, 350, GB_position); else $("#GB_window").show(); } function GB_hide() { $("#GB_window,#GB_overlay").hide(); } function GB_position() { var de = document.documentElement; var h = self.innerHeight || (de && de.clientHeight) || document.body.clientHeight; var w = self.innerWidth || (de && de.clientWidth) || document.body.clientWidth; var iebody = (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body; var dsocleft = document.all? iebody.scrollLeft : pageXOffset; var dsoctop = document.all? iebody.scrollTop : pageYOffset; var height = h < GB_HEIGHT ? h - 32 : GB_HEIGHT; var top = (h - height)/2 + dsoctop; $("#GB_window, #GB_frame").css({ width: GB_WIDTH +"px", height: height +"px", left: ((w - GB_WIDTH)/2) +"px", top: top +"px" }); $("#GB_frame").css("height", height - 32 +"px"); $("#GB_overlay").css({ height: h, top: dsoctop +"px", width: w }); } // FancyZoom.js - v1.1 - http://www.fancyzoom.com // // Copyright (c) 2008 Cabel Sasser / Panic Inc // All rights reserved. // // Requires: FancyZoomHTML.js // Instructions: Include JS files in page, call setupZoom() in onLoad. That's it! // Any links to images will be updated to zoom inline. // Add rel="nozoom" to your to disable zooming for an image. // // Redistribution and use of this effect in source form, with or without modification, // are permitted provided that the following conditions are met: // // * USE OF SOURCE ON COMMERCIAL (FOR-PROFIT) WEBSITE REQUIRES ONE-TIME LICENSE FEE PER DOMAIN. // Reasonably priced! Visit www.fancyzoom.com for licensing instructions. Thanks! // // * Non-commercial (personal) website use is permitted without license/payment! // // * Redistribution of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistribution of source code and derived works cannot be sold without specific // written prior permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. var includeCaption = true; // Turn on the "caption" feature, and write out the caption HTML var zoomTime = 5; // Milliseconds between frames of zoom animation var zoomSteps = 15; // Number of zoom animation frames var includeFade = 1; // Set to 1 to fade the image in / out as it zooms var minBorder = 90; // Amount of padding between large, scaled down images, and the window edges var shadowSettings = '0px 5px 25px rgba(100, 100, 100, '; // Blur, radius, color of shadow for compatible browsers var zoomImagesURI = '/images-global/zoom/'; // Location of the zoom and shadow images // SRG if (typeof(zoomImagesBase) != "undefined") { zoomImagesURI = zoomImagesBase + zoomImagesURI; } // SRG END // Init. Do not add anything below this line, unless it's something awesome. var myWidth = 0, myHeight = 0, myScroll = 0; myScrollWidth = 0; myScrollHeight = 0; var zoomOpen = false, preloadFrame = 1, preloadActive = false, preloadTime = 0, imgPreload = new Image(); var preloadAnimTimer = 0; var zoomActive = new Array(); var zoomTimer = new Array(); var zoomOrigW = new Array(); var zoomOrigH = new Array(); var zoomOrigX = new Array(); var zoomOrigY = new Array(); var zoomID = "ZoomBox"; var theID = "ZoomImage"; var zoomCaption = "ZoomCaption"; var zoomCaptionDiv = "ZoomCapDiv"; if (navigator.userAgent.indexOf("MSIE") != -1) { var browserIsIE = true; } // Zoom: Setup The Page! Called in your 's onLoad handler. function setupZoom() { prepZooms(); insertZoomHTML(); zoomdiv = document.getElementById(zoomID); zoomimg = document.getElementById(theID); } // Zoom: Inject Javascript functions into hrefs pointing to images, one by one! // Skip any href that contains a rel="nozoom" tag. // This is done at page load time via an onLoad() handler. function prepZooms() { if (! document.getElementsByTagName) { return; } var links = document.getElementsByTagName("a"); for (i = 0; i < links.length; i++) { if (links[i].getAttribute("href")) { if (links[i].getAttribute("href").search(/(.*)\.(jpg|jpeg|gif|png|bmp|tif|tiff)/gi) != -1) { if (links[i].getAttribute("rel") != "nozoom") { links[i].onclick = function (event) { return zoomClick(this, event); }; links[i].onmouseover = function () { zoomPreload(this); }; } } } } } // Zoom: Load an image into an image object. When done loading, function sets preloadActive to false, // so other bits know that they can proceed with the zoom. // Preloaded image is stored in imgPreload and swapped out in the zoom function. function zoomPreload(from) { var theimage = from.getAttribute("href"); // Only preload if we have to, i.e. the image isn't this image already if (imgPreload.src.indexOf(from.getAttribute("href").substr(from.getAttribute("href").lastIndexOf("/"))) == -1) { preloadActive = true; imgPreload = new Image(); // Set a function to fire when the preload is complete, setting flags along the way. imgPreload.onload = function() { preloadActive = false; } // Load it! imgPreload.src = theimage; } } // Zoom: Start the preloading animation cycle. function preloadAnimStart() { preloadTime = new Date(); document.getElementById("ZoomSpin").style.left = (myWidth / 2) + 'px'; document.getElementById("ZoomSpin").style.top = ((myHeight / 2) + myScroll) + 'px'; document.getElementById("ZoomSpin").style.visibility = "visible"; preloadFrame = 1; document.getElementById("SpinImage").src = zoomImagesURI+'zoom-spin-'+preloadFrame+'.png'; preloadAnimTimer = setInterval("preloadAnim()", 100); } // Zoom: Display and ANIMATE the jibber-jabber widget. Once preloadActive is false, bail and zoom it up! function preloadAnim(from) { if (preloadActive != false) { document.getElementById("SpinImage").src = zoomImagesURI+'zoom-spin-'+preloadFrame+'.png'; preloadFrame++; if (preloadFrame > 12) preloadFrame = 1; } else { document.getElementById("ZoomSpin").style.visibility = "hidden"; clearInterval(preloadAnimTimer); preloadAnimTimer = 0; zoomIn(preloadFrom); } } // ZOOM CLICK: We got a click! Should we do the zoom? Or wait for the preload to complete? // todo?: Double check that imgPreload src = clicked src function zoomClick(from, evt) { var shift = getShift(evt); // Check for Command / Alt key. If pressed, pass them through -- don't zoom! if (! evt && window.event && (window.event.metaKey || window.event.altKey)) { return true; } else if (evt && (evt.metaKey|| evt.altKey)) { return true; } // Get browser dimensions getSize(); // If preloading still, wait, and display the spinner. if (preloadActive == true) { // But only display the spinner if it's not already being displayed! if (preloadAnimTimer == 0) { preloadFrom = from; preloadAnimStart(); } } else { // Otherwise, we're loaded: do the zoom! zoomIn(from, shift); } return false; } // Zoom: Move an element in to endH endW, using zoomHost as a starting point. // "from" is an object reference to the href that spawned the zoom. function zoomIn(from, shift) { zoomimg.src = from.getAttribute("href"); // Determine the zoom settings from where we came from, the element in the . // If there's no element in the , or we can't get the width, make stuff up if (from.childNodes[0].width) { startW = from.childNodes[0].width; startH = from.childNodes[0].height; startPos = findElementPos(from.childNodes[0]); } else { startW = 50; startH = 12; startPos = findElementPos(from); } hostX = startPos[0]; hostY = startPos[1]; // Make up for a scrolled containing div. // TODO: This HAS to move into findElementPos. if (document.getElementById('scroller')) { hostX = hostX - document.getElementById('scroller').scrollLeft; } // Determine the target zoom settings from the preloaded image object endW = imgPreload.width; endH = imgPreload.height; // Start! But only if we're not zooming already! if (zoomActive[theID] != true) { // Clear everything out just in case something is already open if (document.getElementById("ShadowBox")) { document.getElementById("ShadowBox").style.visibility = "hidden"; } else if (! browserIsIE) { // Wipe timer if shadow is fading in still if (fadeActive["ZoomImage"]) { clearInterval(fadeTimer["ZoomImage"]); fadeActive["ZoomImage"] = false; fadeTimer["ZoomImage"] = false; } document.getElementById("ZoomImage").style.webkitBoxShadow = shadowSettings + '0.0)'; } document.getElementById("ZoomClose").style.visibility = "hidden"; // Setup the CAPTION, if existing. Hide it first, set the text. if (includeCaption) { document.getElementById(zoomCaptionDiv).style.visibility = "hidden"; if (from.getAttribute('title') && includeCaption) { // Yes, there's a caption, set it up document.getElementById(zoomCaption).innerHTML = from.getAttribute('title'); } else { document.getElementById(zoomCaption).innerHTML = ""; } } // Store original position in an array for future zoomOut. zoomOrigW[theID] = startW; zoomOrigH[theID] = startH; zoomOrigX[theID] = hostX; zoomOrigY[theID] = hostY; // Now set the starting dimensions zoomimg.style.width = startW + 'px'; zoomimg.style.height = startH + 'px'; zoomdiv.style.left = hostX + 'px'; zoomdiv.style.top = hostY + 'px'; // Show the zooming image container, make it invisible if (includeFade == 1) { setOpacity(0, zoomID); } zoomdiv.style.visibility = "visible"; // If it's too big to fit in the window, shrink the width and height to fit (with ratio). sizeRatio = endW / endH; if (endW > myWidth - minBorder) { endW = myWidth - minBorder; endH = endW / sizeRatio; } if (endH > myHeight - minBorder) { endH = myHeight - minBorder; endW = endH * sizeRatio; } zoomChangeX = ((myWidth / 2) - (endW / 2) - hostX); zoomChangeY = (((myHeight / 2) - (endH / 2) - hostY) + myScroll); zoomChangeW = (endW - startW); zoomChangeH = (endH - startH); // Shift key? if (shift) { tempSteps = zoomSteps * 7; } else { tempSteps = zoomSteps; } // Setup Zoom zoomCurrent = 0; // Setup Fade with Zoom, If Requested if (includeFade == 1) { fadeCurrent = 0; fadeAmount = (0 - 100) / tempSteps; } else { fadeAmount = 0; } // Do It! zoomTimer[theID] = setInterval("zoomElement('"+zoomID+"', '"+theID+"', "+zoomCurrent+", "+startW+", "+zoomChangeW+", "+startH+", "+zoomChangeH+", "+hostX+", "+zoomChangeX+", "+hostY+", "+zoomChangeY+", "+tempSteps+", "+includeFade+", "+fadeAmount+", 'zoomDoneIn(zoomID)')", zoomTime); zoomActive[theID] = true; } } // Zoom it back out. function zoomOut(from, evt) { // Get shift key status. // IE events don't seem to get passed through the function, so grab it from the window. if (getShift(evt)) { tempSteps = zoomSteps * 7; } else { tempSteps = zoomSteps; } // Check to see if something is happening/open if (zoomActive[theID] != true) { // First, get rid of the shadow if necessary. if (document.getElementById("ShadowBox")) { document.getElementById("ShadowBox").style.visibility = "hidden"; } else if (! browserIsIE) { // Wipe timer if shadow is fading in still if (fadeActive["ZoomImage"]) { clearInterval(fadeTimer["ZoomImage"]); fadeActive["ZoomImage"] = false; fadeTimer["ZoomImage"] = false; } document.getElementById("ZoomImage").style.webkitBoxShadow = shadowSettings + '0.0)'; } // ..and the close box... document.getElementById("ZoomClose").style.visibility = "hidden"; // ...and the caption if necessary! if (includeCaption && document.getElementById(zoomCaption).innerHTML != "") { // fadeElementSetup(zoomCaptionDiv, 100, 0, 5, 1); document.getElementById(zoomCaptionDiv).style.visibility = "hidden"; } // Now, figure out where we came from, to get back there startX = parseInt(zoomdiv.style.left); startY = parseInt(zoomdiv.style.top); startW = zoomimg.width; startH = zoomimg.height; zoomChangeX = zoomOrigX[theID] - startX; zoomChangeY = zoomOrigY[theID] - startY; zoomChangeW = zoomOrigW[theID] - startW; zoomChangeH = zoomOrigH[theID] - startH; // Setup Zoom zoomCurrent = 0; // Setup Fade with Zoom, If Requested if (includeFade == 1) { fadeCurrent = 0; fadeAmount = (100 - 0) / tempSteps; } else { fadeAmount = 0; } // Do It! zoomTimer[theID] = setInterval("zoomElement('"+zoomID+"', '"+theID+"', "+zoomCurrent+", "+startW+", "+zoomChangeW+", "+startH+", "+zoomChangeH+", "+startX+", "+zoomChangeX+", "+startY+", "+zoomChangeY+", "+tempSteps+", "+includeFade+", "+fadeAmount+", 'zoomDone(zoomID, theID)')", zoomTime); zoomActive[theID] = true; } } // Finished Zooming In function zoomDoneIn(zoomdiv, theID) { // Note that it's open zoomOpen = true; zoomdiv = document.getElementById(zoomdiv); // Position the table shadow behind the zoomed in image, and display it if (document.getElementById("ShadowBox")) { setOpacity(0, "ShadowBox"); shadowdiv = document.getElementById("ShadowBox"); shadowLeft = parseInt(zoomdiv.style.left) - 13; shadowTop = parseInt(zoomdiv.style.top) - 8; shadowWidth = zoomdiv.offsetWidth + 26; shadowHeight = zoomdiv.offsetHeight + 26; shadowdiv.style.width = shadowWidth + 'px'; shadowdiv.style.height = shadowHeight + 'px'; shadowdiv.style.left = shadowLeft + 'px'; shadowdiv.style.top = shadowTop + 'px'; document.getElementById("ShadowBox").style.visibility = "visible"; fadeElementSetup("ShadowBox", 0, 100, 5); } else if (! browserIsIE) { // Or, do a fade of the modern shadow fadeElementSetup("ZoomImage", 0, .8, 5, 0, "shadow"); } // Position and display the CAPTION, if existing if (includeCaption && document.getElementById(zoomCaption).innerHTML != "") { // setOpacity(0, zoomCaptionDiv); zoomcapd = document.getElementById(zoomCaptionDiv); zoomcapd.style.top = parseInt(zoomdiv.style.top) + (zoomdiv.offsetHeight + 15) + 'px'; zoomcapd.style.left = (myWidth / 2) - (zoomcapd.offsetWidth / 2) + 'px'; zoomcapd.style.visibility = "visible"; // fadeElementSetup(zoomCaptionDiv, 0, 100, 5); } // Display Close Box (fade it if it's not IE) if (!browserIsIE) setOpacity(0, "ZoomClose"); document.getElementById("ZoomClose").style.visibility = "visible"; if (!browserIsIE) fadeElementSetup("ZoomClose", 0, 100, 5); // Get keypresses document.onkeypress = getKey; } // Finished Zooming Out function zoomDone(zoomdiv, theID) { // No longer open zoomOpen = false; // Clear stuff out, clean up zoomOrigH[theID] = ""; zoomOrigW[theID] = ""; document.getElementById(zoomdiv).style.visibility = "hidden"; zoomActive[theID] == false; // Stop getting keypresses document.onkeypress = null; } // Actually zoom the element function zoomElement(zoomdiv, theID, zoomCurrent, zoomStartW, zoomChangeW, zoomStartH, zoomChangeH, zoomStartX, zoomChangeX, zoomStartY, zoomChangeY, zoomSteps, includeFade, fadeAmount, execWhenDone) { // console.log("Zooming Step #"+zoomCurrent+ " of "+zoomSteps+" (zoom " + zoomStartW + "/" + zoomChangeW + ") (zoom " + zoomStartH + "/" + zoomChangeH + ") (zoom " + zoomStartX + "/" + zoomChangeX + ") (zoom " + zoomStartY + "/" + zoomChangeY + ") Fade: "+fadeAmount); // Test if we're done, or if we continue if (zoomCurrent == (zoomSteps + 1)) { zoomActive[theID] = false; clearInterval(zoomTimer[theID]); if (execWhenDone != "") { eval(execWhenDone); } } else { // Do the Fade! if (includeFade == 1) { if (fadeAmount < 0) { setOpacity(Math.abs(zoomCurrent * fadeAmount), zoomdiv); } else { setOpacity(100 - (zoomCurrent * fadeAmount), zoomdiv); } } // Calculate this step's difference, and move it! moveW = cubicInOut(zoomCurrent, zoomStartW, zoomChangeW, zoomSteps); moveH = cubicInOut(zoomCurrent, zoomStartH, zoomChangeH, zoomSteps); moveX = cubicInOut(zoomCurrent, zoomStartX, zoomChangeX, zoomSteps); moveY = cubicInOut(zoomCurrent, zoomStartY, zoomChangeY, zoomSteps); document.getElementById(zoomdiv).style.left = moveX + 'px'; document.getElementById(zoomdiv).style.top = moveY + 'px'; zoomimg.style.width = moveW + 'px'; zoomimg.style.height = moveH + 'px'; zoomCurrent++; clearInterval(zoomTimer[theID]); zoomTimer[theID] = setInterval("zoomElement('"+zoomdiv+"', '"+theID+"', "+zoomCurrent+", "+zoomStartW+", "+zoomChangeW+", "+zoomStartH+", "+zoomChangeH+", "+zoomStartX+", "+zoomChangeX+", "+zoomStartY+", "+zoomChangeY+", "+zoomSteps+", "+includeFade+", "+fadeAmount+", '"+execWhenDone+"')", zoomTime); } } // Zoom Utility: Get Key Press when image is open, and act accordingly function getKey(evt) { if (! evt) { theKey = event.keyCode; } else { theKey = evt.keyCode; } if (theKey == 27) { // ESC zoomOut(this, evt); } } //////////////////////////// // // FADE Functions // function fadeOut(elem) { if (elem.id) { fadeElementSetup(elem.id, 100, 0, 10); } } function fadeIn(elem) { if (elem.id) { fadeElementSetup(elem.id, 0, 100, 10); } } // Fade: Initialize the fade function var fadeActive = new Array(); var fadeQueue = new Array(); var fadeTimer = new Array(); var fadeClose = new Array(); var fadeMode = new Array(); function fadeElementSetup(theID, fdStart, fdEnd, fdSteps, fdClose, fdMode) { // alert("Fading: "+theID+" Steps: "+fdSteps+" Mode: "+fdMode); if (fadeActive[theID] == true) { // Already animating, queue up this command fadeQueue[theID] = new Array(theID, fdStart, fdEnd, fdSteps); } else { fadeSteps = fdSteps; fadeCurrent = 0; fadeAmount = (fdStart - fdEnd) / fadeSteps; fadeTimer[theID] = setInterval("fadeElement('"+theID+"', '"+fadeCurrent+"', '"+fadeAmount+"', '"+fadeSteps+"')", 15); fadeActive[theID] = true; fadeMode[theID] = fdMode; if (fdClose == 1) { fadeClose[theID] = true; } else { fadeClose[theID] = false; } } } // Fade: Do the fade. This function will call itself, modifying the parameters, so // many instances can run concurrently. Can fade using opacity, or fade using a box-shadow. function fadeElement(theID, fadeCurrent, fadeAmount, fadeSteps) { if (fadeCurrent == fadeSteps) { // We're done, so clear. clearInterval(fadeTimer[theID]); fadeActive[theID] = false; fadeTimer[theID] = false; // Should we close it once the fade is complete? if (fadeClose[theID] == true) { document.getElementById(theID).style.visibility = "hidden"; } // Hang on.. did a command queue while we were working? If so, make it happen now if (fadeQueue[theID] && fadeQueue[theID] != false) { fadeElementSetup(fadeQueue[theID][0], fadeQueue[theID][1], fadeQueue[theID][2], fadeQueue[theID][3]); fadeQueue[theID] = false; } } else { fadeCurrent++; // Now actually do the fade adjustment. if (fadeMode[theID] == "shadow") { // Do a special fade on the webkit-box-shadow of the object if (fadeAmount < 0) { document.getElementById(theID).style.webkitBoxShadow = shadowSettings + (Math.abs(fadeCurrent * fadeAmount)) + ')'; } else { document.getElementById(theID).style.webkitBoxShadow = shadowSettings + (100 - (fadeCurrent * fadeAmount)) + ')'; } } else { // Set the opacity depending on if we're adding or subtracting (pos or neg) if (fadeAmount < 0) { setOpacity(Math.abs(fadeCurrent * fadeAmount), theID); } else { setOpacity(100 - (fadeCurrent * fadeAmount), theID); } } // Keep going, and send myself the updated variables clearInterval(fadeTimer[theID]); fadeTimer[theID] = setInterval("fadeElement('"+theID+"', '"+fadeCurrent+"', '"+fadeAmount+"', '"+fadeSteps+"')", 15); } } //////////////////////////// // // UTILITY functions // // Utility: Set the opacity, compatible with a number of browsers. Value from 0 to 100. function setOpacity(opacity, theID) { var object = document.getElementById(theID).style; // If it's 100, set it to 99 for Firefox. if (navigator.userAgent.indexOf("Firefox") != -1) { if (opacity == 100) { opacity = 99.9999; } // This is majorly awkward } // Multi-browser opacity setting object.filter = "alpha(opacity=" + opacity + ")"; // IE/Win object.opacity = (opacity / 100); // Safari 1.2, Firefox+Mozilla } // Utility: Math functions for animation calucations - From http://www.robertpenner.com/easing/ // // t = time, b = begin, c = change, d = duration // time = current frame, begin is fixed, change is basically finish - begin, duration is fixed (frames), function linear(t, b, c, d) { return c*t/d + b; } function sineInOut(t, b, c, d) { return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; } function cubicIn(t, b, c, d) { return c*(t/=d)*t*t + b; } function cubicOut(t, b, c, d) { return c*((t=t/d-1)*t*t + 1) + b; } function cubicInOut(t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t + b; return c/2*((t-=2)*t*t + 2) + b; } function bounceOut(t, b, c, d) { if ((t/=d) < (1/2.75)){ return c*(7.5625*t*t) + b; } else if (t < (2/2.75)){ return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; } else if (t < (2.5/2.75)){ return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; } else { return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; } } // Utility: Get the size of the window, and set myWidth and myHeight // Credit to quirksmode.org function getSize() { // Window Size if (self.innerHeight) { // Everyone but IE myWidth = window.innerWidth; myHeight = window.innerHeight; myScroll = window.pageYOffset; } else if (document.documentElement && document.documentElement.clientHeight) { // IE6 Strict myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; myScroll = document.documentElement.scrollTop; } else if (document.body) { // Other IE, such as IE7 myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; myScroll = document.body.scrollTop; } // Page size w/offscreen areas if (window.innerHeight && window.scrollMaxY) { myScrollWidth = document.body.scrollWidth; myScrollHeight = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight) { // All but Explorer Mac myScrollWidth = document.body.scrollWidth; myScrollHeight = document.body.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari myScrollWidth = document.body.offsetWidth; myScrollHeight = document.body.offsetHeight; } } // Utility: Get Shift Key Status // IE events don't seem to get passed through the function, so grab it from the window. function getShift(evt) { var shift = false; if (! evt && window.event) { shift = window.event.shiftKey; } else if (evt) { shift = evt.shiftKey; if (shift) evt.stopPropagation(); // Prevents Firefox from doing shifty things } return shift; } // Utility: Find the Y position of an element on a page. Return Y and X as an array function findElementPos(elemFind) { var elemX = 0; var elemY = 0; do { elemX += elemFind.offsetLeft; elemY += elemFind.offsetTop; } while ( elemFind = elemFind.offsetParent ) return Array(elemX, elemY); }// FancyZoomHTML.js - v1.0 // Used to draw necessary HTML elements for FancyZoom // // Copyright (c) 2008 Cabel Sasser / Panic Inc // All rights reserved. function insertZoomHTML() { // All of this junk creates the three
's used to hold the closebox, image, and zoom shadow. var inBody = document.getElementsByTagName("body").item(0); // WAIT SPINNER var inSpinbox = document.createElement("div"); inSpinbox.setAttribute('id', 'ZoomSpin'); inSpinbox.style.position = 'absolute'; inSpinbox.style.left = '10px'; inSpinbox.style.top = '10px'; inSpinbox.style.visibility = 'hidden'; inSpinbox.style.zIndex = '525'; inBody.insertBefore(inSpinbox, inBody.firstChild); var inSpinImage = document.createElement("img"); inSpinImage.setAttribute('id', 'SpinImage'); inSpinImage.setAttribute('src', zoomImagesURI+'zoom-spin-1.png'); inSpinbox.appendChild(inSpinImage); // ZOOM IMAGE // //
// //
// //
//
var inZoombox = document.createElement("div"); inZoombox.setAttribute('id', 'ZoomBox'); inZoombox.style.position = 'absolute'; inZoombox.style.left = '10px'; inZoombox.style.top = '10px'; inZoombox.style.visibility = 'hidden'; inZoombox.style.zIndex = '499'; inBody.insertBefore(inZoombox, inSpinbox.nextSibling); var inImage1 = document.createElement("img"); inImage1.onclick = function (event) { zoomOut(this, event); return false; }; inImage1.setAttribute('src',zoomImagesURI+'spacer.gif'); inImage1.setAttribute('id','ZoomImage'); inImage1.setAttribute('border', '0'); // inImage1.setAttribute('onMouseOver', 'zoomMouseOver();') // inImage1.setAttribute('onMouseOut', 'zoomMouseOut();') // This must be set first, so we can later test it using webkitBoxShadow. inImage1.setAttribute('style', '-webkit-box-shadow: '+shadowSettings+'0.0)'); inImage1.style.display = 'block'; inImage1.style.width = '10px'; inImage1.style.height = '10px'; inImage1.style.cursor = 'pointer'; // -webkit-zoom-out? inZoombox.appendChild(inImage1); var inClosebox = document.createElement("div"); inClosebox.setAttribute('id', 'ZoomClose'); inClosebox.style.position = 'absolute'; // In MSIE, we need to put the close box inside the image. // It's 2008 and I'm having to do a browser detect? Sigh. if (browserIsIE) { inClosebox.style.left = '-1px'; inClosebox.style.top = '0px'; } else { inClosebox.style.left = '-15px'; inClosebox.style.top = '-15px'; } inClosebox.style.visibility = 'hidden'; inZoombox.appendChild(inClosebox); var inImage2 = document.createElement("img"); inImage2.onclick = function (event) { zoomOut(this, event); return false; }; inImage2.setAttribute('src',zoomImagesURI+'closebox.png'); inImage2.setAttribute('width','30'); inImage2.setAttribute('height','30'); inImage2.setAttribute('border','0'); inImage2.style.cursor = 'pointer'; inClosebox.appendChild(inImage2); // SHADOW // Only draw the table-based shadow if the programatic webkitBoxShadow fails! // Also, don't draw it if we're IE -- it wouldn't look quite right anyway. if (! document.getElementById('ZoomImage').style.webkitBoxShadow && ! browserIsIE) { // SHADOW BASE var inFixedBox = document.createElement("div"); inFixedBox.setAttribute('id', 'ShadowBox'); inFixedBox.style.position = 'absolute'; inFixedBox.style.left = '50px'; inFixedBox.style.top = '50px'; inFixedBox.style.width = '100px'; inFixedBox.style.height = '100px'; inFixedBox.style.visibility = 'hidden'; inFixedBox.style.zIndex = '498'; inBody.insertBefore(inFixedBox, inZoombox.nextSibling); // SHADOW // Now, the shadow table. Skip if not compatible, or irrevelant with -box-shadow. //
X // // // // // var inShadowTable = document.createElement("table"); inShadowTable.setAttribute('border', '0'); inShadowTable.setAttribute('width', '100%'); inShadowTable.setAttribute('height', '100%'); inShadowTable.setAttribute('cellpadding', '0'); inShadowTable.setAttribute('cellspacing', '0'); inFixedBox.appendChild(inShadowTable); var inShadowTbody = document.createElement("tbody"); // Needed for IE (for HTML4). inShadowTable.appendChild(inShadowTbody); var inRow1 = document.createElement("tr"); inRow1.style.height = '25px'; inShadowTbody.appendChild(inRow1); var inCol1 = document.createElement("td"); inCol1.style.width = '27px'; inRow1.appendChild(inCol1); var inShadowImg1 = document.createElement("img"); inShadowImg1.setAttribute('src', zoomImagesURI+'zoom-shadow1.png'); inShadowImg1.setAttribute('width', '27'); inShadowImg1.setAttribute('height', '25'); inShadowImg1.style.display = 'block'; inCol1.appendChild(inShadowImg1); var inCol2 = document.createElement("td"); inCol2.setAttribute('background', zoomImagesURI+'zoom-shadow2.png'); inRow1.appendChild(inCol2); // inCol2.innerHTML = ' // // // // inRow2 = document.createElement("tr"); inShadowTbody.appendChild(inRow2); var inCol4 = document.createElement("td"); inCol4.setAttribute('background', zoomImagesURI+'zoom-shadow4.png'); inRow2.appendChild(inCol4); // inCol4.innerHTML = ' '; var inSpacer2 = document.createElement("img"); inSpacer2.setAttribute('src',zoomImagesURI+'spacer.gif'); inSpacer2.setAttribute('height', '1'); inSpacer2.setAttribute('width', '1'); inSpacer2.style.display = 'block'; inCol4.appendChild(inSpacer2); var inCol5 = document.createElement("td"); inCol5.setAttribute('bgcolor', '#ffffff'); inRow2.appendChild(inCol5); // inCol5.innerHTML = ' '; var inSpacer3 = document.createElement("img"); inSpacer3.setAttribute('src',zoomImagesURI+'spacer.gif'); inSpacer3.setAttribute('height', '1'); inSpacer3.setAttribute('width', '1'); inSpacer3.style.display = 'block'; inCol5.appendChild(inSpacer3); var inCol6 = document.createElement("td"); inCol6.setAttribute('background', zoomImagesURI+'zoom-shadow5.png'); inRow2.appendChild(inCol6); // inCol6.innerHTML = ' '; var inSpacer4 = document.createElement("img"); inSpacer4.setAttribute('src',zoomImagesURI+'spacer.gif'); inSpacer4.setAttribute('height', '1'); inSpacer4.setAttribute('width', '1'); inSpacer4.style.display = 'block'; inCol6.appendChild(inSpacer4); // // // // //
 
   
//  
var inRow3 = document.createElement("tr"); inRow3.style.height = '26px'; inShadowTbody.appendChild(inRow3); var inCol7 = document.createElement("td"); inCol7.style.width = '27px'; inRow3.appendChild(inCol7); var inShadowImg7 = document.createElement("img"); inShadowImg7.setAttribute('src', zoomImagesURI+'zoom-shadow6.png'); inShadowImg7.setAttribute('width', '27'); inShadowImg7.setAttribute('height', '26'); inShadowImg7.style.display = 'block'; inCol7.appendChild(inShadowImg7); var inCol8 = document.createElement("td"); inCol8.setAttribute('background', zoomImagesURI+'zoom-shadow7.png'); inRow3.appendChild(inCol8); // inCol8.innerHTML = ' '; var inSpacer5 = document.createElement("img"); inSpacer5.setAttribute('src',zoomImagesURI+'spacer.gif'); inSpacer5.setAttribute('height', '1'); inSpacer5.setAttribute('width', '1'); inSpacer5.style.display = 'block'; inCol8.appendChild(inSpacer5); var inCol9 = document.createElement("td"); inCol9.style.width = '27px'; inRow3.appendChild(inCol9); var inShadowImg9 = document.createElement("img"); inShadowImg9.setAttribute('src', zoomImagesURI+'zoom-shadow8.png'); inShadowImg9.setAttribute('width', '27'); inShadowImg9.setAttribute('height', '26'); inShadowImg9.style.display = 'block'; inCol9.appendChild(inShadowImg9); } if (includeCaption) { // CAPTION // //
// // // // // // //
//
var inCapDiv = document.createElement("div"); inCapDiv.setAttribute('id', 'ZoomCapDiv'); inCapDiv.style.position = 'absolute'; inCapDiv.style.visibility = 'hidden'; inCapDiv.style.marginLeft = 'auto'; inCapDiv.style.marginRight = 'auto'; inCapDiv.style.zIndex = '501'; inBody.insertBefore(inCapDiv, inZoombox.nextSibling); var inCapTable = document.createElement("table"); inCapTable.setAttribute('border', '0'); inCapTable.setAttribute('cellPadding', '0'); // Wow. These honestly need to inCapTable.setAttribute('cellSpacing', '0'); // be intercapped to work in IE. WTF? inCapDiv.appendChild(inCapTable); var inTbody = document.createElement("tbody"); // Needed for IE (for HTML4). inCapTable.appendChild(inTbody); var inCapRow1 = document.createElement("tr"); inTbody.appendChild(inCapRow1); var inCapCol1 = document.createElement("td"); inCapCol1.setAttribute('align', 'right'); inCapRow1.appendChild(inCapCol1); var inCapImg1 = document.createElement("img"); inCapImg1.setAttribute('src', zoomImagesURI+'zoom-caption-l.png'); inCapImg1.setAttribute('width', '13'); inCapImg1.setAttribute('height', '26'); inCapImg1.style.display = 'block'; inCapCol1.appendChild(inCapImg1); var inCapCol2 = document.createElement("td"); inCapCol2.setAttribute('background', zoomImagesURI+'zoom-caption-fill.png'); inCapCol2.setAttribute('id', 'ZoomCaption'); inCapCol2.setAttribute('valign', 'middle'); inCapCol2.style.fontSize = '14px'; inCapCol2.style.fontFamily = 'Helvetica'; inCapCol2.style.fontWeight = 'bold'; inCapCol2.style.color = '#ffffff'; inCapCol2.style.textShadow = '0px 2px 4px #000000'; inCapCol2.style.whiteSpace = 'nowrap'; inCapRow1.appendChild(inCapCol2); var inCapCol3 = document.createElement("td"); inCapRow1.appendChild(inCapCol3); var inCapImg2 = document.createElement("img"); inCapImg2.setAttribute('src', zoomImagesURI+'zoom-caption-r.png'); inCapImg2.setAttribute('width', '13'); inCapImg2.setAttribute('height', '26'); inCapImg2.style.display = 'block'; inCapCol3.appendChild(inCapImg2); } }addDOMLoadEvent=(function(){var e=[],t,s,n,i,o,d=document,w=window,r='readyState',c='onreadystatechange',x=function(){n=1;clearInterval(t);while(i=e.shift())i();if(s)s[c]=''};return function(f){if(n)return f();if(!e[0]){d.addEventListener&&d.addEventListener("DOMContentLoaded",x,false);/*@cc_on@*//*@if(@_win32)d.write("