//E-Loop form validation
function validate() {
	var isValid = true;
	var isNewsletterSelected = true;
	var errorString = '';
	var x = document.OptinForm;
	if (x.field7.selectedIndex == -1) {
	 errorString = errorString + "Club\n ";
	 isValid = false;
	}
	if (x.field8.value == "") {
	 errorString = errorString + "First Name\n";
	 isValid = false;
	}
	if (x.field9.value == "") {
	 errorString = errorString + "Last Name\n";
	 isValid = false;
	}
	if (x.UEmail.value == "") {
	 errorString = errorString + "Email Address. \n ";
	 isValid = false;
	}
	else {
	 if (x.UEmail.value.indexOf("@") == -1 || x.UEmail.value.indexOf(".") == -1) {
		 errorString = errorString + 'Invalid email address.';
		 isValid = false;
	 }
	}
	
	if (isValid == true && isNewsletterSelected == true) {
	 return true;
	}
	else {
	 if (isNewsletterSelected == false) {
		 errorString = errorString + "----------------------\nPlease select at least one subscription";
	 }
	 alert("Following fields are required:\n\n" + errorString); return false;
	}
}


//PLUGIN: Fix flash from overlapping menu dropdown
function fix_flash() {
    // loop through every embed tag on the site
    var embeds = document.getElementsByTagName('embed');
    for (i = 0; i < embeds.length; i++) {
        embed = embeds[i];
        var new_embed;
        // everything but Firefox & Konqueror
        if (embed.outerHTML) {
            var html = embed.outerHTML;
            // replace an existing wmode parameter
            if (html.match(/wmode\s*=\s*('|")[a-zA-Z]+('|")/i))
                new_embed = html.replace(/wmode\s*=\s*('|")window('|")/i, "wmode='transparent'");
            // add a new wmode parameter
            else
                new_embed = html.replace(/<embed\s/i, "<embed wmode='transparent' ");
            // replace the old embed object with the fixed version
            embed.insertAdjacentHTML('beforeBegin', new_embed);
            embed.parentNode.removeChild(embed);
        } else {
            // cloneNode is buggy in some versions of Safari & Opera, but works fine in FF
            new_embed = embed.cloneNode(true);
            if (!new_embed.getAttribute('wmode') || new_embed.getAttribute('wmode').toLowerCase() == 'window')
                new_embed.setAttribute('wmode', 'transparent');
            embed.parentNode.replaceChild(new_embed, embed);
        }
    }
    // loop through every object tag on the site
    var objects = document.getElementsByTagName('object');
    for (i = 0; i < objects.length; i++) {
        object = objects[i];
        var new_object;
        // object is an IE specific tag so we can use outerHTML here
        if (object.outerHTML) {
            var html = object.outerHTML;
            // replace an existing wmode parameter
            if (html.match(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")[a-zA-Z]+('|")\s*\/?\>/i))
                new_object = html.replace(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")window('|")\s*\/?\>/i, "<param name='wmode' value='transparent' />");
            // add a new wmode parameter
            else
                new_object = html.replace(/<\/object\>/i, "<param name='wmode' value='transparent' />\n</object>");
            // loop through each of the param tags
            var children = object.childNodes;
            for (j = 0; j < children.length; j++) {
                try {
                    if (children[j] != null) {
                        var theName = children[j].getAttribute('name');
                        if (theName != null && theName.match(/flashvars/i)) {
                            new_object = new_object.replace(/<param\s+name\s*=\s*('|")flashvars('|")\s+value\s*=\s*('|")[^'"]*('|")\s*\/?\>/i, "<param name='flashvars' value='" + children[j].getAttribute('value') + "' />");
                        }
                    }
                }
                catch (err) {
                }
            }
            // replace the old embed object with the fixed versiony
            object.insertAdjacentHTML('beforeBegin', new_object);
            object.parentNode.removeChild(object);
        }
    }
}



//PLUGIN: jquery.prettyphoto.js
/* ------------------------------------------------------------------------
	Class: prettyPhoto
	Use: Lightbox clone for jQuery
	Author: Stephane Caron (http://www.no-margin-for-errors.com)
	Version: 3.1.3
------------------------------------------------------------------------- */

(function($){$.prettyPhoto={version:'3.1.3'};$.fn.prettyPhoto=function(pp_settings){pp_settings=jQuery.extend({animation_speed:'fast',slideshow:5000,autoplay_slideshow:false,opacity:0.80,show_title:true,allow_resize:true,default_width:500,default_height:344,counter_separator_label:'/',theme:'pp_default',horizontal_padding:20,hideflash:false,wmode:'opaque',autoplay:true,modal:false,deeplinking:true,overlay_gallery:true,keyboard_shortcuts:true,changepicturecallback:function(){},callback:function(){},ie6_fallback:true,markup:'<div class="pp_pic_holder"> \
      <div class="ppt">&nbsp;</div> \
      <div class="pp_top"> \
       <div class="pp_left"></div> \
       <div class="pp_middle"></div> \
       <div class="pp_right"></div> \
      </div> \
      <div class="pp_content_container"> \
       <div class="pp_left"> \
       <div class="pp_right"> \
        <div class="pp_content"> \
         <div class="pp_loaderIcon"></div> \
         <div class="pp_fade"> \
          <a href="#" class="pp_expand" title="Expand the image">Expand</a> \
          <div class="pp_hoverContainer"> \
           <a class="pp_next" href="#">next</a> \
           <a class="pp_previous" href="#">previous</a> \
          </div> \
          <div id="pp_full_res"></div> \
          <div class="pp_details"> \
           <div class="pp_nav"> \
            <a href="#" class="pp_arrow_previous">Previous</a> \
            <p class="currentTextHolder">0/0</p> \
            <a href="#" class="pp_arrow_next">Next</a> \
           </div> \
           <p class="pp_description"></p> \
           <div class="pp_social">{pp_social}</div> \
           <a class="pp_close" href="#">Close</a> \
          </div> \
         </div> \
        </div> \
       </div> \
       </div> \
      </div> \
      <div class="pp_bottom"> \
       <div class="pp_left"></div> \
       <div class="pp_middle"></div> \
       <div class="pp_right"></div> \
      </div> \
     </div> \
     <div class="pp_overlay"></div>',gallery_markup:'<div class="pp_gallery"> \
        <a href="#" class="pp_arrow_previous">Previous</a> \
        <div> \
         <ul> \
          {gallery} \
         </ul> \
        </div> \
        <a href="#" class="pp_arrow_next">Next</a> \
       </div>',image_markup:'<img id="fullResImage" src="{path}" />',flash_markup:'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',quicktime_markup:'<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',iframe_markup:'<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',inline_markup:'<div class="pp_inline">{content}</div>',custom_markup:'',social_tools:'<div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="http://www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>'},pp_settings);var matchedObjects=this,percentBased=false,pp_dimensions,pp_open,pp_contentHeight,pp_contentWidth,pp_containerHeight,pp_containerWidth,windowHeight=$(window).height(),windowWidth=$(window).width(),pp_slideshow;doresize=true,scroll_pos=_get_scroll();$(window).unbind('resize.prettyphoto').bind('resize.prettyphoto',function(){_center_overlay();_resize_overlay();});if(pp_settings.keyboard_shortcuts){$(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto',function(e){if(typeof $pp_pic_holder!='undefined'){if($pp_pic_holder.is(':visible')){switch(e.keyCode){case 37:$.prettyPhoto.changePage('previous');e.preventDefault();break;case 39:$.prettyPhoto.changePage('next');e.preventDefault();break;case 27:if(!settings.modal)
$.prettyPhoto.close();e.preventDefault();break;};};};});};$.prettyPhoto.initialize=function(){settings=pp_settings;if(settings.theme=='pp_default')settings.horizontal_padding=16;if(settings.ie6_fallback&&$.browser.msie&&parseInt($.browser.version)==6)settings.theme="light_square";theRel=$(this).attr('rel');galleryRegExp=/\[(?:.*)\]/;isSet=(galleryRegExp.exec(theRel))?true:false;pp_images=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr('rel').indexOf(theRel)!=-1)return $(n).attr('href');}):$.makeArray($(this).attr('href'));pp_titles=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr('rel').indexOf(theRel)!=-1)return($(n).find('img').attr('alt'))?$(n).find('img').attr('alt'):"";}):$.makeArray($(this).find('img').attr('alt'));pp_descriptions=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr('rel').indexOf(theRel)!=-1)return($(n).attr('title'))?$(n).attr('title'):"";}):$.makeArray($(this).attr('title'));if(pp_images.length>30)settings.overlay_gallery=false;set_position=jQuery.inArray($(this).attr('href'),pp_images);rel_index=(isSet)?set_position:$("a[rel^='"+theRel+"']").index($(this));_build_overlay(this);if(settings.allow_resize)
$(window).bind('scroll.prettyphoto',function(){_center_overlay();});$.prettyPhoto.open();return false;}
$.prettyPhoto.open=function(event){if(typeof settings=="undefined"){settings=pp_settings;if($.browser.msie&&$.browser.version==6)settings.theme="light_square";pp_images=$.makeArray(arguments[0]);pp_titles=(arguments[1])?$.makeArray(arguments[1]):$.makeArray("");pp_descriptions=(arguments[2])?$.makeArray(arguments[2]):$.makeArray("");isSet=(pp_images.length>1)?true:false;set_position=0;_build_overlay(event.target);}
if($.browser.msie&&$.browser.version==6)$('select').css('visibility','hidden');if(settings.hideflash)$('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','hidden');_checkPosition($(pp_images).size());$('.pp_loaderIcon').show();if(settings.deeplinking)
setHashtag();if(settings.social_tools){facebook_like_link=settings.social_tools.replace('{location_href}',encodeURIComponent(location.href));$pp_pic_holder.find('.pp_social').html(facebook_like_link);}
if($ppt.is(':hidden'))$ppt.css('opacity',0).show();$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);$pp_pic_holder.find('.currentTextHolder').text((set_position+1)+settings.counter_separator_label+$(pp_images).size());if(pp_descriptions[set_position]!=""){$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));}else{$pp_pic_holder.find('.pp_description').hide();}
movie_width=(parseFloat(getParam('width',pp_images[set_position])))?getParam('width',pp_images[set_position]):settings.default_width.toString();movie_height=(parseFloat(getParam('height',pp_images[set_position])))?getParam('height',pp_images[set_position]):settings.default_height.toString();percentBased=false;if(movie_height.indexOf('%')!=-1){movie_height=parseFloat(($(window).height()*parseFloat(movie_height)/100)-150);percentBased=true;}
if(movie_width.indexOf('%')!=-1){movie_width=parseFloat(($(window).width()*parseFloat(movie_width)/100)-150);percentBased=true;}
$pp_pic_holder.fadeIn(function(){(settings.show_title&&pp_titles[set_position]!=""&&typeof pp_titles[set_position]!="undefined")?$ppt.html(unescape(pp_titles[set_position])):$ppt.html('&nbsp;');imgPreloader="";skipInjection=false;switch(_getFileType(pp_images[set_position])){case'image':imgPreloader=new Image();nextImage=new Image();if(isSet&&set_position<$(pp_images).size()-1)nextImage.src=pp_images[set_position+1];prevImage=new Image();if(isSet&&pp_images[set_position-1])prevImage.src=pp_images[set_position-1];$pp_pic_holder.find('#pp_full_res')[0].innerHTML=settings.image_markup.replace(/{path}/g,pp_images[set_position]);imgPreloader.onload=function(){pp_dimensions=_fitToViewport(imgPreloader.width,imgPreloader.height);_showContent();};imgPreloader.onerror=function(){alert('Image cannot be loaded. Make sure the path is correct and image exist.');$.prettyPhoto.close();};imgPreloader.src=pp_images[set_position];break;case'youtube':pp_dimensions=_fitToViewport(movie_width,movie_height);movie_id=getParam('v',pp_images[set_position]);if(movie_id==""){movie_id=pp_images[set_position].split('youtu.be/');movie_id=movie_id[1];if(movie_id.indexOf('?')>0)
movie_id=movie_id.substr(0,movie_id.indexOf('?'));if(movie_id.indexOf('&')>0)
movie_id=movie_id.substr(0,movie_id.indexOf('&'));}
movie='http://www.youtube.com/embed/'+movie_id;(getParam('rel',pp_images[set_position]))?movie+="?rel="+getParam('rel',pp_images[set_position]):movie+="?rel=1";if(settings.autoplay)movie+="&autoplay=1";toInject=settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);break;case'vimeo':pp_dimensions=_fitToViewport(movie_width,movie_height);movie_id=pp_images[set_position];var regExp=/http:\/\/(www\.)?vimeo.com\/(\d+)/;var match=movie_id.match(regExp);movie='http://player.vimeo.com/video/'+match[2]+'?title=0&amp;byline=0&amp;portrait=0';if(settings.autoplay)movie+="&autoplay=1;";vimeo_width=pp_dimensions['width']+'/embed/?moog_width='+pp_dimensions['width'];toInject=settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,movie);break;case'quicktime':pp_dimensions=_fitToViewport(movie_width,movie_height);pp_dimensions['height']+=15;pp_dimensions['contentHeight']+=15;pp_dimensions['containerHeight']+=15;toInject=settings.quicktime_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);break;case'flash':pp_dimensions=_fitToViewport(movie_width,movie_height);flash_vars=pp_images[set_position];flash_vars=flash_vars.substring(pp_images[set_position].indexOf('flashvars')+10,pp_images[set_position].length);filename=pp_images[set_position];filename=filename.substring(0,filename.indexOf('?'));toInject=settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);break;case'iframe':pp_dimensions=_fitToViewport(movie_width,movie_height);frame_url=pp_images[set_position];frame_url=frame_url.substr(0,frame_url.indexOf('iframe')-1);toInject=settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url);break;case'ajax':doresize=false;pp_dimensions=_fitToViewport(movie_width,movie_height);doresize=true;skipInjection=true;$.get(pp_images[set_position],function(responseHTML){toInject=settings.inline_markup.replace(/{content}/g,responseHTML);$pp_pic_holder.find('#pp_full_res')[0].innerHTML=toInject;_showContent();});break;case'custom':pp_dimensions=_fitToViewport(movie_width,movie_height);toInject=settings.custom_markup;break;case'inline':myClone=$(pp_images[set_position]).clone().append('<br clear="all" />').css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo($('body')).show();doresize=false;pp_dimensions=_fitToViewport($(myClone).width(),$(myClone).height());doresize=true;$(myClone).remove();toInject=settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());break;};if(!imgPreloader&&!skipInjection){$pp_pic_holder.find('#pp_full_res')[0].innerHTML=toInject;_showContent();};});return false;};$.prettyPhoto.changePage=function(direction){currentGalleryPage=0;if(direction=='previous'){set_position--;if(set_position<0)set_position=$(pp_images).size()-1;}else if(direction=='next'){set_position++;if(set_position>$(pp_images).size()-1)set_position=0;}else{set_position=direction;};rel_index=set_position;if(!doresize)doresize=true;$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');_hideContent(function(){$.prettyPhoto.open();});};$.prettyPhoto.changeGalleryPage=function(direction){if(direction=='next'){currentGalleryPage++;if(currentGalleryPage>totalPage)currentGalleryPage=0;}else if(direction=='previous'){currentGalleryPage--;if(currentGalleryPage<0)currentGalleryPage=totalPage;}else{currentGalleryPage=direction;};slide_speed=(direction=='next'||direction=='previous')?settings.animation_speed:0;slide_to=currentGalleryPage*(itemsPerPage*itemWidth);$pp_gallery.find('ul').animate({left:-slide_to},slide_speed);};$.prettyPhoto.startSlideshow=function(){if(typeof pp_slideshow=='undefined'){$pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){$.prettyPhoto.stopSlideshow();return false;});pp_slideshow=setInterval($.prettyPhoto.startSlideshow,settings.slideshow);}else{$.prettyPhoto.changePage('next');};}
$.prettyPhoto.stopSlideshow=function(){$pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){$.prettyPhoto.startSlideshow();return false;});clearInterval(pp_slideshow);pp_slideshow=undefined;}
$.prettyPhoto.close=function(){if($pp_overlay.is(":animated"))return;$.prettyPhoto.stopSlideshow();$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){$(this).remove();});$pp_overlay.fadeOut(settings.animation_speed,function(){if($.browser.msie&&$.browser.version==6)$('select').css('visibility','visible');if(settings.hideflash)$('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','visible');$(this).remove();$(window).unbind('scroll.prettyphoto');clearHashtag();settings.callback();doresize=true;pp_open=false;delete settings;});};function _showContent(){$('.pp_loaderIcon').hide();projectedTop=scroll_pos['scrollTop']+((windowHeight/2)-(pp_dimensions['containerHeight']/2));if(projectedTop<0)projectedTop=0;$ppt.fadeTo(settings.animation_speed,1);$pp_pic_holder.find('.pp_content').animate({height:pp_dimensions['contentHeight'],width:pp_dimensions['contentWidth']},settings.animation_speed);$pp_pic_holder.animate({'top':projectedTop,'left':(windowWidth/2)-(pp_dimensions['containerWidth']/2),width:pp_dimensions['containerWidth']},settings.animation_speed,function(){$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']);$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed);if(isSet&&_getFileType(pp_images[set_position])=="image"){$pp_pic_holder.find('.pp_hoverContainer').show();}else{$pp_pic_holder.find('.pp_hoverContainer').hide();}
if(pp_dimensions['resized']){$('a.pp_expand,a.pp_contract').show();}else{$('a.pp_expand').hide();}
if(settings.autoplay_slideshow&&!pp_slideshow&&!pp_open)$.prettyPhoto.startSlideshow();settings.changepicturecallback();pp_open=true;});_insert_gallery();};function _hideContent(callback){$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');$pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed,function(){$('.pp_loaderIcon').show();callback();});};function _checkPosition(setCount){(setCount>1)?$('.pp_nav').show():$('.pp_nav').hide();};function _fitToViewport(width,height){resized=false;_getDimensions(width,height);imageWidth=width,imageHeight=height;if(((pp_containerWidth>windowWidth)||(pp_containerHeight>windowHeight))&&doresize&&settings.allow_resize&&!percentBased){resized=true,fitting=false;while(!fitting){if((pp_containerWidth>windowWidth)){imageWidth=(windowWidth-200);imageHeight=(height/width)*imageWidth;}else if((pp_containerHeight>windowHeight)){imageHeight=(windowHeight-200);imageWidth=(width/height)*imageHeight;}else{fitting=true;};pp_containerHeight=imageHeight,pp_containerWidth=imageWidth;};_getDimensions(imageWidth,imageHeight);if((pp_containerWidth>windowWidth)||(pp_containerHeight>windowHeight)){_fitToViewport(pp_containerWidth,pp_containerHeight)};};return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(pp_containerHeight),containerWidth:Math.floor(pp_containerWidth)+(settings.horizontal_padding*2),contentHeight:Math.floor(pp_contentHeight),contentWidth:Math.floor(pp_contentWidth),resized:resized};};function _getDimensions(width,height){width=parseFloat(width);height=parseFloat(height);$pp_details=$pp_pic_holder.find('.pp_details');$pp_details.width(width);detailsHeight=parseFloat($pp_details.css('marginTop'))+parseFloat($pp_details.css('marginBottom'));$pp_details=$pp_details.clone().addClass(settings.theme).width(width).appendTo($('body')).css({'position':'absolute','top':-10000});detailsHeight+=$pp_details.height();detailsHeight=(detailsHeight<=34)?36:detailsHeight;if($.browser.msie&&$.browser.version==7)detailsHeight+=8;$pp_details.remove();$pp_title=$pp_pic_holder.find('.ppt');$pp_title.width(width);titleHeight=parseFloat($pp_title.css('marginTop'))+parseFloat($pp_title.css('marginBottom'));$pp_title=$pp_title.clone().appendTo($('body')).css({'position':'absolute','top':-10000});titleHeight+=$pp_title.height();$pp_title.remove();pp_contentHeight=height+detailsHeight;pp_contentWidth=width;pp_containerHeight=pp_contentHeight+titleHeight+$pp_pic_holder.find('.pp_top').height()+$pp_pic_holder.find('.pp_bottom').height();pp_containerWidth=width;}
function _getFileType(itemSrc){if(itemSrc.match(/youtube\.com\/watch/i)||itemSrc.match(/youtu\.be/i)){return'youtube';}else if(itemSrc.match(/vimeo\.com/i)){return'vimeo';}else if(itemSrc.match(/\b.mov\b/i)){return'quicktime';}else if(itemSrc.match(/\b.swf\b/i)){return'flash';}else if(itemSrc.match(/\biframe=true\b/i)){return'iframe';}else if(itemSrc.match(/\bajax=true\b/i)){return'ajax';}else if(itemSrc.match(/\bcustom=true\b/i)){return'custom';}else if(itemSrc.substr(0,1)=='#'){return'inline';}else{return'image';};};function _center_overlay(){if(doresize&&typeof $pp_pic_holder!='undefined'){scroll_pos=_get_scroll();contentHeight=$pp_pic_holder.height(),contentwidth=$pp_pic_holder.width();projectedTop=(windowHeight/2)+scroll_pos['scrollTop']-(contentHeight/2);if(projectedTop<0)projectedTop=0;if(contentHeight>windowHeight)
return;$pp_pic_holder.css({'top':projectedTop,'left':(windowWidth/2)+scroll_pos['scrollLeft']-(contentwidth/2)});};};function _get_scroll(){if(self.pageYOffset){return{scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};}else if(document.documentElement&&document.documentElement.scrollTop){return{scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};}else if(document.body){return{scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};};};function _resize_overlay(){windowHeight=$(window).height(),windowWidth=$(window).width();if(typeof $pp_overlay!="undefined")$pp_overlay.height($(document).height()).width(windowWidth);};function _insert_gallery(){if(isSet&&settings.overlay_gallery&&_getFileType(pp_images[set_position])=="image"&&(settings.ie6_fallback&&!($.browser.msie&&parseInt($.browser.version)==6))){itemWidth=52+5;navWidth=(settings.theme=="facebook"||settings.theme=="pp_default")?50:30;itemsPerPage=Math.floor((pp_dimensions['containerWidth']-100-navWidth)/itemWidth);itemsPerPage=(itemsPerPage<pp_images.length)?itemsPerPage:pp_images.length;totalPage=Math.ceil(pp_images.length/itemsPerPage)-1;if(totalPage==0){navWidth=0;$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').hide();}else{$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').show();};galleryWidth=itemsPerPage*itemWidth;fullGalleryWidth=pp_images.length*itemWidth;$pp_gallery.css('margin-left',-((galleryWidth/2)+(navWidth/2))).find('div:first').width(galleryWidth+5).find('ul').width(fullGalleryWidth).find('li.selected').removeClass('selected');goToPage=(Math.floor(set_position/itemsPerPage)<totalPage)?Math.floor(set_position/itemsPerPage):totalPage;$.prettyPhoto.changeGalleryPage(goToPage);$pp_gallery_li.filter(':eq('+set_position+')').addClass('selected');}else{$pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');}}
function _build_overlay(caller){if(settings.social_tools)
facebook_like_link=settings.social_tools.replace('{location_href}',encodeURIComponent(location.href));settings.markup=settings.markup.replace('{pp_social}',(settings.social_tools)?facebook_like_link:'');$('body').append(settings.markup);$pp_pic_holder=$('.pp_pic_holder'),$ppt=$('.ppt'),$pp_overlay=$('div.pp_overlay');if(isSet&&settings.overlay_gallery){currentGalleryPage=0;toInject="";for(var i=0;i<pp_images.length;i++){if(!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)){classname='default';img_src='';}else{classname='';img_src=pp_images[i];}
toInject+="<li class='"+classname+"'><a href='#'><img src='"+img_src+"' width='50' alt='' /></a></li>";};toInject=settings.gallery_markup.replace(/{gallery}/g,toInject);$pp_pic_holder.find('#pp_full_res').after(toInject);$pp_gallery=$('.pp_pic_holder .pp_gallery'),$pp_gallery_li=$pp_gallery.find('li');$pp_gallery.find('.pp_arrow_next').click(function(){$.prettyPhoto.changeGalleryPage('next');$.prettyPhoto.stopSlideshow();return false;});$pp_gallery.find('.pp_arrow_previous').click(function(){$.prettyPhoto.changeGalleryPage('previous');$.prettyPhoto.stopSlideshow();return false;});$pp_pic_holder.find('.pp_content').hover(function(){$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();},function(){$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();});itemWidth=52+5;$pp_gallery_li.each(function(i){$(this).find('a').click(function(){$.prettyPhoto.changePage(i);$.prettyPhoto.stopSlideshow();return false;});});};if(settings.slideshow){$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
$pp_pic_holder.find('.pp_nav .pp_play').click(function(){$.prettyPhoto.startSlideshow();return false;});}
$pp_pic_holder.attr('class','pp_pic_holder '+settings.theme);$pp_overlay.css({'opacity':0,'height':$(document).height(),'width':$(window).width()}).bind('click',function(){if(!settings.modal)$.prettyPhoto.close();});$('a.pp_close').bind('click',function(){$.prettyPhoto.close();return false;});$('a.pp_expand').bind('click',function(e){if($(this).hasClass('pp_expand')){$(this).removeClass('pp_expand').addClass('pp_contract');doresize=false;}else{$(this).removeClass('pp_contract').addClass('pp_expand');doresize=true;};_hideContent(function(){$.prettyPhoto.open();});return false;});$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){$.prettyPhoto.changePage('previous');$.prettyPhoto.stopSlideshow();return false;});$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){$.prettyPhoto.changePage('next');$.prettyPhoto.stopSlideshow();return false;});_center_overlay();};if(!pp_alreadyInitialized&&getHashtag()){pp_alreadyInitialized=true;hashIndex=getHashtag();hashRel=hashIndex;hashIndex=hashIndex.substring(hashIndex.indexOf('/')+1,hashIndex.length-1);hashRel=hashRel.substring(0,hashRel.indexOf('/'));setTimeout(function(){$("a[rel^='"+hashRel+"']:eq("+hashIndex+")").trigger('click');},50);}
return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize);};function getHashtag(){url=location.href;hashtag=(url.indexOf('#!')!=-1)?decodeURI(url.substring(url.indexOf('#!')+2,url.length)):false;return hashtag;};function setHashtag(){if(typeof theRel=='undefined')return;location.hash='!'+theRel+'/'+rel_index+'/';};function clearHashtag(){url=location.href;hashtag=(url.indexOf('#!prettyPhoto'))?true:false;if(hashtag)location.hash="!prettyPhoto";}
function getParam(name,url){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(url);return(results==null)?"":results[1];}})(jQuery);var pp_alreadyInitialized=false;


