
	function popup(url){
		window.open(url,'gazetaesportiva','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=630,height=450');     
	}

	
	//run the currently selected effect
	function runEffect(vars){
		//get effect type from 
		var selectedEffect = 'slide';
		//most effect types need no options passed by default
		var options = {};
		//check if it's scale, transfer, or size - they need options explicitly set
		if(navigator.appVersion.split(";")[1] == ' MSIE 6.0'){
			if(vars == 'hide'){
				$("#over_view").hide();
			}else if(vars == 'show'){
				$("#over_view").show();
			}
		}else{
			if(vars == 'hide'){
				if($("#over_view").css('display') == 'none'){
						$("#over_view").css({'display':'none'});
				}else{
				$("#over_view").hide(selectedEffect,options,500);
				}
			}else if(vars == 'show'){
				if($("#over_view").css('display') == 'block'){
					
						$("#over_view").css({'display':'none'});
				}else{
				$("#over_view").show(selectedEffect,options,500);
				}
			}
		}
	}

	$(function(){

		var count = $("a[id^='link-rotativo-']").length;
		var tempo_rotacao = 3000;
		var aux = 1;
		var intervalo;
		var temp_hide_show = 100;

		function transicao_frames(time,display){
			//get effect type from 
			var selectedEffect = 'slide';
			//most effect types need no options passed by default
			var options = {};
	
			if(time == true){
				clearInterval(intervalo);
				intervalo = window.setInterval(function() {
					if(aux <= count){
					$("a[id^='link-rotativo-"+aux+"']").click();
						$("#rotativo-frames a").removeClass("rotativo_focus_frame");
						$("a[id^='link-rotativo-"+aux+"']").addClass("rotativo_focus_frame");
					aux++;
					}else{
					aux = 1;
					$("a[id^='link-rotativo-"+aux+"']").click();
						$("#rotativo-frames a").removeClass("rotativo_focus_frame");
						$("a[id^='link-rotativo-"+aux+"']").addClass("rotativo_focus_frame");
					aux++;
					}
				}, tempo_rotacao);	
			}else{
				clearInterval(intervalo);
				intervalo = window.setTimeout(function() {
					//check if it's scale, transfer, or size - they need options explicitly set
					if(navigator.appVersion.split(";")[1] == ' MSIE 6.0'){
						if(display == 'hide'){
							$("#over_view").css({'display':'none'});
						}else if(display == 'show'){
							$("#over_view").css({'display':'block'});
						}
					}else{
						if(display == 'hide'){
							if($("#over_view").css('display') == 'none'){
								$("#over_view").css({'display':'none'});
							}					
							if($("#over_view").css('display') == 'block'){
								clearInterval(intervalo);
								intervalo = window.setTimeout(function() {
								$("#over_view").hide(selectedEffect,options,500);
								}, temp_hide_show);
							}
						}else if(display == 'show'){
							if($("#over_view").css('display') == 'block'){
								$("#over_view").css({'display':'block'});
							}					
							if($("#over_view").css('display') == 'none'){
								clearInterval(intervalo);
								intervalo = window.setTimeout(function() {
								$("#over_view").show(selectedEffect,options,500);
								}, temp_hide_show);
							}
						}
					}
				}, temp_hide_show);
				return false;
			}
		}
		
		transicao_frames(true,'hide');
	
		function mudaSlide(id,flag){
			if(flag != true){
				var id_aux = $("[id^='num-frame-']:visible").attr('id').split("-")[2];
			}
			if(flag != true){
				if(id != id_aux){
					$("[id^='num-frame-']").hide();
					$("#num-frame-"+id).fadeIn(500);
				}else if(id < count){
					id = parseInt(id) + 1;
					$("[id^='num-frame-']").hide();
					$("#num-frame-"+id).fadeIn(500);
				}else{
					id = 1;
					$("[id^='num-frame-']").hide();
					$("#num-frame-"+id).fadeIn(500);
				}
			}else{
				$("[id^='num-frame-']").hide();
				$("#num-frame-"+id).fadeIn(500);
			}
			
			
		}
			
		var story_link;
		$("a[id^='link-rotativo-']").live('mouseover',function(event){
			if(story_link != $(this).attr('id')){
				story_link = $(this).attr('id');
				transicao_frames(false,'hide');
				var id = $(this).attr("id").split("-")[2];
				mudaSlide(id,true);
				event.preventDefault();
			}
		}).live('mouseout',function(){
			transicao_frames(true,'hide');
		}); 
		
		
		$("#rotativo").live('mouseover',function(event){
			transicao_frames(false,'hide');   
		}).live('mouseout',function(){
			transicao_frames(true,'hide');
		}); 
		
		
		$("a[id^='link-rotativo-']").live('click',function(event){
			var id = $(this).attr("id").split("-")[2];
			mudaSlide(id,true);
			event.preventDefault();
		}); 
		
		
		
	});

	