// LIGHTBOX
var $x1 = jQuery.noConflict();
$x1(function() {$x1('a[@rel*=lightbox1]').lightBox();});
var $x2 = jQuery.noConflict();
$x2(function() {$x2('a[@rel*=lightbox2]').lightBox();});
var $x3 = jQuery.noConflict();
$x3(function() {$x3('a[@rel*=lightbox3]').lightBox();});

// CARROSSEL
$y(function() {
    $y(".jCarouselLite1").jCarouselLite({
		btnNext: "#next1",
		btnPrev: "#prev1"
	});
});
$y(function() {
    $y(".jCarouselLite2").jCarouselLite({
		btnNext: "#next2",
		btnPrev: "#prev2"
	});
});
$y(function() {
    $y(".jCarouselLite3").jCarouselLite({
		btnNext: "#next3",
		btnPrev: "#prev3"
	});
});


// SOBRE
function mudar_sobre (sobre) {
   jQuery.ajax({  
	  //usando metodo POST
      type: "POST",  
	  
      // action do script para onde vai ser enviado os dados	  
      url: "?page=sobre",  	  
	  
      // antes de enviar
      beforeSend: function(){
      },
	  	  
      success: function() {   
         jQuery(window.top.document.getElementById('sobre')).load(sobre+'.php'); 	 
      },
      
	  // se acontecer algum erro é executada essa função
      error: function(txt){
          jQuery('#sobre').html('Erro ao enviar os dados !');
      } 
   });  
}


// IMPRENSA
function mudar_imprensa (imp) {
   jQuery.ajax({  
	  //usando metodo POST
      type: "POST",  
	  
      // action do script para onde vai ser enviado os dados	  
      url: "?page=imprensa",  	  
	  
      // antes de enviar
      beforeSend: function(){
      },
	  	  
      success: function() {   
         jQuery(window.top.document.getElementById('list')).load(imp+'.php'); 	 
      },
      
	  // se acontecer algum erro é executada essa função
      error: function(txt){
          jQuery('#list').html('Erro ao enviar os dados!');
      } 
   });  
}

// NOTÍCIA
function mudar_noticia (not) {
   jQuery.ajax({  
	  //usando metodo POST
      type: "POST",  
	  
      // action do script para onde vai ser enviado os dados	  
      url: "?page=imprensa",  	  
	  
      // antes de enviar
      beforeSend: function(){
      },
	  	  
      success: function() {   
         jQuery(window.top.document.getElementById('noticia')).load('noticias/'+not+'.php'); 	 
      },
      
	  // se acontecer algum erro é executada essa função
      error: function(txt){
          jQuery('#noticia').html('Erro ao enviar os dados!');
      } 
   });  
}

var $class = jQuery.noConflict();
var Lst;
function CngClass(obj){
 $class('.current-s').removeClass("current-s");
 if (Lst) Lst.className=''
 obj.className='current-s';
 Lst=obj;
}

var $class2 = jQuery.noConflict();
var Lst;
function CngClass2(obj){
 $class2('.current-i').removeClass("current-i");
 if (Lst) Lst.className=''
 obj.className='current-i';
 Lst=obj;
}

function enviar1() {
	var e = document.form1.email.value
	var arroba=false
	for (Count = 0; Count < e.length; Count++) {
		if (e.charAt(Count) == "@")  var arroba=true; 
	}
	if (
		document.form1.nome.value == ""
		|| document.form1.email.value == ""
		|| document.form1.mensagem.value == ""
	)
	{alert('Todos os campos devem ser preenchidos.');
	} else if (arroba == false) {
		alert('O e-mail est\u00e1 vazio ou foi preenchido incorretamente.');
		document.form1.email.focus();
	}	
	else {
	document.form1.submit();
	}
}

function enviar2() {
	var e = document.form2.email.value
	var arroba=false
	for (Count = 0; Count < e.length; Count++) {
		if (e.charAt(Count) == "@")  var arroba=true; 
	}
	if (
		document.form2.nome_loja.value == ""
		|| document.form2.responsavel.value == ""
		|| document.form2.endereco.value == ""
		|| document.form2.cidade.value == ""
		|| document.form2.rede.value == ""
		|| document.form2.email.value == ""
		|| document.form2.bairro.value == ""
		|| document.form2.uf.value == ""
		|| document.form2.fone.value == ""
		|| document.form2.observacoes.value == ""
	)
	{alert('Todos os campos devem ser preenchidos.');
	} else if (arroba == false) {
		alert('O e-mail est\u00e1 vazio ou foi preenchido incorretamente.');
		document.form2.email.focus();
	}	
	else {
	document.form2.submit();
	}
}

function software(){
	largura = 800;
	altura= 640;	
	posx = (screen.width/2)-(largura/2);
	posy = (screen.height/2)-(altura/2);
	features= "width=" + largura + " height=" + altura + " top=" + posy + " left=" + posx + " scrollbars=0";
	newin = window.open("http://www.metalfarma.com.br/loja/loja.html","Lista",features);
	newin.blur();
	newin.focus();
}

function checkFormOrc(form) {
	$c = jQuery.noConflict();
	var fields = [$c('#nome_loja'),$c('#responsavel'),$c('#endereco'),$c('#cidade'),$c('#rede'),$c('#email'),$c('#bairro'),$c('#uf'),$c('#fone'),$c('#observacoes')];
	email = $c('#email').val();
	error = false; arroba = false;
	for (i=0; i<email.length; i++) {if (email.charAt(i) == "@") var arroba=true;}
	$c(fields).each(function(){if ($c(this).val() == "") {error = true}});
	if (error == true){alert('Preencha todos os campos!');}
	else if (arroba == false){alert('Preencha seu email corretamente!');}
	else {$c(form).submit();}
}

function checkFormCont(form) {
	$c = jQuery.noConflict();
	var fields = [$c('#nome'),$c('#email'),$c('#cidade'),$c('#uf'),$c('#telefone'),$c('#mensagem')];
	email = $c('#email').val();
	error = false; arroba = false;
	for (i=0; i<email.length; i++) {if (email.charAt(i) == "@") var arroba=true;}
	$c(fields).each(function(){if ($c(this).val() == "") {error = true}});
	if (error == true){alert('Preencha todos os campos!');}
	else if (arroba == false){alert('Preencha seu email corretamente!');}
	else {$c(form).submit();}
}










