var Soap = {
	init : function(){
		jQuery('#destaques').show();
		jQuery('.scrollable').scrollable({size: 1, speed: 700});
		
		Soap.destaques_flash();
		Soap.sky_flash();
		Soap.cbn();
		Soap.ground_flash();
		
		jQuery(window).bind('load', function(){
			Soap.change_portfolio();
		});
		
		Soap.resize();
		
		jQuery(window).bind('resize', function(){
			if (jQuery(this).width() > 778)
				Soap.resize();
			
			if (jQuery('body').innerWidth() < 778){
				jQuery('body').css({
					backgroundPosition: '-611px 119px'
				});
			} else {
				jQuery('body').css({
					backgroundPosition: 'center 119px'
				});
			}
		});
	},
	
	change_portfolio : function(){
		jQuery("#detalhe-portfolio .detalhe:first").show();
		jQuery('#detalhe-portfolio').cycle({
			timeout: 2500,
			speed: 1000
		});
	},
	
	destaques_flash : function(){
		jQuery('#destaques #flash').media({
			width: 774,
			height: 263,
			autoplay: true,
			src: TEMPLATEPATH + "/swf/home/top.swf",
			attrs: {
				id: 'destaques_flash'
			},
			params: {
				quality: "high",
				wmode: "transparent"
			},
			flashvars: {
				urlBase: URL_BASE
			}
		});
	},
	
	sky_flash : function(){
		jQuery('#flash-sky').media({
			width: '100%',
			height: 778,
			autoplay: true,
			src: TEMPLATEPATH + "/swf/home/sky.swf",
			attrs: {
				id: 'sky_flash'
			},
			params: {
				quality: "high",
				wmode: "transparent"
			},
			flashvars: {
				urlBase: URL_BASE
			}
		});
	},
	
	cbn : function(){
		jQuery('#cbn').media({
			width: '100%',
			height: 738,
			autoplay: true,
			src: TEMPLATEPATH + "/swf/cbn.swf",
			attrs: {
				id: 'cbn'
			},
			params: {
				quality: "high",
				wmode: "transparent"
			},
			flashvars: {
				urlBase: URL_BASE
			}
		});
	},
	
	ground_flash : function(){
		jQuery('#flash-ground').media({
			width: '100%',
			height: 275,
			autoplay: false,
			src: TEMPLATEPATH + "/swf/home/ground.swf",
			attrs: {
				id: 'ground_flash'
			},
			params: {
				quality: "high",
				wmode: "transparent"
			},
			flashvars: {
				urlBase: URL_BASE
			}
		});
	},
	
	resize : function (){
		jQuery('#flash-sky').css({
			width: parseInt((jQuery('#content').innerWidth() / 2) - 220) + "px"
		});
	}
}

$(document).ready(function(){
	Soap.init();
});