$(document).ready(function(){

   

    $('.title').each(function(){

        $(this).css('bottom', '-' + $(this).height() + 'px');

    });

   

    $('.album').hover(

        function(){

            $(this).children('.colour').css('z-index', '30');

            $(this).children('.monochrome').css('z-index', '20');

            $(this).children('.title').animate({

                bottom: '+=' + $(this).children('.title').height() + 'px'

            }, 'fast');

        },

        function(){

            //var titleHeight = $this.children('.title').height();

            $(this).children('.title').animate({

                bottom: '-=' + $(this).children('.title').height() + 'px'

            }, 'fast');

            $(this).children('.monochrome').css('z-index', '30');

            $(this).children('.colour').css('z-index', '20');

        });

   

    $('.thumbs img').click(function(){

        var thumb_src = $(this).attr('src');

        $('.active').attr('src', thumb_src);

    });

   

  $('#arrow_left').hover(
        function(){
            $(this).animate({
                opacity: 1
            }, 'fast');
        },
        function(){
            $(this).animate({
                opacity: 0
            }, 'fast');
        }
        );
        
    $('#arrow_right').hover(
        function(){
            $(this).animate({
                opacity: 1
            }, 'fast');
        },
        function(){
            $(this).animate({
                opacity: 0
            }, 'fast');
        }
        );
        

    /*$(".thumbs").jCarouselLite({

        btnNext: "#arrow_right",

        btnPrev: "#arrow_left",

        circular: false,

        visible: 5

    });*/

});







$(document).ready(function(){



    $('div.news_modal').hide();

    

    /*$('.tab').click(function(){

        var tabclicked = $(this).attr('id');

        $('.pentext').css('z-index', '1');

        $('.pentext#' + tabclicked).css('z-index', '9999');

    });*/

    

    $('input.field').val('Search...');

    $('input.field').focus(function(){

        $(this).val(''); 

    });

    

    $('#searchform').submit(function(){

        if($('#s').val() == '' || $('#s').val() == 'Search...'){

            var retour = false;

        }

        if(retour == false){

            return false;

        }

    });

    

    $('#email_field').val('Enter email');

    $('#email_field').focus(function(){

        $(this).val(''); 

    });

    $('#email_field').blur(function(){

        if( $(this).val() == ''){

            $('#email_field').val('Enter email');

        } 

    });

    

    $('#name_field').val('Enter name');

    $('#name_field').focus(function(){

        $(this).val(''); 

    });

    $('#name_field').blur(function(){

        if( $(this).val() == ''){

            $('#name_field').val('Enter name');

        } 

    });

    

    $('#company_field').val('Enter company name');

    $('#company_field').focus(function(){

        $(this).val(''); 

    });

    $('#company_field').blur(function(){

        if( $(this).val() == ''){

            $('#company_field').val('Enter company name');

        } 

    });

   

    $('.letter p').click(function(){

        $('div.news_modal').slideToggle('fast') 

    });

    

    $('#news_form').submit(function(){

        var form = $(this),

        formData = form.serialize(),

        formUrl = form.attr('action'),

        formMethod = form.attr('method'),

        responseMsg = $('#signup-response');

        

        //add status data to form  

        form.data('formstatus','submitting');

        

        //show response message - waiting

        responseMsg.hide()

        .addClass('response-waiting')

        .text('Please Wait...')

        .fadeIn(200);

        

        $.ajax({

            url: formUrl,

            type: formMethod,

            data: formData,

            success:function(data){



                //setup variables

                var responseData = jQuery.parseJSON(data),

                klass = '';

                

                //response conditional

                switch(responseData.status){

                    case 'error':

                        klass = 'response-error';

                        break;

                    case 'success':

                        klass = 'response-success';

                        break;

                }

                //show reponse message

                responseMsg.fadeOut(200,function(){

                    $(this).removeClass('response-waiting')

                    .addClass(klass)

                    .text(responseData.message)

                    .fadeIn(200,function(){

                        //set timeout to hide response message

                        setTimeout(function(){

                            responseMsg.fadeOut(500,function(){

                                $(this).removeClass(klass);

                                form.data('formstatus','idle');

                            });

                        },3000)

                    })

                })

            }

        })

        

        return false;

    });



    $('.thumbs').show();

    $('#tab').toggle(function(){

        var config = {

            basePath: "<?php echo bloginfo('template_url'); ?>"

        }

	   

        $('#tab').animate({

            bottom: '-=170'

        }, 600);

        $('#tab').css('background-image', 'url(http://adrenaline-clientarea.co.uk/danielsgroupnew/wordpress/wp-content/themes/danielsconstruction/IMAGES/more_tab.png)');

        $('.thumbs').slideToggle(600);

    },function(){

        var config = {

            basePath: "<?php echo bloginfo('template_url'); ?>"

        }

	   



        $('#tab').animate({

            bottom: '+=170'

        }, 600);

        $('#tab').css('background-image', 'url(http://adrenaline-clientarea.co.uk/danielsgroupnew/wordpress/wp-content/themes/danielsconstruction/IMAGES/close_tab.png)');

        $('.thumbs').slideToggle(600);

    });

    

    

});










