function selecaoLinha(linha,cursor)
{
	while (linha.tagName!="TR")
	{		linha=linha.parentElement;	}
	if (linha.selecionada==0)
	{
		linha.className="tabela_linha_selecionada_dado";
		//Padrão do cursor é o definido na classe acima!
		if (cursor!=null) linha.style.cursor=cursor;
		linha.selecionada=1;
	}
	else
	{
		linha.className="tabela_linha_dado";
		linha.selecionada=0;
	}
}


var mySlideList1 = ['images/Espumante1.jpg','images/Espumante2.jpg'];
var mySlideShow1 = new SlideShow(mySlideList1, 'first', 4000, "mySlideShow1"); 

var mySlideListBanner = ['images/ziero1.jpg', 'images/ziero2.jpg','images/ziero3.jpg'];
var mySlideShowBanner = new SlideShow(mySlideListBanner, 'Banner', 7000, "mySlideShowBanner"); 

function SlideShow(slideList, image, speed, name){
         this.slideList = slideList;
         this.image = image;
         this.speed = speed;
         this.name = name;
         this.current = 0;
         this.timer = 0;
 }

SlideShow.prototype.play = SlideShow_play; 

function switchImage(imgName, imgSrc){
         if (document.images){
                 if (imgSrc != "none"){
                         document.images[imgName].src = imgSrc;
                 }
         }
 } 
 
 
function SlideShow_play(){
         with(this){
                 if(current++ == slideList.length-1) current = 0;
                 switchImage(image, slideList[current]);
                 clearTimeout(timer);
                 timer = setTimeout(name+'.play()', speed);
         }
} 


var d=document;
$ = function(id) {
	if(!arguments[1]) return document.getElementById(id);
	else document.getElementById(id).style[arguments[1]]=arguments[2];
}


function delItem(arr,item){
for(;item<arr.length;item++) arr[item]=arr[item + 1];
arr.length=arr.length-1;
} 

function goURL(){
(Item[atual][3].indexOf('_blank')!=-1) ? window.open(Item[atual][3].substring(0,Item[atual][3].indexOf(' '))) : location.href=Item[atual][3];
} 


function startSlide(){ 
loadImages();
if(!paused) timeoutId=setTimeout('changeImg(1)',6000);
} 


function initialize(){
timeoutId=0;
textareaContent=d.form_cr.select_cr.value.split(/[\r\n]/i);
Item = new Array();
for(x=0,y=0;x<textareaContent.length;x++){ 
	if(textareaContent[x].length>30) Item[y++]=textareaContent[x].split('|');
	}
for(i=Item.length-1;i>=0;i--){
	Item[i][0]=Item[i][0].replace(/([ \n\t\r])+/, " ");
	Item[i][4]=(Item[i][4].length<3) ? '' : '<img src="'+Item[i][4]+'" border="0" style="margin-left:4px;" />';
	if(Item[i][1].length<3||Item[i][3].length<3||Item[i][2].length<3||Item[i][0].length<2) delItem(Item,i);
	}
if(Item.length==1) d.write('<style>#anterior,#proximo,#pause{visibility:hidden;}</style>');
atual = Math.random().toString().substring(2,6) % Item.length;
} 


function startPanel(){
usaCredito = '';
initialize();
if(arguments.length>0){
	if(!isNaN(arguments[0])) atual = arguments[0];
	}
if(paused) {imgpause='on'; altpause='alt="Ligar" title="Ligar"';}
else {imgpause='off'; altpause='alt="Parar" title="Parar"';}
d.write('<div id="to-blend">'+usaCredito+'<a href="javascript:goURL()"><img src="'+Item[atual][1]+'" id="imgslide" name="img1" border="0" title="'+Item[atual][0]+'" alt="'+Item[atual][0]+'"></a>');
d.write('<h2><a href="javascript:goURL()" id="p-link"><span id="txt1">'+Item[atual][2]+'</span><span id="icon-area">'+Item[atual][4]+'</span></a></h2></div>');
} 

var okToGo=false;

//onload=startSlide;

