	$(document).ready(function() {
		
		$('#images').innerfade({
			animationtype: 'fade',
			speed: 750,
			timeout: 3000,
			type: 'sequence',
			containerheight: '729px'
		});
		
		$('.tabs .tab-active').show(); // show default content
		$('.tabs .header ul a').click(function(){
			$('.tabs .header ul li').removeClass('active');
			$(this).parent().addClass('active'); // make clicked tab active
			$('.tabs .tab').hide(); // hide all content
			$('.tabs').find('#' + $(this).attr('rel')).show(); // and show content related to clicked tab
			return false;
		});
		
		$("a.lightview").fancybox({'overlayShow': true, overlayOpacity:0.9,frameWidth:600,frameHeight:400 });
		
		$("a").focus(function () {
        	$(this).blur();
		});
		$("img.rollover").hover(function () {
			newsrc=$(this).attr('src').replace('.jpg','-over.jpg').replace('.png','-over.png');
        	$(this).attr('src',newsrc);
		},function () {
			newsrc=$(this).attr('src').replace('-over.jpg','.jpg').replace('-over.png','.png');
        	$(this).attr('src',newsrc);
		});
		
	});
	
	function sendEmail() {
		$('#sendbutton').val('sending...');
		$('#sendbutton').attr("disabled","true");
		$.post('contact-form.php?r='+Math.random(),{
			v_name: $('#name').val(),
			v_email: $('#email').val(),
			v_telephone: $('#telephone').val(),
			v_message: $('#message').val()
		},
		function (data) {
			$('#contactForm').html("");
			$('#sendStatus').html("<br /><p>Your message has been sent, we will reply as soon as possible.<br /><br />Thank you,<br />Bacchus</p>");
			$('#sendbutton').val('Send Message');
			$('#sendbutton').attr("disabled",false);
		}
		);
		return false;
	}
	
	function clickSub(thediv,div,image){
        $.each($('.'+div),function(){
            if(this.id==thediv){
                if(this.style.display=='none')
                {
                    $('#'+this.id).slideDown(700);
                    $('#'+image).show(700);
                    $('#'+'plus-'+this.id).hide(700)
                }
                else
                {
                    $('#'+this.id).slideUp(700);
                    $('#'+image).show(700);
                    $('#'+'minus-'+this.id).hide(700)
                }
            }else
            {
                $('#'+this.id).slideUp(700);
                $('#'+'minus-'+this.id).hide(700);
                $('#'+'plus-'+this.id).show(700);
            }

        });
	}
