function sliderBox(selector,xml) {
	// slider
	var items = 0;
	var id = new Array();
	var imagePath = new Array();
	var links = new Array();
	var titulo = new Array();
	var descricao = new Array();
	var control = '';
	var count = 1;
	
	function showInfo() {
		$(selector+' .addLink').click(function(){ open(links[count], '_self'); });
		$(selector+' .splash-content').html(imagePath[count]);
		$(selector+' .title').html(titulo[count]);
		$(selector+' .info').html(descricao[count]);
	}
 
	$.get(xml, function(data) { // pegando xml
	
		$(data).find('bannerEntry').each(function() {
			// populando array
			items++;
			var $slide = $(this); 
			
			id[items] = new Number($slide.find('id').text()); //pega id xml
			links[items] = $slide.find('links').text(); //busca links xml
			titulo[items] = $slide.find('titulo').text(); //busca titulo xml
			descricao[items] = $slide.find('descricao').text(); //busca descricao xml
			
			//regra para img e swf
			
			var arquivo = $slide.find('imagePath').text().substr(-3, 3).toLowerCase(); // pega a extenção do arquivo
						
			if (arquivo == "jpg" || arquivo == "gif" || arquivo == "png" || arquivo == "peg") {
				imagePath[items] = '<img rel="'+$slide.find('tempo').text()+'" src="'+$slide.find('imagePath').text()+'" width="673" height="292" alt="" />'; //busca img xml
			}
			
			if (arquivo == "swf") {
				imagePath[items] = "<object width='673' height='292' rel='"+$slide.find("tempo").text()+"'><param name='movie' value='"+$slide.find("imagePath").text()+"' /><param name='quality' value='high' /><param name='wmode' value='opaque' /><param name='swfversion' value='6.0.65.0' /><!--[if !IE]>--><object type='application/x-shockwave-flash' data='"+$slide.find("imagePath").text()+"' width='673' height='292'><!--<![endif]--><param name='quality' value='high' /><param name='wmode' value='opaque' /><param name='swfversion' value='6.0.65.0' /><!--[if !IE]>--></object><!--<![endif]--></object>"; //busca img xml
			}
			
			//$('.splash').attr('rel', $slide.find('tempo').text());
			
			// criando abas
			if(items == 1) control = control + '<a href="#" class="selected" rel="'+items+'">'+items+'</a>';
			else control = control + '<a href="#" rel="'+items+'">'+items+'</a>';
		});
 
		showInfo();
		
		// add controle 
		$(selector+' .splash-controls').html(control);
	});
		
	function Slide2Next(selector,count,imagePath,links,titulo,descricao,items,id, slideID) {
		if(count < items){
			count++;
			$(selector+' .splash-content').animate({opacity:0},500, function() {
				showInfo();
				$(selector+' .splash-content').animate({opacity:1},500);
			});
			//$('.splash').attr('rel', $slide.find('tempo').text());
		} else {
			count = 1;
			$(selector+' .splash-content').animate({opacity:0},500, function() {
				showInfo();
				$(selector+' .splash-content').animate({opacity:1},500);
			});
			//$('.splash').attr('rel', $slide.find('tempo').text());
		}
		
		$('.splash-controls > a').removeClass('selected');
		$('.splash-controls > a[rel='+count+']').addClass('selected');
		
        return count;
	}
	
	// quando clicar
	$(selector+' .splash-controls a').live('click',function () {
		var slideID = $(this).attr('rel');
		count = slideID - 1;
		
		//timeS = $('.splash').attr('rel');
		
		count = Slide2Next(selector,count,imagePath,links,titulo,descricao,items,slideID,id);
		clearInterval(slideInterval);
		
		if (id.length+1 != 1) {	
			slideInterval = setInterval(function(){ count = Slide2Next(selector,count,imagePath,links,titulo,descricao, items, id)}, 8000);
		} else {
			count = Slide2Next(selector,count,imagePath,links,titulo,descricao, items, id);
		}
		
		return false;
	});
	
	if (id.length+1 != 1) {
		var slideInterval = setInterval(function(){ count = Slide2Next(selector,count,imagePath,links,titulo,descricao, items, id)}, 8000);
	} else {
		count = Slide2Next(selector,count,imagePath,links,titulo,descricao, items, id);
	}
}
