var AvonMaquiagem = {
	
	init : function() {
		AvonMaquiagem.print_flash_maquiagem_virtual();
		jQuery('a').click(function(e){
			if(jQuery(this).attr('rel') != 'external' && jQuery(this).attr('href') != '#'){
				e.preventDefault();
				jQuery('#flashVirtualMakeup').get(0).jsChangeSection(jQuery(this).attr('href'));
			}
		});
		jQuery('.menu-register').attr("href","#");
		jQuery('.menu-register').click(function(){
			AvonMaquiagem.open_register();
		});
		jQuery('.menu-forgot').remove();
		
		/*if(REGISTER_SUCCESS){
			pageTracker._trackPageview("/maquiagem-virtual/simulador/cadastro");
		}*/
	},
	open_register : function(){
		if(jQuery('#content_login').css('display') == 'none'){
			jQuery('#menu_register').slideDown("slow");
		}else{
			jQuery('#content_login').slideUp("slow",function(){
				jQuery('#menu_register').slideDown("slow");
			});
		}
	},
	response_register : function(){
		jQuery('#flashVirtualMakeup').get(0).goStep();
		
	},
	open_login : function(){
		if(jQuery('#menu_register').css('display') == 'none'){
			jQuery('#content_login').slideDown("slow");
		}else{
			jQuery('#menu_register').slideUp("slow",function(){
				jQuery('#content_login').slideDown("slow");
			});
		}
	},
	response_login : function(){
		
		jQuery('#flashVirtualMakeup').get(0).goStep();
		
	},
	print_flash_maquiagem_virtual : function(){
	if(FlashDetect.installed) {

		if (FlashDetect.majorAtLeast(9)) {
		jQuery('#details #content-flash').media({
			width: "100%",
			height: 600,
			src: URL_BASE + "swf/maquiagem-virtual/virtual-makeup.swf?noCache="+Math.ceil(100000*Math.random()),
			autoplay: true,
			caption: false,
			attrs: { id: 'flashVirtualMakeup'},
			params: {
				allowScriptAccess:"sameDomain",
				quality: "high",
				bgColor:"#000000"
			},
			flashvars: {
				URL_BASE: URL_BASE,
				CONFIG_PATH:"_conteudo/virtual-makup/config/config.xml"
			}
		});
		
		}else{
				window.location.href = URL_BASE + 'no-flash';
			}

		}else{
			window.location.href = URL_BASE + 'no-flash';
		}
	}
};

AvonMaquiagem.init();


function changeTitle(title) {	
	jQuery("#titleJs").get(0).changeTitle(title)
}	

