$(document).ready(function() {
		
	$("#monthlyUpdates input").focus(function() {
        $(this).val('');
    });
    
    $('#otblogo a[href]').qtip({
        content: 'outside the box creates integrated marketing campaigns for some of the UK&apos;s largest companies',
        position: {
            corner: {
                target: 'bottomLeft',
                tooltip: 'topRight'
            }
        },
        style: { 
            width: 165,
            padding: 10,            
            background: '#FFFFFF',
            color: '#000000',
            textAlign: 'left',
            border: {
                width: 2,
                radius: 5,
                color: '#ABD822'
            },
            tip: 'topRight',
            name: 'dark' // Inherit the rest of the attributes from the preset dark style
        }
    });

    setInterval( "slideSwitch('#box1')", 4000 );
    setInterval( "slideSwitch('#box2')", 4000 );
    setInterval( "slideSwitch('#box3')", 4000 );
    setInterval( "slideSwitch('#largebox1')", 4000 );
    setInterval( "slideSwitch('#slideshow')", 4000 );
    
    $("a.iframeconsultant").fancybox({
		'width': 450,
		'height': 450
    });
    
    $("a.iframeaudit").fancybox({
		'width': 450,
		'height': 450
    });
    
    $("#consultantLink").fancybox({
     'width' : '45%',
     'height' : '25%',
    'autoScale' : false,
    'transitionIn' : 'none',
     'transitionOut' : 'none',
     }); 
    
    $("a.iframemap").fancybox({
		'width': 850,
		'height': 650
    });
    
    $("a.iframeshowreel").fancybox({
		'width': 952,
		'height': 285,
		'onComplete': function() { 
		    $("#fancybox-wrap").css({'top':'100px'});
	    }   
    });
		
});

function slideSwitch(target) {
        var $active = $(target + ' img.active');

        if ( $active.length == 0 ) $active = $(target + ' img:last');

        var $next =  $active.next().length ? $active.next()
            : $(target + ' img:first');

        $active.addClass('last-active');

        $next.css({opacity: 0.0})
            .addClass('active')
            .animate({opacity: 1.0}, 1500, function() {
                $active.removeClass('active last-active');
            });
    }
