var __SITEPATH = 'http://www.hoffmannfoundation.org.uk/';

$('.plus-icon').hover(function(){
   if($(this).attr('src')== 'images/plusClickable.jpg' || $(this).attr('src')== __SITEPATH+'images/plusClickable.jpg'){
    $(this).attr('src','images/plusClickableon.jpg');
   }

   if($(this).attr('src')== 'images/plusClickable.png' || $(this).attr('src')== __SITEPATH+'images/plusClickable.png'){
    $(this).attr('src','images/plusClickableon.png');
   }

   if($(this).attr('src')== 'images/minusClickable.jpg' || $(this).attr('src')== __SITEPATH+'images/minusClickable.jpg'){
    $(this).attr('src','images/minusClickableon.jpg');
   }

   if($(this).attr('src')== 'images/minusClickable.png' || $(this).attr('src')== __SITEPATH+'images/minusClickable.png'){
    $(this).attr('src','images/minusClickableon.png');
   }
}, function(){
    if($(this).attr('src')== 'images/plusClickableon.jpg'  || $(this).attr('src')== __SITEPATH+'images/plusClickableon.jpg'){
        $(this).attr('src','images/plusClickable.jpg');
    }

    if($(this).attr('src')== 'images/plusClickableon.png'  || $(this).attr('src')== __SITEPATH+'images/plusClickableon.png'){
        $(this).attr('src','images/plusClickable.png');
    }

    if($(this).attr('src')== 'images/minusClickableon.jpg' || $(this).attr('src')== __SITEPATH+'images/minusClickableon.jpg'){
    $(this).attr('src','images/minusClickable.jpg');
   }

   if($(this).attr('src')== 'images/minusClickableon.png' || $(this).attr('src')== __SITEPATH+'images/minusClickableon.png'){
    $(this).attr('src','images/minusClickable.png');
   }
});

$('.read-more').hover(function(){
    $(this).attr('src','images/newsReadMoreButtonon.png');
},function(){
    $(this).attr('src','images/newsReadMoreButton.png');
});

$('#latest').click(function(){
    $('#latest').attr('src', __SITEPATH+'images/categoryLatestoff.png');
    $('#news').attr('src', __SITEPATH+'images/categoryNewsOff.jpg');
    $('#hoffmann').attr('src', __SITEPATH+'images/categoryHoffmannOff.jpg');
    $('#other').attr('src', __SITEPATH+'images/categoryOtherOff.jpg');

    $('#latest').attr('src', __SITEPATH+'images/categoryLatestOn.jpg');
});

$('#news').click(function(){
    $('#latest').attr('src', __SITEPATH+'images/categoryLatestoff.png');
    $('#news').attr('src', __SITEPATH+'images/categoryNewsOff.jpg');
    $('#hoffmann').attr('src', __SITEPATH+'images/categoryHoffmannOff.jpg');
    $('#other').attr('src', __SITEPATH+'images/categoryOtherOff.jpg');

    $('#news').attr('src', __SITEPATH+'images/categoryNewson.png');
});

$('#hoffmann').click(function(){
    $('#latest').attr('src', __SITEPATH+'images/categoryLatestoff.png');
    $('#news').attr('src', __SITEPATH+'images/categoryNewsOff.jpg');
    $('#hoffmann').attr('src', __SITEPATH+'images/categoryHoffmannOff.jpg');
    $('#other').attr('src', __SITEPATH+'images/categoryOtherOff.jpg');

    $('#hoffmann').attr('src', __SITEPATH+'images/categoryHoffmannon.png');
});

$('#other').click(function(){
    $('#latest').attr('src', __SITEPATH+'images/categoryLatestoff.png');
    $('#news').attr('src', __SITEPATH+'images/categoryNewsOff.jpg');
    $('#hoffmann').attr('src', __SITEPATH+'images/categoryHoffmannOff.jpg');
    $('#other').attr('src', __SITEPATH+'images/categoryOtherOff.jpg');

    $('#other').attr('src', __SITEPATH+'images/categoryOtheron.png');
});

