// Funciones JavaScript 
// Torro Consultores, S.L.

function tc_hideExplorer() {if (document.all) {("");return false;}}
function tc_hideMozilla(e) {
if(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {("");return false;}}}

if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=tc_hideExplorer;}
else{document.onmouseup=tc_hideExplorer;document.oncontextmenu=tc_hideMozilla;}
document.oncontextmenu=new Function("return false")

if ((navigator.appName.indexOf('Microsoft')+1)) {
document.write('<style type="text/css"> .opacity50 {filter:alpha(opacity=50)} .opacity60 {filter:alpha(opacity=60)} .opacity70 {filter:alpha(opacity=70)} .opacity80 {filter:alpha(opacity=80)} .opacity90 {filter:alpha(opacity=80)} .opacity100 {filter:alpha(opacity=100)} </style>'); }
if ((navigator.appName.indexOf('Netscape')+1)) {
document.write('<style type="text/css"> .opacity50 {-moz-opacity:0.5} .opacity60 {-moz-opacity:0.6} .opacity70 {-moz-opacity:0.7} .opacity80 {-moz-opacity:0.8} .opacity90 {-moz-opacity:0.9} .opacity100 {-moz-opacity:1} </style>'); }
else {
document.write(''); }


function tc_preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=tc_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function tc_swapImgRestore() {
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function tc_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function tc_swapImage() {
  var i,j=0,x,a=tc_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=tc_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//funcion para mover el texto de la barra de estado

function tc_mueve_message_rapido(){
   msgPosicion = msgPosicion + 1
   window.status = msgTexto.substring(0,msgPosicion)
   if (msgPosicion == msgTexto.length){
      msgPosicion = 0
     setTimeout("tc_mueve_message_rapido()",1500)
   } else{
      setTimeout("tc_mueve_message_rapido()",100)
   }
}

function tc_mueve_message_lento(){
   msgPosicion = msgPosicion + 1
   msgLongitud = msgLongitud + 1 
   if ( msgLongitud > msgTexto.length ) msgLongitud = msgTexto.length ;
   window.status = msgTexto.substring(0,msgLongitud)
   if ( msgPosicion == 100 ) {
	   msgLongitud = 0 
	   msgPosicion = 0  
   }
   setTimeout("tc_mueve_message_lento()",100)
 }

function tc_mueve_message_varios( msgPosicion ) {
    if (msgTexto.charAt( msgPosicion ) != '^') {
      txt    = txt + msgTexto.charAt( msgPosicion )
      window.status = txt
      pauze  = scrollSpeed
    }
    else {
      pauze = lineDelay
      txt   = ""
      if (msgPosicion == msgTexto.length-1) msgPosicion = -1
    }
    msgPosicion++
    setTimeout("tc_mueve_message_varios('"+msgPosicion+"')",pauze)
  }


function tc_message_activa( pTexto, Efecto ) {
   msgPosicion = 0 
   msgLongitud = 0 
   msgTexto    = pTexto 
   switch (Efecto) {
	case 2:
	{
	   scrollSpeed = 100
  	   lineDelay   = 2500
       txt         = ""
	   tc_mueve_message_varios(msgPosicion)
	   break
	}
    case 1: 
	   tc_mueve_message_rapido()  
       break 
    case 0: 
	   tc_mueve_message_lento()
	   break
	default:
	   tc_mueve_message_lento()
   }
}

function tc_PrevFoto(img){
  foto1= new Image();
  foto1.src=(img);
  tc_Controlla(img);
}

function tc_Controlla(img){
  if((foto1.width!=0)&&(foto1.height!=0)){
    tc_viewFoto(img,factor);
  }
  else{
    funzione="tc_Controlla('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}

function tc_viewFoto(img){
  largh=foto1.width+20;
  altez=foto1.height+20;
  stringa="width="+largh+",height="+altez;
  finestra=window.open(img,"",stringa);
}
function tc_PrevFoto(img){
  foto1= new Image();
  foto1.src=(img);
  tc_Controlla(img);
}

function tc_Controlla(img){
  if((foto1.width!=0)&&(foto1.height!=0)){
    tc_viewFoto(img,factor);
  }
  else{
    funzione="tc_Controlla('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}

function tc_muestra_imagen(pagina, imagen, titulo, texto, propiedades ){
  window.open( pagina+"?imagen="+imagen+"&titulo="+titulo+"&texto="+texto, '', propiedades );
}



