$(document).ready(function(){
	          
	$('.zebra-table').find('tr:odd').addClass('odd');

	$('.zebra-table').find('tr:even').addClass('even');

	$(".player-table tr").each(function(){$(this).find("td:first").css({"border-right":"1px solid #023668"});});

	$(".zebra-table").each(function(){$(this).find("tr th:first").css({"border-right":"1px solid #fff"});});									

	$('#gallery ul').cycle({ 
		fx:     'scrollLeft', 
		speed:  500, 
		timeout: 6000, 
		pager:  '#gallery-pager',
		pagerAnchorBuilder: function(idx, slide) {return '<li><a href="#"><span>'+slide.title+'</span></a></li>';}});
		
    $(".signin").click(function() {
        $("fieldset##signin_menu").toggle();
		$(".signin").toggleClass("menu-open");
    });
	
	$("fieldset##signin_menu").mouseup(function() {
		return false
	});
		
	$(document).mouseup(function(e) {
		if($(e.target).parent("a.signin").length==0) {
			$(".signin").removeClass("menu-open");
			$("fieldset##signin_menu").hide();
		}
	});				
	
	$('#sample1 input').ptTimeSelect();	
				
	$('#welcome-nav #pause').click(function() { 
		$('#gallery ul').cycle('pause');
		return false;});
						
	$('#welcome-nav a:not(#pause)').click(function() { 
		var a=$('#welcome-nav a:not(#pause)').index($(this));
		$('#gallery ul').cycle(a);
		$('#gallery ul').cycle('pause');
		return false;});		
            		
	$('#sports-pager').cycle({ 
		fx: 'scrollLeft',
		speed:500,
		timeout:0,
		pager:"#sports",		
		pagerAnchorBuilder: function(idx, slide) {
		return '<li><a href="#"><span>'+slide.title+'</span></a></li>';}});
				 
					
	$('#sports-pager  li .section_container .inner_section').cycle({ 
		fx: 'scrollLeft',
		speed:500,
		timeout:0,
		after:function(){
		$(this).siblings('.section').hide();
		},
		next:'.sports-next',
		prev: '.sports-prev'});

	$('.threeTab a').click(function(){
		var index=$(this).parents('.tab').find('a').index(this);
		var tab=$(this).parents('.tab');
		tab.next('.tabContentContainer').find('.tabContent').hide();
		tab.next('.tabContentContainer').find('.tabContent').eq(index).show();
		tab.css('background','url(/images/template/3tab_'+index+'.gif) left top no-repeat');
		$(this).parents('ul').find('li').removeClass('current');
		$(this).parent('li').addClass('current');
		return false;});
										   
	$('.fourTab a').click(function(){
		var index=$(this).parents('.tab').find('a').index(this);
		var tab=$(this).parents('.tab');
		tab.next('.tabContentContainer').find('.tabContent').hide();
		tab.next('.tabContentContainer').find('.tabContent').eq(index).show();
		tab.css('background','url(/images/template/4tab_'+index+'.png) left top no-repeat');
		$(this).parents('ul').find('li').removeClass('current');
		$(this).parent('li').addClass('current');
		return false;});
										   
	$('#comments .tabContent').hide();

	$('#comments .tabContent').eq(0).show();
				  
	$('input[type=text]').addClass('textbox');

	$('.roundblueHeader,.head').html('<h3><span></span></h3>');

	$('.roundblueFooter,.foot').html('<h3><span></span></h3>');

	/*$('.blueround-nav li.current').append('<img src="/images/down-arrow.jpg" class="down-arrow" />');*/

	$('.dotList').each(function(){$(this).find('li:last').css("border-bottom","none");});
							  
	$('.bluezebraList li:odd').not('.commentheader').addClass('odd');

	$('.bluezebraList li:even').not('.commentheader').addClass('even');

	$('.bluezebraList>li:last').addClass('last');
	
	$('.bluezebraList2 li:odd').addClass('odd');

	$('.bluezebraList2 li:even').addClass('even');

	$('.bluezebraList2>li:last').addClass('last');
	
	$('.innerTbl tr:last').addClass('last');				
	
	$('.grayzebraTbl tr:odd').not('.tblHeading').addClass('odd');

	$('.grayzebraTbl tr:even').not('.tblHeading').addClass('even');												
	
	/* Added for listings */
	
	$("#welcomeList li:odd").css('margin-right','0');

	$("input[type=text]").addClass('textbox');

	$("input[type=image]").addClass('imgBtn');

	$(".no-margin").css('margin','0');
	
	$(".shadow580").prepend('<img src="/images/box/shadowbox580-top.jpg" />').append('<img src="/images/box/shadowbox580-bottom.jpg" />');

	$("#testimonials ul").each(function(){

	$(this).find(">li:last").addClass('last-item');

	$(this).find(">li:first").addClass('first-item');

	$(this).find('>li:odd').addClass('odd');

	$(this).find('>li:even').addClass('even');});
	
	$(".page_right>div:last").css('margin-bottom','0');
	
	$(".threeColList").each(function(){
		var medialist=$(this);
		var total=medialist.find('li').length;
		for(var i=1;i<total+1;i++)
		{
		if(i%3==0)
		{
		medialist.find('li').eq(i-1).css('margin-right','0'); 
		}
		}
		medialist.find('li').eq(total-1).css('margin-bottom','0');
		medialist.find('li').eq(total-2).css('margin-bottom','0'); 
		medialist.find('li').eq(total-3).css('margin-bottom','0');  
		});
	
	$(".twoColList").each(function(){
		var medialist=$(this);
		var total=medialist.find('li').length;
		for(var i=1;i<total+1;i++)
		{
		if(i%2==0)
		{
		medialist.find('li').eq(i-1).css('margin-right','0'); 
		}
		}
		medialist.find('li').eq(total-1).css('margin-bottom','0');
		medialist.find('li').eq(total-2).css('margin-bottom','0'); 
		medialist.find('li').eq(total-3).css('margin-bottom','0');  
		});	
						
	$(function() {
		// initialize scrollable
		$(".scrollable").scrollable({ vertical: true, mousewheel: true });	
		});	
	
	$(function() {	
		// initialize scrollable
		$(".scrollable2").scrollable({ vertical: true, mousewheel: true });	
		});		
		
	/*$('a[rel*=facebox]').fancybox({	
		'showNavArrows'		: false,

		'titleShow'		: false,
		'scrolling'		: 'no'
	});*/
	
	$("a[rel=facebox]").fancybox({ 
		'onComplete' : function() {$("#fancybox-wrap").unbind('mousewheel.fb');} , 
		'scrolling' : 'no', 
		'titleShow'     : false, 
		'cyclic'		: false,					
		'showNavArrows' : false
	}); 	
	
	$('a[rel*=galleryfacebox]').fancybox({	
		'showNavArrows'		: true,
		'cyclic'		: true,			
		'scrolling'		: 'no'
	});	
    
     $("#results_list ul").each(function(){
        $(this).find(">li:last").addClass('last-item');
        $(this).find(">li:first").addClass('first-item');
        $(this).find('>li:odd').addClass('odd');
		$(this).find('>li:even').addClass('even');
     });
    
	// main vertical scroll
	$("#main_welcome").scrollable({
	 
		// basic settings
		vertical: true,
	 
	 
	// main navigator (thumbnail images)
	}).navigator("#main_navi");
	 
	// horizontal scrollables. each one is circular and has its own navigator instance
	var horizontal = $(".scrollable_welcome").scrollable({ circular: true }).navigator(".navi");
	 				  			  
	$('.accordionContent,.accordionContent-settings').hide();

	$('.accordionContent,.accordionContent-manuallyadd').hide();	
			  
	$('.accordion-trigger').click(function(){
	var target=$(this).attr('href');
	if($(target).css('display')=='none')
	{
		$(target).show();
		$(this).text('Collapse View');
	}
	else
	{
		$(target).hide();
		$(this).text('Expand View');
	}
	return false;
	});
	
	$('.accordion-lister').click(function(){
	var target=$(this).attr('href');
	if($(target).css('display')=='none')
	{
		$(target).show();
		$(this).text('Hide Settings');
	}
	else
	{
		$(target).hide();
		$(this).text('Manage Settings for this Pet');
	}
	return false;
	});	
	
	$('.accordion-listerpet').click(function(){
	var target=$(this).attr('href');
	if($(target).css('display')=='none')
	{
		$(target).show();
		$(this).text('Hide Add Pet Form');
	}
	else
	{
		$(target).hide();
		$(this).text('Add another pet listing');
	}
	return false;
	});		
		

	$('.accordion-fire').click(function(){
	var target=$(this).attr('name');
	if($(target).css('display')=='none')
	{
		$(target).show();
		$(this).text('Collapse View');
	}
	else
	{
		$(target).hide();
		$(this).text('Expand View');
	}
	return false;
	});


	$('.accordion-map').click(function(){
	var target=$(this).attr('name');
	if($(target).css('display')=='none')
	{
		$(target).show();
		$(this).text('Hide Map');
	}
	else
	{
		$(target).hide();
		$(this).text('Show Map');
	}
	return false;
	});
	
	function megaHoverOver(){
		$(this).find(".mainnavsub").stop().fadeTo('fast', 1).show();
			
	}								
	function megaHoverOut(){ 
	  $(this).find(".mainnavsub").stop().fadeTo('fast', 0, function() {
		  $(this).hide(); 
	  });
	}							 							 
	var config = {    
		 sensitivity: 10, // number = sensitivity threshold (must be 1 or higher)    
		 interval: 10, // number = milliseconds for onMouseOver polling interval    
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)    
		 timeout: 2000, // number = milliseconds delay before onMouseOut    
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
	};
	
	$("ul#main_navigation_bar .mainnavsub").css({'display':'none'});
	
	/*$("ul#main_navigation_bar li").hoverIntent(config);*/ //removed for sub domains per TODDMIKE							 							 							 	

	$('a[rel=tooltip1]').tooltip({offset: [-10,100]});	
	 
	$(".collapsibleContainer").collapsiblePanel();
				
	/*
	$('.section_container').serialScroll({
		items:'div.section',
		prev:'#baseball_prev',
		next:'#baseball_next',
		//offset:-230, //when scrolling to photo, stop 230 before reaching it (from the left)
		//start:1, //as we are centering it, start at the 2nd
		duration:500,
		force:true,
		stop:true,
		lock:false,
		cycle:false, //don't pull back once you reach the end
		//easing:'easeOutQuart', //use this easing equation for a funny effect
		jump: true //click on the images to scroll to them});
	*/
	
});

	
	