// PLUGIN: jquery.cycle
/*!
 * jQuery Cycle Plugin (with Transition Definitions)
 * Examples and documentation at: http://jquery.malsup.com/cycle/
 * Copyright (c) 2007-2010 M. Alsup
 * Version: 2.9995 (09-AUG-2011)
 * Dual licensed under the MIT and GPL licenses.
 * http://jquery.malsup.com/license.html
 * Requires: jQuery v1.3.2 or later
 */
(function(a){var n="click.cycle",m="none",o="absolute",j="auto",l="position",d=true,c=null,g="cycle.opts",b=false,A="2.9995";if(a.support==undefined)a.support={opacity:!a.browser.msie};function f(b){a.fn.cycle.debug&&e(b)}function e(){window.console&&console.log&&console.log("[cycle] "+Array.prototype.join.call(arguments," "))}a.expr[":"].paused=function(a){return a.cyclePause};a.fn.cycle=function(g,h){var c=this,d={s:c.selector,c:c.context};if(c.length===0&&g!="stop"){if(!a.isReady&&d.s){e("DOM not ready, queuing slideshow");a(function(){a(d.s,d.c).cycle(g,h)});return c}e("terminating; zero elements found by selector"+(a.isReady?"":" (DOM not ready)"));return c}return c.each(function(){var c=this,k=v(c,g,h);if(k===b)return;k.updateActivePagerLink=k.updateActivePagerLink||a.fn.cycle.updateActivePagerLink;c.cycleTimeout&&clearTimeout(c.cycleTimeout);c.cycleTimeout=c.cyclePause=0;var o=a(c),n=k.slideExpr?a(k.slideExpr,c):o.children(),m=n.get(),j=x(o,n,m,k,d);if(j===b)return;if(m.length<2){e("terminating; too few slides: "+m.length);return}var l=j.continuous?10:s(m[j.currSlide],m[j.nextSlide],j,!j.backwards);if(l){l+=j.delay||0;if(l<10)l=10;f("first timeout: "+l);c.cycleTimeout=setTimeout(function(){i(m,j,0,!k.backwards)},l)}})};function h(c,d,e){var b=a(c).data(g),f=!!c.cyclePause;if(f&&b.paused)b.paused(c,b,d,e);else!f&&b.resumed&&b.resumed(c,b,d,e)}function v(f,j,m){if(f.cycleStop==undefined)f.cycleStop=0;if(j===undefined||j===c)j={};if(j.constructor==String){switch(j){case"destroy":case"stop":var k=a(f).data(g);if(!k)return b;f.cycleStop++;f.cycleTimeout&&clearTimeout(f.cycleTimeout);f.cycleTimeout=0;k.elements&&a(k.elements).stop();a(f).removeData(g);j=="destroy"&&z(k);return b;case"toggle":f.cyclePause=f.cyclePause===1?0:1;n(f.cyclePause,m,f);h(f);return b;case"pause":f.cyclePause=1;h(f);return b;case"resume":f.cyclePause=0;n(b,m,f);h(f);return b;case"prev":case"next":var k=a(f).data(g);if(!k){e('options not found, "prev/next" ignored');return b}a.fn.cycle[j](k);return b;default:j={fx:j}}return j}else if(j.constructor==Number){var l=j;j=a(f).data(g);if(!j){e("options not found, can not advance slide");return b}if(l<0||l>=j.elements.length){e("invalid slide index: "+l);return b}j.nextSlide=l;if(f.cycleTimeout){clearTimeout(f.cycleTimeout);f.cycleTimeout=0}if(typeof m=="string")j.oneTimeFx=m;i(j.elements,j,1,l>=j.currSlide);return b}return j;function n(h,j,f){if(!h&&j===d){var c=a(f).data(g);if(!c){e("options not found, can not resume");return b}if(f.cycleTimeout){clearTimeout(f.cycleTimeout);f.cycleTimeout=0}i(c.elements,c,1,!c.backwards)}}}function r(b,c){if(!a.support.opacity&&c.cleartype&&b.style.filter)try{b.style.removeAttribute("filter")}catch(d){}}function z(b){b.next&&a(b.next).unbind(b.prevNextEvent);b.prev&&a(b.prev).unbind(b.prevNextEvent);(b.pager||b.pagerAnchorBuilder)&&a.each(b.pagerAnchors||[],function(){this.unbind().remove()});b.pagerAnchors=c;b.destroy&&b.destroy(b)}function x(p,v,n,z,K){var x="px",f=a.extend({},a.fn.cycle.defaults,z||{},a.metadata?p.metadata():a.meta?p.data():{}),O=a.isFunction(p.data)?p.data(f.metaAttr):c;if(O)f=a.extend(f,O);if(f.autostop)f.countdown=f.autostopCount||n.length;var H=p[0];p.data(g,f);f.$cont=p;f.stopCount=H.cycleStop;f.elements=n;f.before=f.before?[f.before]:[];f.after=f.after?[f.after]:[];!a.support.opacity&&f.cleartype&&f.after.push(function(){r(this,f)});f.continuous&&f.after.push(function(){i(n,f,0,!f.backwards)});u(f);!a.support.opacity&&f.cleartype&&!f.cleartypeNoBg&&q(v);p.css(l)=="static"&&p.css(l,"relative");f.width&&p.width(f.width);f.height&&f.height!=j&&p.height(f.height);if(f.startingSlide)f.startingSlide=parseInt(f.startingSlide,10);else if(f.backwards)f.startingSlide=n.length-1;if(f.random){f.randomMap=[];for(var I=0;I<n.length;I++)f.randomMap.push(I);f.randomMap.sort(function(){return Math.random()-.5});f.randomIndex=1;f.startingSlide=f.randomMap[1]}else if(f.startingSlide>=n.length)f.startingSlide=0;f.currSlide=f.startingSlide||0;var s=f.startingSlide;v.css({position:o,top:0,left:0}).hide().each(function(b){var c;if(f.backwards)c=s?b<=s?n.length+(b-s):s-b:n.length-b;else c=s?b>=s?n.length-(b-s):s-b:n.length-b;a(this).css("z-index",c)});a(n[s]).css("opacity",1).show();r(n[s],f);if(f.fit)if(!f.aspect){f.width&&v.width(f.width);f.height&&f.height!=j&&v.height(f.height)}else v.each(function(){var b=a(this),c=f.aspect===d?b.width()/b.height():f.aspect;if(f.width&&b.width()!=f.width){b.width(f.width);b.height(f.width/c)}if(f.height&&b.height()<f.height){b.height(f.height);b.width(f.height*c)}});f.center&&(!f.fit||f.aspect)&&v.each(function(){var b=a(this);b.css({"margin-left":f.width?(f.width-b.width())/2+x:0,"margin-top":f.height?(f.height-b.height())/2+x:0})});f.center&&!f.fit&&!f.slideResize&&v.each(function(){var b=a(this);b.css({"margin-left":f.width?(f.width-b.width())/2+x:0,"margin-top":f.height?(f.height-b.height())/2+x:0})});var P=f.containerResize&&!p.innerHeight();if(P){for(var C=0,B=0,J=0;J<n.length;J++){var D=a(n[J]),E=D[0],G=D.outerWidth(),F=D.outerHeight();if(!G)G=E.offsetWidth||E.width||D.attr("width");if(!F)F=E.offsetHeight||E.height||D.attr("height");C=G>C?G:C;B=F>B?F:B}C>0&&B>0&&p.css({width:C+x,height:B+x})}var L=b;f.pause&&p.hover(function(){L=d;this.cyclePause++;h(H,d)},function(){L&&this.cyclePause--;h(H,d)});if(t(f)===b)return b;var M=b;z.requeueAttempts=z.requeueAttempts||0;v.each(function(){var c=this,g=a(c);c.cycleH=f.fit&&f.height?f.height:g.height()||c.offsetHeight||c.height||g.attr("height")||0;c.cycleW=f.fit&&f.width?f.width:g.width()||c.offsetWidth||c.width||g.attr("width")||0;if(g.is("img")){var j=a.browser.msie&&c.cycleW==28&&c.cycleH==30&&!c.complete,i=a.browser.mozilla&&c.cycleW==34&&c.cycleH==19&&!c.complete,k=a.browser.opera&&(c.cycleW==42&&c.cycleH==19||c.cycleW==37&&c.cycleH==17)&&!c.complete,h=c.cycleH==0&&c.cycleW==0&&!c.complete;if(j||i||k||h)if(K.s&&f.requeueOnImageNotLoaded&&++z.requeueAttempts<100){e(z.requeueAttempts," - img slide not loaded, requeuing slideshow: ",c.src,c.cycleW,c.cycleH);setTimeout(function(){a(K.s,K.c).cycle(z)},f.requeueTimeout);M=d;return b}else e("could not determine size of image: "+c.src,c.cycleW,c.cycleH)}return d});if(M)return b;f.cssBefore=f.cssBefore||{};f.cssAfter=f.cssAfter||{};f.cssFirst=f.cssFirst||{};f.animIn=f.animIn||{};f.animOut=f.animOut||{};v.not(":eq("+s+")").css(f.cssBefore);a(v[s]).css(f.cssFirst);if(f.timeout){f.timeout=parseInt(f.timeout,10);if(f.speed.constructor==String)f.speed=a.fx.speeds[f.speed]||parseInt(f.speed,10);if(!f.sync)f.speed=f.speed/2;var Q=f.fx==m?0:f.fx=="shuffle"?500:250;while(f.timeout-f.speed<Q)f.timeout+=f.speed}if(f.easing)f.easeIn=f.easeOut=f.easing;if(!f.speedIn)f.speedIn=f.speed;if(!f.speedOut)f.speedOut=f.speed;f.slideCount=n.length;f.currSlide=f.lastSlide=s;if(f.random){if(++f.randomIndex==n.length)f.randomIndex=0;f.nextSlide=f.randomMap[f.randomIndex]}else if(f.backwards)f.nextSlide=f.startingSlide==0?n.length-1:f.startingSlide-1;else f.nextSlide=f.startingSlide>=n.length-1?0:f.startingSlide+1;if(!f.multiFx){var N=a.fn.cycle.transitions[f.fx];if(a.isFunction(N))N(p,v,f);else if(f.fx!="custom"&&!f.multiFx){e("unknown transition: "+f.fx,"; slideshow terminating");return b}}var A=v[s];if(!f.skipInitializationCallbacks){f.before.length&&f.before[0].apply(A,[A,A,f,d]);f.after.length&&f.after[0].apply(A,[A,A,f,d])}f.next&&a(f.next).bind(f.prevNextEvent,function(){return k(f,1)});f.prev&&a(f.prev).bind(f.prevNextEvent,function(){return k(f,0)});(f.pager||f.pagerAnchorBuilder)&&y(n,f);w(f,n);return f}function u(b){b.original={before:[],after:[]};b.original.cssBefore=a.extend({},b.cssBefore);b.original.cssAfter=a.extend({},b.cssAfter);b.original.animIn=a.extend({},b.animIn);b.original.animOut=a.extend({},b.animOut);a.each(b.before,function(){b.original.before.push(this)});a.each(b.after,function(){b.original.after.push(this)})}function t(c){var g,i,h=a.fn.cycle.transitions;if(c.fx.indexOf(",")>0){c.multiFx=d;c.fxs=c.fx.replace(/\s*/g,"").split(",");for(g=0;g<c.fxs.length;g++){var j=c.fxs[g];i=h[j];if(!i||!h.hasOwnProperty(j)||!a.isFunction(i)){e("discarding unknown transition: ",j);c.fxs.splice(g,1);g--}}if(!c.fxs.length){e("No valid transitions named; slideshow terminating.");return b}}else if(c.fx=="all"){c.multiFx=d;c.fxs=[];for(p in h){i=h[p];h.hasOwnProperty(p)&&a.isFunction(i)&&c.fxs.push(p)}}if(c.multiFx&&c.randomizeEffects){var k=Math.floor(Math.random()*20)+30;for(g=0;g<k;g++){var l=Math.floor(Math.random()*c.fxs.length);c.fxs.push(c.fxs.splice(l,1)[0])}f("randomized fx sequence: ",c.fxs)}return d}function w(b,c){b.addSlide=function(g,f){var d=a(g),e=d[0];if(!b.autostopCount)b.countdown++;c[f?"unshift":"push"](e);b.els&&b.els[f?"unshift":"push"](e);b.slideCount=c.length;d.css(l,o);d[f?"prependTo":"appendTo"](b.$cont);if(f){b.currSlide++;b.nextSlide++}!a.support.opacity&&b.cleartype&&!b.cleartypeNoBg&&q(d);b.fit&&b.width&&d.width(b.width);b.fit&&b.height&&b.height!=j&&d.height(b.height);e.cycleH=b.fit&&b.height?b.height:d.height();e.cycleW=b.fit&&b.width?b.width:d.width();d.css(b.cssBefore);(b.pager||b.pagerAnchorBuilder)&&a.fn.cycle.createPagerAnchor(c.length-1,e,a(b.pager),c,b);if(a.isFunction(b.onAddSlide))b.onAddSlide(d);else d.hide()}}a.fn.cycle.resetState=function(b,d){d=d||b.fx;b.before=[];b.after=[];b.cssBefore=a.extend({},b.original.cssBefore);b.cssAfter=a.extend({},b.original.cssAfter);b.animIn=a.extend({},b.original.animIn);b.animOut=a.extend({},b.original.animOut);b.fxFn=c;a.each(b.original.before,function(){b.before.push(this)});a.each(b.original.after,function(){b.after.push(this)});var e=a.fn.cycle.transitions[d];a.isFunction(e)&&e(b.$cont,a(b.elements),b)};function i(h,e,m,k){if(m&&e.busy&&e.manualTrump){f("manualTrump in go(), stopping active transition");a(h).stop(d,d);e.busy=0}if(e.busy){f("transition active, ignoring new tx request");return}var l=e.$cont[0],j=h[e.currSlide],g=h[e.nextSlide];if(l.cycleStop!=e.stopCount||l.cycleTimeout===0&&!m)return;if(!m&&!l.cyclePause&&!e.bounce&&(e.autostop&&--e.countdown<=0||e.nowrap&&!e.random&&e.nextSlide<e.currSlide)){e.end&&e.end(e);return}var q=b;if((m||!l.cyclePause)&&e.nextSlide!=e.currSlide){q=d;var o=e.fx;j.cycleH=j.cycleH||a(j).height();j.cycleW=j.cycleW||a(j).width();g.cycleH=g.cycleH||a(g).height();g.cycleW=g.cycleW||a(g).width();if(e.multiFx){if(k&&(e.lastFx==undefined||++e.lastFx>=e.fxs.length))e.lastFx=0;else if(!k&&(e.lastFx==undefined||--e.lastFx<0))e.lastFx=e.fxs.length-1;o=e.fxs[e.lastFx]}if(e.oneTimeFx){o=e.oneTimeFx;e.oneTimeFx=c}a.fn.cycle.resetState(e,o);e.before.length&&a.each(e.before,function(b,a){if(l.cycleStop!=e.stopCount)return;a.apply(g,[j,g,e,k])});var r=function(){e.busy=0;a.each(e.after,function(b,a){if(l.cycleStop!=e.stopCount)return;a.apply(g,[j,g,e,k])})};f("tx firing("+o+"); currSlide: "+e.currSlide+"; nextSlide: "+e.nextSlide);e.busy=1;if(e.fxFn)e.fxFn(j,g,e,r,k,m&&e.fastOnEvent);else if(a.isFunction(a.fn.cycle[e.fx]))a.fn.cycle[e.fx](j,g,e,r,k,m&&e.fastOnEvent);else a.fn.cycle.custom(j,g,e,r,k,m&&e.fastOnEvent)}if(q||e.nextSlide==e.currSlide){e.lastSlide=e.currSlide;if(e.random){e.currSlide=e.nextSlide;if(++e.randomIndex==h.length)e.randomIndex=0;e.nextSlide=e.randomMap[e.randomIndex];if(e.nextSlide==e.currSlide)e.nextSlide=e.currSlide==e.slideCount-1?0:e.currSlide+1}else if(e.backwards){var n=e.nextSlide-1<0;if(n&&e.bounce){e.backwards=!e.backwards;e.nextSlide=1;e.currSlide=0}else{e.nextSlide=n?h.length-1:e.nextSlide-1;e.currSlide=n?0:e.nextSlide+1}}else{var n=e.nextSlide+1==h.length;if(n&&e.bounce){e.backwards=!e.backwards;e.nextSlide=h.length-2;e.currSlide=h.length-1}else{e.nextSlide=n?0:e.nextSlide+1;e.currSlide=n?h.length-1:e.nextSlide-1}}}q&&e.pager&&e.updateActivePagerLink(e.pager,e.currSlide,e.activePagerClass);var p=0;if(e.timeout&&!e.continuous)p=s(h[e.currSlide],h[e.nextSlide],e,k);else if(e.continuous&&l.cyclePause)p=10;if(p>0)l.cycleTimeout=setTimeout(function(){i(h,e,0,!e.backwards)},p)}a.fn.cycle.updateActivePagerLink=function(d,c,b){a(d).each(function(){a(this).children().removeClass(b).eq(c).addClass(b)})};function s(d,e,a,g){if(a.timeoutFn){var c=a.timeoutFn.call(d,d,e,a,g);while(a.fx!=m&&c-a.speed<250)c+=a.speed;f("calculated timeout: "+c+"; speed: "+a.speed);if(c!==b)return c}return a.timeout}a.fn.cycle.next=function(a){k(a,1)};a.fn.cycle.prev=function(a){k(a,0)};function k(c,f){var e=f?1:-1,d=c.elements,j=c.$cont[0],g=j.cycleTimeout;if(g){clearTimeout(g);j.cycleTimeout=0}if(c.random&&e<0){c.randomIndex--;if(--c.randomIndex==-2)c.randomIndex=d.length-2;else if(c.randomIndex==-1)c.randomIndex=d.length-1;c.nextSlide=c.randomMap[c.randomIndex]}else if(c.random)c.nextSlide=c.randomMap[c.randomIndex];else{c.nextSlide=c.currSlide+e;if(c.nextSlide<0){if(c.nowrap)return b;c.nextSlide=d.length-1}else if(c.nextSlide>=d.length){if(c.nowrap)return b;c.nextSlide=0}}var h=c.onPrevNextEvent||c.prevNextClick;a.isFunction(h)&&h(e>0,c.nextSlide,d[c.nextSlide]);i(d,c,1,f);return b}function y(c,b){var d=a(b.pager);a.each(c,function(e,f){a.fn.cycle.createPagerAnchor(e,f,d,c,b)});b.updateActivePagerLink(b.pager,b.startingSlide,b.activePagerClass)}a.fn.cycle.createPagerAnchor=function(j,r,l,q,c){var g;if(a.isFunction(c.pagerAnchorBuilder)){g=c.pagerAnchorBuilder(j,r);f("pagerAnchorBuilder("+j+", el) returned: "+g)}else g='<a href="#">'+(j+1)+"</a>";if(!g)return;var e=a(g);if(e.parents("body").length===0){var p=[];if(l.length>1){l.each(function(){var b=e.clone(d);a(this).append(b);p.push(b[0])});e=a(p)}else e.appendTo(l)}c.pagerAnchors=c.pagerAnchors||[];c.pagerAnchors.push(e);var o=function(f){f.preventDefault();c.nextSlide=j;var e=c.$cont[0],b=e.cycleTimeout;if(b){clearTimeout(b);e.cycleTimeout=0}var d=c.onPagerEvent||c.pagerClick;a.isFunction(d)&&d(c.nextSlide,q[c.nextSlide]);i(q,c,1,c.currSlide<j)};if(/mouseenter|mouseover/i.test(c.pagerEvent))e.hover(o,function(){});else e.bind(c.pagerEvent,o);!/^click/.test(c.pagerEvent)&&!c.allowPagerClickBubble&&e.bind(n,function(){return b});var k=c.$cont[0],m=b;c.pauseOnPagerHover&&e.hover(function(){m=d;k.cyclePause++;h(k,d,d)},function(){m&&k.cyclePause--;h(k,d,d)})};a.fn.cycle.hopsFromLast=function(c,e){var d,a=c.lastSlide,b=c.currSlide;if(e)d=b>a?b-a:c.slideCount-a;else d=b<a?a-b:a+c.slideCount-b;return d};function q(d){var c="background-color";f("applying clearType background-color hack");function b(a){a=parseInt(a,10).toString(16);return a.length<2?"0"+a:a}function e(e){for(;e&&e.nodeName.toLowerCase()!="html";e=e.parentNode){var d=a.css(e,c);if(d&&d.indexOf("rgb")>=0){var f=d.match(/\d+/g);return"#"+b(f[0])+b(f[1])+b(f[2])}if(d&&d!="transparent")return d}return"#ffffff"}d.each(function(){a(this).css(c,e(this))})}a.fn.cycle.commonReset=function(f,e,c,i,h,g){a(c.elements).not(f).hide();if(typeof c.cssBefore.opacity=="undefined")c.cssBefore.opacity=1;c.cssBefore.display="block";if(c.slideResize&&i!==b&&e.cycleW>0)c.cssBefore.width=e.cycleW;if(c.slideResize&&h!==b&&e.cycleH>0)c.cssBefore.height=e.cycleH;c.cssAfter=c.cssAfter||{};c.cssAfter.display=m;a(f).css("zIndex",c.slideCount+(g===d?1:0));a(e).css("zIndex",c.slideCount+(g===d?0:1))};a.fn.cycle.custom=function(l,m,b,n,o,d){var i=a(l),j=a(m),f=b.speedIn,e=b.speedOut,h=b.easeIn,g=b.easeOut;j.css(b.cssBefore);if(d){if(typeof d=="number")f=e=d;else f=e=1;h=g=c}var k=function(){j.animate(b.animIn,f,h,function(){n()})};i.animate(b.animOut,e,g,function(){i.css(b.cssAfter);!b.sync&&k()});b.sync&&k()};a.fn.cycle.transitions={fade:function(d,c,b){c.not(":eq("+b.currSlide+")").css("opacity",0);b.before.push(function(c,d,b){a.fn.cycle.commonReset(c,d,b);b.cssBefore.opacity=0});b.animIn={opacity:1};b.animOut={opacity:0};b.cssBefore={top:0,left:0}}};a.fn.cycle.ver=function(){return A};a.fn.cycle.defaults={activePagerClass:"activeSlide",after:c,allowPagerClickBubble:b,animIn:c,animOut:c,aspect:b,autostop:0,autostopCount:0,backwards:b,before:c,center:c,cleartype:!a.support.opacity,cleartypeNoBg:b,containerResize:1,continuous:0,cssAfter:c,cssBefore:c,delay:0,easeIn:c,easeOut:c,easing:c,end:c,fastOnEvent:0,fit:0,fx:"fade",fxFn:c,height:j,manualTrump:d,metaAttr:"cycle",next:c,nowrap:0,onPagerEvent:c,onPrevNextEvent:c,pager:c,pagerAnchorBuilder:c,pagerEvent:n,pause:0,pauseOnPagerHover:0,prev:c,prevNextEvent:n,random:0,randomizeEffects:1,requeueOnImageNotLoaded:d,requeueTimeout:250,rev:0,shuffle:c,skipInitializationCallbacks:b,slideExpr:c,slideResize:1,speed:1e3,speedIn:c,speedOut:c,startingSlide:0,sync:1,timeout:4e3,timeoutFn:c,updateActivePagerLink:c,width:c}})(jQuery);
/*!
 * jQuery Cycle Plugin Transition Definitions
 * This script is a plugin for the jQuery Cycle Plugin
 * Examples and documentation at: http://malsup.com/jquery/cycle/
 * Copyright (c) 2007-2010 M. Alsup
 * Version:	 2.73
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
(function(a){var f=10,c=false,e="hidden",d="overflow",b=true,g="block";a.fn.cycle.transitions.none=function(d,c,b){b.fxFn=function(c,d,e,b){a(d).show();a(c).hide();b()}};a.fn.cycle.transitions.fadeout=function(e,d,c){d.not(":eq("+c.currSlide+")").css({display:g,opacity:1});c.before.push(function(e,f,c,h,g,d){a(e).css("zIndex",c.slideCount+(!d===b?1:0));a(f).css("zIndex",c.slideCount+(!d===b?0:1))});c.animIn.opacity=1;c.animOut.opacity=0;c.cssBefore.opacity=1;c.cssBefore.display=g;c.cssAfter.zIndex=0};a.fn.cycle.transitions.scrollUp=function(c,g,b){c.css(d,e);b.before.push(a.fn.cycle.commonReset);var f=c.height();b.cssBefore.top=f;b.cssBefore.left=0;b.cssFirst.top=0;b.animIn.top=0;b.animOut.top=-f};a.fn.cycle.transitions.scrollDown=function(c,g,b){c.css(d,e);b.before.push(a.fn.cycle.commonReset);var f=c.height();b.cssFirst.top=0;b.cssBefore.top=-f;b.cssBefore.left=0;b.animIn.top=0;b.animOut.top=f};a.fn.cycle.transitions.scrollLeft=function(c,g,b){c.css(d,e);b.before.push(a.fn.cycle.commonReset);var f=c.width();b.cssFirst.left=0;b.cssBefore.left=f;b.cssBefore.top=0;b.animIn.left=0;b.animOut.left=0-f};a.fn.cycle.transitions.scrollRight=function(c,g,b){c.css(d,e);b.before.push(a.fn.cycle.commonReset);var f=c.width();b.cssFirst.left=0;b.cssBefore.left=-f;b.cssBefore.top=0;b.animIn.left=0;b.animOut.left=f};a.fn.cycle.transitions.scrollHorz=function(c,f,b){c.css(d,e).width();b.before.push(function(d,e,b,c){if(b.rev)c=!c;a.fn.cycle.commonReset(d,e,b);b.cssBefore.left=c?e.cycleW-1:1-e.cycleW;b.animOut.left=c?-d.cycleW:d.cycleW});b.cssFirst.left=0;b.cssBefore.top=0;b.animIn.left=0;b.animOut.top=0};a.fn.cycle.transitions.scrollVert=function(c,f,b){c.css(d,e);b.before.push(function(d,e,b,c){if(b.rev)c=!c;a.fn.cycle.commonReset(d,e,b);b.cssBefore.top=c?1-e.cycleH:e.cycleH-1;b.animOut.top=c?d.cycleH:-d.cycleH});b.cssFirst.top=0;b.cssBefore.left=0;b.animIn.top=0;b.animOut.left=0};a.fn.cycle.transitions.slideX=function(f,e,d){d.before.push(function(e,f,d){a(d.elements).not(e).hide();a.fn.cycle.commonReset(e,f,d,c,b);d.animIn.width=f.cycleW});d.cssBefore.left=0;d.cssBefore.top=0;d.cssBefore.width=0;d.animIn.width="show";d.animOut.width=0};a.fn.cycle.transitions.slideY=function(f,e,d){d.before.push(function(e,f,d){a(d.elements).not(e).hide();a.fn.cycle.commonReset(e,f,d,b,c);d.animIn.height=f.cycleH});d.cssBefore.left=0;d.cssBefore.top=0;d.cssBefore.height=0;d.animIn.height="show";d.animOut.height=0};a.fn.cycle.transitions.shuffle=function(i,h,c){var e,j=i.css(d,"visible").width();h.css({left:0,top:0});c.before.push(function(c,d,e){a.fn.cycle.commonReset(c,d,e,b,b,b)});if(!c.speedAdjusted){c.speed=c.speed/2;c.speedAdjusted=b}c.random=0;c.shuffle=c.shuffle||{left:-j,top:15};c.els=[];for(e=0;e<h.length;e++)c.els.push(h[e]);for(e=0;e<c.currSlide;e++)c.els.push(c.els.shift());c.fxFn=function(d,h,b,i,c){if(b.rev)c=!c;var e=c?a(d):a(h);a(h).css(b.cssBefore);var g=b.slideCount;e.animate(b.shuffle,b.speedIn,b.easeIn,function(){var j="z-index";for(var m=a.fn.cycle.hopsFromLast(b,c),l=0;l<m;l++)c?b.els.push(b.els.shift()):b.els.unshift(b.els.pop());if(c)for(var h=0,k=b.els.length;h<k;h++)a(b.els[h]).css(j,k-h+g);else{var n=a(d).css(j);e.css(j,parseInt(n,f)+1+g)}e.animate({left:0,top:0},b.speedOut,b.easeOut,function(){a(c?this:d).hide();i&&i()})})};a.extend(c.cssBefore,{display:g,opacity:1,top:0,left:0})};a.fn.cycle.transitions.turnUp=function(f,e,d){d.before.push(function(f,d,e){a.fn.cycle.commonReset(f,d,e,b,c);e.cssBefore.top=d.cycleH;e.animIn.height=d.cycleH;e.animOut.width=d.cycleW});d.cssFirst.top=0;d.cssBefore.left=0;d.cssBefore.height=0;d.animIn.top=0;d.animOut.height=0};a.fn.cycle.transitions.turnDown=function(f,e,d){d.before.push(function(e,f,d){a.fn.cycle.commonReset(e,f,d,b,c);d.animIn.height=f.cycleH;d.animOut.top=e.cycleH});d.cssFirst.top=0;d.cssBefore.left=0;d.cssBefore.top=0;d.cssBefore.height=0;d.animOut.height=0};a.fn.cycle.transitions.turnLeft=function(f,e,d){d.before.push(function(f,d,e){a.fn.cycle.commonReset(f,d,e,c,b);e.cssBefore.left=d.cycleW;e.animIn.width=d.cycleW});d.cssBefore.top=0;d.cssBefore.width=0;d.animIn.left=0;d.animOut.width=0};a.fn.cycle.transitions.turnRight=function(f,e,d){d.before.push(function(e,f,d){a.fn.cycle.commonReset(e,f,d,c,b);d.animIn.width=f.cycleW;d.animOut.left=e.cycleW});a.extend(d.cssBefore,{top:0,left:0,width:0});d.animIn.left=0;d.animOut.width=0};a.fn.cycle.transitions.zoom=function(f,e,d){d.before.push(function(f,d,e){a.fn.cycle.commonReset(f,d,e,c,c,b);e.cssBefore.top=d.cycleH/2;e.cssBefore.left=d.cycleW/2;a.extend(e.animIn,{top:0,left:0,width:d.cycleW,height:d.cycleH});a.extend(e.animOut,{width:0,height:0,top:f.cycleH/2,left:f.cycleW/2})});d.cssFirst.top=0;d.cssFirst.left=0;d.cssBefore.width=0;d.cssBefore.height=0};a.fn.cycle.transitions.fadeZoom=function(e,d,b){b.before.push(function(e,b,d){a.fn.cycle.commonReset(e,b,d,c,c);d.cssBefore.left=b.cycleW/2;d.cssBefore.top=b.cycleH/2;a.extend(d.animIn,{top:0,left:0,width:b.cycleW,height:b.cycleH})});b.cssBefore.width=0;b.cssBefore.height=0;b.animOut.opacity=0};a.fn.cycle.transitions.blindX=function(f,g,b){var c=f.css(d,e).width();b.before.push(function(c,d,b){a.fn.cycle.commonReset(c,d,b);b.animIn.width=d.cycleW;b.animOut.left=c.cycleW});b.cssBefore.left=c;b.cssBefore.top=0;b.animIn.left=0;b.animOut.left=c};a.fn.cycle.transitions.blindY=function(f,g,b){var c=f.css(d,e).height();b.before.push(function(c,d,b){a.fn.cycle.commonReset(c,d,b);b.animIn.height=d.cycleH;b.animOut.top=c.cycleH});b.cssBefore.top=c;b.cssBefore.left=0;b.animIn.top=0;b.animOut.top=c};a.fn.cycle.transitions.blindZ=function(c,h,b){var f=c.css(d,e).height(),g=c.width();b.before.push(function(c,d,b){a.fn.cycle.commonReset(c,d,b);b.animIn.height=d.cycleH;b.animOut.top=c.cycleH});b.cssBefore.top=f;b.cssBefore.left=g;b.animIn.top=0;b.animIn.left=0;b.animOut.top=f;b.animOut.left=g};a.fn.cycle.transitions.growX=function(f,e,d){d.before.push(function(e,f,d){a.fn.cycle.commonReset(e,f,d,c,b);d.cssBefore.left=this.cycleW/2;d.animIn.left=0;d.animIn.width=this.cycleW;d.animOut.left=0});d.cssBefore.top=0;d.cssBefore.width=0};a.fn.cycle.transitions.growY=function(f,e,d){d.before.push(function(e,f,d){a.fn.cycle.commonReset(e,f,d,b,c);d.cssBefore.top=this.cycleH/2;d.animIn.top=0;d.animIn.height=this.cycleH;d.animOut.top=0});d.cssBefore.height=0;d.cssBefore.left=0};a.fn.cycle.transitions.curtainX=function(f,e,d){d.before.push(function(e,f,d){a.fn.cycle.commonReset(e,f,d,c,b,b);d.cssBefore.left=f.cycleW/2;d.animIn.left=0;d.animIn.width=this.cycleW;d.animOut.left=e.cycleW/2;d.animOut.width=0});d.cssBefore.top=0;d.cssBefore.width=0};a.fn.cycle.transitions.curtainY=function(f,e,d){d.before.push(function(f,e,d){a.fn.cycle.commonReset(f,e,d,b,c,b);d.cssBefore.top=e.cycleH/2;d.animIn.top=0;d.animIn.height=e.cycleH;d.animOut.top=f.cycleH/2;d.animOut.height=0});d.cssBefore.height=0;d.cssBefore.left=0};a.fn.cycle.transitions.cover=function(f,i,b){var c=b.direction||"left",h=f.css(d,e).width(),g=f.height();b.before.push(function(d,e,b){a.fn.cycle.commonReset(d,e,b);if(c=="right")b.cssBefore.left=-h;else if(c=="up")b.cssBefore.top=g;else if(c=="down")b.cssBefore.top=-g;else b.cssBefore.left=h});b.animIn.left=0;b.animIn.top=0;b.cssBefore.top=0;b.cssBefore.left=0};a.fn.cycle.transitions.uncover=function(g,j,c){var f=c.direction||"left",i=g.css(d,e).width(),h=g.height();c.before.push(function(d,e,c){a.fn.cycle.commonReset(d,e,c,b,b,b);if(f=="right")c.animOut.left=i;else if(f=="up")c.animOut.top=-h;else if(f=="down")c.animOut.top=h;else c.animOut.left=-i});c.animIn.left=0;c.animIn.top=0;c.cssBefore.top=0;c.cssBefore.left=0};a.fn.cycle.transitions.toss=function(e,h,c){var g=e.css(d,"visible").width(),f=e.height();c.before.push(function(d,e,c){a.fn.cycle.commonReset(d,e,c,b,b,b);if(!c.animOut.left&&!c.animOut.top)a.extend(c.animOut,{left:g*2,top:-f/2,opacity:0});else c.animOut.opacity=0});c.cssBefore.left=0;c.cssBefore.top=0;c.animIn.left=0};a.fn.cycle.transitions.wipe=function(t,w,h){var n="rect(",i="px ",s="rect(0px ",k=t.css(d,e).width(),j=t.height();h.cssBefore=h.cssBefore||{};var l;if(h.clip)if(/l2r/.test(h.clip))l="rect(0px 0px "+j+"px 0px)";else if(/r2l/.test(h.clip))l=s+k+i+j+i+k+"px)";else if(/t2b/.test(h.clip))l=s+k+"px 0px 0px)";else if(/b2t/.test(h.clip))l=n+j+i+k+i+j+"px 0px)";else if(/zoom/.test(h.clip)){var v=parseInt(j/2,f),u=parseInt(k/2,f);l=n+v+i+u+i+v+i+u+"px)"}h.cssBefore.clip=h.cssBefore.clip||l||"rect(0px 0px 0px 0px)";var m=h.cssBefore.clip.match(/(\d+)/g),r=parseInt(m[0],f),q=parseInt(m[1],f),o=parseInt(m[2],f),p=parseInt(m[3],f);h.before.push(function(h,l,m){if(h==l)return;var s=a(h),t=a(l);a.fn.cycle.commonReset(h,l,m,b,b,c);m.cssAfter.display=g;var e=1,d=parseInt(m.speedIn/13,f)-1;(function u(){var g=r?r-parseInt(e*(r/d),f):0,b=p?p-parseInt(e*(p/d),f):0,a=o<j?o+parseInt(e*((j-o)/d||1),f):j,c=q<k?q+parseInt(e*((k-q)/d||1),f):k;t.css({clip:n+g+i+c+i+a+i+b+"px)"});e++<=d?setTimeout(u,13):s.css("display","none")})()});a.extend(h.cssBefore,{display:g,opacity:1,top:0,left:0});h.animIn={left:0};h.animOut={left:0}}})(jQuery);

// PLUGIN: jquery.tweet.js - See http://tweet.seaofclouds.com/ or https://github.com/seaofclouds/tweet for more info
// Copyright (c) 2008-2011 Todd Matthews & Steve Purcell
(function($) {
  $.fn.tweet = function(o){
    var s = $.extend({
      username: null,                           // [string or array] required unless using the 'query' option; one or more twitter screen names (use 'list' option for multiple names, where possible)
      list: null,                               // [string]   optional name of list belonging to username
      favorites: false,                         // [boolean]  display the user's favorites instead of his tweets
      query: null,                              // [string]   optional search query (see also: http://search.twitter.com/operators)
      avatar_size: null,                        // [integer]  height and width of avatar if displayed (48px max)
      count: 3,                                 // [integer]  how many tweets to display?
      fetch: null,                              // [integer]  how many tweets to fetch via the API (set this higher than 'count' if using the 'filter' option)
      page: 1,                                  // [integer]  which page of results to fetch (if count != fetch, you'll get unexpected results)
      retweets: true,                           // [boolean]  whether to fetch (official) retweets (not supported in all display modes)
      intro_text: null,                         // [string]   do you want text BEFORE your your tweets?
      outro_text: null,                         // [string]   do you want text AFTER your tweets?
      join_text:  null,                         // [string]   optional text in between date and tweet, try setting to "auto"
      auto_join_text_default: "i said,",        // [string]   auto text for non verb: "i said" bullocks
      auto_join_text_ed: "i",                   // [string]   auto text for past tense: "i" surfed
      auto_join_text_ing: "i am",               // [string]   auto tense for present tense: "i was" surfing
      auto_join_text_reply: "i replied to",     // [string]   auto tense for replies: "i replied to" @someone "with"
      auto_join_text_url: "i was looking at",   // [string]   auto tense for urls: "i was looking at" http:...
      loading_text: null,                       // [string]   optional loading text, displayed while tweets load
      refresh_interval: null ,                  // [integer]  optional number of seconds after which to reload tweets
      twitter_url: "twitter.com",               // [string]   custom twitter url, if any (apigee, etc.)
      twitter_api_url: "api.twitter.com",       // [string]   custom twitter api url, if any (apigee, etc.)
      twitter_search_url: "search.twitter.com", // [string]   custom twitter search url, if any (apigee, etc.)
      template: "{avatar}{time}{join}{text}",   // [string or function] template used to construct each tweet <li> - see code for available vars
      comparator: function(tweet1, tweet2) {    // [function] comparator used to sort tweets (see Array.sort)
        return tweet2["tweet_time"] - tweet1["tweet_time"];
      },
      filter: function(tweet) {                 // [function] whether or not to include a particular tweet (be sure to also set 'fetch')
        return true;
      }
    }, o);

    // See http://daringfireball.net/2010/07/improved_regex_for_matching_urls
    var url_regexp = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»""'']))/gi;

    // Expand values inside simple string templates with {placeholders}
    function t(template, info) {
      if (typeof template === "string") {
        var result = template;
        for(var key in info) {
          var val = info[key];
          result = result.replace(new RegExp('{'+key+'}','g'), val === null ? '' : val);
        }
        return result;
      } else return template(info);
    }
    // Export the t function for use when passing a function as the 'template' option
    $.extend({tweet: {t: t}});

    function replacer (regex, replacement) {
      return function() {
        var returning = [];
        this.each(function() {
          returning.push(this.replace(regex, replacement));
        });
        return $(returning);
      };
    }

    $.fn.extend({
      linkUrl: replacer(url_regexp, function(match) {
        var url = (/^[a-z]+:/i).test(match) ? match : "http://"+match;
        return "<a href=\""+url+"\">"+match+"</a>";
      }),
      linkUser: replacer(/@(\w+)/gi, "@<a href=\"http://"+s.twitter_url+"/$1\">$1</a>"),
      // Support various latin1 (\u00**) and arabic (\u06**) alphanumeric chars
      linkHash: replacer(/(?:^| )[\#]+([\w\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff\u0600-\u06ff]+)/gi,
                         ' <a href="http://'+s.twitter_search_url+'/search?q=&tag=$1&lang=all'+((s.username && s.username.length == 1) ? '&from='+s.username.join("%2BOR%2B") : '')+'">#$1</a>'),
      capAwesome: replacer(/\b(awesome)\b/gi, '<span class="awesome">$1</span>'),
      capEpic: replacer(/\b(epic)\b/gi, '<span class="epic">$1</span>'),
      makeHeart: replacer(/(&lt;)+[3]/gi, "<tt class='heart'>&#x2665;</tt>")
    });

    function parse_date(date_str) {
      // The non-search twitter APIs return inconsistently-formatted dates, which Date.parse
      // cannot handle in IE. We therefore perform the following transformation:
      // "Wed Apr 29 08:53:31 +0000 2009" => "Wed, Apr 29 2009 08:53:31 +0000"
      return Date.parse(date_str.replace(/^([a-z]{3})( [a-z]{3} \d\d?)(.*)( \d{4})$/i, '$1,$2$4$3'));
    }

    function relative_time(date) {
      var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
      var delta = parseInt((relative_to.getTime() - date) / 1000, 10);
      var r = '';
      if (delta < 60) {
        r = delta + ' seconds ago';
      } else if(delta < 120) {
        r = 'a minute ago';
      } else if(delta < (45*60)) {
        r = (parseInt(delta / 60, 10)).toString() + ' minutes ago';
      } else if(delta < (2*60*60)) {
        r = 'an hour ago';
      } else if(delta < (24*60*60)) {
        r = '' + (parseInt(delta / 3600, 10)).toString() + ' hours ago';
      } else if(delta < (48*60*60)) {
        r = 'a day ago';
      } else {
        r = (parseInt(delta / 86400, 10)).toString() + ' days ago';
      }
      return 'about ' + r;
    }

    function build_auto_join_text(text) {
      if (text.match(/^(@([A-Za-z0-9-_]+)) .*/i)) {
        return s.auto_join_text_reply;
      } else if (text.match(url_regexp)) {
        return s.auto_join_text_url;
      } else if (text.match(/^((\w+ed)|just) .*/im)) {
        return s.auto_join_text_ed;
      } else if (text.match(/^(\w*ing) .*/i)) {
        return s.auto_join_text_ing;
      } else {
        return s.auto_join_text_default;
      }
    }

    function maybe_https(url) {
      return ('https:' == document.location.protocol) ? url.replace(/^http:/, 'https:') : url;
    }

    function build_api_url() {
      var proto = ('https:' == document.location.protocol ? 'https:' : 'http:');
      var count = (s.fetch === null) ? s.count : s.fetch;
      if (s.list) {
        return proto+"//"+s.twitter_api_url+"/1/"+s.username[0]+"/lists/"+s.list+"/statuses.json?page="+s.page+"&per_page="+count+"&callback=?";
      } else if (s.favorites) {
        return proto+"//"+s.twitter_api_url+"/favorites/"+s.username[0]+".json?page="+s.page+"&count="+count+"&callback=?";
      } else if (s.query === null && s.username.length == 1) {
        return proto+'//'+s.twitter_api_url+'/1/statuses/user_timeline.json?screen_name='+s.username[0]+'&count='+count+(s.retweets ? '&include_rts=1' : '')+'&page='+s.page+'&callback=?';
      } else {
        var query = (s.query || 'from:'+s.username.join(' OR from:'));
        return proto+'//'+s.twitter_search_url+'/search.json?&q='+encodeURIComponent(query)+'&rpp='+count+'&page='+s.page+'&callback=?';
      }
    }

    // Convert twitter API objects into data available for
    // constructing each tweet <li> using a template
    function extract_template_data(item){
      var o = {};
      o.item = item;
      o.source = item.source;
      o.screen_name = item.from_user || item.user.screen_name;
      o.avatar_size = s.avatar_size;
      o.avatar_url = maybe_https(item.profile_image_url || item.user.profile_image_url);
      o.retweet = typeof(item.retweeted_status) != 'undefined';
      o.tweet_time = parse_date(item.created_at);
      o.join_text = s.join_text == "auto" ? build_auto_join_text(item.text) : s.join_text;
      o.tweet_id = item.id_str;
      o.twitter_base = "http://"+s.twitter_url+"/";
      o.user_url = o.twitter_base+o.screen_name;
      o.tweet_url = o.user_url+"/status/"+o.tweet_id;
      o.reply_url = o.twitter_base+"intent/tweet?in_reply_to="+o.tweet_id;
      o.retweet_url = o.twitter_base+"intent/retweet?tweet_id="+o.tweet_id;
      o.favorite_url = o.twitter_base+"intent/favorite?tweet_id="+o.tweet_id;
      o.retweeted_screen_name = o.retweet && item.retweeted_status.user.screen_name;
      o.tweet_relative_time = relative_time(o.tweet_time);
      o.tweet_raw_text = o.retweet ? ('RT @'+o.retweeted_screen_name+' '+item.retweeted_status.text) : item.text; // avoid '...' in long retweets
      o.tweet_text = $([o.tweet_raw_text]).linkUrl().linkUser().linkHash()[0];
      o.tweet_text_fancy = $([o.tweet_text]).makeHeart().capAwesome().capEpic()[0];

      // Default spans, and pre-formatted blocks for common layouts
      o.user = t('<a class="tweet_user" href="{user_url}">{screen_name}</a>', o);
      o.join = s.join_text ? t(' <span class="tweet_join">{join_text}</span> ', o) : ' ';
      o.avatar = o.avatar_size ?
        t('<a class="tweet_avatar" href="{user_url}"><img src="{avatar_url}" height="{avatar_size}" width="{avatar_size}" alt="{screen_name}\'s avatar" title="{screen_name}\'s avatar" border="0"/></a>', o) : '';
      o.time = t('<span class="tweet_time"><a href="{tweet_url}" title="view tweet on twitter">{tweet_relative_time}</a></span>', o);
      o.text = t('<span class="tweet_text">{tweet_text_fancy}</span>', o);
      o.reply_action = t('<a class="tweet_action tweet_reply" href="{reply_url}">reply</a>', o);
      o.retweet_action = t('<a class="tweet_action tweet_retweet" href="{retweet_url}">retweet</a>', o);
      o.favorite_action = t('<a class="tweet_action tweet_favorite" href="{favorite_url}">favorite</a>', o);
      return o;
    }

    return this.each(function(i, widget){
      var list = $('<ul class="tweet_list">').appendTo(widget);
      var intro = '<p class="tweet_intro">'+s.intro_text+'</p>';
      var outro = '<p class="tweet_outro">'+s.outro_text+'</p>';
      var loading = $('<p class="loading">'+s.loading_text+'</p>');

      if(s.username && typeof(s.username) == "string"){
        s.username = [s.username];
      }

      if (s.loading_text) $(widget).append(loading);
      $(widget).bind("tweet:load", function(){
        $.getJSON(build_api_url(), function(data){
          if (s.loading_text) loading.remove();
          if (s.intro_text) list.before(intro);
          list.empty();

          var tweets = $.map(data.results || data, extract_template_data);
          tweets = $.grep(tweets, s.filter).sort(s.comparator).slice(0, s.count);
          list.append($.map(tweets, function(o) { return "<li>" + t(s.template, o) + "</li>"; }).join('')).
              children('li:first').addClass('tweet_first').end().
              children('li:odd').addClass('tweet_even').end().
              children('li:even').addClass('tweet_odd');

          if (s.outro_text) list.after(outro);
          $(widget).trigger("loaded").trigger((tweets.length === 0 ? "empty" : "full"));
          if (s.refresh_interval) {
            window.setTimeout(function() { $(widget).trigger("tweet:load"); }, 1000 * s.refresh_interval);
          }
        });
      }).trigger("tweet:load");
    });
  };
})(jQuery);



