$(document).ready(function() {

// SCROLL TO
//$.scrollTo( 'div#conteudo', 800, {easing:'elasout'} );

//REDES SOCIAIS --------------------------------------------------------------------------------------------------------

	if($("#redes-sociais").length > 0){
	
		var URL = "http://www.facebook.com/plugins/like.php?href=" + document.URL + "&;%0Alayout=standard&show_faces=false&width=380&action=like&colorscheme=light&height=25";
				
	    stLight.options({
	            publisher:'fh'
	    });
	
		$("#redes-sociais").prepend("<iframe src=\""+URL+"\" style=\"border:none; overflow:hidden; width: 420px; height:25px;\" allowtransparency=\"true\" frameborder=\"0\" scrolling=\"no\" id=\"curtir\"></iframe>");
		$("#redes-sociais #sharethis").append("<span class=\"st_twitter\"></span>");
		$("#redes-sociais #sharethis").append("<span class=\"st_email\"></span>");
		$("#redes-sociais #sharethis").append("<span class=\"st_linkedin\"></span>");
		$("#redes-sociais #sharethis").append("<span class=\"st_sharethis\"></span>");
	
	}
	
// --------------------------------------------------------------------------------------------------------------------

		
		
//MAPA ----------------------------------------------------------------------------------------------------------------
	
	$('map[name|="mapa"] > area').click( function() {    	
		$('#box-mapa-lista-endereco > ul > li').hide();	    	
		$('li[title|=' + this.id + ']').fadeIn("slow");
	});

// --------------------------------------------------------------------------------------------------------------------

// ---------------------------------------------------------------------------------------------------------------------


/*Slide menu Clientes*/	
	//Set default open/close settings
$('.cliente-detalhes').hide(); //Hide/close all containers
$('.cliente-setor:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container

//On Click
$('.cliente-setor').click(function(){
	if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
		$('.cliente-setor').removeClass('active').next().slideUp(); //Remove all .acc_trigger classes and slide up the immediate next container
		$(this).toggleClass('active').next().slideDown(); //Add .acc_trigger class to clicked trigger and slide down the immediate next container
	}
	return false; //Prevent the browser jump to the link anchor
});

/*menu expansivel*/
	$('img.drop-menu').click(function () {
	$('ul#drop-conteudo').slideToggle('medium');
    });
	
	$('div.drop-menu').click(function () {
	$('ul#drop-conteudo').slideToggle('medium');
    });
	
	
});

/* breadcrumbs */

function breadcrumbs(){
  sURL = new String;
  bits = new Object;
  var x = 0;
  var stop = 0;
  var output = "<a href=\"/\">Home</a> &raquo; ";
  sURL = location.href;
  sURL = sURL.slice(8,sURL.length);
  sStart = sURL.indexOf("/Paginas/");
  sURL = sURL.slice(sStart+9,sURL.length);
  
  while(!stop){
    sStart = sURL.indexOf("/");
    if (sStart != -1){
	      
	      bits[x] = sURL.slice(0,sStart);
	      sURL = sURL.slice(sStart+1,sURL.length);
	 	    
    }
    else {
      stop = 1;
    }
    x++;
  }
  
  for(var i in bits){
    output += "<a href=\"";
    for(y=1;y<x-i;y++){
      output += "../";
    }
    
    output += bits[i] + "/\">" + tratarNome(bits[i]) + "</a>  &raquo; ";
  }
  
  document.write(output + document.title);
}

function tratarNome(valor)
{
	valor = valor.replace(/[-]/gi, ' ');
	valor = valor.replace('coes', '&ccedil;&otilde;es');
	valor = valor.replace('Servicos', 'Servi&ccedil;os')
	return valor;
}
