var noticiaOver = false;
var mudar = false;
var x = 0; 
var not = 0;
var prox = null;

window.onload = function(){
                //document.getElementById('noticia4').innerHTML = "1";
				document.getElementById('noticia4').innerHTML = noticia[0];
				//document.getElementById('noticia2').innerHTML = noticia[1];
				//document.getElementById('noticia3').innerHTML = noticia[2];
				//document.getElementById('noticia4').innerHTML = noticia[3];
				
				//document.getElementById('Li1').innerHTML = "2";
				//document.getElementById('Li2').innerHTML = "3";
				//document.getElementById('Li3').innerHTML = "4";
				document.getElementById('Li1').innerHTML = noticiaLateral[1];
				document.getElementById('Li2').innerHTML = noticiaLateral[2];
				document.getElementById('Li3').innerHTML = noticiaLateral[3];
				//document.getElementById('Li4').innerHTML = noticiaLateral[3];
				
			}

		function over(){
			noticiaOver = true;
		}
		function out(){
			noticiaOver = false;
		}
		
		$(document).ready(function() {
		
			function mudaNoticia(moveNext){	
			
					mudar = true;
					
					/* FUNÇÂO PARA O CLICK*/
//					if(moveNext){
//						if(!prox)
//						{
//							prox = true;
//							not+=2;
//						}
//					}else{
//						if(prox)
//						{						
//							not-=2;
//							prox=false;
//						}
//					}
					/* END CLICK */
					

					
					//for(i=1;i<5;i++)
					//{
						//if(i!=not)
//						{
//							$("#noticia"+i).animate({
//								opacity: 'hide'
//							}, 'slow');
							
							//alert(document.getElementById('noticia'+i).innerHTML);
							
					        //$("#Li"+i).css('display','block');
					        
					        //$("#Li"+i)[0].innerHTML = $("#noticia"+i).innerHTML
					        //not++;
					        if(!moveNext){not--;}
					        if(not>3){not=0;}
					        if(not<0){not=3;}
					        document.getElementById('noticia4').innerHTML = noticia[not];
                            if(moveNext)
					            not++;
					        else
					            not--;
					        if(not>3){not=0;}
					        if(not<0){not=3;}
					        document.getElementById('Li1').innerHTML = noticiaLateral[not];
					        if(moveNext)
					            not++;
					        else
					            not--;
					        if(not>3){not=0;}
					        if(not<0){not=3;}
					        document.getElementById('Li2').innerHTML = noticiaLateral[not];
					        if(moveNext)
					            not++;
					        else
					            not--;
					        if(not>3){not=0;}
					        
					        document.getElementById('Li3').innerHTML = noticiaLateral[not];
					        
					        
					        
							//$("#Li"+i).css('background','#ffffff');
//						}else
//						{
//							$("#noticia"+not).animate({
//								opacity: 'show'
//							}, 'slow');
//							
//                            $("#Li"+not).css('display','none');							

//							//$("#Li"+not).css('background','#000000');
//						}
					//}
					
					if(moveNext){
						//not++;
					}else{
						//not--;
					}
					
					x=0;
				}
			
			
			$("#icoProximo").click(					
				function(){
					mudaNoticia(true);
				});
			
			$("#icoAnterior").click(			
				function() {					
					mudaNoticia(false);
				});
		
			setInterval(
						function(){
							if(x==0){
								mudaNoticia(true);
							}
						}
						, 500);
	
			setInterval(
						function() {
							if(mudar && !noticiaOver){
								if (x < 600){
									barraMais('barraLoad');
								}else{
									x = 0;
									mudar = false;
								}
							}
							
						}, 100);

			function barraMais(id) {
				x+=10;
				document.getElementById(id).style.width = (x/5.3)+"px";
			}
		
		});
