//jQuery(document).ready(function(){
//	jQuery(function() { //on DOM ready
//		jQuery("#scroller").simplyScroll({
//			autoMode: 'loop'

//		});
//	});
//});


		
jQuery(document).ready(function(){
jQuery('#sliderContent').cycle({ 
fx:     'scrollHorz', 
speed:   500, 
timeout: 10000, 
next:   '#next', 
prev:   '#prev',
pause: 1,
height: 'auto',
width: '100%',
fit: 0,
containerResize: 0

});
});




// this tells jquery to run the function below once the DOM is ready
jQuery(document).ready(function() {

// choose text for the show/hide link
var showText="Read more [+]";
var hideText="Read less [-]";

// create the toggle link
jQuery("#hide_this").after("<p><a href='#' id='toggle_link'>"+showText+"</a></p>");

// hide the content
jQuery('#hide_this').hide();

// capture clicks on the newly created link
jQuery('a#toggle_link').click(function() {

// change the link text
if (jQuery('a#toggle_link').text()==showText) {
jQuery('a#toggle_link').text(hideText);
}
else {
jQuery('a#toggle_link').text(showText);
}

// toggle the display
jQuery('#hide_this').slideToggle('slow');

// return false so any link destination is not followed
return false;
});

});


// this tells jquery to run the function below once the DOM is ready
jQuery(document).ready(function() {

// choose text for the show/hide link
var showText="Read more [+]";
var hideText="Read less [-]";

// create the toggle link
jQuery("#hide_this2").after("<p><a href='#' id='toggle_link2'>"+showText+"</a></p>");

// hide the content
jQuery('#hide_this2').hide();

// capture clicks on the newly created link
jQuery('a#toggle_link2').click(function() {

// change the link text
if (jQuery('a#toggle_link2').text()==showText) {
jQuery('a#toggle_link2').text(hideText);
}
else {
jQuery('a#toggle_link2').text(showText);
}

// toggle the display
jQuery('#hide_this2').slideToggle('slow');

// return false so any link destination is not followed
return false;
});

});


// this tells jquery to run the function below once the DOM is ready
jQuery(document).ready(function() {

// choose text for the show/hide link
var showText="View more [+]";
var hideText="View less [-]";

// create the toggle link
jQuery("#hide_wines").after("<p><a class='button' href='#' id='wine_link'>"+showText+"</a></p>");

// hide the content
jQuery('#hide_wines').hide();

// capture clicks on the newly created link
jQuery('a#wine_link').click(function() {

// change the link text
if (jQuery('a#wine_link').text()==showText) {
jQuery('a#wine_link').text(hideText);
}
else {
jQuery('a#wine_link').text(showText);
}

// toggle the display
jQuery('#hide_wines').slideToggle('slow');

// return false so any link destination is not followed
return false;
});

});

//jQuery(document).ready(function(){
//jQuery(".block-link").hide();
//jQuery("#home .block-sm").hover(
//function(){
//jQuery(this).find(".block-link").fadeIn('fast');
//},
//function() {
//jQuery(this).find(".block-link").fadeOut('fast');
//});
//});




//jQuery(document).ready(function(){
//jQuery("#winegala").click(function(){
//    	window.location=jQuery(this).find("a").attr("href");return false;
//	});
//jQuery("#winegala").css({"cursor":"pointer"});
//});

//jQuery(document).ready(function(){
//jQuery("#tickets").click(function(){
//    	window.location=jQuery(this).find("a").attr("href");return false;
//	});
//jQuery("#tickets").css({"cursor":"pointer"});
//});


jQuery(document).ready( function() {
jQuery('A[rel="external"]').addClass("external").click( function() {
window.open( jQuery(this).attr('href') );
return false;
});
});



jQuery(document).ready( function() {
jQuery('.galleryid-433 a, .galleryid-433 img').attr('title', '(C) 2008 WaynesView Photography');
});

jQuery(document).ready( function() {
jQuery('.galleryid-344 a, .galleryid-344 img').attr('title', '(C) 2008 WaynesView Photography');
});


jQuery(document).ready( function() {
jQuery('.slickr-flickr-gallery').addClass('gallery');
});







