// Detecta el navegador
var ie=document.all;
var ns=document.layers;
var ns6=document.getElementById&&!document.all;
// Conversor de moneda "importado" del php
function conversor(vinicio, vdestino, vvalor) {
var vcoeficiente = new Array();vcoeficiente["dolares"] = 3;
vcoeficiente["euros"] = 4;
vcoeficiente["pesos"] = 1;
var vsimbolomoneda = new Array();vsimbolomoneda["dolares"] = 'u$';
vsimbolomoneda["euros"] = '€';
vsimbolomoneda["pesos"] = '$';
// Conertimos la moneda
if(vinicio == vdestino) { vresultado = vvalor; }
else if(vinicio == 'pesos') { vresultado = vvalor / vcoeficiente[vdestino]; }
else if(vdestino == 'pesos') { vresultado = vvalor * vcoeficiente[vinicio]; }
else { vresultado = ((vvalor * vcoeficiente[vinicio]) / vcoeficiente[vdestino]); }
// Redondeamos a 2 decimales
if(vresultado == 0) {
return 'xx';
} else {
vcostofinal = ""+vsimbolomoneda[vdestino]+" "+Math.round(vresultado);
return vcostofinal;
}
}
// Funcion para calcular streaming a medida
function calculastreaming(vusuarios,vkbps,vhoras,vdias) {
var vcoeficiente = new Array();vcoeficiente["dolares"] = 3;
vcoeficiente["euros"] = 4;
vcoeficiente["pesos"] = 1;
var vsimbolomoneda = new Array();vsimbolomoneda["dolares"] = 'u$';
vsimbolomoneda["euros"] = '€';
vsimbolomoneda["pesos"] = '$';
preciomil = 45; // precio en dolares de 1mbps x mes
// calcula el precio de un kilobyte
precioporkb = preciomil / 720 / 1024;
// calcula la cantidad de kbps por hora
cantidadkb = vkbps * vusuarios * vhoras * vdias * 4;
// subtotal con iva y costos de servicio
subtotal1 = cantidadkb * precioporkb * 3;
// sumamos el iva
subtotal2 = subtotal1 + ((subtotal1 * 21) / 100);
// precio final en la moneda deseada (redondeado)
preciofinal = conversor('dolares', 'dolares', subtotal2);
if(preciofinal != 'xx') document.getElementById('streamingprecio').innerHTML = preciofinal+" 00";
if(preciofinal != 'xx') document.getElementById('iprecio').value = preciofinal+" 00";
}
// Checkea si se completó el precio ok
function checkstreaming() {
str = document.getElementById('iprecio').value;
if((str == '0')||(str == '')||(str == '0.00')||(str == 'xx')) {
alert("El formulario está incompleto, por favor revíselo.");
return false;
} else {
return true;
}
}
// Funcion para mostrar u ocultar tips en hosting
function showhelptip(showtexto,divid) {
// Muestra texto de rollover
document.getElementById(divid).innerHTML = showtexto;
}
// Checkea el formulario de contacto
function checkformcontacto() {
var error = 0;
if(document.getElementById('postpais').value.length == 0) { error = 1; }
if(document.getElementById('postemail').value.length == 0) { error = 1; }
if((document.getElementById('postemail').value.indexOf('@') < 1)||(document.getElementById('postemail').value.indexOf('.') < 1)) { error = 2; }
if(document.getElementById('postnombre').value.length == 0) { error = 1; }
if(document.getElementById('postconsulta').value.length == 0) { error = 1; }
return error;
}
// Variables generales del topmenu
var izquierda = 0;
var arriba = 0;
var menuabierto = ' ';
var cerrardivok = 0;
var scrheight = 0;
var scrwidth = 0;
var timer = 1;
var anchodiv = 135;
// Devuelve las coordenadas del objeto donde nos paramos
function encontrar(obj) {
var curleft = 0
var curtop = 0;
if (obj.offsetParent) {
curleft = obj.offsetLeft;
curtop = obj.offsetTop;
while (obj = obj.offsetParent) {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
}
}
izquierda = curleft;
arriba = curtop+13;
}
function mostrardiv(nombre,identificador) {
// Buscamos las coordenadas
encontrar(identificador);
// Si hay un menu, lo cerramos
if((menuabierto != nombre)&&(menuabierto != ' ')) { timer = 0; cerrardivok = 1; cerrardiv(menuabierto); }
cerrardivok = 0; menuabierto = nombre;
// Detectamos la resolución de pantalla...
if (self.screen) { // for NN4 and IE4
scrwidth = screen.width;
scrheight = screen.height
} else if (self.java) { // for NN3 with enabled Java
var jkit = java.awt.Toolkit.getDefaultToolkit();
var scrsize = jkit.getScreenSize();
scrwidth = scrsize.width;
scrheight = scrsize.height;
}
// Div y Frame
LinkId = document.getElementById(nombre);
DivId = document.getElementById("sub"+nombre);
FraId = document.getElementById("iframefantasma");
// Fix para 800x600
if ((izquierda + anchodiv) > scrwidth - 50) {
izquierda = izquierda - anchodiv + LinkId.offsetWidth;
}
// Cosas para mostrar el Div
LinkId.className='linktophover';
DivId.style.left = izquierda+"px";
DivId.style.top = arriba+"px";
DivId.style.visibility = "visible";
DivId.style.display = "block";
// Iframe fix para IE
if(ie) {
FraId.style.width = anchodiv+"px";
FraId.style.top = arriba+"px";
FraId.style.left = izquierda+"px";
FraId.style.height = DivId.offsetHeight;
FraId.style.visibility = "visible";
FraId.style.display = "block";
}
}
function cerrardiv() {
// Cierra un Div, si esta ok y es el abierto
if(timer == 0) {
if((menuabierto != ' ')&&(cerrardivok == 1)) {
// Div y Frame
LinkId = document.getElementById(menuabierto);
DivId = document.getElementById("sub"+menuabierto);
FraId = document.getElementById("iframefantasma");
LinkId.className='';
DivId.style.top = "0px";
DivId.style.left = "0px";
DivId.style.visibility = "hidden";
DivId.style.display = "none";
menuabierto = ' ';
cerrardivok = 0;
// Iframe fix para IE
if(ie) {
FraId = document.getElementById("iframefantasma");
FraId.style.visibility = "hidden";
FraId.style.display = "none";
}
clearInterval(intervalo);
timer = 1;
}
} else {
timer = 0;
intervalo = setInterval("cerrardiv()","250");
}
}
// Script DHTML para los infotips de compra y otros
var offsetxpoint=-60
var offsetypoint=20
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
function ietruebody() {
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
// Crea/modifica los tooltips
function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie) {
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}
// Le cambia la posición segun el mouse
function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
// Se fija si estamos en el borde o esquina de la ventana
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
// Si no alcanza el ancho de ventana, vamos para la izquierda
if (rightedge 0) document.getElementById('leftfondo').style.height = resultado + "px";
}
if(document.getElementById('rightfondo') != undefined) {
altura1 = document.getElementById('rightmenu').offsetHeight - document.getElementById('rightfondo').offsetHeight;
altura2 = document.getElementById('central').offsetHeight;
resultado = altura2 - altura1;
if(resultado > 0) document.getElementById('rightfondo').style.height = resultado + "px";
}
}
//change the opacity for different browsers
function changeOpac(opacity, id) {
var object = document.getElementById(id).style;
if(object.opacity != undefined) object.opacity = (opacity / 100);
else if(object.MozOpacity != undefined) object.MozOpacity = (opacity / 100);
else if(object.KhtmlOpacity != undefined) object.KhtmlOpacity = (opacity / 100);
else if(object.filter != undefined) object.filter = "alpha(opacity=" + opacity + ")";
}
// el cojonudo script para que funcione nutdomains con todas las exts
function sendAllTlds(thisForm) {
var i,sendStr = '?first=Y'
for (i = 0; i < thisForm.tld.length; i++)
if (thisForm.tld.options[thisForm.tld.selectedIndex].value != thisForm.tld.options[i].value)
sendStr += '&tld=' + thisForm.tld.options[i].value
if (thisForm.suggestalternatives.checked) {
for (i = 0; i < thisForm.tld.length; i++)
sendStr += '&' + thisForm.tld.options[i].value + '=Y'
} else {
sendStr += '&' + thisForm.tld.options[thisForm.tld.selectedIndex].value + '=Y'
}
thisForm.action = thisForm.action + sendStr
}
// checkea registro de dominio argentino
function checkregarg() {
var errorencampo = 0;
// Datos principales
if(document.formregarg.postnro.value.length < 1) errorencampo = 1;
if(document.formregarg.postnombrea.value.length < 1) errorencampo = 1;
if(document.formregarg.postusemail.value.length < 1) errorencampo = 1;
if(document.formregarg.postdominio.value.length < 1) errorencampo = 1;
// Entidad Registrante
if(document.formregarg.postentnombrea.value.length < 1) errorencampo = 1;
if(document.formregarg.postentnro.value.length < 1) errorencampo = 1;
if(document.formregarg.postentusemail.value.length < 1) errorencampo = 1;
if(document.formregarg.postentdomicilio.value.length < 1) errorencampo = 1;
if(document.formregarg.postentcp.value.length < 1) errorencampo = 1;
if(document.formregarg.postentciudad.value.length < 1) errorencampo = 1;
if(document.formregarg.postentprovincia.value.length < 1) errorencampo = 1;
if(document.formregarg.postentpais.value.length < 1) errorencampo = 1;
if(document.formregarg.postenttelefono.value.length < 1) errorencampo = 1;
if(document.formregarg.postentactividad.value.length < 1) errorencampo = 1;
// Persona Responsable
if(document.formregarg.postcontnombrea.value.length < 1) errorencampo = 1;
if(document.formregarg.postcontnro.value.length < 1) errorencampo = 1;
if(document.formregarg.postcontusemail.value.length < 1) errorencampo = 1;
if(document.formregarg.postcontdomicilio.value.length < 1) errorencampo = 1;
if(document.formregarg.postcontcp.value.length < 1) errorencampo = 1;
if(document.formregarg.postcontciudad.value.length < 1) errorencampo = 1;
if(document.formregarg.postcontprovincia.value.length < 1) errorencampo = 1;
if(document.formregarg.postcontpais.value.length < 1) errorencampo = 1;
if(document.formregarg.postconttelefono.value.length < 1) errorencampo = 1;
if(document.formregarg.postconthorario.value.length < 1) errorencampo = 1;
// Devuelve los Errores
if(errorencampo == 0) {
return true;
} else if(errorencampo == 1) {
alert("Por favor completa todos los campos, son obligatorios.");
return false;
} else return false;
}
// Evita boton derecho
document.oncontextmenu = new Function("return false");
// Evita seleccion de texto (solo IE)
//document.onselectstart = new Function ("return false");
// Mueve los tooltips con el mouse
document.onmousemove = positiontip;
// Cambia de tamaño los menus izquierdo y derecho
var yahiceresize = false;
document.onload = resizemenus;
window.onload = resizemenus;
// Le dice al sitio que ya se cargó este javascript
var loaded = 'yes';