﻿// ARCHIVO JAVASCRIPT DE LA PLANTILLA SINCROSHOP
//
// ÚLTIMA MODIFICACIÓN --> 19 DE ABRIL DEL 2006
//

//Abrir Popup - 11 de Abril del 2006
function AbrirPopup(theURL,winName,features)
{
  window.open(theURL,winName,features);
}

//Funciones para el control ctl_Txt_MinMax - 19 de Abril del 2006
function EsNum(valor)
{
    //Compruebo si es un valor numérico 
    if (isNaN(valor))
    { 
       //entonces (no es numero) devuelvo false
       return false
    }
    else
    { 
       //En caso contrario (Si era un número) devuelvo true
       return true 
    } 
}

//Abrir Ventana - 28 de Julio del 2006
navegador="IE"
function abrirVentana(direccion,nombre,ancho,alto,tamano,retorna,nocentrado,parametros)
{
	var izq,arr,ventana,tamanoventana
	if (tamano=="") {
		if (navegador=="NetS") {
			tamano="0"
		}
		else {
			tamano="1"
		}
	}
	if (navegador=="NetS") {
		izq = screen.availLeft
		arr = screen.availTop
		ancho=parseInt(ancho)+18;
		alto=parseInt(alto)+45;
	}
	else if (navegador=="Opera") {
		izq = 0
		arr = 0
		ancho=parseInt(ancho)+25;
		alto=parseInt(alto)+18;
	}
	else {
		izq = 0
		arr = 0
	}
	
	tamanoventana=""
	altodef=alto
	if (ancho>=screen.availWidth) {
		ancho=(screen.availWidth*95)/100
	}
	if (alto>=screen.availHeight) {
		altodef=(screen.availHeight*95)/100
	}
	arr = arr + Math.round(((screen.availHeight-altodef)/2))
	izq = izq + Math.round(((screen.availWidth-ancho)/2))
	
	if (navegador>="NetS") {
		if (navegador=="NetS") {
			if (tamano!="1") {
				tamanoventana="outer"
			}
			if (alto>=screen.availHeight) {
				altodef=((screen.availHeight-55)*95)/100
				arr=15
			}
			else {
				ancho=ancho+8
			}
		}
		if (navegador=="Opera") {
			arr=10
		}
	}

	parametros="top="+arr+",left=" + izq + ',' + parametros;

	ventana=window.open(direccion,nombre,tamanoventana+"height="+altodef+","+tamanoventana+"width="+ancho+"," + parametros)
	ventana.focus();
	if (retorna==1) {
		return ventana;
	}
}

//SetUniqueRadioButton (sirve para que los radio buttons, dentro de repeaters tengan el mismo group name) - 24 de Agosto del 2006
function SetUniqueRadioButton(nameregex, current)
{
   re = new RegExp(nameregex);
   for(i = 0; i < document.forms[0].elements.length; i++)
   {
      elm = document.forms[0].elements[i]
      if (elm.type == 'radio')
      {
         if (re.test(elm.name))
         {
            elm.checked = false;
         }
      }
   }
   current.checked = true;
}

//AllScroll (sirve para hacer scroll de la pantalla arriba y abajo hasta que se limpie el timeout)
timThumb = 0;
numThumb = 0;
function AllScroll()
{
    if (numThumb != 3)
    {
        scroll(0, 500);
        scroll(0, 0);
        timThumb = setTimeout(AllScroll, 500);
        numThumb++;
    }
}

//ClearAllScroll (limpia el timeout de AllScroll)
function ClearAllScroll()
{
    numThumb = 0;
    clearTimeout(timThumb);
}