        $(document).ready(function() {
	$("input.phonenumber").mask("(999) 999-9999");
    $("input.state").mask("aa");
    $("input.zip").mask("99999");
	
	$("#backtotop a").click(function() {
        $('html, body').animate({ scrollTop: 0 }, 'slow');
    });
	$('a[href=#Comments]').click(function() {
        $('html,body').animate({scrollTop: $('a[name=Comments]').offset().top-250},'slow');
    });
	
	$("a.zoom").fancybox({
		'overlayOpacity' : 0.9,
		'overlayColor' : '#3F2319'
	});
	$("a.newsletter").fancybox({
		'overlayOpacity' : 0.9,
		'overlayColor' : '#3F2319',
		'width' : '700',
		'height' : '620',
		'hideOnOverlayClick' : true,
		'hideOnContentClick' : false,
		'type'				: 'iframe',
	});
	
	if($('#videocont').length>0){
		$('#videocont').cycle({ 
			fx:     'scrollRight', 
			speed:  1500, 
			timeout: 8000, 
			pause: 1,
			pauseOnPagerHover: 1,
			pager:  '#slidenav',
			pagerAnchorBuilder: function(idx, slide) { 
				return '<a href="#">&nbsp;</a>'; 
			}
		});
	}
	if (jQuery.browser.msie) { 
		$('.videonameback').each(function(){
			$(this).css({'background-image' : 'none', 'filter' : 'alpha(opacity=88)'});
		});
	}
	$('#videocopy').columnize({width:228, lastNeverTallest: true, balanced: true, height:410});
	$('.bloglistinfo.image .truncate_150').expander({
		slicePoint: 150, 
		widow: 4,
		expandEffect: 'fadeIn', 
		userCollapse: false, 
		expandText: '',
		expandPrefix: '...'
	});
	$('.bloglistinfo .truncate_150').expander({
		slicePoint: 250, 
		widow: 4,
		expandEffect: 'fadeIn', 
		userCollapse: false, 
		expandText: '',
		expandPrefix: '...'
	});
	$('.taglist .truncate_150').expander({
		slicePoint: 150, 
		widow: 4,
		expandEffect: 'fadeIn', 
		userCollapse: false, 
		expandText: '',
		expandPrefix: '...'
	});
	$('#videocontent .truncate_150').expander({
		slicePoint: 250, 
		widow: 4,
		expandEffect: 'fadeIn', 
		userCollapse: false, 
		expandText: '',
		expandPrefix: '...'
	});
	$('.box .boxcopy').expander({
		slicePoint: 200, 
		widow: 4,
		expandEffect: 'fadeIn', 
		userCollapse: false, 
		expandText: '',
		expandPrefix: '...'
	});
	$('#homepageslides span.truncate').expander({
		slicePoint: 150, 
		widow: 4,
		expandEffect: 'fadeIn', 
		userCollapse: false, 
		expandText: '',
		expandPrefix: '...'
	});
	
	$('ul.videolist li:even').addClass('clear');
	$('ul.videolist li:even').before('<li class="spacer">&nbsp;</li>');
	
	$('ul#press li:even').addClass('clear');
	$('ul#press li:even').before('<li class="spacer">&nbsp;</li>');
	
	$('ul.videolist li.spacer:first').remove();
	$('ul#press li.spacer:first').remove();
	
	$("#searchboxContainer input").focus(function(){
		if(this.value == 'Search'){
			this.select();
		}
	});
	
});
jQuery.preloadImages = function() {
    for (var i = 0; i < arguments.length; i++) {
        jQuery("<img>").attr("src", arguments[i]);
    }
}

function onAfter(curr, next, opts) {
	try{
		var oId = $('ul#videocont li:eq('+parseInt(opts.currSlide-1)+')').attr('id');
		jwplayer("video"+oId+"").stop();
	}
	catch(err){}
}
function onBefore(){
	try{
	jwplayer("video"+$(this).attr('id')+"").setup({
		flashplayer: "/assets/root/include/flash/video_player.swf",
		file: ''+$(this).attr('file')+'',
		height: 295,
		width: 480,
		controlbar: 'bottom',
		screencolor: 'ffffff',
		image: ''+$(this).attr('image')+'',
		plugins: {
			gapro: { accountid: "UA-17791160-1" },
			sharing: {link: true, code: true }
		},
		events: {
			onComplete: function() { $('#videocont').cycle('resume'); },
			onPlay: function() { $('#videocont').cycle('pause'); },
			onPause: function() { $('#videocont').cycle('pause'); },
		}
	});
	} catch(err){}
}

    