/*$('#latest').hover(function(){
    if($(this).attr('src') == __SITEPATH+'images/categoryLatestoff.png'){
        $(this).attr('src',__SITEPATH+'images/categoryLatestOn.jpg');
    }else{
        $(this).attr('src',__SITEPATH+'images/categoryLatestoff.png');
    }
},function(){
    if($(this).attr('src') == __SITEPATH+'images/categoryLatestoff.png'){
        $(this).attr('src',__SITEPATH+'images/categoryLatestOn.jpg');
    }else{
        $(this).attr('src',__SITEPATH+'images/categoryLatestoff.png');
    }
});

$('#news').hover(function(){
    if($(this).attr('src') == __SITEPATH+'images/categoryNewsOff.jpg'){
        $(this).attr('src',__SITEPATH+'images/categoryNewson.png');
    }else{
        $(this).attr('src',__SITEPATH+'images/categoryNewsOff.jpg');
    }
},function(){
    if($(this).attr('src') == __SITEPATH+'images/categoryNewsOff.jpg'){
        $(this).attr('src',__SITEPATH+'images/categoryNewson.png');
    }else{
        $(this).attr('src',__SITEPATH+'images/categoryNewsOff.jpg');
    }
});

$('#hoffmann').hover(function(){
    if($(this).attr('src') == __SITEPATH+'images/categoryHoffmannOff.jpg'){
        $(this).attr('src',__SITEPATH+'images/categoryHoffmannon.png');
    }else{
        $(this).attr('src',__SITEPATH+'images/categoryHoffmannOff.jpg');
    }
},function(){
    if($(this).attr('src') == __SITEPATH+'images/categoryHoffmannOff.jpg'){
        $(this).attr('src',__SITEPATH+'images/categoryHoffmannon.png');
    }else{
        $(this).attr('src',__SITEPATH+'images/categoryHoffmannOff.jpg');
    }
});

$('#other').hover(function(){
    if($(this).attr('src') == __SITEPATH+'images/categoryOtherOff.jpg'){
        $(this).attr('src',__SITEPATH+'images/categoryOtheron.png');
    }else{
        $(this).attr('src',__SITEPATH+'images/categoryOtherOff.jpg');
    }
},function(){
    if($(this).attr('src') == __SITEPATH+'images/categoryOtherOff.jpg'){
        $(this).attr('src',__SITEPATH+'images/categoryOtheron.png');
    }else{
        $(this).attr('src',__SITEPATH+'images/categoryOtherOff.jpg');
    }
});*/

$('#search_term').click(function(){
    if($(this).val() == 'Search for an article here...'){
        $(this).val('');
    }
});

$('#search_term').blur(function(){
    if($(this).val() == ''){
        $(this).val('Search for an article here...');
    }
});

$('.view-more3').click(function() {
    $('.text2').fadeOut('slow');
    $('.text3').fadeOut('slow', function() {
        $('.text1').fadeIn('slow');
        $('.button1').attr('src', 'images/activeDot.jpg')
        $('.button2').attr('src', 'images/inactiveDot.jpg');
        $('.button3').attr('src', 'images/inactiveDot.jpg');;
    });
});




$('#what-support-expand').click(function() {
    if($('#what-support-content').height() > 0 ){
        $('#what-support-content').animate({
            height: '0px'
        },800, function() {
            $('#what-support').animate({
                top: '0px'
            },800,function() {
                $('#marriot-road,#pear-close,#park-avenue,#castleton-avenue,#what-cost,#not-sure').animate({
                    opacity: '1'
                },800)
            })
        });
        $('#what-support-expand').attr('src', 'images/plusClickable.png');
        $('#what-support-expand').attr('alt', 'Read More');
    }else if($('#what-support-content').height() <= 0){
        $('#not-sure').fadeOut(800, function() {
            $('#what-support-content').animate({
                height: '115px'
            },1200
            )
        });

        $('#marriot-road,#pear-close,#park-avenue,#castleton-avenue,#what-cost,#not-sure').animate({
            opacity: '0'
        }, 800, function() {});

        $('#what-support, #what-support-content').delay(800).animate({
            top: '-220px'
        }, 800);

        $('#what-support-expand').attr('src', 'images/minusClickable.png');
        $('#what-support-expand').attr('alt', 'Hide');
        $('#not-sure').fadeIn('slow');
    }
});


$('#what-cost-expand').click(function() {
    if($('#what-cost-content').height() > 0 ){
        $('#what-cost-content').animate({
            height: '0px'
        },800, function() {
            $('#what-cost').animate({
                top: '0px'
            },800,function() {
                $('#marriot-road,#pear-close,#park-avenue,#castleton-avenue,#what-support,#not-sure').animate({
                    opacity: '1'
                },800)
            })
        });
        $('#what-cost-expand').attr('src', 'images/plusClickable.png');
        $('#what-cost-expand').attr('alt', 'Read More');
    }else if($('#what-cost-content').height() <= 0){
        $('#not-sure').fadeOut(800, function() {
            $('#what-cost-content').animate({
                height: '125px'
            },1200
            )
        });

        $('#marriot-road,#pear-close,#park-avenue,#castleton-avenue,#what-support,#not-sure').animate({
            opacity: '0'
        }, 800, function() {});

        $('#what-cost, #what-cost-content').delay(800).animate({
            top: '-290px'
        }, 800);

        $('#what-cost-expand').attr('src', 'images/minusClickable.png');
        $('#what-cost-expand').attr('alt', 'Hide');
        $('#not-sure').fadeIn('slow');
    }
});

$('#contact-enquiry').click(function(){
    if($(this).val()=='Enquiry'){
        $(this).val('');
    }
});

$('#plus5').click(function() {
    if($('#art-contact').height() > 35){
        $('#art-contact').animate({
            height: '35px'
        }, 1000, function() {})
        $('#plus5').attr('src', 'images/plusClickable.jpg');
        $('#plus5').attr('alt', 'Read More');
    }else if($('#art-contact').height() <= 35){
        $('#art-contact').animate({
            height: $('#art-contact-text').height()+ 60 +'px'
        }, 1000, function() {})
        $('#plus5').attr('src', 'images/minusClickable.jpg');
        $('#plus5').attr('alt', 'Hide');
    }
});

