function UR_Start() 
{
	UR_Nu = new Date;
	UR_Indhold = showFilled(UR_Nu.getHours()) + ":" + showFilled(UR_Nu.getMinutes()) + ":" + showFilled(UR_Nu.getSeconds());
	document.getElementById("ur").innerHTML = UR_Indhold;
	setTimeout("UR_Start()",1000);
}
function showFilled(Value) 
{
	return (Value > 9) ? "" + Value : "0" + Value;
}
function abreSubs(id)
{
	if(document.getElementById("categ"+id).style.display == "none")
	{
		$(".categs").slideUp();
		$("#categ"+id).slideDown();
	}
	
}
function EnviaNews()
	{
		$.ajax({
			type: "POST", 
			url: "ajax/envia_news.php", 
			data: "email=" + $("#email_news").val(),
			beforeSend: function()
				{
				$("#retornoNews").html("<img src='admin/Imagens/gifs/load.gif' width='18' border='0'>");
				},
			
				success: function(resposta)
				{
					//alert(resposta)
					arr_resposta = eval("("+resposta+")");
					completo = arr_resposta.completo;
					mensagem = arr_resposta.mensagem;
					if(completo)
					{
						$("#email_news").val("");
						$("#retornoNews").html('<img align="absmiddle" src="admin/Imagens/success.png" width="15" border="0">&nbsp;' + mensagem);
					}
					else
					{
						$("#retornoNews").html('<img align="absmiddle" src="admin/Imagens/fail.png" width="15" border="0" style=" padding-left:10px">&nbsp;' + mensagem);
					}
				}
		});
	}
$(document).ready(function(){
$('#cid').SelectCustomizer();
$('#bairro').SelectCustomizer();
});

$(document).ready(function () {
    // THIS IS NEW CODE FOR THE AUTOMATIC INFINITE CAROUSEL
    var autoscrolling = true;
    
    $('.infiniteCarousel').infiniteCarousel().mouseover(function () {
        autoscrolling = false;
    }).mouseout(function () {
        autoscrolling = true;
    });
    
    setInterval(function () {
        if (autoscrolling) {
            $('.infiniteCarousel').trigger('next');
        }
    }, 6000);
	
$.getJSON("https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=area17oficial&count=1&callback=?",
  {
    format: "json"
  },
  function(data)
  {
	data[0].text
  });
});

function dump(arr,level) {
   var dumped_text = "";
   if(!level) level = 0;
 
   //The padding given at the beginning of the line.
   var level_padding = "";
   for(var j = 0;j < level+1;j++)
     level_padding += "    ";
 
   if(typeof(arr) == 'object') //Array/Hashes/Objects
   {
     for(var item in arr)
     {
        var value = arr[item];
 
        if(typeof(value) == 'object') //If it is an array,
        {
           dumped_text += level_padding + "'" + item + "' ...\n";
           dumped_text += dump(value,level+1);
        }
        else
        {
           dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
        }
     }
   }
   else //Stings/Chars/Numbers etc.
   {
     dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
   }
   return dumped_text;
}

$(document).ready(function(){
	//Ajax para mostrar bairro da cidade selecionada
	
	$("#cid_options div").click(
	function()
	{
		cid = $(this).attr("title");
		
		$.ajax({
		type: "POST", 
		url: "ajax/busca_bairros.php", 
		data: "cid=" + cid,
		beforeSend: function()
		{
			$("#retornoBairros").html("<img src='Imagens/load.gif' width='18' border='0'>");
			
		},
		success: function(resposta)
		{
			$("#retornoBairros").html(resposta);
			$('#bairro').SelectCustomizer();

		}
	
});
		
	});

});
function limpa_campo(id,lbl)
{
	value_campo = document.getElementById(id).value;
	if(value_campo == lbl)
	{
		document.getElementById(id).value = "";
	}
}
function suja_campo(id,lbl)
{
	value_campo = document.getElementById(id).value;
	if(value_campo == "")
	{
		document.getElementById(id).value = lbl;
	}
}

hs.graphicsDir = 'admin/js/highslide/graphics/';
hs.align = 'center';
hs.transitions = ['expand', 'crossfade'];
hs.outlineType = 'rounded-white';
hs.fadeInOut = true;
//hs.dimmingOpacity = 0.75;

// Add the controlbar
hs.addSlideshow({
	//slideshowGroup: 'group1',
	interval: 5000,
	repeat: false,
	useControls: true,
	fixedControls: 'fit',
	overlayOptions: {
		opacity: 0.75,
		position: 'bottom center',
		hideOnMouseOut: true
	}
});
