
var cache = "_geral.js12682138351268213835126821383512682";

function popAtendimento(){
		w = window.open('http://www.mazaya.com.br/online/request_email.php?l=admin&x=1&deptid=0',"atendimento","width=500,height=450,scrollbars=yes,left=0,resizable=yes");
		w.focus();
								pageTracker._trackPageview('Atendimento Online');
				}

function fakeRadio(){
	$$('a[inputId="'+this.readAttribute('inputId')+'"]').each(function (e){e.removeClassName('radioFocus')});
	if($(this.readAttribute('inputId')).value != this.readAttribute('value')){
		this.addClassName('radioFocus');
		$(this.readAttribute('inputId')).value = this.readAttribute('value');
	}else{
		this.removeClassName('radioFocus');
		$(this.readAttribute('inputId')).value = '';
	}
}


function sendWindowForm( divForm, _form ){
	divResp = 'emailResponse'+divForm;
	var valid = new Validation( _form ,{onSubmit:false});
	if(valid.validate()){
		
		if(!$(divForm).childElements().last().hasClassName('emailResponse'))
			$(divForm).insert({'bottom' : '<div id="'+divResp+'" class="emailResponse"><div id="emailResponseMsg">Aguarde o processamento...</div></div>'});
		
		$('emailResponseMsg').show().update('Enviando...').addClassName('emailResponseEnviando').scrollIntoView();
		new Ajax.Request('http://www.mazaya.com.br/_Request/',{
						
					  parameters: $(_form).serialize(),
					  onComplete: function(resposta) {
					  	if(resposta.responseText.isJSON()){
							var res = resposta.responseText.evalJSON();
							if(res.status == 'ok'){
								$('emailResponseMsg')
									.update(res.mensagem)
									.removeClassName('emailResponseErro')
									.addClassName('emailResponseEnviada');
								
								if(res.mensagem){
									$('emailResponseMsg').pulsate().scrollIntoView();
								}else{
									$('emailResponseMsg').remove();
								}
								//$(_form).reset();
								if(res.script)
									eval(res.script);
							}else{
								$('emailResponseMsg')
									.update(res.mensagem)
									.removeClassName('emailResponseEnviando')
									.addClassName('emailResponseErro')
									.pulsate()
									.scrollIntoView();
							}
						}else{
							$('emailResponseMsg')
								.update('Não foi possível executar esta função neste momento. Tente novamente, por favor ou envie e-mail para <a href="contato@mazaya.com.br">contato@mazaya.com.br</a>.')
								.removeClassName('emailResponseEnviando')
								.addClassName('emailResponseErro')
								.scrollIntoView();
							$('emailResponseMsg').pulsate();
						}
					  }		});
	}
	return false;
}
function blog_focus(){
	this.addClassName('inputFocus');
	if(this.value == this.previous('label').innerHTML){
		this.value = '';
	}
	this.previous('label').addClassName('labelFocus');		
}
function blog_blur(){
	this.removeClassName('inputFocus');
	if(this.value == ''){
		//this.value = this.previous('label').innerHTML;
	}
	this.previous('label').removeClassName('labelFocus');	
}



var gnuolane = {
  src: 'http://www.mazaya.com.br/_imagens/gnuolane.swf'
};
var kautiva = {
  src: 'http://www.mazaya.com.br/_imagens/kautiva.swf'
};

sIFR.activate(kautiva,gnuolane);
//function sifrReplace(){
	
	sIFR.replace(kautiva, {
				 selector: 'h2',
				 wmode: 'transparent',
				 css: [ '.sIFR-root {leading: -2; color:#FFFFFF; }' ]
			});
	sIFR.replace(kautiva, {
				 selector: '#conteudo h3',
				 wmode: 'transparent',
				 css: [ '.sIFR-root {leading: -2; color:#FFC20E; font-weight:bold; }' ]
			});
	sIFR.replace(kautiva, {
				 selector: '#sidebar h3',
				 wmode: 'transparent',
				 css: [ '.sIFR-root {leading: -2; color:#FFFFFF; text-align: right; text-align: right; }' ]
			});
	sIFR.replace(gnuolane, {
				 selector: 'label,button,.radioSpan,h4',
				 wmode: 'transparent',
				 ratios: [8, 1.41, 10, 1.33, 14, 1.31, 16, 1.26, 20, 1.27, 24, 1.26, 25, 1.24, 26, 1.25, 35, 1.24, 39, 1.23, 40, 1.24, 51, 1.23, 54, 1.22, 55, 1.23, 81, 1.22, 84, 1.21, 86, 1.22, 89, 1.21, 90, 1.22, 94, 1.21, 95, 1.22, 1.21],
				 css: [ '.sIFR-root { color:#FFFFFF; text-align: right}', 'a {color:#FFFFFF;}', 'a:hover {color:#FFC20E;}' ]
			});
//}

function init() {
	$$(".inputField").each(function(_ele){
		Event.observe(_ele, 'focus', blog_focus.bindAsEventListener(_ele));
		Event.observe(_ele, 'blur', blog_blur.bindAsEventListener(_ele));
	});
		
	$$('a.radio').each(function (_ele){	
		Event.observe(_ele, 'click', fakeRadio.bindAsEventListener(_ele));
	});

	$$('a.menuA_nivel1').each(function (_ele){	
		//Event.observe(_ele, 'click', menu.bindAsEventListener(_ele.href));
		//_ele.onclick = menu;
	});
	
	//$$('.blocoTexto').each(function (_ele){
		//_ele.insert('<div class="flashReplace" style="position: absolute; top:0; left: 0; width : 700px; height : 400px;" swf="http://www.mazaya.com.br/box.swf"></div>');
	//});
	
	//$$('.boxPortfoliosInfo').each(function (_ele){
		//_ele.fade({ duration: 3.0, from : 1, to : 0.8 });
	//});
	
	//$$(".boxPortfoliosInfo").invoke("fade", { duration: 3.0, from : 1, to : 0.5 });
	//$$(".boxPortfoliosImg").invoke("fade", { duration: 3.0, from : 1, to : 0.1 });
	//$$(".boxPortfoliosImg").invoke("observe", "mouseover", function() {this.appear({ duration: 0.1, from : 0.1, to : 1 }) });
	//$$(".boxPortfoliosImg").invoke("observe", "mouseout", function() {this.fade({ duration: 0.1, from : 1, to : 0.1 }) });

	
	//bigger = Math.max($('conteudo').getHeight(), $('sidebar').getHeight()) + 100;
	
	//$('sidebarBack').setOpacity( 0.5 ).setStyle({'height':bigger+"px"});
	
	$$('.flashReplace').each(function ( _ele ){
				attr = _ele.readAttribute('swf')
				_width = _ele.getWidth();
				_height = _ele.getHeight();
				
				var flashvars = {};
				var params = {
				  menu: "false",
				  scale: "scale",
				  quality: "high",
				  wmode: "transparent",
				  salign: "t"
				};
				var attributes = {};
				
				swfobject.embedSWF(attr, _ele.id, _width, _height, "9","http://www.mazaya.com.br/_shared/_swf/expressInstall.swf", flashvars, params, attributes);
	});
	//resizeFrames();
	//sifrReplace();
}

//function resizeFrames(){
		//$('container').setStyle({'height':(document.viewport.getHeight())+"px"});
//}

//Event.observe(document.onresize ? document : window, "resize", resizeFrames);
//Event.observe(window, "load", resizeFrames);
document.observe("dom:loaded",init);



