$(function() {


	// http://j.mp/jquery-target-blank
	$('a[href^="http://"], a[rel="external"], a[href$=".pdf"]').attr({
		target: "_blank",
		title: "Opens in a new window"
	});

	// Labelify
	$('#locate-form .text input').labelify({
	  text: "label"
	});

	// Slideshow Cycle Plugin
	$('#slides').after('<ul id="pager-nav" class="nav">').cycle({
        fx:      'fade',
        prev:    '#sn-prev',
        next:    '#sn-next',
        pager:   '#pager-nav',
        pagerAnchorBuilder: pagerFactory
    });

    function pagerFactory(idx, slide) {
        var s = idx > 20 ? ' style="display:none"' : '';
        return '<li'+s+'><a href="#">'+(idx+1)+'</a></li>';
    };

	$('#location_id').change(function() {
		window.location = '/locations/view/' + $(this).val();
	});
	
	// Fancybox
	$('a#contact_loc').fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
	
	$('a[href$=".jpg"]').fancybox();



	// Wide Selects in IE
	$(".ie7 .wide, .ie8 .wide")

	.focus(function(){
		$(this)
		.data("origWidth", $(this).css("width"))
		.css("width", "auto");
	})

	.blur(function(){
		$(this).css("width", $(this).data("origWidth"));
	});

	
		
});




















