
var cache = "605644264script.js126820";

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).firstDescendant().id != divResp)
			$(divForm).insert({'top' : '<div id="'+divResp+'" class="emailResponse"><div id="emailResponseMsg"></div></div>'});
		
		$('emailResponseMsg').show().update('Enviando...').addClassName('emailResponseEnviando');
		
		new Ajax.Request('http://www.masaia.com.br/_Request/enviarDados/',{
						
					  parameters: $(_form).serialize(),
					  onComplete: function(resposta) {
					  	if(resposta.responseText.isJSON()){
							var res = resposta.responseText.evalJSON();
							if(res.status == 'ok'){
								$(divForm).update(res.mensagem).addClassName('emailResponseEnviada');
								//$('emailResponseMsg').update(res.mensagem).removeClassName('emailResponseEnviando').removeClassName('emailResponseErro').addClassName('emailResponseEnviada');
							}else{
								$('emailResponseMsg').update(res.mensagem).removeClassName('emailResponseEnviando').addClassName('emailResponseErro');
							}
						}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');
						}
					  }
		
		
		});
	}
	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.masaia.com.br/_imagens/gnuolane.swf'
};
sIFR.activate(gnuolane);

var kautiva = {
  src: 'http://www.masaia.com.br/_imagens/kautiva.swf'
};
sIFR.activate(kautiva);

//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',
				 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.masaia.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.masaia.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);



