swfobject.embedSWF('./swf/balettcipo.swf', 'logo', '250', '400', '9.0.0', './swf/expressInstall.swf', {}, {'wmode': 'transparent'}, {});

function music(){
    if ($('body').is('.page')) {
        soundManager.url = './swf/';
        soundManager.onload = function(){
            var mySound = soundManager.createSound({
                id: 'music',
                url: './mp3/002.mp3'
            });
            if (!$.cookie('music') || $.cookie('music') == 'on') {
                $.cookie('music', 'on', {
                    expires: 7
                });
                mySound.play({
                    onfinish: function(){
                        this.play();
                    }
                });
            }
            else {
                $.cookie('music', 'off', {
                    expires: 7
                });
            }
            
            var cooVal = $.cookie('music');
            $('var.'+cooVal).siblings().show();
            
            $('#toggleMusic').click(function(){
                if ($.cookie('music') == 'on') {
                    $('.state').toggle();
                    mySound.stop();
                    $.cookie('music', 'off', {
                        expires: 7
                    });
                }
                else {
                    $('.state').toggle();
                    mySound.play({
                        onfinish: function(){
                            this.play();
                        }
                    });
                    $.cookie('music', 'on', {
                        expires: 7
                    });
                }
                return false;
            });
        }
    }
}

function slideshow(){
    var $picsBox = $('.pictureBox');
    if($picsBox.length){
        $picsBox.each(function(i){
        	var $pics = $(this).find('.pictures'),
        		p = $pics.length,
	            n = 0;
	        
	        setInterval(function(){
	            if(n==p)n=0;
	            $pics.hide().eq(n).fadeIn(1000);
	            n++;
	        },5000+i*1000);
        });
    }
}

jQuery(function($){
    music();
    slideshow();
    $('a[rel="gallery"]').colorbox();
	$('marquee').marquee();
});

