// JavaScript Document

function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;



var w = 480, h = 340;
if (document.all || document.layers) {
   w = screen.availWidth;
   h = screen.availHeight;
}
var popW = 700, popH = 450;
var leftPos = (w-popW)/2, topPos = (h-popH)/2;
window.open(href, windowname, 'width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos);



return false;
}

function enviar()
{
var valor = document.getElementById('txt_num_ras').value;

	if (valor != "" ) //Validar Vacio
	{
		if( !(isNaN(valor)) )
		{
			if (valor.length == 10)
			{
			window.open('1','ventanaGuia','width = 365px,height=170px');
			document.forms['form1'].submit();
			} 
			else if  ((valor.length == 9)||(valor.length == 14)||(valor.length == 22))
			{
			 window.open('1','ventanaGuia','scrollbars=1,location=0,resizable=0,width =800px,height=600px');
			 document.forms['form1'].submit();
			}
			else
			{
				alert('Código Incompleto');
				return false;
			}
		
		}
		else
		{
			alert('Teclee el código de rastreo correcto.');
			return false;
		}
	}
	else
	{
		alert('Teclee Código de Rastreo');	
	
	}
}

function enviaruser()
{
var valor = document.getElementById('user').value;

	if (valor != "" ) //Validar Vacio
	{
		if( !(isNaN(valor)) )
		{
			if (valor.length == 10)
			{
			window.open('1','ventanaGuia','width = 365px,height=170px');
			document.forms['form1'].submit();
			}
			else
			{
				alert('Usuario Incompleto');
				return false;
			}
		
		}
		else
		{
			alert('Teclee usuario correcto.');
			return false;
		}
	}
	else
	{
		alert('Teclee usuario');	
	
	}
}


function enviarTiempo()
{
var cb_Origen = document.getElementById('comboOrigen').value;
var cb_Destino = document.getElementById('comboDestino').value;

	if (cb_Origen != cb_Destino ) //Validar Vacio
	{

			window.open('calculoTiempo.php','ventanaTiempo','width = 365px,height=170px');
			document.forms['form2'].submit();

	}
	else
	{
		alert('Para entregas locales, comuníquese a las oficinas.');
		return false;
	
	}
	
}




