var capa = 'phone';

function toggleLayer(whichLayer) {



		capa = whichLayer;

		if (document.getElementById) {
			// this is the way the standards work
			var style2 = document.getElementById(whichLayer).style;
			style2.display = "block";
		}
		else if (document.all) {
			// this is the way old msie versions work
			var style2 = document.all[whichLayer].style;
			style2.display = "block";
		}
		else
			if (document.layers) {
				// this is the way nn4 works
				var style2 = document.layers[whichLayer].style;
				style2.display = "block";
			}


	//alert('mostramos: ' + whichLayer + ' - ' + document.getElementById(whichLayer).style.display);

}

function hideLayer(whichLayer) {
	if (document.getElementById) {
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = "none";
	}
	else if (document.all) {
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = "none";
	}
	else
		if (document.layers) {
			// this is the way nn4 works
			var style2 = document.layers[whichLayer].style;
			style2.display = "none";
		}

		//alert('ocultamos: '  + whichLayer + ' - ' +  document.getElementById(whichLayer).style.display);
}


function redirectData(response) {

	if (response != '')	document.location.href=response;

}

function redirectDataIframe(response) {

	if (response != '') top.location.href=response;

}

function updateText(timeleft){
	var obj = document.getElementById("segundos");
	obj.innerHTML = timeleft;
}

function timeUp (){

/*
	if (capa == 'phone') {

		hideLayer('phone');
		toggleLayer('visa');

	}
*/

}

function refresh (){
	 updateText(timeleft);
	if (timeleft>0){
		timeleft--;
		setTimeout ("refresh()",1000);
	}
	//else timeUp ();
	else changeMenuPayment('phone2');
}

function montaFecha(segundos){

	var segRestan = aniadeCero(segundos%60);
	var minutos = (segundos-segRestan)/60;
	var minRestan = aniadeCero(minutos%60);
	var horas = (minutos-minRestan)/60;
	var horasRestan = aniadeCero(horas%24);

	var result = +horasRestan+':'+minRestan+':'+segRestan;

	return result;

}

function aniadeCero(valor){
	if(valor<10){
		valor = '0'+valor;
	}
	return valor;
}

function agregar(url_fav, txt){
   if ((navigator.appName=="Microsoft Internet Explorer") &&
         (parseInt(navigator.appVersion)>=4)) {
      var url=url_fav;
      var titulo=txt;
      window.external.AddFavorite(url,titulo);
   } else {
      if(navigator.appName == "Netscape")
         alert("Presione Crtl+D para agregar este sitio en sus Marcadores");
   }
}

function changeMenuPayment(newop) {
	var opmenu = document.getElementById('opmenu');
	var oldop  = opmenu.value;
	if (newop != oldop) {
		toggleLayer(newop);
		hideLayer(oldop);
		//alert('ocultamos '+ oldop +', mostramos '+ newop);
		opmenu.value = newop;
		//alert(document.getElementById(newop).style.display);
		//alert(document.getElementById(oldop).style.display);
	}
}


function validarSuscripcion() {

	var telefono = document.acceso_sms.telefono.value;

	if (telefono == ""){
		alert ("No puedes dejar el campo telefono vacío");
		document.acceso_sms.telefono.focus();
		return false;
	} else {
		return true;
	}
}