/*
 * jQuery Extras Common file for bookstore framework
 *
 * Requires jquery v1.4.x or above
 *
 * Includes:
 * - jQuery bgiframe v2.1
 * - jQuery hoverIntent
 * - jQuery preloadImages
 * - jQuery Easing v1.3
 * - jQuery prettyPhoto v2.2.7 (Modified by Mika Babcock)
 * - jQuery pngFix v1.2
 * - jQuery mbRollover v1.1
 * - jQuery mbModal v1.0
*/
var scripts_isIE=jQuery.browser.msie;var scripts_isIE6=(scripts_isIE&&jQuery.browser.version.substr(0,1)<="6");(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='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild)})}return this};if(!$.browser.version)$.browser.version=navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)[1]})(jQuery);jQuery.easing['jswing']=jQuery.easing['swing'];jQuery.extend(jQuery.easing,{def:'easeOutQuad',swing:function(x,t,b,c,d){return jQuery.easing[jQuery.easing.def](x,t,b,c,d)},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b},easeInOutCubic:function(x,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},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b},easeOutQuart:function(x,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b},easeInSine:function(x,t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b},easeInOutSine:function(x,t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b},easeInExpo:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b},easeOutExpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b},easeInOutExpo:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b},easeInCirc:function(x,t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b},easeOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b},easeInOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b},easeInBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b},easeOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},easeInOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b},easeInBounce:function(x,t,b,c,d){return c-jQuery.easing.easeOutBounce(x,d-t,0,c,d)+b},easeOutBounce:function(x,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}},easeInOutBounce:function(x,t,b,c,d){if(t<d/2)return jQuery.easing.easeInBounce(x,t*2,0,c,d)*.5+b;return jQuery.easing.easeOutBounce(x,t*2-d,0,c,d)*.5+c*.5+b}});var $pp_pic_holder;var $ppt;var begFlag=0;var endFlag=0;(function($){$.fn.prettyPhoto=function(settings){var doresize=true;var imagesArray=[];var setPosition=0;var arrayPosition=0;var $caller;var $scrollPos=_getScroll();$(window).scroll(function(){_centerPicture();$scrollPos=_getScroll()});$(window).resize(function(){_centerPicture();_resizeOverlay()});$(document).keyup(function(e){switch(e.keyCode){case 37:if(setPosition==1)return;changePicture('previous');break;case 39:if(setPosition==setCount)return;changePicture('next');break;case 27:close();break}});settings=jQuery.extend({animationSpeed:'normal',padding:40,opacity:0.35,showTitle:true,allowresize:true,counter_separator_label:'/',theme:'light_rounded'},settings);$(this).each(function(){var hasTitle=false;var isSet=false;var setCount=0;var arrayPosition=0;var alreadySet=false;var imgstr="";var imgstr2="";var imgpos;imgstr=$(this).attr('href');imgpos=imgstr.lastIndexOf("/");imgstr=imgstr.substring(imgpos);for(i=0;i<imagesArray.length;i++){imgstr2=$(imagesArray[i]).attr('href');if(imgstr2.indexOf(imgstr)!=-1){alreadySet=true;break}}if(!alreadySet)imagesArray[imagesArray.length]=this;$(this).bind('click',function(){open(this);return false})});function open(el){$caller=$(el);theRel=$caller.attr('rel');galleryRegExp=/\[(?:.*)\]/;theGallery=galleryRegExp.exec(theRel);isSet=false;setCount=0;var imgstr="";for(i=0;i<imagesArray.length;i++){if($(imagesArray[i]).attr('rel').indexOf(theGallery)!=-1){setCount++;if(setCount>1)isSet=true;imgstr=$caller.attr('href');if(imgstr.indexOf($(imagesArray[i]).attr('href'))!=-1){setPosition=setCount;arrayPosition=i}}};_buildOverlay();$pp_pic_holder.find('p.currentTextHolder').text(setPosition+settings.counter_separator_label+setCount);_centerPicture();$('#pp_full_res').hide();$pp_pic_holder.find('.pp_loaderIcon').show()};showimage=function(width,height,containerWidth,containerHeight,contentHeight,contentWidth,resized){$('.pp_loaderIcon').hide();if($.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=$(window).height();windowWidth=$(window).width()};$pp_pic_holder.find('.pp_content').animate({'height':contentHeight,'width':containerWidth},settings.animationSpeed);projectedTop=$scrollPos['scrollTop']+((windowHeight/2)-(containerHeight/2));if(projectedTop<0)projectedTop=0+$('div.ppt').height();$pp_pic_holder.animate({'top':projectedTop,'left':((windowWidth/2)-(containerWidth/2)),'width':containerWidth},settings.animationSpeed,function(){$pp_pic_holder.width(containerWidth);$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(height).width(width);$pp_pic_holder.find('#pp_full_res').fadeIn(settings.animationSpeed);_shownav($pp_pic_holder,$ppt);if(resized)$('a.pp_expand,a.pp_contract').fadeIn(settings.animationSpeed)})};function changePicture(direction){_checkPosition();if(direction=='previous'){if(begFlag==1){arrayPosition=setCount;setPosition=setCount+1}arrayPosition--;setPosition--;begFlag=0}else{if(endFlag==1){arrayPosition=-1;setPosition=0}arrayPosition++;setPosition++;endFlag=0};if(!doresize)doresize=true;$pp_pic_holder.find('.pp_hoverContainer,.pp_details').fadeOut(settings.animationSpeed);$pp_pic_holder.find('#pp_full_res').fadeOut(settings.animationSpeed,function(){$('.pp_loaderIcon').show();_preload()});_hideTitle();$('a.pp_expand,a.pp_contract').fadeOut(settings.animationSpeed,function(){$(this).removeClass('pp_contract').addClass('pp_expand')})};function close(){$('div.pp_pic_holder,div.ppt').fadeOut(settings.animationSpeed,function(){$('div.pp_overlay').fadeOut(settings.animationSpeed,function(){$('div.pp_overlay,div.pp_pic_holder,div.ppt').remove();if($.browser.msie&&$.browser.version==6){$('select').css('visibility','visible')}})});doresize=true};function _checkPosition(){if(setPosition==setCount){endFlag=1}else{$pp_pic_holder.find('a.pp_next').css('visibility','visible');$pp_pic_holder.find('a.pp_arrow_next.disabled').removeClass('disabled').bind('click',function(){changePicture('next');return false})};if(setPosition==1){begFlag=1}else{$pp_pic_holder.find('a.pp_previous').css('visibility','visible');$pp_pic_holder.find('a.pp_arrow_previous.disabled').removeClass('disabled').bind('click',function(){changePicture('previous');return false})};$pp_pic_holder.find('p.currentTextHolder').text(setPosition+settings.counter_separator_label+setCount);$caller=(isSet)?$(imagesArray[arrayPosition]):$caller;if($caller.attr('title')){$pp_pic_holder.find('.pp_description').show().html(unescape($caller.attr('title')))}else{$pp_pic_holder.find('.pp_description').hide().text('')};if($caller.find('img').attr('alt')&&settings.showTitle){hasTitle=true;$ppt.find('.ppt_content').html(unescape($caller.find('img').attr('alt')))}else{hasTitle=false}};function _fitToViewport(width,height){hasBeenResized=false;$('div.pp_pic_holder .pp_details').width(width);$('div.pp_pic_holder .pp_details p.pp_description').width(width-parseFloat($('div.pp_pic_holder a.pp_close').css('width')));contentHeight=height+parseFloat($('div.pp_pic_holder .pp_details').height())+parseFloat($('div.pp_pic_holder .pp_details').css('margin-top'))+parseFloat($('div.pp_pic_holder .pp_details').css('margin-bottom'));contentWidth=width;containerHeight=height+parseFloat($('div.ppt').height())+parseFloat($('div.pp_pic_holder .pp_top').height())+parseFloat($('div.pp_pic_holder .pp_bottom').height());containerWidth=width+settings.padding;imageWidth=width;imageHeight=height;windowHeight=$(window).height();windowWidth=$(window).width();if(((containerWidth>windowWidth)||(containerHeight>windowHeight))&&doresize&&settings.allowresize){hasBeenResized=true;notFitting=true;while(notFitting){if((containerWidth>windowWidth)){imageWidth=(windowWidth-100);imageHeight=(height/width)*imageWidth}else if((containerHeight>windowHeight)){imageHeight=(windowHeight-100);imageWidth=(width/height)*imageHeight}else{notFitting=false};containerHeight=imageHeight;containerWidth=imageWidth};contentHeight=imageHeight+parseFloat($('div.pp_pic_holder .pp_details').height())+parseFloat($('div.pp_pic_holder .pp_details').css('margin-top'))+parseFloat($('div.pp_pic_holder .pp_details').css('margin-bottom'));contentWidth=imageWidth;containerHeight=imageHeight+parseFloat($('div.ppt').height())+parseFloat($('div.pp_pic_holder .pp_top').height())+parseFloat($('div.pp_pic_holder .pp_bottom').height());containerWidth=imageWidth+settings.padding;$('div.pp_pic_holder .pp_details').width(contentWidth);$('div.pp_pic_holder .pp_details p.pp_description').width(contentWidth-parseFloat($('div.pp_pic_holder a.pp_close').css('width')))};return{width:imageWidth,height:imageHeight,containerHeight:containerHeight,containerWidth:containerWidth,contentHeight:contentHeight,contentWidth:contentWidth,resized:hasBeenResized}};function _centerPicture(){if($pp_pic_holder){if($pp_pic_holder.size()==0){return}}else{return};if($.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=$(window).height();windowWidth=$(window).width()};if(doresize){$pHeight=$pp_pic_holder.height();$pWidth=$pp_pic_holder.width();$tHeight=$ppt.height();$offset=$pp_pic_holder.offset();projectedTop=(windowHeight/2)+$scrollPos['scrollTop']-($pHeight/2);if(projectedTop<0)projectedTop=0+$tHeight;$pp_pic_holder.css({'top':projectedTop,'left':(windowWidth/2)+$scrollPos['scrollLeft']-($pWidth/2)});$ppt.css({'top':$offset.top-$tHeight,'left':$offset.left+(settings.padding/2)})}};function _shownav(){if(isSet)$pp_pic_holder.find('.pp_hoverContainer').fadeIn(settings.animationSpeed);$pp_pic_holder.find('.pp_details').fadeIn(settings.animationSpeed);_showTitle($pp_pic_holder,$ppt)};function _showTitle(){if(settings.showTitle&&hasTitle){$ppt.css({'top':$pp_pic_holder.offset().top-22,'left':$pp_pic_holder.offset().left+(settings.padding/2),'display':'none'});$ppt.find('div.ppt_content').css('width','auto');if($ppt.width()>$pp_pic_holder.width()){$ppt.find('div.ppt_content').css('width',$pp_pic_holder.width()-(settings.padding*2))}else{$ppt.find('div.ppt_content').css('width','')};$ppt.fadeIn(settings.animationSpeed)}};function _hideTitle(){$ppt.fadeOut(settings.animationSpeed)};function _preload(){_checkPosition();imgPreloader=new Image();nextImage=new Image();if(isSet&&setPosition>setCount)nextImage.src=$(imagesArray[arrayPosition+1]).attr('href');prevImage=new Image();if(isSet&&imagesArray[arrayPosition-1])prevImage.src=$(imagesArray[arrayPosition-1]).attr('href');$pp_pic_holder.find('.pp_content').css('overflow','hidden');$pp_pic_holder.find('#fullResImage').attr('src',$caller.attr('href'));imgPreloader.onload=function(){var correctSizes=_fitToViewport(imgPreloader.width,imgPreloader.height);imgPreloader.width=correctSizes['width'];imgPreloader.height=correctSizes['height'];showimage(imgPreloader.width,imgPreloader.height,correctSizes["containerWidth"],correctSizes["containerHeight"],correctSizes["contentHeight"],correctSizes["contentWidth"],correctSizes["resized"])};imgPreloader.src=$caller.attr('href')};function _getScroll(){scrollTop=window.pageYOffset||document.documentElement.scrollTop||0;scrollLeft=window.pageXOffset||document.documentElement.scrollLeft||0;return{scrollTop:scrollTop,scrollLeft:scrollLeft}};function _resizeOverlay(){$('div.pp_overlay').css({'height':$(document).height(),'width':$(window).width()})};function _buildOverlay(){toInject="";toInject+="<div class='pp_overlay'></div>";toInject+='<div class="pp_pic_holder"><div class="pp_top"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div><div class="pp_content"><a href="#" class="pp_expand" title="Expand the image">Expand</a><div class="pp_loaderIcon"></div><div class="pp_hoverContainer"><a class="pp_next" href="#">next</a><a class="pp_previous" href="#">previous</a></div><div id="pp_full_res"><img id="fullResImage" src="" /></div><div class="pp_details clearfix"><a class="pp_close" href="#">Close</a><p class="pp_description"></p><div class="pp_nav"><a href="#" class="pp_arrow_previous">Previous</a><p class="currentTextHolder">0'+settings.counter_separator_label+'0</p><a href="#" class="pp_arrow_next">Next</a></div></div></div><div class="pp_bottom"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div></div>';toInject+='<div class="ppt"><div class="ppt_left"></div><div class="ppt_content"></div><div class="ppt_right"></div></div>';$('body').append(toInject);$pp_pic_holder=$('.pp_pic_holder');$ppt=$('.ppt');$('div.pp_overlay').css('height',$(document).height()).bind('click',function(){close()});$pp_pic_holder.css({'opacity':0}).addClass(settings.theme);$('a.pp_close').bind('click',function(){close();return false});$('a.pp_expand').bind('click',function(){$this=$(this);if($this.hasClass('pp_expand')){$this.removeClass('pp_expand').addClass('pp_contract');doresize=false}else{$this.removeClass('pp_contract').addClass('pp_expand');doresize=true};_hideTitle();$pp_pic_holder.find('.pp_hoverContainer, #pp_full_res, .pp_details').fadeOut(settings.animationSpeed,function(){_preload()});return false});$pp_pic_holder.find('.pp_previous, .pp_arrow_previous').bind('click',function(){changePicture('previous');return false});$pp_pic_holder.find('.pp_next, .pp_arrow_next').bind('click',function(){changePicture('next');return false});$pp_pic_holder.find('.pp_hoverContainer').css({'margin-left':settings.padding/2});if(!isSet){$pp_pic_holder.find('.pp_hoverContainer,.pp_nav').hide()};if($.browser.msie&&$.browser.version==6){$('body').addClass('ie6');$('select').css('visibility','hidden')};$('div.pp_overlay').css('opacity',0).fadeTo(settings.animationSpeed,settings.opacity,function(){$pp_pic_holder.css('opacity',0).fadeIn(settings.animationSpeed,function(){$pp_pic_holder.attr('style','left:'+$pp_pic_holder.css('left')+';top:'+$pp_pic_holder.css('top')+';');_preload()})});if(scripts_isIE6)$pp_pic_holder.pngFix()}}})(jQuery);(function($){jQuery.fn.pngFix=function(settings){settings=jQuery.extend({blankgif:'blank.gif'},settings);var ie55=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 5.5")!=-1);var ie6=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 6.0")!=-1);if(jQuery.browser.msie&&(ie55||ie6)){jQuery(this).find("img[src$=.png]").each(function(){jQuery(this).attr('width',jQuery(this).width());jQuery(this).attr('height',jQuery(this).height());var prevStyle='';var strNewHTML='';var imgId=(jQuery(this).attr('id'))?'id="'+jQuery(this).attr('id')+'" ':'';var imgClass=(jQuery(this).attr('class'))?'class="'+jQuery(this).attr('class')+'" ':'';var imgTitle=(jQuery(this).attr('title'))?'title="'+jQuery(this).attr('title')+'" ':'';var imgAlt=(jQuery(this).attr('alt'))?'alt="'+jQuery(this).attr('alt')+'" ':'';var imgAlign=(jQuery(this).attr('align'))?'float:'+jQuery(this).attr('align')+';':'';var imgHand=(jQuery(this).parent().attr('href'))?'cursor:hand;':'';if(this.style.border){prevStyle+='border:'+this.style.border+';';this.style.border=''}if(this.style.padding){prevStyle+='padding:'+this.style.padding+';';this.style.padding=''}if(this.style.margin){prevStyle+='margin:'+this.style.margin+';';this.style.margin=''}var imgStyle=(this.style.cssText);strNewHTML+='<span '+imgId+imgClass+imgTitle+imgAlt;strNewHTML+='style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;strNewHTML+='width:'+jQuery(this).width()+'px;'+'height:'+jQuery(this).height()+'px;';strNewHTML+='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader'+'(src=\''+jQuery(this).attr('src')+'\', sizingMethod=\'scale\');';strNewHTML+=imgStyle+'"></span>';if(prevStyle!=''){strNewHTML='<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:'+jQuery(this).width()+'px;'+'height:'+jQuery(this).height()+'px;'+'">'+strNewHTML+'</span>'}jQuery(this).hide();jQuery(this).after(strNewHTML)});jQuery(this).find("*").each(function(){var bgIMG=jQuery(this).css('background-image');if(bgIMG.indexOf(".png")!=-1){var iebg=bgIMG.split('url("')[1].split('")')[0];jQuery(this).css('background-image','none');jQuery(this).get(0).runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+iebg+"',sizingMethod='scale')"}});jQuery(this).find("input[src$=.png]").each(function(){var bgIMG=jQuery(this).attr('src');jQuery(this).get(0).runtimeStyle.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader'+'(src=\''+bgIMG+'\', sizingMethod=\'scale\');';jQuery(this).attr('src',settings.blankgif)})}return jQuery}})(jQuery);(function($){$.fn.mbRollover=function(options){return this.each(function(){var defaults={endStr:'1',klass:'mbRollover'};var t=$(this),set=$.extend(defaults,options),rollover={init:function(){if(t.hasClass(set.klass))return;t.addClass(set.klass).bind(rollover);rollover.start()},start:function(){t.trigger('preload');t.delegate("img","mouseenter mouseleave",function(event){if(event.type=='mouseenter'||event.type=='mouseover'){$(this).attr('src',rollover.newimage($(this).attr("src")))}else{$(this).attr('src',rollover.oldimage($(this).attr("src")))}})},preload:function(){$(window).bind('load',function(){t.children("img").each(function(key,elm){$('<img>').attr('src',rollover.newimage($(this).attr("src")))})})},newimage:function(src){var str=src.substring(0,src.search(/(\.[a-z]+)$/))+set.endStr+src.match(/(\.[a-z]+)$/)[0];return str},oldimage:function(src){var last_idx=src.lastIndexOf(set.endStr);var slice1=src.substring(0,last_idx);var slice2=src.substring(last_idx);slice2=slice2.replace(eval('/'+set.endStr+'\./'),'.');var str=slice1+slice2;return str}};t.ready(rollover.init)})}})(jQuery);(function($){var cache=[];$.preLoadImages=function(){var args_len=arguments.length;for(var i=args_len;i--;){var cacheImage=document.createElement('img');cacheImage.src=arguments[i];cache.push(cacheImage)}}})(jQuery);(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){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}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.mouseover(handleHover).mouseout(handleHover)}})(jQuery);(function($){$.fn.mbModal=function(options,callbackFn,callbackFn2){return this.each(function(){var defaults={overlayClass:'site_overlay',overlayBGColor:'',overlayImg:'../images/contentPattern.png',dimBackground:true,opacity:0.80,openDivID:'divToOpen',createDiv:'',createCSS:{},centerLyr:true,centerOffsetLeft:0,centerOffsetTop:0,positionTo:'',posLeftMethod:'position',posTopMethod:'position',positionTopFixed:false,positionLeftFixed:false,parentDiv:'',parentZIndex:0,zIndexStart:9000,clickToClose:false,buttonClose:'',removeOnClose:false,bgiframe:true,klass:'mbModal'};var t=$(this),set=$.extend(defaults,options,callbackFn),divID=set.openDivID,scripts_isIE6=(jQuery.browser.msie&&jQuery.browser.version.substr(0,1)<="6"),on={setup:function(){if(t.hasClass(set.klass))return;t.addClass(set.klass).bind(on);on.open()},open:function(){if(set.dimBackground){var toShow='';toShow+='<div class="'+set.overlayClass+'"></div>';$('body').append(toShow);var overlay=$('.'+set.overlayClass);overlay.css({"position":"absolute","left":"0","top":"0","z-index":set.zIndexStart,"width":"100%","height":"100%","opacity":"0"});if(set.overlayImg!="")overlay.css("background-image","url('"+set.overlayImg+"')");if(set.overlayBGColor!="")overlay.css("background-color",set.overlayBGColor);$(overlay).css('height',$(document).height());if(set.clickToClose){$(overlay).bind('click',function(){t.trigger('close')})}$(overlay).css('opacity',0).fadeTo('slow',set.opacity,function(){if(divID!="")t.trigger('showDiv');$(overlay).css("z-index",set.zIndexStart)})}else{if(divID!="")t.trigger('showDiv')}if(set.buttonClose!=""){$("#"+set.buttonClose).live('click',function(){t.trigger('close')})}},showDiv:function(){if(set.createDiv!=""&&$('#'+divID).length==0){var newDiv='<div id="'+divID+'" style="display: none;">'+set.createDiv+'</div>';if(set.parentDiv!="")$(set.parentDiv).append(newDiv.replace(/'/gi,"\\'"));else $('body').append(newDiv.replace(/'/gi,"\\'"))}$('#'+divID).css(set.createCSS);var toShow=$("#"+divID);if(scripts_isIE6&&set.bgiframe){toShow.bgiframe()}var divZindex=(set.parentZIndex>0?set.parentZIndex:set.zIndexStart+1);toShow.css({"z-index":divZindex,"visibility":"visible"});if(set.centerLyr){t.trigger('center');t.trigger('reposition')}toShow.fadeIn('slow',function(){});if($.isFunction(callbackFn)){setTimeout(function(){callbackFn.call(this)},500)}},teardown:function(){t.removeClass(set.klass).unbind(on);if(set.centerLyr)$(window).unbind('resize');if(set.dimBackground){$('.'+set.overlayClass).fadeOut('slow',function(){$('.'+set.overlayClass).remove()})}if(typeof callbackFn2=='function'){setTimeout(function(){callbackFn2.call(this)},500)}},center:function(){if(set.positionTo!=""){switch(set.posTopMethod){case'position':var newTop=(!set.positionTopFixed?$(set.positionTo).position().top+set.centerOffsetTop:set.positionTopFixed);break;case'offset':var newTop=(!set.positionTopFixed?$(set.positionTo).offset().top+set.centerOffsetTop:set.positionTopFixed);break;case'window':var newTop=(($(window).height()-$(set.positionTo).height())/2+$(document).scrollTop())+set.centerOffsetTop;break}if(newTop<0)newTop=0;switch(set.posLeftMethod){case'position':var newLeft=(!set.positionLeftFixed?$(set.positionTo).position().left+set.centerOffsetLeft:set.positionLeftFixed);break;case'offset':var newLeft=(!set.positionLeftFixed?$(set.positionTo).offset().left+set.centerOffsetLeft:set.positionLeftFixed);break;case'window':var newLeft=(($(document).width()-$(set.positionTo).width())/2+$(document).scrollLeft())+set.centerOffsetLeft;break}if(newLeft<0)newLeft=0}else{var newTop=(($(window).height()-$('#'+divID).height())/2+$(document).scrollTop())+set.centerOffsetTop;if(newTop<0)newTop=0;var newLeft=(($(document).width()-$('#'+divID).width())/2+$(document).scrollLeft())+set.centerOffsetLeft;if(newLeft<0)newLeft=0}$('#'+divID).css("top",newTop+"px");$('#'+divID).css("left",newLeft+"px")},reposition:function(){$(window).bind('resize',function(){t.trigger('center')})},close:function(){t.trigger('teardown');if(divID!=""){$("#"+divID).fadeOut('slow',function(){if(set.removeOnClose)$("#"+divID).remove()})}}};t.ready(on.setup)})}})(jQuery);
