var whitespace = " \t\n\r";

function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}

function isWhitespace (s)
{   var i;
    if (isEmpty(s)) return true;
    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);
        // si el caracter en que estoy no aparece en whitespace,
        // entonces retornar falso
        if (whitespace.indexOf(c) == -1) return false;
    }
    return true;
}

function openkit()
{
   var l,t;
   l = (screen.width / 2)-95;
   t = (screen.height / 2)-80;
window.open('resourcekit.html','','top='+t+',left='+l+',width=185,height=160');

}
function opendemo()
{
   var l,t;
   l = (screen.width / 2)-260;
   t = (screen.height / 2)-180;
window.open('flash/demo.html','','top='+t+',left='+l+',width=520,height=360');

}
function openvsat()
{
   var l,t;
   l = (screen.width / 2)-174.5;
   t = (screen.height / 2)-156.5;
window.open('flash/whatisavsat.htm','','top='+t+',left='+l+',width=349,height=313');

}
function validateContactForm()
{
	validateFlag = true;
	if (document.contactform.cboCountry.value == '-1')
		{
		alert('Please select your Country.');
		document.contactform.cboCountry.focus();
		return;
		}
	if (document.contactform.txtName.value=='')
		{
		alert ('Please fill in your name.');
		document.contactform.txtName.focus();
		return;
		}

	if (document.contactform.txtTitle.value=='')
		{
		alert('Please fill in your Title.');
		document.contactform.txtTitle.focus();
		return;
		}

	if (document.contactform.txtCompany.value=='')
		{
		alert('Please fill in Company Name.');
		document.contactform.txtCompany.focus();
		return;
		}

	if (!isEmail(document.contactform.txtEmail.value))
		{
		alert('Please fill in full e-mail address.');
		document.contactform.txtEmail.focus();
		return;
		}

	if (document.contactform.cboIndustry.value == '-1')
		{
		alert('Please select your Industry.');
		document.contactform.cboIndustry.focus();
		return;
		}

	if (document.contactform.txtComments.value.length > 1000)
		{
		alert('\'Comments\' field can not contain more than 1000 characters.');
		document.contactform.txtComments.focus();
		return;
		}

		document.contactform.saveMode.value = 'SAVE';
		document.contactform.submit();

}


/********************************************
*	Func: isEmail
*	Input: email address
*	Check for the format x@x.x
*	where x is anything
**********************************************/
function isEmail(addr) {
	var email = addr;
	var posAt;
	var posPoint;
	var size = email.length;

	posAt = email.indexOf('@');
	posPoint = email.lastIndexOf('.');

	if ( (posAt > 0) && (posPoint > (posAt + 1)) && (size > 5) ) {
		return true
	}

	return false;
}