navName = navigator.appName;
function FotoAmpliada(Imagen,Alto,Ancho)
{
	var newWidth, newHeight;
	var centerX, centerY;
	var winSet, UrlToGo;
	
	newWidth = 15 + Ancho;
	newHeight = 25 + Alto;
	centerX = (screen.width - Ancho)/2;
	centerY = (screen.height - Alto)/2;
	
	if (navName == 'Netscape'){
   	winSet = "scrollbars=no,resizable=no,status=no,location=no,menubar=no,screenX=" + centerX + ",screenY=" + centerY + ",width=" + newWidth + ",height=" + newHeight;}
	else{
		winSet = "scrollbars=no,resizable=no,status=no,location=no,menubar=no,Left=" + centerX + ",Top=" + centerY + ",width=" + newWidth + ",height=" + newHeight;}

	UrlToGo = 'ar_imagen.asp?Imagen=' + Imagen;
	window.open(UrlToGo, 'FotoAmpliada',winSet);
}
function AbrirVentana(theURL,winName,features,Alto,Ancho)
{
	var centerX, centerY;

	centerX = (screen.width - Ancho)/2;
	centerY = (screen.height - Alto)/2;
	
	if (navName == 'Netscape'){
   	features = features + ",screenX=" + centerX + ",screenY=" + centerY + ",width=" + Ancho + ",height=" + Alto;}
	else{
		features = features + ",Left=" + centerX + ",Top=" + centerY + ",width=" + Ancho + ",height=" + Alto;}

  window.open(theURL,winName,features);
}
function SearchOptionValue(theoption,thevalue)
{
	for (var Current=0;Current < theoption.options.length;Current++)
	{
		if (theoption.options[Current].value == thevalue)
		{
			theoption.selectedIndex = Current;
			break;
		}
   }
}
function ExpanderMenu(objsubmenu, idsubmenu) {  

	var colldiv = document.all.tags("DIV");
	for (i=0; i<colldiv.length; i++)
		if ((idsubmenu-1) != i)  { 
			colldiv[i].style.display = "none";
		}  
	if (objsubmenu.style.display == "") {
   	objsubmenu.style.display = "none";
   	}
   else {
   	objsubmenu.style.display = "";
   }
} 
function ImprimeFecha()
{
	var months=new Array(13);
	months[1]="Enero";
	months[2]="Febrero";
	months[3]="Marzo";
	months[4]="Abril";
	months[5]="Mayo";
	months[6]="Junio";
	months[7]="Julio";
	months[8]="Agosto";
	months[9]="Septiembre";
	months[10]="Octubre";
	months[11]="Noviembre";
	months[12]="Diciembre";
	var time=new Date();
	var lmonth=months[time.getMonth() + 1];
	var date=time.getDate();
	var year=time.getYear();
	if (year < 2000)
	year = year + 1900;	
	document.write("Guayaquil - Ecuador, " + lmonth + " " + date + " del " + year + "&nbsp;");
}
function checkEmail(Email)
{
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(Email)){
return (true)
}
alert("Dirección email invalida!");
return (false);
}

function chckceduruc(CedRuc)
{
  var numeros
  var pesos
  var Imodulo
  var posicion
  var tempo
  var Itotal
  var Iresiduo
  var cuenta
  
  numeros = parseInt(CedRuc.slice(0,2),10);
  
  
 if (CedRuc.length < 10 ) 
    {  alert ("Menos de 10");
       return (false);
    	}
 if ((CedRuc.length != 10 )&& (CedRuc.length != 13 ))
    {  alert ("Diferente de 10 0 13");
         return (false);
    	}  
  if ((numeros < 1 ) || (numeros > 22))
     {  alert(numeros);
        alert ("menor que 1 o mayor a 22");
         return (false);	
     	}
  
  numeros = parseInt(CedRuc.slice(2,3),10);   	
  
  if ((numeros != 6 ) && (numeros != 8) && (numeros != 9))
    {
    	pesos =  "212121212";
    	Imodulo = 10;
    	posicion = 9;
    	}
  else
    {  Imodulo = 11;
       if (numeros == 9)
         {
            pesos = "432765432"	;
            posicion = 9;
           	}
        else 
          {   pesos = "32765432";
              posicion = 8;
          	}	
    }
    
    tempo = 0;
    Itotal = 0;
    Iresiduo = 0;
    numeros= 0;
    
  if (Imodulo == 10)
  {
  	cuenta = 0;
  	
  	while (cuenta < posicion)
  	{   tempo =  (parseInt(CedRuc.charAt(cuenta),10)) * (parseInt(pesos.charAt(cuenta),10));
            
            if (tempo > 9)
               {
               	Itotal = Itotal + (tempo - 9);
               	}
            else
               {
               	Itotal = Itotal + tempo ;
               	}   	
  		
  		cuenta ++
  		}
  	Iresiduo = Itotal%Imodulo ;
  	if (Iresiduo >= (Imodulo -9))
  	  {
  	  	Iresiduo = Imodulo - Iresiduo ;
  	  	}
   }
   
   else
     { 
     	cuenta = 0;
        while (cuenta < posicion)
        { 
           tempo =  (parseInt(CedRuc.charAt(cuenta),10)) * (parseInt(pesos.charAt(cuenta),10));
           Itotal = Itotal + tempo;
             		
          cuenta++
         }
     	
     	Iresiduo = Imodulo - (Itotal % Imodulo) ;
     	alert (Iresiduo);
     	
     	if (Iresiduo == Imodulo)
     	{  Iresiduo = 0;
     		}
     	}
    
    numeros = parseInt(CedRuc.charAt(posicion),10);
    
    if (numeros == Iresiduo)
    {   return (true);
    	}
   else {
   	alert(CedRuc);
	return (false);
   	}
  return (false); 	
 }