

function resposta(msg){
	
	$(document).ready(function(){ 
		
		
		$("input:not(input[type=submit]),select,textarea").focus(function(){ $(this).animate({opacity:0.75}); });
		$("input:not(input[type=submit]),select,textarea").blur(function(){ $(this).animate({opacity:1}); });
		$("input[type=submit]").mouseover(function(){ $(this).animate({opacity:0.75}); });
		$("input[type=submit]").mouseout(function(){ $(this).animate({opacity:1}); });
		
		
		$(".mensagem p").html(msg);
		$(".lockscreen").slideDown();		
		$(".mensagem").fadeIn();
		setTimeout('$(".mensagem,.lockscreen").fadeOut();',2000);
		
	});

}


function uploadimg(){

     $("#upload-container").html('');
     var myinput = "<input type='text' name='file' value='asd'/>";
     $("#myfile input").appendTo("#upload-container");
     $(myinput).appendTo("image-loader");
     $("#image-loader").fadeIn();
     document.myupload.submit();
     
}


/*
function uploadimg(newname){

	$("#upload-container").html('');
	var myinput = "<input type='text' name='file' value='"+newname+"'/>";
	$("#myfile input").appendTo("#upload-container");
	$(myinput).appendTo("image-loader");
	$("#image-loader").fadeIn();
	document.myupload.submit();
	
}
*/
function uploadimg2(newname){
	
	$("#upload-container").html('');
	var myinput = "<input type='text' name='file-lay' value='"+newname+"'/>";
	$("#myfile2 input").appendTo("#upload-container");
	$(myinput).appendTo("image-loader2");
	$("#image-loader2").fadeIn();
	document.myupload.submit();
	
}

function addfile(){
	
	$("#myfile").html("<input type='file' name='file' style='width:190px;' onchange='uploadimg();'/>");
	$("#container img").remove();
	$("#myupload input").remove();
	$("#container").fadeOut();
	document.oform.pic.value='';
	
}

function addfile2(){
	
	$("#myfile2").html("<input type='file' name='file-lay' style='width:190px;' onchange='uploadimg2();'/>");
	$("#container2 img").remove();
	$("#myupload2 input").remove();
	$("#container2").fadeOut();
	document.oform.layout.value='';
	
}

function addimagem(){
	
	$("#imagens-container table").clone().prependTo("#imagens-reciver");

}


function addalt(){
	
	$("#imagens-container table").clone().appendTo("#imagens-reciver");

}




function votar(){
	
	var voto = $("#enquete input:checked").attr("value");
	vote('enquete-votar','indice='+voto,'stats');
	
}


function ultimosJogos(campeonato){

$("#ultimos").html("<p style='padding:5px;'> carregando ...</p>");

          $.ajax({
               type: "POST",
               url: "libs/php/ajax.php?cmd=ultimos-jogos&campeonato="+campeonato,
               dataType:"text",
               success: function(msg){ $("#ultimos").html(msg); }
          });

}




function selectClube(divisao){

          $("#division").html("<p style='padding:5px;'> carregando ...</p>");

          $.ajax({
               type: "POST",
               url: "libs/php/ajax.php?cmd=select-clube&divisao="+divisao,
               dataType:"text",
               success: function(msg){ $("#division").html(msg); }
          });

}





	$(document).ready(function(){
		
		
		$("input,select,textarea").focus(function(){ $(this).animate({opacity:0.75},100); });
		$("input,select,textarea").blur(function(){ $(this).animate({opacity:1},100); });
		$("input[type=submit]").mouseover(function(){ $(this).animate({opacity:0.75},100); });
		$("input[type=submit]").mouseout(function(){ $(this).animate({opacity:1},100); });
		
		$("#data").datepicker();
		$("#tabs").tabs();
		
		$("input,textarea,select").focus(function(){ $(this).animate({backgroundColor:"#f0f0f0"},100); });
		$("input,textarea,select").blur(function(){ $(this).animate({backgroundColor:"#ffffff"},100); });
		

		//mostra campeonato
		$('.rodadas > div').css({"display":"none"});
		$('.rodadas div:first').css({"display":"block"});

		//mostra campeonato
		$('.fases > div').css({"display":"none"});
		$('.fases #fase1').css({"display":"block"});

		
	});
	



/* GALERIA DE FOTOS */


	
	function editarLegenda(id){
	
		var myid = document.getElementById("myid");
		var myinput = document.getElementById("mylegend");
		myinput.value =  $("#leg"+id).text();
		myid.value = id;
		$("#legend-mask").fadeIn(); 	
	}



	function updateLegend(){
		
		var id = document.getElementById("myid").value;
		var legenda = document.getElementById("mylegend").value;
		var legendatext = document.getElementById("leg"+id);
		
		process('editar-legenda','legenda='+legenda+'&id='+id);
		
		legendatext.innerHTML = legenda;
		$("#legend-mask").fadeOut();
		
				
	}
	
	
	function removeImg(id){
		
		$("#img-container"+id).fadeOut();

		process('remover-imagem','id='+id);

	}

$(function() {
		
		$('.gal-container a').lightBox(); // Select all links in object with gallery ID
		$(".accordion").accordion({autoHeight: false });
/*
		$('#accordion1').accordion( {autoHeight: true });
		$('#accordion2').accordion( {autoHeight: true });
		$('#accordion3').accordion( {autoHeight: true });
		$('#accordion4').accordion( {autoHeight: true });
		$('#accordion5').accordion( {autoHeight: true });
		$('#accordion6').accordion( {autoHeight: true });
		$('#accordion7').accordion( {autoHeight: true });
		$('#accordion').accordion( {autoHeight: true });
*/

		$('#reciver p span').fadeIn();
});

