jQuery(document).ready(function(){
    jQuery('#faloc').click(function(){
        jQuery('#location-list').toggle('slow', 'linear');
    });
     
    jQuery('.tag-clk').click(function(){
        var ids = this.id.split('-');
        switch_banner(ids);
        return false;
    });
    
    jQuery('.tag-clk h3').click(function(){
        var ids = this.id.split('-');
        switch_banner(ids);
        return false;
    });
    
    jQuery('.sliderblk a').click(function(){
        window.location = jQuery( '.sliderblk.active ul li a').attr('href');
        return false;    
    });
    
    function switch_banner(ids){
        jQuery('.sliderblk').hide();
        jQuery('.sliderblk').removeClass('active');
        jQuery('#slider-'+ids[1]).show();
        jQuery('#slider-'+ids[1]).addClass('active');
        jQuery('.tag-clk').removeClass('selected');
        
        jQuery('#chngs-'+ids[1]+'-'+ids[2]).addClass('selected');
    }
    
    $(".service").click(function(){
        window.location=$(this).find("a").attr("href");
        return false;
   });
    $(".splash").click(function(){
        window.location=$(this).find("a").attr("href");
        return false;
   });
    $("ul.buttons li").click(function(){
        window.location=$(this).find("a").attr("href");
        return false;
   });
    $(".bnr-rotate").click(function(){
        window.location=$(this).find("a").attr("href");
        return false;
   });
    checkForMap = function(){
        checking = setInterval(function(){ //Set timer - this will repeat itself every 8 seconds
            $('.mapp-overlay-links #mapp0_directionslink').html('Click for Directions');
            $('#mapp0_daddr').val($('#gm_loc').val());
            $('.mapp-directions table input#saddr').attr('style','width: 95% !important');
            $('.mapp-directions table input#daddr').attr('style','width: 95% !important');
            $('.mapp-directions table input#mapp0_closedirections').attr('style','width: 100px !important');
            if($('#mapp0_directionslink').html() == "Click for Directions"){
                clearInterval(checking)
            }
            
        }, 200); //Timer speed in milliseconds 
    };
    
    checkForMap();
    
	$('.qanda dt').click(function() {
	    ( $(this).hasClass( 'open' ) ) ? $(this).removeClass( 'open' ) : $(this).addClass( 'open' );  
		$(this).next().toggle('fast');
		return false;
	}).next().hide();
  
    // round corner
   
   $('#mnthly-cpn-print').click(function(){
        $('#content').hide();
        $('#header-wrap').hide();
        $('h1').hide();
        $('h2').hide();
        $('#footer').hide();
        $('body').css({ 'height' : '500px' });
        $('#mnthly-cpn-print').hide();
        window.print();
   });
    
   $('input[name="ea"]').focus(function(){
        if( $(this).val() == 'Enter your email address' ){
            $(this).val( '' );
        }
   });
    $('input[name="ea"]').focusout(function(){
        if( $(this).val() == '' ){
            $(this).val( 'Enter your email address' );
        }
    });
});

