$(document).ready(function(){
    //page photo rotator
    var intervalPhotoRotate;
    
    var start = 1;
    intervalPhotoRotate = setInterval(ImageRotate, 8000);
    
    function ImageRotate(){
        var imgRotate = $('.photo-images img');
        var imgRotateSize = parseInt($('.photo-images img').size()-1);
        var textRotate = $('.photo-text .text');
        imgRotate.each(function(){
            $(this).fadeOut(500);
        })
        textRotate.each(function(){
            $(this).fadeOut(500);
        })
        imgRotate.eq(start).fadeIn(500);
        textRotate.eq(start).fadeIn(500);
        
        if(start == imgRotateSize){
            start = 0;
        }else{
            parseInt(start ++);
        }

    }

    $('#photo-rotator').hover(
    function(){
        clearInterval(intervalPhotoRotate);
    }, function(){
        intervalPhotoRotate = setInterval(ImageRotate, 4000);
    })
    
})