jQuery(document).ready(function(){
jQuery(".res-link,.gen-link,.stu-link,.basic-link,.tooltip,.tabled-link").click(function(event) {
    event.preventDefault();
});

jQuery('.tooltip').qtip({
content: '<h5>The All Access VIP Pass includes: </h5><ul><li>Annual membership in PIFMA</li><li>2 All Access VIP passes to all events except Wine Gala and Wearable Art Luncheon</li><li>Preferred Seating (the best there is)</li><li>Listing in souvenir program as a member</li><li>Option to purchase Wine Gala tickets at a reduced price of $75</li></ul><p><strong>Price: $250.00</strong></p>',
position: {
viewport: jQuery(window)
},
   style: {
      classes: 'ui-tooltip-red',
tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

   });

//bitsnpieces
jQuery('#post-3457 .basic-link').qtip({
content: {
      text: jQuery('#post-3457 .ticket-basic') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {

        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});

//chalk walk
jQuery('#post-1345 .basic-link').qtip({
content: {
      text: jQuery('#post-1345 .ticket-basic') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {
      
        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});

//hit men
jQuery('#post-3448 .res-link').qtip({
content: {
      text: jQuery('#post-3448 .ticket-res') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {
      classes: 'ui-tooltip-blue',
        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});

jQuery('#post-3448 .gen-link').qtip({
content: {
      text: jQuery('#post-3448 .ticket-gen') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {

        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});


//david osborne
jQuery('#post-3438 .gen-link').qtip({
content: {
      text: jQuery('#post-3438 .ticket-gen') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {

        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});

jQuery('#post-3438 .res-link').qtip({
content: {
      text: jQuery('#post-3438 .ticket-res') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {
      classes: 'ui-tooltip-blue',
        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});


//ball in the house
jQuery('#post-3382 .gen-link').qtip({
content: {
      text: jQuery('#post-3382 .ticket-gen') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {

        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});

jQuery('#post-3382 .res-link').qtip({
content: {
      text: jQuery('#post-3382 .ticket-res') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {
      classes: 'ui-tooltip-blue',
        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});

jQuery('#post-3382 .stu-link').qtip({
content: {
      text: jQuery('#post-3382 .ticket-stu') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {
      classes: 'ui-tooltip-green',
        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});


//char chamber opera
jQuery('#post-3379 .basic-link').qtip({
content: {
      text: jQuery('#post-3379 .ticket-basic') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {

        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});

//kickin grass
jQuery('#post-3374 .basic-link').qtip({
content: {
      text: jQuery('#post-3374 .ticket-basic') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {

        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});


//spyro gyra
jQuery('#post-3363 .res-link').qtip({
content: {
      text: jQuery('#post-3363 .ticket-res') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {
      classes: 'ui-tooltip-blue',
        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});



jQuery('#post-3363 .gen-link').qtip({
content: {
      text: jQuery('#post-3363 .ticket-gen') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {
      tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }
});


//wine gala
jQuery('#post-3352 .basic-link').qtip({
content: {
      text: jQuery('#post-3352 .ticket-basic') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {

        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});

//they came to play
jQuery('#post-3593 .basic-link').qtip({
content: {
      text: jQuery('#post-3593 .ticket-basic') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {

        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});

//mac arnold
jQuery('#post-3342 .basic-link').qtip({
content: {
      text: jQuery('#post-3342 .ticket-basic') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {

        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});

//uncommon folk
jQuery('#post-3602 .basic-link').qtip({
content: {
      text: jQuery('#post-3602 .ticket-basic') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {

        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});

//saving sandy island
jQuery('#post-3338 .basic-link').qtip({
content: {
      text: jQuery('#post-3338 .ticket-basic') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {

        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});

//gallery crawl
jQuery('#post-3331 .basic-link').qtip({
content: {
      text: jQuery('#post-3331 .ticket-basic') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {

        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});

//luncheon
jQuery('#post-3647 .basic-link').qtip({
content: {
      text: jQuery('#post-3647 .ticket-basic') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {

        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});

//tabled event
jQuery('.tabled-link').qtip({
id: 'tabled-event',
content: {
      text: jQuery('.tabled-event') // Add .clone() if you don't want the matched elements to be removed, but simply copied
   },
position: {
viewport: jQuery(window)
},
   style: {
      classes: 'ui-tooltip-brown',
        tip: {
         corner: false,
         mimic: 'center' // Single 'center' value here
      }
   }

});


//end
});



jQuery(document).ready(function(){
jQuery("#myaccordion").accordion({ header: 'dt', autoHeight: false });
  });



  
jQuery(document).ready(function(){
jQuery('#defaultCountdown').countdown({until: new Date(2011, 9 - 1, 20), format: 'odH'}); 
});


jQuery(document).ready(function() {
	jQuery('ul#cat-filter a').click(function() {
		jQuery(this).css('outline','none');
		jQuery('ul#cat-filter .cat-link').removeClass('cat-link');
		jQuery(this).parent().addClass('cat-link');
		
		var filterVal = jQuery(this).text().toLowerCase().replace(' ','-');
				
		if(filterVal == 'entire-program') {
			jQuery('#cat-folio > div.hidden').fadeIn('slow').removeClass('hidden');
		} else {
			
			jQuery('#cat-folio > div').each(function() {
				if(!jQuery(this).hasClass(filterVal)) {
					jQuery(this).fadeOut('normal').addClass('hidden');
				} else {
					jQuery(this).fadeIn('normal').removeClass('hidden');
				}
			});
		}
		
		return false;
	});
});





//jQuery(function() {
//    jQuery('.quickFlip').quickFlip();
//});

//jQuery(window).load(function(){
//jQuery(".card img").imgCenter({scaleToFit:false});
//});

//jQuery(window).load(function(){
//jQuery("#home .entry .thumb img").imgCenter({scaleToFit:true});
//});

(function(a){a.fn.scaleImage=function(c){var d=a.extend({parent:false,scale:"fill",center:true,fade:0},c);return this.each(function(){var g=a(this);var h=d.parent?g.parents(d.parent):g.parent();h.css({opacity:0,overflow:"hidden"});if(h.length>0){g.removeAttr("height").removeAttr("width");if(this.complete){f(g,h)}else{g.load(function(){f(g,h)})}}});function f(h,k){var r=b(h),s=r.width,j=r.height,t=k.width(),m=k.height(),u=parseInt(h.css("borderLeftWidth"),10)+parseInt(h.css("borderRightWidth"),10),n=parseInt(h.css("borderTopWidth"),10)+parseInt(h.css("borderBottomWidth"),10),q,o,p,l,g;if(m===0||t===0){var i=e(k);t=i.width;m=i.height}u=isNaN(u)?0:u;n=isNaN(n)?0:n;q=t/s;o=m/j;if(d.scale==="fit"){p=q<o?q:o}else{if(d.scale==="fill"){p=q>o?q:o}}l=parseInt(s*p,10)-u;g=parseInt(j*p,10)-n;h.css({width:l,height:g}).attr({width:l,height:g});if(d.center){h.css("margin-left",Math.floor((t-l)/2));h.css("margin-top",Math.floor((m-g)/2))}if(d.fade>0){k.animate({opacity:1},d.fade)}else{k.css("opacity",1)}}function b(h){var g=new Image();g.src=h.attr("src");return{width:g.width,height:g.height}}function e(h){var i=h.clone().css({visibility:"hidden",display:"block",position:"absolute"});a("body").append(i);var g={width:i.width(),height:i.height()};i.remove();return g}}})(jQuery);


jQuery(document).ready(function(){
  jQuery('#home .entry .thumb img').scaleImage({
  	
  	center: true
  });
}); 

jQuery(document).ready(function(){
  jQuery('#program .thumb img').scaleImage({
  	
  	center: true
  });
}); 

jQuery(document).ready(function(){
  jQuery('.pifma-sponsor img').scaleImage({
  	scale: 'fit',
  	center: true
  });
}); 

jQuery(document).ready(function(){
  jQuery('.sponsor-card img').scaleImage({
  	scale: 'fit',
  	center: true
  });
}); 


jQuery(document).ready(function(){
  jQuery('#logoscale li img').scaleImage({
  	scale: 'fit',
  	center: true
  });
}); 

jQuery(document).ready(function() {
jQuery(".merchandise .photo a").append("<div class='zoom'></div>"); 
   });

jQuery(document).ready(function() {
jQuery('.bar').mosaic({
animation: 'slide',
speed: 300
});
});

jQuery(document).ready(function() {
jQuery("#home .menu li").removeClass("current-menu-item"); 
   });


// kwicks
jQuery(document).ready(function() {
	jQuery('#social ul').kwicks({
		min: 42,
defaultKwick: 1,
       sticky : true,
spacing: 1
	});

});

// carousel

(function () {
    $.fn.infiniteCarousel = function () {
        function repeat(str, n) {
            return new Array( n + 1 ).join(str);
        }
        
        return this.each(function () {
            // magic!
            var $wrapit = $('> div', this).css('overflow', 'hidden'),
                $slider = $wrapit.find('> ul').width(19999),
                $items = $slider.find('> li'),
                $single = $items.filter(':first')
                
                singleWidth = $single.outerWidth(),
                visible = Math.ceil($wrapit.innerWidth() / singleWidth),
                currentPage = 1,
                pages = Math.ceil($items.length / visible);
                
            /* TASKS */
            
            // 1. pad the pages with empty element if required
            if ($items.length % visible != 0) {
                // pad
                $slider.append(repeat('<li class="empty" />', visible - ($items.length % visible)));
                $items = $slider.find('> li');
            }
            
            // 2. create the carousel padding on left and right (cloned)
            $items.filter(':first').before($items.slice(-visible).clone().addClass('cloned'));
            $items.filter(':last').after($items.slice(0, visible).clone().addClass('cloned'));
            $items = $slider.find('> li');
            
            // 3. reset scroll
            $wrapit.scrollLeft(singleWidth * visible);
            
            // 4. paging function
            function gotoPage(page) {
                var dir = page < currentPage ? -1 : 1,
                    n = Math.abs(currentPage - page),
                    left = singleWidth * dir * visible * n;
                
                $wrapit.filter(':not(:animated)').animate({
                    scrollLeft : '+=' + left
                }, 500, function () {
                    // if page == last page - then reset position
                    if (page > pages) {
                        $wrapit.scrollLeft(singleWidth * visible);
                        page = 1;
                    } else if (page == 0) {
                        page = pages;
                        $wrapit.scrollLeft(singleWidth * visible * pages);
                    }
                    
                    currentPage = page;
                });
            }
            
            // 5. insert the back and forward link
            $wrapit.after('<a href="#" class="arrow back">&lt;</a><a href="#" class="arrow forward">&gt;</a>');
            
            // 6. bind the back and forward links
            $('a.back', this).click(function () {
                gotoPage(currentPage - 1);
                return false;
            });
            
            $('a.forward', this).click(function () {
                gotoPage(currentPage + 1);
                return false;
            });
            
            $(this).bind('goto', function (event, page) {
                gotoPage(page);
            });
            
            // THIS IS NEW CODE FOR THE AUTOMATIC INFINITE CAROUSEL
            $(this).bind('next', function () {
                gotoPage(currentPage + 1);
            });
        });
    };
})(jQuery);

jQuery(document).ready(function () {
    // THIS IS NEW CODE FOR THE AUTOMATIC INFINITE CAROUSEL
    var autoscrolling = true;
    
    jQuery('.infiniteCarousel').infiniteCarousel().mouseover(function () {
        autoscrolling = false;
    }).mouseout(function () {
        autoscrolling = true;
    });
    
    setInterval(function () {
        if (autoscrolling) {
            jQuery('.infiniteCarousel').trigger('next');
        }
    }, 5000);
});


// tabs
jQuery(document).ready(function () {
			var tabContainers = jQuery('div.tabs > div');
			tabContainers.hide().filter(':first').show();
			
			jQuery('div.tabs ul.tabNavigation a').click(function () {
				tabContainers.hide();
				tabContainers.filter(this.hash).show();
				jQuery('div.tabs ul.tabNavigation a').removeClass('selected');
				jQuery(this).addClass('selected');
				return false;
			}).filter(':first').click();
		});



