/* Author: 

*/

/* 

jQuery FormBox - Copyright AddyOsmani.com, 2010.
Released under the GPL for open-source use

*/

$().ready(function(){
    $('#contact_container').accordion({
    header: "h3",
    autoHeight: false
    });
    
	$('#coda-slider').codaSlider({
           autoSlide: true,
           autoSlideInterval: 4000,
           autoSlideStopWhenClicked: true,
           dynamicTabsPosition: 'bottom'
    });
    
    $('#coda-slider-2').codaSlider({
    	   crossLinking: true,
           dynamicTabsPosition: 'bottom'
    });
    
    $('#coda-slider-3').codaSlider({
    	   crossLinking: true,
           dynamicTabsPosition: 'bottom'
    });
    
    $('#coda-slider-4').codaSlider({
    		dynamicArrows: false,
    		dynamicTabs: false,
    	   autoSlide: true,
    	   autoSlideInterval: 9000,
    	   autoSlideStopWhenClicked: true
    });

$('#coda-slider-5').codaSlider({
		dynamicArrows: false,
		dynamicTabs: false,
	   crossLinking: true
	   
});



    
    $('input[type="text"]').addClass("idlefield");
    		$('textarea').addClass("idlefield");
    		$.fn.formLabels();
    		

        	
             	
});

$(function() {
$('#grid_1, #over_1').hover(function () {
 $('#over_1').show();
}, function () {
$('#over_1').hide();
});
});

$(function() {
$('#grid_2, #grid_2').hover(function () {
 $('#over_2').show();
}, function () {
$('#over_2').hide();
});
});

$(function() {
$('#grid_3, #over_3').hover(function () {
 $('#over_3').show();
}, function () {
$('#over_3').hide();
});
});

$(function() {
$('#grid_4, #over_4').hover(function () {
 $('#over_4').show();
}, function () {
$('#over_4').hide();
});
});

$(function() {
$('#grid_5, #over_5').hover(function () {
 $('#over_5').show();
}, function () {
$('#over_5').hide();
});
});

$(function() {
$('#grid_6, #over_6').hover(function () {
 $('#over_6').show();
}, function () {
$('#over_6').hide();
});
});

$(function() {
$('#grid_7, #over_7').hover(function () {
 $('#over_7').show();
}, function () {
$('#over_7').hide();
});
});

$(function() {
$('#grid_8, #over_8').hover(function () {
 $('#over_8').show();
}, function () {
$('#over_8').hide();
});
});

$(function() {
$('#grid_9, #over_9').hover(function () {
 $('#over_9').show();
}, function () {
$('#over_9').hide();
});
});

$(function() {
$('#treat, #treat_over').hover(function () {
 $('#treat_over').show();
}, function () {
$('#treat_over').hide();
});
});

$(function() {
$('#callus, #callpo').hover(function () {
 $('#callpop').show();
}, function () {
$('#callpop').hide();
});
});

$(function() {
$('#emailus, #emailpop').hover(function () {
 $('#emailpop').show();
}, function () {
$('#emailpop').hide();
});
});

$(function() {
$('#h_img_1, #coney_lg_over').hover(function () {
 $('#coney_lg_over').show();
}, function () {
$('#coney_lg_over').hide();
});
});

$(function() {
$('#featered_1, #over_5b').hover(function () {
 $('#over_5b').show();
}, function () {
$('#over_5b').hide();
});
});

$(function() {
$('#featered_2, #over_3b').hover(function () {
 $('#over_3b').show();
}, function () {
$('#over_3b').hide();
});
});

$(function() {
$('#featered_3, #over_6b').hover(function () {
 $('#over_6b').show();
}, function () {
$('#over_6b').hide();
});
});

$(function() {
$('#history_slide3, #history_lg_over').hover(function () {
 $('#history_lg_over').show();
}, function () {
$('#history_lg_over').hide();
});
});



$(window).load(function(){

var tabs = $("#tabs");
var tabPanesContainer = $("ul#tabPanes");
var tabPanesAll = tabPanesContainer.find("li").css("position", "absolute");
var tabMenuLinks = $("ul#tabMenu .dropdown");
var tabMenuHover = $("li.dropdown a");
var regularLinks = $("ul#tabMenu .regular");
var dropDownSpeed = 300;
var dropUpSpeed   = 100;
var menuHeight = '220px';


/*Close the currently open menu*/
function closeMenu()
{

tabMenuHover.removeClass('active');

    tabPanesContainer.stop().animate({
        height: '0px'
    }, dropUpSpeed);

	
}

/*Handle non tab-menu links*/
regularLinks.click(function() 
{
    tabPanesContainer.stop().animate({
        height: '0px'
    });
    
    tabMenuHover.removeClass('active');
    $(this).addClass('active');

}, function() {
    $(this).removeClass('active');

});

/*Handle tab-menu links*/
tabMenuLinks.hover(function() 
{

    var thisMenuItem = $(this);

    /*get the offset of this item in respect to the page*/
    var thisMargin   = thisMenuItem.offset().left;
    
    /*get the offset of the navigation bar in respect to the page*/
    var tabsOffset   = tabs.offset().left;
    var thisIndex = thisMenuItem.index();
    
    thisMargin = Math.floor(thisMargin - tabsOffset);
    
       
    var thisOffset = thisMargin - 0;
    
    /* handle IE margin difference*/
    if($.browser.msie)
    {
      thisOffset = thisMargin - 0;
    }
    

    tabPanesContainer.css('margin-left', thisOffset);

    tabPanesContainer.stop().animate({
        height: menuHeight
    }, dropDownSpeed);
	
	
    
    tabMenuHover.removeClass('active');
    thisMenuItem.find("a").addClass('active');


    var thisHash = thisMenuItem.find("a").attr('href');
    var tabClicked = tabPanesAll.filter(thisHash);

    
    tabClicked.appendTo(tabPanesContainer).show();
	
	
    
    return false;


}, function() {

   $(this).stop();
   
});







/*Handle a user hovering over the tab container*/
tabPanesContainer.hover(function() 
{
 
}, function() 
{  
    closeMenu();
});


$('.edges').hover(function()
{
   closeMenu();
   
}, function()
{
});


$(function()
{
	$('.scroll-pane').jScrollPane();
});

	});
// bind to accordion object
$().ready(function(){
    $('#contact_container').accordion({
    header: "h3",
    collapsible: true
    });
            
});

// actions taken upon clicking the expand all (collapse all) link
$('#contact_container #expand').click( function() {
        // if link was expand then show and toggle text
        var currHTML = $('#contact_container #expand').html();
        if (currHTML.indexOf("Expand All")>0) {
                $('#contact_container .section').slideDown();
                $('#contact_container #expand').html("<IMG src=\"minus.gif\"/> Collapse All");
        }
        // if link was collapse then hide and toggle text
        else {
                $('#contact_container .section').slideUp();
                $('#contact_container .section').each(function(i){
                    if (i==0) $(this).slideDown();
                });
                $('#contact_container #expand').html("<IMG src=\"plus.gif\"/> Expand All");
        }
});
	
	
	

	
	






















