/* ********************************************************************************************** */
/* ***** imprimir pagina y enviar pagina.                                                   ***** */
/* ***** Archivo de estilos usado:                                                          ***** */
/* *****     /<carpeta prontus>/css/site/port/estilos.css                                   ***** */
/* ***** V1.0 09/04/2003 - MCO - Primera version.                                           ***** */
/* ***** V2.0 09/05/2003 - MCO - Se agrega el uso del estilo gral * y si en uno de los      ***** */
/* *****                         estilos usados no viene el valor, se usa uno por defecto.  ***** */
/* *****                         Se agrega restriccion para no tomar los estilos con hover. ***** */
/* ********************************************************************************************** */




// ******************************** ENVIAR A *******************************
// Envio de noticia por e-mail.
function enviar() {
  var url = document.URL;
  var loc = '/prontus_meteo/stat/enviar/formulario.html?_URL=' + escape(url);
  var envia = window.open(loc,'enviar',
  'toolbar=0,status=0,menubar=0,scrollbars=0,resizable=0,location=0,directories=0,width=400,height=420');
  envia.focus();
}; // enviar.

// ******************************** IMPRIMIR PAGINA *******************************
// Imprime noticia actual.
function imprimir() {
var url = document.URL;
var loc = '/cgi-bin/imprimir.cgi?_URL=' + escape(url);
var imprime = window.open(loc, 'imprimir');
imprime.focus();
}; //imprimir.

// ******************************** LAYER *******************************
function MM_findObj(n, d) { //v4.01
  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 MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//layer

// ******************************** POP para Zoom *******************************
var FOTOS = new Array();
var TITUS = new Array();
var PIES = new Array();
function popZoom(loc, nom, ancho, alto, posx, posy) {                                                        
  var options="toolbar=no,status=no,menubar=no,scrollbars=no,resizable=yes,location=no,directories=no,width="
             + ancho + ",height=" + alto;                                                                    
  winzoom = window.open(loc, nom, options);                                                                  
  winzoom.focus();                                                                                           
  if ( (posx > 0) && (posy > 0) ) {                                                                          
    winzoom.moveTo(posx, posy);                                                                              
  };                                                                                                         
}; // popZoom 

// ******************************** MUESTRA O OCULTA DIV FLASH *******************************

function activa_flash() {           
  if ( (asActivo == '1') ) {                                                                          
       document.getElementById("contenedorAlerta").style.visibility="visible";
	   //INICIA MOVIMIENTO
	   alertaMoveON();
	   
  };                                                                                                         
}; 



// *INICIO******************************* MOVIMIENTO DIV FLASH *******************************
function alertaMoveON() {

//alert('empieza');

//Se setean id de intervalos
idIzquierda=0;
idArriba=0;
idAbajo=0;
idDerecha=0;
idMaster=0;

alertaVecesTotal=2000;
alertaFrec=50;

//Se setean contadores 
contnVeces = 0;
contvecesDerecha=0;
contvecesArriba=0;
contvecesIzquierda=0;
contvecesAbajo=0;	
	
document.getElementById('contenedorAlerta').style.top = "50px";
document.getElementById('contenedorAlerta').style.left = "50px";

			idMaster =	setInterval("muevete()",alertaFrec);
}

function muevete(){

	var n1 = alertaVecesTotal/4;

	if (contnVeces == 0){
		idDerecha =	setInterval("moveDivDerecha()",alertaFrec*2);

	}else if(contnVeces == (n1)){
		idAbajo =	setInterval("moveDivAbajo()",alertaFrec*2);
		clearInterval(idDerecha);

	}else if(contnVeces == (2*n1)){
		idIzquierda =	setInterval("moveDivIzquierda()",alertaFrec*2);
		clearInterval(idAbajo);

	}else if(contnVeces == (3*n1)){
		idArriba =	setInterval("moveDivArriba()",alertaFrec*2);
		clearInterval(idIzquierda);
	}
	
	if(contnVeces == alertaVecesTotal){
		clearInterval(idIzquierda);
			clearInterval(idAbajo);
				clearInterval(idArriba);
					clearInterval(idDerecha);	
	}

	if (contnVeces<alertaVecesTotal){
		contnVeces=contnVeces+1;
	}else{
		//para que se repita
		contnVeces=0;
		clearInterval(idMaster);
		alertaMoveON();
		}
	
}


function moveDivDerecha(){
	if (contvecesDerecha<alertaVecesTotal){
		  var the_style = getStyleObject("contenedorAlerta");
		  var the_left = parseInt(the_style.left) + 1 ;
		  var the_top = parseInt(the_style.top) + 0;

		if (document.layers){
			the_style.left = the_left;
			the_style.top = the_top;
		  } else{
			the_style.left = the_left + "px";
			the_style.top = the_top + "px";  
		  }
			contvecesDerecha=contvecesDerecha+1;
	}else {
	clearInterval(idDerecha);
	}

}

function moveDivIzquierda(){
	if (contvecesIzquierda<alertaVecesTotal){
		  var the_style = getStyleObject("contenedorAlerta");
		  var the_left = parseInt(the_style.left) - 1 ;
		  var the_top = parseInt(the_style.top) + 0;
			contvecesIzquierda=contvecesIzquierda+1;
		if (document.layers)
		  {
			the_style.left = the_left;
			the_style.top = the_top;
		 } else {
			the_style.left = the_left + "px";
			the_style.top = the_top + "px";  
		  }
	} else{
	clearInterval(idIzquierda);
	}
}

function moveDivArriba(){
	if (contvecesArriba<alertaVecesTotal){
		  var the_style = getStyleObject("contenedorAlerta");
		  var the_left = parseInt(the_style.left) + 0 ;
		  var the_top = parseInt(the_style.top) - 1;
			contvecesArriba=contvecesArriba+1;
		if (document.layers){
			the_style.left = the_left;
			the_style.top = the_top;
		  } else{
			the_style.left = the_left + "px";
			the_style.top = the_top + "px";  
		  }
	} else{
	clearInterval(idArriba);
	}
}

function moveDivAbajo(){
	if (contvecesAbajo<alertaVecesTotal){
		  var the_style = getStyleObject("contenedorAlerta");
		  var the_left = parseInt(the_style.left) + 0 ;
		  var the_top = parseInt(the_style.top) + 1;
			contvecesAbajo=contvecesAbajo+1;
		if (document.layers){
			the_style.left = the_left;
			the_style.top = the_top;
		  } else{
			the_style.left = the_left + "px";
			the_style.top = the_top + "px";  
		  }
	} else{
	clearInterval(idAbajo);
	}

}



function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} 
// *FIN******************************* MOVIMIENTO DIV FLASH *******************************
