function externalLinks(){
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i];
   if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
function addLoadEvent(func)
{	var oldonload = window.onload;
	if (typeof window.onload != 'function')
	    window.onload = func;
	else{
	    window.onload = function(){
	        if (oldonload)
	            oldonload();
	        func();
	    }
	}
}

addLoadEvent(function(){externalLinks();});

	window.addEvent('domready',function(){
      //Flash
        var div = $('boxFlash');
        if(div){
           	var hsFlash = new noobSlide({
			box: $('boxFlash'),
            items: $$('#boxFlash img'),
			size: 980,
			autoPlay: true,
            interval: 10000
		    });
        }
		//SAMPLE banners abajo
        var div = $('box1');
        if(div){
           	var hs1 = new noobSlide({
			box: $('box1'),
            items: $$('#box1 img'),
			size: 650,
			autoPlay: true,
            interval: 10000
		    });
        }                 

        /*fotos laterales*/
        var hs2 = new noobSlide({
            mode: 'vertical',
            box: $('box2'),
            items: $$('#box2 img'),
			size: 316,
			autoPlay: true,
            interval: 5000
		});
         var hs3 = new noobSlide({
            mode: 'vertical',
            box: $('box3'),
            items: $$('#box3 img'),
			size: 240,
			autoPlay: true,
             interval: 10000
		});
         var hs4 = new noobSlide({
            mode: 'vertical',
    		box: $('box4'),
	        items: $$('#box4 img'),
			size: 316,
			autoPlay: true,
             interval: 7000
		});

        //SAMPLE 7
        var div = $('box7');
        if(div){
    		var startItem = 3; //or   0   or any
    		var thumbs_mask7 = $('thumbs_mask7').setStyle('left',(startItem*60-568)+'px').set('opacity',0.8);
    		//var fxOptions7 = {property:'left',duration:1000, transition:Fx.Transitions.Back.easeOut, wait:false}
    		var fxOptions7 = {property:'left',duration:1000, transition:Fx.cubic, wait:false}
    		var thumbsFx = new Fx.Tween(thumbs_mask7,fxOptions7);
    		var nS7 = new noobSlide({
    			box: $('box7'),
    		  /*  items: $$('#box7 span'), */
                items: $$('#box7 img'),
    			handles: $$('#thumbs_handles7 span'),
    			fxOptions: fxOptions7,
       			autoPlay: true,
    			onWalk: function(currentItem){
    				thumbsFx.start(currentItem*60-568);
    			},
    			startItem: startItem
    		});
    		//walk to first with fx
    		nS7.walk(0);
        }


        //tabs
        var div = $('box8');
        if(div){
    		var handles8_more = $$('#handles8_more span');
    		var nS8 = new noobSlide({
    			box: $('box8'),
    			items: $$('#box8 h3'),
    			size: 680,
           		autoPlay: true,
                interval: 20000,
    			handles: $$('#handles8 span'),
    			addButtons: {play: $('play8'), stop: $('stop8')},
    			onWalk: function(currentItem,currentHandle){
    				//style for handles
    				$$(this.handles,handles8_more).removeClass('active');
    				$$(currentHandle,handles8_more[this.currentIndex]).addClass('active');
    			}
    		});
    		//more handle buttons
    		nS8.addHandleButtons(handles8_more);
    		//walk to item 3 witouth fx
    		nS8.walk(0,false,true);
        }
    //tabs eventos
        var div = $('box9');
        if(div){
    		var handles9_more = $$('#handles9_more span');
    		var nS9 = new noobSlide({
    			box: $('box9'),
    			items: $$('#box9 h3'),
    			size: 680,
                autoPlay: true,
                interval: 20000,
    			handles: $$('#handles9 span'),
    			addButtons: {play: $('play9'), stop: $('stop9')},
    			onWalk: function(currentItem,currentHandle){
    				//style for handles
    				$$(this.handles,handles9_more).removeClass('active');
    				$$(currentHandle,handles9_more[this.currentIndex]).addClass('active');
    				//text for "previous" and "next" default buttons
    			}
    		});
    		//more handle buttons
    		nS9.addHandleButtons(handles9_more);
    		//walk to item 3 witouth fx
    		nS9.walk(0,false,true);
          }

        })