$('#the-hub #plus6').click(function() {
    if($('#the-hub #art-gallery').height() > 35){
        $('#the-hub #art-gallery').animate({
            height: '35px'
        }, 1000, function() {})
        $('#plus6').attr('src', 'images/plusClickable.jpg');
        $('#plus6').attr('alt', 'Read More');
    }else if($('#the-hub #art-gallery').height() <= 35){
        $('#the-hub #art-gallery').animate({
            height: $('#art-gallery-text').height()+ 60 +'px'
        }, 1000, function() {})
        $('#plus6').attr('src', 'images/minusClickable.jpg');
        $('#plus6').attr('alt', 'Hide');
    }
});


$('#plus8').click(function() {
    if($('#art-gallery').height() > 35){
        $('#art-gallery').animate({
            height: '35px'
        }, 1000, function() {})
        $('#plus8').attr('src', 'images/plusClickable.jpg');
        $('#plus8').attr('alt', 'Read More');
    }else if($('#art-gallery').height() <= 35){
        $('#art-gallery').animate({
            height: $('#art-gallery-text').height()+ 60 +'px'
        }, 1000, function() {})
        $('#plus8').attr('src', 'images/minusClickable.jpg');
        $('#plus8').attr('alt', 'Hide');
    }
});


$('#the-hub #plus7').click(function() {
    if($('#the-hub #gallery-details').height() > 35){
        $('#the-hub #gallery-details').animate({
            height: '35px'
        }, 1000, function() {})
        $('#plus7').attr('src', 'images/plusClickable.jpg');
        $('#plus7').attr('alt', 'Read More');
    }else if($('#the-hub #gallery-details').height() <= 35){
        $('#the-hub #gallery-details').animate({
            height: $('#gallery-details-text').height()+ 60 +'px'
        }, 1000, function() {})
        $('#plus7').attr('src', 'images/minusClickable.jpg');
        $('#plus7').attr('alt', 'Hide');
    }
});


$('#supported-living #plus7').click(function() {
    if($('#supported-living #content7').height() > 35){
        $('#supported-living #content7').animate({
            height: '35px'
        }, 1000, function() {})
        $('#plus7').attr('src', 'images/plusClickable.jpg');
        $('#plus7').attr('alt', 'Read More');
    }else if($('#supported-living #content7').height() <= 35){
        $('#supported-living #content7').animate({
            height: $('#content7-text').height()+ 60 +'px'
        }, 1000, function() {})
        $('#plus7').attr('src', 'images/minusClickable.jpg');
        $('#plus7').attr('alt', 'Hide');
    }
});


$('#pyschology #plus11').click(function() {

    if($('#pyschology #contact-psy').height() > 35){
        $('#pyschology #contact-psy').animate({
            height: '35px'
        }, 1000, function() {})
        $('#plus11').attr('src', 'images/plusClickable.jpg');
        $('#plus11').attr('alt', 'Read More');
    }else if($('#pyschology #contact-psy').height() <= 35){
        $('#pyschology #contact-psy').animate({
            height: $('#contact-psy-text').height()+ 60 +'px'
        }, 1000, function() {})
        $('#plus11').attr('src', 'images/minusClickable.jpg');
        $('#plus11').attr('alt', 'Hide');
    }
});


$('#pyschology #plus12').click(function() {

    if($('#pyschology #gallery-psy').height() > 35){
        $('#pyschology #gallery-psy').animate({
            height: '35px'
        }, 1000, function() {})
        $('#plus12').attr('src', 'images/plusClickable.jpg');
        $('#plus12').attr('alt', 'Read More');
    }else if($('#pyschology #gallery-psy').height() <= 35){
        $('#pyschology #gallery-psy').animate({
            height: $('#gallery-psy-text').height()+ 60 +'px'
        }, 1000, function() {})
        $('#plus12').attr('src', 'images/minusClickable.jpg');
        $('#plus12').attr('alt', 'Hide');
    }
});

$('.about-nav').hover(function(){
    $('about-subnav').show();
},function(){
    $('about-subnav').hide();
});


$("#about-button").hover(
    function () {
       
        $(this).css('background-image','url("http://www.hoffmannfoundation.org.uk/images/aboutustab.png")');
        
    },
    function () {
        $(this).css('background-image','url("")');
    }
    );

$("#services-button-2").hover(
    function () {

        $(this).css('background-image','url("http://www.hoffmannfoundation.org.uk/images/servicestab.png")');

    },
    function () {
        $(this).css('background-image','url("")');
    }
    );

$("#get-involved-button-2").hover(
    function () {

        $(this).css('background-image','url("http://www.hoffmannfoundation.org.uk/images/getinvolvedtab.png")');

    },
    function () {
        $(this).css('background-image','url("")');
    }
    );

$('#news-fly-to-top').click(function(){
    $('html, body').animate({scrollTop: 0}, 2000);
});
