// JavaScript Document
//Framework Jquery	
		
		//inicio do código
		$('document').ready(function(){
			
			//validação de browser
				jQuery.each(jQuery.browser, function(i, val) {
					if(i=="mozilla"){
					//Acerto resolução pro firefox 
					$('#content').css("width",1008);//div Content
					$('#topo').css("width",1008);//div topo
					$('#menuUl').css("width",738);//div menu
					 }
				});
				
				 if($.browser.msie){
    			 	$('#content').css("width",1004);//div Content
					$('#topo').css("width",1004);//div topo
					$('#menuUl').css("width",734);//div menu
   				 }			
			//Fim da Validação do browser
			
			//Acerto resolução Conteudo busca;	
				if(screen.height>768){
					$('#conteudocCategory').css("height",600);
					$('#conteudocCategory').css("minHeight",600);
				};
				
				if(screen.height==1200){
					$('#conteudocCategory').css("height",700);
					$('#conteudocCategory').css("minHeight",700);
				}
				if(screen.height>1200){
					$('#conteudocCategory').css("height",900);
					$('#conteudocCategory').css("minHeight",900);
				};
				if(screen.height>=1440){
					$('#conteudocCategory').css("height",1000);
					$('#conteudocCategory').css("minHeight",1000);
				};
				if(screen.height>768){
					$('#curvamenuesquerda').css("display","block");
					$('#curvamenudireita').css("display","block");
				};
			
			//Fim do acerto;
			//Acerto resolução Conteudo busca;	
				if(screen.height>768){
					$('#conteudoBusca').css("height",600);
					$('#conteudoBusca').css("minHeight",600);
				};
				if(screen.height==1200){
					$('#conteudoBusca').css("height",700);
					$('#conteudoBusca').css("minHeight",700);
				}
				if(screen.height>1200){
					$('#conteudoBusca').css("height",900);
					$('#conteudoBusca').css("minHeight",900);
				};
				if(screen.height>=1440){
					$('#conteudoBusca').css("height",1000);
					$('#conteudoBusca').css("minHeight",1000);
				};
			//Fim do acerto;
			
			//ImageRepleacemetn				
				function ImageRepleacement(elemento,imagem){
					$(elemento).attr("src","http://www.modaposthaus.com.br/wordpress/wp-content/themes/ModaPosthaus/imgs/menu/"+imagem+".jpg");
				
				};
				
			//Chamadas ImageRepleacement
			
				//MenuHomeImageRepleacemetn
					$('#menuHome').mouseenter(function(){
						ImageRepleacement("#menuHome","homeActive");
					});
					$('#menuHome').mouseleave(function(){
						ImageRepleacement("#menuHome","Home");
					});
				//DicasImageRepleacement
					$('#menuDicas').mouseenter(function(){
						ImageRepleacement("#menuDicas","DicasActive");
					});
					$('#menuDicas').mouseleave(function(){
						ImageRepleacement("#menuDicas","Dicas");
					});
				//NovidadesImageRepleacement
					$('#menuNovidades').mouseenter(function(){
						ImageRepleacement("#menuNovidades","NovidadesActive");
					});
					$('#menuNovidades').mouseleave(function(){
						ImageRepleacement("#menuNovidades","Novidades");
					});
				//posthausTVImageRepleacement
					$('#menuPosthausTV').mouseenter(function(){
						ImageRepleacement("#menuPosthausTV","PosthaustvActive");
					});
					$('#menuPosthausTV').mouseleave(function(){
						ImageRepleacement("#menuPosthausTV","PosthausTV");
					});		
			
			//Termino das chamadas
					
			//Chamada pra a função do twitter(getTwitter);
					$('#TwitterMeio').getTwitter({
						userName: "posthaus",
						numTweets: 3,
						loaderText: "",
						slideIn: true,
						slideDuration: 750,
						showHeading: true,
						headingText: "",
						showProfileLink: true,
						showTimestamp: false
					});
			//Inicio das validações do formulario de comments @single.php		
					$('#submit').click(function(){
						var email = $('#email').val(); 
						var nome = $('#author').val();
						var comment=$('#comment').val();
						var status=0;
			
			//Validação do comapo de email e do campo nome
					
					function  valida_emailcomment(email){	

					if(email.length<7){
					return false;
					}
					var proibidos = "'?`^~?#$/:,*&()+!=;<>[]{}% ";
					for(x=0;x<email.length;x++){
						if(email.indexOf(proibidos.substring(x,x+1))>-1){
						break;
						return false;
					}
					}
					if(email.indexOf(" ")>-1){return false;}
					if(email.toUpperCase().indexOf('WWW.')>-1){return false;}  
					if(email.toUpperCase().indexOf('.COM.BE')>-1){return false;}
					if(email.toUpperCase().indexOf('.VOM.BR')>-1){ return false;}
					if(email.toUpperCase().indexOf('.HOTMIL.COM')>-1){return false;}
					if(email.toUpperCase().indexOf('.HOTMAL.COM')>-1){return false;}
					if(email.toUpperCase().indexOf('.HOTMAIL.COM.BR')>-1){return false;}
					if(email.toUpperCase().indexOf('.GMAIL.COM.BR')>-1){return false;}	
					if(email.toUpperCase().indexOf('.CPM.BR')>-1){return false;}
					if(email.toUpperCase().indexOf('@.')>-1){return false;}
					if(email.toUpperCase().indexOf('-@')>-1){return false;}
					if(email.toUpperCase().indexOf('@-')>-1){return false;}
					if(email.indexOf('..')>-1){return false;}          
					if(email.indexOf('@.')>-1){return false;} 
					if(email.toUpperCase().indexOf('@ ')>-1){return false;} 
					if(email.indexOf('@@')>-1){return false;} 
					if(email.indexOf('-.')>-1){return false;} 
					if(email.indexOf('.')==-1){return false;}
					if(email.indexOf('@')==-1){return false;}                 
					if(email.substring(0,1)=='@'){return false;} 
					if((email.lastIndexOf('@')+1)==email.length){return false;}
					if((email.lastIndexOf('.')+1)==email.length){return false;}
					return true;                                
					}
					if(valida_emailcomment(email)==false){
						alert('E-mail inválido');
						return false;
					}
					else{
						status=1;
					}
						
			//Validação do comapo do comentario
						if(comment.length==0){
							alert('digite um comentário');
							status=0;
							return false;
						}
						else{
							status=1;
						}
			//Confirmação do comentario enviado
						if(status==1){
							alert('Seu comentário foi enviado com sucesso e espera aprovação do moderador');
						}
					});
					

			//Aviso Caso envio do formulario
				checkbox=true;
				$('#aceitar').click(function(){
					if(checkbox==true){
						checkbox=false;
					}
					else{
						checkbox=true;
					}
				});
				$("#enviar").click(function(){
					nlnome = $('#nome').val();
					nlmail = $('#emailnew').val();
					
					function  valida_email(email){	
					if(email.length<7){
					return false;
					}
					var proibidos = "'?`^~?#$/:,*&()+!=;<>[]{}% ";
					for(x=0;x<email.length;x++){
						if(email.indexOf(proibidos.substring(x,x+1))>-1){
						break;
						return false;
					}
					}
					if(email.toUpperCase().indexOf('WWW.')>-1){return false;}  
					if(email.toUpperCase().indexOf('.COM.BE')>-1){return false;}
					if(email.toUpperCase().indexOf('.VOM.BR')>-1){ return false;}
					if(email.toUpperCase().indexOf('.HOTMIL.COM')>-1){return false;}
					if(email.toUpperCase().indexOf('.HOTMAL.COM')>-1){return false;}
					if(email.toUpperCase().indexOf('.HOTMAIL.COM.BR')>-1){return false;}
					if(email.toUpperCase().indexOf('.GMAIL.COM.BR')>-1){return false;}	
					if(email.toUpperCase().indexOf('.CPM.BR')>-1){return false;}
					if(email.toUpperCase().indexOf('@.')>-1){return false;}
					if(email.toUpperCase().indexOf('-@')>-1){return false;}
					if(email.toUpperCase().indexOf('@-')>-1){return false;}
					if(email.indexOf('..')>-1){return false;}          
					if(email.indexOf('@.')>-1){return false;} 
					if(email.toUpperCase().indexOf('@ ')>-1){return false;} 
					if(email.indexOf('@@')>-1){return false;} 
					if(email.indexOf('-.')>-1){return false;} 
					if(email.indexOf('.')==-1){return false;}
					if(email.indexOf('@')==-1){return false;}                 
					if(email.substring(0,1)=='@'){return false;} 
					if((email.lastIndexOf('@')+1)==email.length){return false;}
					if((email.lastIndexOf('.')+1)==email.length){return false;}
					return true;                                
					}
					if(valida_email(nlmail)==false){
						alert('E-mail inválido!');
						return false;
					};
					
					
					//validação do Nome
					if(nlnome.length=0){
						alert('digite seus dados corretamente');
						return false;
					}
					if(checkbox==false){
						alert("Você precisa aceitar os termos para se cadastrar");
						return false;
					}	
						
					$('#iframe').html('<code><iframe src="http://www.posthaus.com.br/cadastrese?acao=news&nome='+nlnome+'&mail='+nlmail+'&origem=17"</iframe></code>');
					$('#newsletterForm')[0].reset();
					$('#Aviso2').fadeIn('slow');	
					return false;

				//cadastro enviado com sucesso;
				});
				$("#fechaAviso").click(function(){
					$("#Aviso2").toggle("slow");
				})
				
				//Verificação do flash
					
		//termino do código...
		});