var Site = {
	init : function() {
		Site.default_definitions();
		Site.print_flash();
		Site.window_size();
		
		//adicionado flash das redes sociais no rodape.
		
		$('#flash-redes-sociais').media({
			width: '120px',
			height: '25px',
			src: URL_BASE + 'swf/redes-sociais.swf',
			autoplay: true,
			params: {
				quality: 'high',
				wmode:'transparent'
			}
		});
		
	},

	default_definitions : function() {
		$('a[rel=external]').attr('target', '_blank');
		
		$(window).bind('resize', function() {
			Site.window_size();
		});
	},

	print_flash: function() {
		if(FlashDetect.installed) {
			if (/pages\/home/gi.test(VIEW)) {
				$('#flash-content').media({
					width: '100%',
					height: '100%',
					src: URL_BASE + 'swf/home.swf',
					autoplay: true,
					params: {
						quality: 'high',
						bgColor: '#0b0e0b'
					},
					flashvars: {
						urlBase: URL_BASE
					}
				});
			}else{
				ID = Site.getId();
				$('#flash-menu').media({
					width: '100%',
					height: '93px',
					src: URL_BASE + 'swf/menu2.swf',
					autoplay: true,
					params: {
						quality: 'high',
						bgColor: '#0b0e0b'
					},
					flashvars: {
						urlBase: URL_BASE,
						sectionID : ID,
						blockAnimation : (block == "true") ? "true" : "false"
					}
				});
			}
			
		}else{			
			window.location.href = URL_BASE + 'no-flash';
		}

	},

	window_size : function() {

		if (/pages\/home/gi.test(VIEW)) {
			if ( document.body.clientHeight > 460 ) {
				$('#main #flash-content, #main').css({
					height: $('body').innerHeight() - $('#footer').outerHeight()
				});
			}
		}else{

			var contentHeight = parseInt( jQuery('.content').outerHeight() );
			var heightIE = (jQuery.browser.msie) ? 50 : 0;

			if ( (jQuery(window).height() - heightIE) < (contentHeight + 93 + 20) ) {
				jQuery('#main').css({
					height: (contentHeight + 150) + 'px'
				});
			}else{				
				jQuery('#main').css({
					height: jQuery('body').innerHeight() - jQuery('#footer').outerHeight()
				});
			}

		}

	},

	getId : function() {
		var id = null;
		switch(VIEW) {
			case 'pages/jadir':
			 id = 1;
			 break;
			case 'pages/galeria':
			 id = 2;
			 break;
			case 'galerias/index':
			 id = 3;
			 break;
			case 'galerias/ver':
			 id = 3;
			 break;
			case 'noticias/index':
			 id = 4;
			 break;   
			case 'noticias/ler':
			 id = 4;
			 break;   
			case 'usuarios/cadastro':
			 id = 5;
			 break;   
			 case 'usuarios/contato':
			 id = 6;
			 break;     
		}
		return id;
	}
}

jQuery( Site.init() );