//PLUGIN: jCarousel Lite
(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var b=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var c=$(this),ul=$("ul",c),tLi=$("li",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v}var f=$("li",ul),itemLength=f.size(),curr=o.start;c.css("visibility","visible");f.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});c.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var g=o.vertical?height(f):width(f);var h=g*itemLength;var j=g*v;f.css({width:f.width(),height:f.height()});ul.css(sizeCss,h+"px").css(animCss,-(curr*g));c.css(sizeCss,j+"px");if(o.btnPrev)$(o.btnPrev).click(function(){return go(curr-o.scroll)});if(o.btnNext)$(o.btnNext).click(function(){return go(curr+o.scroll)});if(o.btnGo)$.each(o.btnGo,function(i,a){$(a).click(function(){return go(o.circular?o.visible+i:i)})});if(o.mouseWheel&&c.mousewheel)c.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll)});if(o.auto)setInterval(function(){go(curr+o.scroll)},o.auto+o.speed);function vis(){return f.slice(curr).slice(0,v)};function go(a){if(!b){if(o.beforeStart)o.beforeStart.call(this,vis());if(o.circular){if(a<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*g)+"px");curr=a==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll}else if(a>=itemLength-v+1){ul.css(animCss,-((v)*g)+"px");curr=a==itemLength-v+1?v+1:v+o.scroll}else curr=a}else{if(a<0||a>itemLength-v)return;else curr=a}b=true;ul.animate(animCss=="left"?{left:-(curr*g)}:{top:-(curr*g)},o.speed,o.easing,function(){if(o.afterEnd)o.afterEnd.call(this,vis());b=false});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled")}}return false}})};function css(a,b){return parseInt($.css(a[0],b))||0};function width(a){return a[0].offsetWidth+css(a,'marginLeft')+css(a,'marginRight')};function height(a){return a[0].offsetHeight+css(a,'marginTop')+css(a,'marginBottom')}})(jQuery);


// usage: log('inside coolFunc', this, arguments);
window.log = function(){
  log.history = log.history || [];   // store logs to an array for reference
  log.history.push(arguments);
  if(this.console) {
      arguments.callee = arguments.callee.caller;
      console.log( Array.prototype.slice.call(arguments) );
  }
};
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c})(window.console=window.console||{});

