//window.onerror = function() { return true; }

function getObj(eId,tag){
  if (document.getElementById) {typeof(eId)=='string'?obj=document.getElementById(eId):obj=eId; if (typeof(tag)=='string') obj?obj=obj.getElementsByTagName(tag):obj=null;}
  else if (document.all) {typeof(eId)=='string'?obj=document.all[eId]:obj=eId; if (typeof(tag)=='string') obj?obj=obj.all.tags(tag):obj=null;}
       else return null;
  return obj;
 }


function toBegin(eId){
	 var h=200;

	 for(i=0;i<aLI.length;i++) {

      if (eId){
          aLI[i].offsetHeight>h? h=aLI[i].offsetHeight:'';
  //        oID.style.height = h + 40 + "px";
		  

       }

	    eId&&i==eId-1&&aLI[eId-1]?aLI[i].style.display='block':aLI[i].style.display='none';
	  }
}

function buildLinks(eId){
 	 var aH2addon='';
	 if (aH2) {
	    for(i=0;i<aLI.length;i++)
	 	     aH2addon+='<li><a href="#" ' + (eId==i?'class="active"':'') + ' onclick="update('+(i+1)+');return false;">'+(i+1)+'</a></li>'

      //aDIV=getObj(aH2[0],'DIV');
      if (aH2) aH2.innerHTML=aH2addon;
    }
}


function update(eId){

 if (eId==0) {
     for(i=0;i<aLI.length;i++)
     		 if (aLI[i].style.display=='block') {
     		 	     aLI[i].style.display='none';
   		 	       aLI.length>(i+1) ? _toId=i+1:_toId=0;
               aLI[_toId].style.display='block';
     		 	     buildLinks(_toId);
     		 	     break;
       		 	 }
    //_timer=window.setTimeout("update(0);", 7000);
    _timer=window.setTimeout("update(0);", 3000);

  }else{
     toBegin(0);
     if (aLI[eId-1]) aLI[eId-1].style.display='block';
     buildLinks(eId-1);
     if (_timer) window.clearTimeout(_timer);

  }

}


  var oID=getObj('block-views-artcarousel-block_1',0);
  var aLIxx=getObj(oID,'LI');
  var aH2=getObj('artcarouselnav',0);



  var aLI = new Array();
  j=0;
  for (i=0; i<aLIxx.length; i++){
     if (aLIxx[i].parentNode.className.indexOf('inks')!=1)
        { aLI[j]=aLIxx[i];
            j++;
        }
  }



  if (aLI && aLI.length>1 && aLI.length!=null) {
  	 toBegin(aLI.length);
  	 update(0);

  }
