jQuery.noConflict();
jQuery(document).ready(function(){

//
// /** 
// *
// * Sliders 
// *
// **/
// jQuery('.slider').cycle({fx:'fade'});
// jQuery('#prof').cycle({fx:'scrollLeft',pauseOnPagerHover:true});
// jQuery('#suArea').cycle({fx:'fade'});
//
 /**
 *
 *
 *  Efeito placeholder
 *  Para usar o efeito nos input text, faça o seguinte
 *  1º)  input deve pertencer a uma class "hover"
 *  2º)  coloque no mesmo input um alt com o texto que voce quer que apareca
 *  3º)  Depois insira o mesmo texto no value do input
 *
 **/


  //  jQuery('.hover').css('color', '#CCC');
  //  jQuery('#preMatricula .hover').css('color','#00364A');
  //  jQuery('#preMatricula label').hide();
    var color = '';
    var textDefault ='';
    jQuery('.hover').css('background-color','#B5CCF1');
    jQuery('.hover').focus(function(){
    



        textDefault = jQuery(this).attr('alt');
        if(jQuery(this).val() == textDefault)
        {
        	color =  jQuery(this).css('color');
            jQuery(this).val('');
            jQuery(this).css('color', '#000');
        }
    });

    jQuery('.hover').blur(function(){
        if(jQuery(this).val() == '')
        {
              jQuery(this).val(textDefault);
              jQuery(this).css('color', color);
        }
    });

    /*
     * Placeholder usando uma imagem
     *
     *
     *
     */
     var image;
     jQuery('.hoverImage').focus(function(){
         if(jQuery(this).val()=='')
            image = jQuery(this).css('background');
         jQuery(this).css('background','#FFF');

     });

     jQuery('.hoverImage').blur(function(){
         if(jQuery(this).val()=='')
            jQuery(this).css('background',image);
     });

    /**
     *
     * Efeito de ajax da newsletter
     *
     *
     **/

    jQuery('#divajax').hide();
    jQuery('.buttonajax').click(function(){
   	jQuery('#divajax').show();
	    jQuery.post('../site/news.php',{
            email1: jQuery('.formajax input[type=text]').val()
            },function(result){
                var html;
                if(result == 'true')
                {
                   // jQuery('#divajax').css('color','#0A0');
                   // html = '<img src="../imgs/loading_ok.png"  height="16px"  width:="16px" />';
		   alert("E-Mail cadastrado com sucesso");
                }
                else
                {
//                     jQuery('#divajax').css('color','#F00');
//                      html = '<img  src="../imgs/loading_erro.png" height="16px"  width:="16px" />';
		    if(result == "errorMail"){
		      alert("Digite um e-mail válido");
		    }else{
		      alert("E-Mail já cadastrado, tente novamente");
		    }
                }
               jQuery('.formajax input[type=text]').val('Seu email');
               jQuery('#divajax').hide();
              
	       
               
        });

        jQuery('#divajax').ajaxStart(function(){
           
    		jQuery('#divajax').show();
        });

	jQuery('#divajax').ajaxStop(function(){
	    jQuery(this).hide();
	});
    
    });

   /*
   *
   * Validacao
   * 
   *
   */ 
   
 /*   jQuery('#franqueado').validate({
        rules:
        {
            nome : 'required',
            rg: 'required',
            cpf: {
                required:true,
                minlenght:11
            },
            telefone: 'required',
            nascimento:'required',
            celular:'required',
            email:'required'
            
            
            
            
        },
        messages:
        {
            nome: 'Campo obrigatorio',
            nascimento: 'Digite uma data valida',
            email:'Por favor digite um e-mail valido',
            cpf:'Digite um cpf por valido',
            rg: 'Campo obrigatório',
            celular:'Campo obrigatório',
            telefone:'Campo obrigatório'
        }
    });
    
    
    
    

    /*
    *
    * Configurações 
    *
    

	jQuery('#result').hide();
	jQuery('.cpf').mask('999.999.999-99');
	jQuery('.phone').mask('(99)9999-9999');
	jQuery('.cep').mask('99999-999');	
	jQuery('.nascimento').mask('99/99/9999');

	*/
	
	
	jQuery('#buttonajaxmail').click(function(){
		jQuery('#divajaxmail').html('').css('width','16px');
		jQuery('#divajaxmail').css('display','visible');
		jQuery('#buttonajaxmail').hide();
		jQuery.post('index.php?secao=contato',{
			submit:true,
			email:  jQuery('email').val(),
			assunto:jQuery('#assunto').val(),
			texto:  jQuery('#texto').val(),
			ajax  :  true			
		},  function(retorno) {
			 if(retorno == "true")
			 {
			 	jQuery('#divajaxmail').html('<span> E-mail enviado com sucesso</span>').css('color','#0F0').css('width','500');
	 	  		
			 }
			 else
			 {	
			 	jQuery('#divajaxmail').html('<span> E-mail não enviado</span>').css('color','#F00').css('width','500px');
			 		
			 }
			 	
               jQuery('#divajaxmail').fadeIn('slow');
               jQuery('#divajaxmail').fadeOut('medium');
               jQuery('#divajaxmail').fadeIn('slow');
               jQuery('#divajaxmail').fadeOut('medium');
               jQuery('#divajaxmail').fadeIn('medium');
               jQuery('#divajaxmail').fadeOut(15000);
               jQuery('#buttonajaxmail').show();
               jQuery('#divajaxmail').css('display','none');
			 
		});
		
	});
	
		jQuery('.direct').change(function(){
			
			window.location = jQuery('option:selected',this).val();
		});	

	
	/**
	*
	* Slider da home 
	* 
	*
	*
	*/
	
	jQuery("#lojaSlider").cycle({pause:true});

});

function clearTextarea(textarea){
    
    var id= jQuery(textarea).attr('id');
   
    if(jQuery('#'+id).val() == 'Deixe seu comentario aqui!'){
	
	jQuery('#'+id).val('');
    }else {
	if(jQuery('#'+id).val() == ''){
	    jQuery('#'+id).val('Deixe seu comentario aqui!');
	}
	
    }
}

	





