banners = new Array();
banners[0] = "images/template/home.swf";
banners[1] = "images/template/home2.swf";
banners[2] = "images/template/home4.swf";
times = new Array();
times[0] = 17000;
times[1] = 17000;
times[2] = 17000;
links = new Array();
links[0] = 'servicios';
links[1] = 'servicios';
links[2] = 'nosotros';
var t;
var pos = 0;
var last_pos = 0;
totalbanners = banners.length;
function get_flash(num) {
	pos = num;
	clearTimeout(t);
	flash_rotate();
}
function get_flash_prev() {
	pos = last_pos - 1;
	if(pos < 0){pos = totalbanners - 1;}
	clearTimeout(t);
	flash_rotate();
}
function get_flash_next() {
	pos = last_pos + 1;
	if(pos == totalbanners){pos = 0;}
	clearTimeout(t);
	flash_rotate();
}
function flash_rotate(){
	var flashVersion = deconcept.SWFObjectUtil.getPlayerVersion();
	if(flashVersion['major'] >= 6) {
	var so = new SWFObject(banners[pos],"id","980","400","8","#FFF");
	so.addParam("scale", "noscale");
	so.addParam("wmode", "transparent");
	so.addVariable("link",encodeURIComponent(links[pos]));
	so.write("flashcontent"); 
	}
	else{
	document.getElementById("flashcontent").innerHTML = '<div style="text-align:center;padding-top:200px;"><h3>Este contenido requiere Flash</h3><br />Para ver este contenido es necesario tener instalada la última versión de Flash Player<br /><br /><a href="http://www.adobe.com/go/getflashplayer">Descarga Flash Player gratis ahora</a><br /><br /><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="adobe flash player" title="adobe flash player" /></a></div>';
	}
	t = setTimeout('flash_rotate()',times[pos]);
	document.getElementById("item["+last_pos+"]").src = 'images/template/flash_inactive.gif';
	document.getElementById("item["+pos+"]").src = 'images/template/flash_active.gif';
	last_pos = pos; 
	pos = pos + 1;
	if(pos == totalbanners){pos = 0;}
}
function createElements( args ) {  
   var el;  
   if( typeof(args) == "string" ) {  
      el = document.createTextNode(args);  
   } else if ( typeof(args) == "object" ) {  
      el = document.createElement( args.tag );  
      if ( args.attributes ) {  
         for ( i in args.attributes ) {  
            el.setAttribute(i, args.attributes[i]);  
         }  
      }  
      if ( args.style ) {  
         for ( i in args.style ) {  
            el.style[i] = args.style[i];  
         }  
      }  
      if ( args.children ) {  
         for ( var i = 0; i < args.children.length; i++ ) {  
            el.appendChild( createElements( args.children[i] ) );  
         }  
      }  
   }  
   return el;  
}  
	var node = createElements({  
	     tag: "a",  
	     attributes: {
	        href: "javascript:get_flash_prev();"  
	     }, 
	     children: [  
	        {  
	           tag: "img",  
	           attributes: {  
	              src: "images/template/flash_prev.gif",   
	              border: "0"  
	           }
	        }
	     ]  
	});  
	document.getElementById("buttons_flash").appendChild(node); 
for( var x = 0; x < totalbanners; x++ ) {
	var node = createElements({  
	     tag: "a",  
	     attributes: {
	        href: "javascript:get_flash("+x+");"  
	     }, 
	     children: [  
	        {  
	           tag: "img",  
	           attributes: {  
			   	  id: "item["+x+"]",
	              src: "images/template/flash_inactive.gif",    
	              border: "0"  
	           }
	        }
	     ]  
	});  
	document.getElementById("buttons_flash").appendChild(node); 
}
	var node = createElements({  
	     tag: "a",  
	     attributes: {
	        href: "javascript:get_flash_next();"  
	     }, 
	     children: [  
	        {  
	           tag: "img",  
	           attributes: {  
	              src: "images/template/flash_next.gif",   
	              border: "0"  
	           }
	        }
	     ]  
	});  
	document.getElementById("buttons_flash").appendChild(node); 
flash_rotate();